diff --git a/deluge/ui/console/console.py b/deluge/ui/console/console.py index f782e3513..4236ef271 100644 --- a/deluge/ui/console/console.py +++ b/deluge/ui/console/console.py @@ -50,7 +50,7 @@ def load_commands(command_dir): class Console(UI): - cmd_description = """A console or command-line interface""" + cmd_description = """Console or command-line user interface""" def __init__(self, *args, **kwargs): super(Console, self).__init__("console", *args, description="Test", **kwargs) diff --git a/deluge/ui/gtkui/__init__.py b/deluge/ui/gtkui/__init__.py index 709fb8e6a..8e449b2c0 100644 --- a/deluge/ui/gtkui/__init__.py +++ b/deluge/ui/gtkui/__init__.py @@ -1,4 +1,47 @@ -from deluge.ui.gtkui.gtkui import Gtk +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2009 Andrew Resch +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with +# the additional special exception to link portions of this program with the OpenSSL library. +# See LICENSE for more details. +# + +import logging + +from deluge.ui.ui import UI + +log = logging.getLogger(__name__) + + +# Keep this class in __init__.py to avoid the console having to import everything in gtkui.py +class Gtk(UI): + + cmd_description = """GTK-based graphical user interface""" + + def __init__(self, *args, **kwargs): + super(Gtk, self).__init__("gtk", *args, description="Starts the Deluge GTK+ interface", **kwargs) + + group = self.parser.add_argument_group(_("GTK Options")) + group.add_argument("torrents", metavar="", nargs="*", default=None, + help=_("Add one or more torrent files, torrent URLs or magnet URIs" + " to a currently running Deluge GTK instance")) + + def start(self, args=None): + super(Gtk, self).start(args) + from deluge.ui.gtkui.gtkui import GtkUI + import deluge.common + + def run(options): + try: + gtkui = GtkUI(options) + gtkui.start() + except Exception as ex: + log.exception(ex) + raise + + deluge.common.run_profiled(run, self.options, output_file=self.options.profile, + do_profile=self.options.profile) def start(): diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 0d20908f7..39fc71e20 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -53,7 +53,6 @@ from deluge.ui.gtkui.torrentdetails import TorrentDetails from deluge.ui.gtkui.torrentview import TorrentView from deluge.ui.sessionproxy import SessionProxy from deluge.ui.tracker_icons import TrackerIcons -from deluge.ui.ui import UI from deluge.ui.util import lang @@ -133,33 +132,6 @@ DEFAULT_PREFS = { } -class Gtk(UI): - - cmd_description = """A GTK-based graphical user interface""" - - def __init__(self, *args, **kwargs): - super(Gtk, self).__init__("gtk", *args, description="Starts the Deluge GTK+ interface", **kwargs) - - group = self.parser.add_argument_group(_("GTK Options")) - group.add_argument("torrents", metavar="", nargs="*", default=None, - help=_("Add one or more torrent files, torrent URLs or magnet URIs" - " to a currently running Deluge GTK instance")) - - def start(self, args=None): - super(Gtk, self).start(args) - - def run(options): - try: - gtkui = GtkUI(options) - gtkui.start() - except Exception as ex: - log.exception(ex) - raise - - deluge.common.run_profiled(run, self.options, output_file=self.options.profile, - do_profile=self.options.profile) - - class GtkUI(object): def __init__(self, args): # Setup gtkbuilder/glade translation diff --git a/deluge/ui/web/__init__.py b/deluge/ui/web/__init__.py index 99d896ba3..3757e0b1c 100644 --- a/deluge/ui/web/__init__.py +++ b/deluge/ui/web/__init__.py @@ -2,4 +2,5 @@ from deluge.ui.web.web import Web def start(): - Web().start() + web = Web() + web.start() diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index 72a376633..321bd0059 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -19,19 +19,12 @@ from deluge.ui.ui import UI log = logging.getLogger(__name__) -class WebUI(object): - def __init__(self, args): - from deluge.ui.web import server - deluge_web = server.DelugeWeb() - deluge_web.start() - - class Web(UI): - cmd_description = """A web-based interface (http://localhost:8112)""" + cmd_description = """Web-based user interface (http://localhost:8112)""" def __init__(self, *args, **kwargs): - super(Web, self).__init__("web", *args, description="Starts the Deluge web interface", **kwargs) + super(Web, self).__init__("web", *args, description="Starts the Deluge Web interface", **kwargs) self.__server = None group = self.parser.add_argument_group(_("Web Server Options")) @@ -65,8 +58,3 @@ class Web(UI): log.exception(ex) raise run_profiled(run, output_file=self.options.profile, do_profile=self.options.profile) - - -def start(): - web = Web() - web.start()