diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
commit | 2e2851dc13d73352530dd4495c7e05603b2e520d (patch) | |
tree | 622b9cd8e5d32091c9aa9e4937b533975a40356c /deluge/ui/gtk3/__init__.py | |
parent | Initial commit. (diff) | |
download | deluge-2e2851dc13d73352530dd4495c7e05603b2e520d.tar.xz deluge-2e2851dc13d73352530dd4495c7e05603b2e520d.zip |
Adding upstream version 2.1.2~dev0+20240219.upstream/2.1.2_dev0+20240219upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/ui/gtk3/__init__.py')
-rw-r--r-- | deluge/ui/gtk3/__init__.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/deluge/ui/gtk3/__init__.py b/deluge/ui/gtk3/__init__.py new file mode 100644 index 0000000..d1b4ec5 --- /dev/null +++ b/deluge/ui/gtk3/__init__.py @@ -0,0 +1,63 @@ +# +# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com> +# +# 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 os import environ + +from deluge.ui.ui import UI + +log = logging.getLogger(__name__) +# Hide pygame community banner +environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1' + + +# 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().__init__( + 'gtk', *args, description='Starts the Deluge GTK+ interface', **kwargs + ) + + group = self.parser.add_argument_group(_('GTK Options')) + group.add_argument( + 'torrents', + metavar='<torrent>', + 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): + super().start() + import deluge.common + + from .gtkui import GtkUI + + 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(): + Gtk().start() |