mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 20:14:13 +00:00
[UI] Changed ui command description and help
This commit is contained in:
parent
6adbd14bf8
commit
91ed621ec8
@ -50,11 +50,10 @@ def load_commands(command_dir):
|
|||||||
|
|
||||||
class Console(UI):
|
class Console(UI):
|
||||||
|
|
||||||
help = """Starts the Deluge console interface"""
|
cmd_description = """A console or command-line interface"""
|
||||||
cmdline = """A console or command-line interface"""
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Console, self).__init__("console", *args, **kwargs)
|
super(Console, self).__init__("console", *args, description="Test", **kwargs)
|
||||||
|
|
||||||
group = self.parser.add_argument_group(_("Console Options"), "These daemon connect options will be "
|
group = self.parser.add_argument_group(_("Console Options"), "These daemon connect options will be "
|
||||||
"used for commands, or if console ui autoconnect is enabled.")
|
"used for commands, or if console ui autoconnect is enabled.")
|
||||||
@ -67,6 +66,7 @@ class Console(UI):
|
|||||||
# we add a subparser for each command which will trigger the help/usage when given
|
# we add a subparser for each command which will trigger the help/usage when given
|
||||||
from deluge.ui.console.main import ConsoleCommandParser # import here because (see top)
|
from deluge.ui.console.main import ConsoleCommandParser # import here because (see top)
|
||||||
self.console_parser = ConsoleCommandParser(parents=[self.parser], add_help=False,
|
self.console_parser = ConsoleCommandParser(parents=[self.parser], add_help=False,
|
||||||
|
description="Starts the Deluge console interface",
|
||||||
formatter_class=lambda prog:
|
formatter_class=lambda prog:
|
||||||
DelugeTextHelpFormatter(prog, max_help_position=33, width=90))
|
DelugeTextHelpFormatter(prog, max_help_position=33, width=90))
|
||||||
self.parser.subparser = self.console_parser
|
self.parser.subparser = self.console_parser
|
||||||
|
@ -136,11 +136,10 @@ DEFAULT_PREFS = {
|
|||||||
|
|
||||||
class Gtk(UI):
|
class Gtk(UI):
|
||||||
|
|
||||||
help = """Starts the Deluge GTK+ interface"""
|
cmd_description = """A GTK-based graphical user interface"""
|
||||||
cmdline = """A GTK-based graphical user interface"""
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Gtk, self).__init__("gtk", *args, **kwargs)
|
super(Gtk, self).__init__("gtk", *args, description="Starts the Deluge GTK+ interface", **kwargs)
|
||||||
|
|
||||||
group = self.parser.add_argument_group(_("GTK Options"))
|
group = self.parser.add_argument_group(_("GTK Options"))
|
||||||
group.add_argument("torrents", metavar="<torrent>", nargs="*", default=None,
|
group.add_argument("torrents", metavar="<torrent>", nargs="*", default=None,
|
||||||
|
@ -26,10 +26,12 @@ except ImportError:
|
|||||||
|
|
||||||
class UI(object):
|
class UI(object):
|
||||||
|
|
||||||
def __init__(self, name="gtk", parser=None):
|
cmd_description = """Insert command description"""
|
||||||
|
|
||||||
|
def __init__(self, name="gtk", parser=None, **kwargs):
|
||||||
self.__name = name
|
self.__name = name
|
||||||
lang.setup_translations(setup_pygtk=(name == "gtk"))
|
lang.setup_translations(setup_pygtk=(name == "gtk"))
|
||||||
self.__parser = parser if parser else BaseArgParser()
|
self.__parser = parser if parser else BaseArgParser(**kwargs)
|
||||||
|
|
||||||
def parse_args(self, args=None):
|
def parse_args(self, args=None):
|
||||||
options = self.parser.parse_args(args)
|
options = self.parser.parse_args(args)
|
||||||
|
@ -40,12 +40,7 @@ def start_ui():
|
|||||||
for entrypoint in pkg_resources.iter_entry_points("deluge.ui")])
|
for entrypoint in pkg_resources.iter_entry_points("deluge.ui")])
|
||||||
|
|
||||||
cmd_help = [_("The UI that you wish to launch. The UI choices are:")]
|
cmd_help = [_("The UI that you wish to launch. The UI choices are:")]
|
||||||
max_len = 0
|
cmd_help.extend(["%s -- %s" % (k, getattr(v, "cmd_description", "")) for k, v in ui_entrypoints.iteritems()])
|
||||||
for k, v in ui_entrypoints.iteritems():
|
|
||||||
cmdline = getattr(v, "cmdline", "")
|
|
||||||
max_len = max(max_len, len(cmdline))
|
|
||||||
|
|
||||||
cmd_help.extend(["%s -- %s" % (k, getattr(v, "cmdline", "")) for k, v in ui_entrypoints.iteritems()])
|
|
||||||
|
|
||||||
group.add_argument("-u", "--ui", action="store",
|
group.add_argument("-u", "--ui", action="store",
|
||||||
choices=ui_entrypoints.keys(), help="\n * ".join(cmd_help))
|
choices=ui_entrypoints.keys(), help="\n * ".join(cmd_help))
|
||||||
|
@ -28,11 +28,10 @@ class WebUI(object):
|
|||||||
|
|
||||||
class Web(UI):
|
class Web(UI):
|
||||||
|
|
||||||
help = """Starts the Deluge web interface"""
|
cmd_description = """A web-based interface (http://localhost:8112)"""
|
||||||
cmdline = """A web-based interface (http://localhost:8112)"""
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Web, self).__init__("web", *args, **kwargs)
|
super(Web, self).__init__("web", *args, description="Starts the Deluge web interface", **kwargs)
|
||||||
self.__server = None
|
self.__server = None
|
||||||
|
|
||||||
group = self.parser.add_argument_group(_("Web Server Options"))
|
group = self.parser.add_argument_group(_("Web Server Options"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user