Skip to content

Commit

Permalink
Deprecate multi-character cli switches
Browse files Browse the repository at this point in the history
  • Loading branch information
torzdf committed Apr 5, 2024
1 parent 64a7b58 commit 95b4431
Show file tree
Hide file tree
Showing 99 changed files with 7,978 additions and 6,338 deletions.
7 changes: 7 additions & 0 deletions docs/full/lib/gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ menu module
:undoc-members:
:show-inheritance:

options module
==============
.. automodule:: lib.gui.options
:members:
:undoc-members:
:show-inheritance:

popup_configure module
======================
.. automodule:: lib.gui.popup_configure
Expand Down
12 changes: 7 additions & 5 deletions faceswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
os.environ["LANG"], _ = locale.getdefaultlocale()

from lib.cli import args as cli_args # pylint:disable=wrong-import-position
from lib.cli.args_train import TrainArgs # pylint:disable=wrong-import-position
from lib.cli.args_extract_convert import ConvertArgs, ExtractArgs # noqa:E501 pylint:disable=wrong-import-position
from lib.config import generate_configs # pylint:disable=wrong-import-position

# LOCALES
Expand Down Expand Up @@ -41,11 +43,11 @@ def _main() -> None:
generate_configs()

subparser = _PARSER.add_subparsers()
cli_args.ExtractArgs(subparser, "extract", _("Extract the faces from pictures or a video"))
cli_args.TrainArgs(subparser, "train", _("Train a model for the two faces A and B"))
cli_args.ConvertArgs(subparser,
"convert",
_("Convert source pictures or video to a new one with the face swapped"))
ExtractArgs(subparser, "extract", _("Extract the faces from pictures or a video"))
TrainArgs(subparser, "train", _("Train a model for the two faces A and B"))
ConvertArgs(subparser,
"convert",
_("Convert source pictures or video to a new one with the face swapped"))
cli_args.GuiArgs(subparser, "gui", _("Launch the Faceswap Graphical User Interface"))
_PARSER.set_defaults(func=_bad_args)
arguments = _PARSER.parse_args()
Expand Down
1,044 changes: 68 additions & 976 deletions lib/cli/args.py

Large diffs are not rendered by default.

743 changes: 743 additions & 0 deletions lib/cli/args_extract_convert.py

Large diffs are not rendered by default.

382 changes: 382 additions & 0 deletions lib/cli/args_train.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/cli/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _test_tkinter(cls) -> None:
If tkinter cannot be imported
"""
try:
import tkinter # noqa pylint: disable=unused-import,import-outside-toplevel
import tkinter # noqa pylint:disable=unused-import,import-outside-toplevel
except ImportError as err:
logger.error("It looks like TkInter isn't installed for your OS, so the GUI has been "
"disabled. To enable the GUI please install the TkInter application. You "
Expand Down
3 changes: 2 additions & 1 deletion lib/gui/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .control_helper import ControlPanel
from .custom_widgets import Tooltip
from .utils import get_images, get_config
from .options import CliOption

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -129,7 +130,7 @@ def build_tab(self):
""" Build the tab """
logger.debug("Build Tab: '%s'", self.command)
options = get_config().cli_opts.opts[self.command]
cp_opts = [val["cpanel_option"] for key, val in options.items() if key != "helptext"]
cp_opts = [val.cpanel_option for val in options.values() if isinstance(val, CliOption)]
ControlPanel(self,
cp_opts,
label_width=16,
Expand Down

0 comments on commit 95b4431

Please sign in to comment.