From d1772d410235592b482e3b08b1863f6624d9fe6b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 19 Feb 2023 15:52:21 +0100 Subject: Adding upstream version 2.0.3. Signed-off-by: Daniel Baumann --- deluge/ui/gtk3/__init__.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 deluge/ui/gtk3/__init__.py (limited to 'deluge/ui/gtk3/__init__.py') diff --git a/deluge/ui/gtk3/__init__.py b/deluge/ui/gtk3/__init__.py new file mode 100644 index 0000000..3b9d2b1 --- /dev/null +++ b/deluge/ui/gtk3/__init__.py @@ -0,0 +1,63 @@ +# -*- 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. +# + +from __future__ import unicode_literals + +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): + super(Gtk, self).start() + from .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(): + Gtk().start() -- cgit v1.2.3