[GTK3] Change module structure from ui/gtkui to ui/gtk3

This moves the directory structure so that there is no conflict with the
old gtk2 UI. Also changes the conf and state files being loaded.
This commit is contained in:
Calum Lind 2018-07-13 09:34:49 +01:00 committed by Calum Lind
parent ca0db4d1a7
commit 01fafd4fe0
71 changed files with 185 additions and 197 deletions

View File

@ -37,7 +37,7 @@ class FilesTabTestCase(BaseTestCase):
raise unittest.SkipTest('GTKUI dependencies not available') raise unittest.SkipTest('GTKUI dependencies not available')
common.set_tmp_config_dir() common.set_tmp_config_dir()
ConfigManager('gtkui.conf', defaults=DEFAULT_PREFS) ConfigManager('gtk3ui.conf', defaults=DEFAULT_PREFS)
self.mainwindow = MainWindow() self.mainwindow = MainWindow()
self.filestab = FilesTab() self.filestab = FilesTab()
self.t_id = '1' self.t_id = '1'

View File

@ -111,7 +111,7 @@ class TorrentviewTestCase(BaseTestCase):
common.set_tmp_config_dir() common.set_tmp_config_dir()
# MainWindow loads this config file, so lets make sure it contains the defaults # MainWindow loads this config file, so lets make sure it contains the defaults
ConfigManager('gtkui.conf', defaults=DEFAULT_PREFS) ConfigManager('gtk3ui.conf', defaults=DEFAULT_PREFS)
self.mainwindow = MainWindow() self.mainwindow = MainWindow()
self.torrentview = TorrentView() self.torrentview = TorrentView()
self.torrentdetails = TorrentDetails() self.torrentdetails = TorrentDetails()

View File

@ -40,7 +40,7 @@ class Gtk(UI):
def start(self): def start(self):
super(Gtk, self).start() super(Gtk, self).start()
from deluge.ui.gtkui.gtkui import GtkUI from .gtkui import GtkUI
import deluge.common import deluge.common
def run(options): def run(options):

View File

@ -14,7 +14,8 @@ from gi.repository import Gtk
import deluge.component as component import deluge.component as component
from deluge.common import get_version, open_url_in_browser, windows_check from deluge.common import get_version, open_url_in_browser, windows_check
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.common import get_deluge_icon, get_pixbuf
from .common import get_deluge_icon, get_pixbuf
class AboutDialog(object): class AboutDialog(object):

View File

@ -24,15 +24,12 @@ from deluge.configmanager import ConfigManager
from deluge.httpdownloader import download_file from deluge.httpdownloader import download_file
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.common import TorrentInfo from deluge.ui.common import TorrentInfo
from deluge.ui.gtkui.common import (
get_clipboard_text, from .common import get_clipboard_text, listview_replace_treestore, reparent_iter
listview_replace_treestore, from .dialogs import ErrorDialog
reparent_iter, from .edittrackersdialog import trackers_tiers_from_text
) from .path_chooser import PathChooser
from deluge.ui.gtkui.dialogs import ErrorDialog from .torrentview_data_funcs import cell_data_size
from deluge.ui.gtkui.edittrackersdialog import trackers_tiers_from_text
from deluge.ui.gtkui.path_chooser import PathChooser
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -44,20 +41,19 @@ class AddTorrentDialog(component.Component):
# The base dialog # The base dialog
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'add_torrent_dialog.ui') __package__, os.path.join('glade', 'add_torrent_dialog.ui')
) )
) )
# The infohash dialog # The infohash dialog
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', __package__, os.path.join('glade', 'add_torrent_dialog.infohash.ui')
os.path.join('glade', 'add_torrent_dialog.infohash.ui'),
) )
) )
# The url dialog # The url dialog
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'add_torrent_dialog.url.ui') __package__, os.path.join('glade', 'add_torrent_dialog.url.ui')
) )
) )
@ -679,7 +675,7 @@ class AddTorrentDialog(component.Component):
chooser.add_filter(file_filter) chooser.add_filter(file_filter)
# Load the 'default_load_path' from the config # Load the 'default_load_path' from the config
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
if self.config['default_load_path'] is not None: if self.config['default_load_path'] is not None:
chooser.set_current_folder(self.config['default_load_path']) chooser.set_current_folder(self.config['default_load_path'])

View File

@ -284,7 +284,7 @@ def save_pickled_state_file(filename, state):
""" """
from deluge.configmanager import get_config_dir from deluge.configmanager import get_config_dir
filepath = os.path.join(get_config_dir(), 'gtkui_state', filename) filepath = os.path.join(get_config_dir(), 'gtk3ui_state', filename)
filepath_bak = filepath + '.bak' filepath_bak = filepath + '.bak'
filepath_tmp = filepath + '.tmp' filepath_tmp = filepath + '.tmp'
@ -321,11 +321,10 @@ def load_pickled_state_file(filename):
""" """
from deluge.configmanager import get_config_dir from deluge.configmanager import get_config_dir
filepath = os.path.join(get_config_dir(), 'gtkui_state', filename) filepath = os.path.join(get_config_dir(), 'gtk3ui_state', filename)
filepath_bak = filepath + '.bak' filepath_bak = filepath + '.bak'
old_data_filepath = os.path.join(get_config_dir(), filename)
for _filepath in (filepath, filepath_bak, old_data_filepath): for _filepath in (filepath, filepath_bak):
log.info('Opening %s for load: %s', filename, _filepath) log.info('Opening %s for load: %s', filename, _filepath)
try: try:
with open(_filepath, 'rb') as _file: with open(_filepath, 'rb') as _file:

View File

@ -21,10 +21,11 @@ from deluge.common import resource_filename, windows_check
from deluge.configmanager import ConfigManager, get_config_dir from deluge.configmanager import ConfigManager, get_config_dir
from deluge.error import AuthenticationRequired, BadLoginError, IncompatibleClient from deluge.error import AuthenticationRequired, BadLoginError, IncompatibleClient
from deluge.ui.client import Client, client from deluge.ui.client import Client, client
from deluge.ui.gtkui.common import get_clipboard_text
from deluge.ui.gtkui.dialogs import AuthenticationDialog, ErrorDialog
from deluge.ui.hostlist import DEFAULT_PORT, LOCALHOST, HostList from deluge.ui.hostlist import DEFAULT_PORT, LOCALHOST, HostList
from .common import get_clipboard_text
from .dialogs import AuthenticationDialog, ErrorDialog
try: try:
from urllib.parse import urlparse from urllib.parse import urlparse
except ImportError: except ImportError:
@ -68,7 +69,7 @@ def cell_render_status(column, cell, model, row, data):
class ConnectionManager(component.Component): class ConnectionManager(component.Component):
def __init__(self): def __init__(self):
component.Component.__init__(self, 'ConnectionManager') component.Component.__init__(self, 'ConnectionManager')
self.gtkui_config = ConfigManager('gtkui.conf') self.gtkui_config = ConfigManager('gtk3ui.conf')
self.hostlist = HostList() self.hostlist = HostList()
self.running = False self.running = False
@ -90,7 +91,7 @@ class ConnectionManager(component.Component):
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'connection_manager.ui') __package__, os.path.join('glade', 'connection_manager.ui')
) )
) )
self.connection_manager = self.builder.get_object('connection_manager') self.connection_manager = self.builder.get_object('connection_manager')
@ -387,8 +388,7 @@ class ConnectionManager(component.Component):
""" """
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', __package__, os.path.join('glade', 'connection_manager.addhost.ui')
os.path.join('glade', 'connection_manager.addhost.ui'),
) )
) )
dialog = self.builder.get_object('addhost_dialog') dialog = self.builder.get_object('addhost_dialog')

View File

@ -21,11 +21,12 @@ import deluge.component as component
from deluge.common import get_path_size, is_url, resource_filename from deluge.common import get_path_size, is_url, resource_filename
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.edittrackersdialog import (
from .edittrackersdialog import (
last_tier_trackers_from_liststore, last_tier_trackers_from_liststore,
trackers_tiers_from_text, trackers_tiers_from_text,
) )
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size from .torrentview_data_funcs import cell_data_size
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -37,35 +38,18 @@ class CreateTorrentDialog(object):
def show(self): def show(self):
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
# The main dialog ui_filenames = [
self.builder.add_from_file( 'create_torrent_dialog.ui',
resource_filename( 'create_torrent_dialog.remote_path.ui',
'deluge.ui.gtkui', os.path.join('glade', 'create_torrent_dialog.ui') 'create_torrent_dialog.remote_save.ui',
'create_torrent_dialog.progress.ui',
]
for filename in ui_filenames:
self.builder.add_from_file(
resource_filename(__package__, os.path.join('glade', filename))
) )
)
# The remote path dialog
self.builder.add_from_file(
resource_filename(
'deluge.ui.gtkui',
os.path.join('glade', 'create_torrent_dialog.remote_path.ui'),
)
)
# The remote save dialog
self.builder.add_from_file(
resource_filename(
'deluge.ui.gtkui',
os.path.join('glade', 'create_torrent_dialog.remote_save.ui'),
)
)
# The progress dialog
self.builder.add_from_file(
resource_filename(
'deluge.ui.gtkui',
os.path.join('glade', 'create_torrent_dialog.progress.ui'),
)
)
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.dialog = self.builder.get_object('create_torrent_dialog') self.dialog = self.builder.get_object('create_torrent_dialog')
self.dialog.set_transient_for(component.get('MainWindow').window) self.dialog.set_transient_for(component.get('MainWindow').window)
@ -478,7 +462,7 @@ class CreateTorrentDialog(object):
builder = Gtk.Builder() builder = Gtk.Builder()
builder.add_from_file( builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'edit_trackers.add.ui') __package__, os.path.join('glade', 'edit_trackers.add.ui')
) )
) )
dialog = builder.get_object('add_tracker_dialog') dialog = builder.get_object('add_tracker_dialog')

View File

@ -14,8 +14,9 @@ from xml.sax.saxutils import escape as xml_escape
import deluge.component as component import deluge.component as component
from deluge.common import fdate, fsize, is_url from deluge.common import fdate, fsize, is_url
from deluge.ui.gtkui.tab_data_funcs import fdate_or_dash, fpieces_num_size
from deluge.ui.gtkui.torrentdetails import Tab from .tab_data_funcs import fdate_or_dash, fpieces_num_size
from .torrentdetails import Tab
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -16,7 +16,8 @@ from twisted.internet import defer
import deluge.component as component import deluge.component as component
from deluge.common import windows_check from deluge.common import windows_check
from deluge.ui.gtkui.common import get_deluge_icon, get_pixbuf_at_size
from .common import get_deluge_icon, get_pixbuf_at_size
class BaseDialog(Gtk.Dialog): class BaseDialog(Gtk.Dialog):

View File

@ -19,7 +19,8 @@ import deluge.component as component
from deluge.common import is_url, resource_filename from deluge.common import is_url, resource_filename
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.common import get_deluge_icon
from .common import get_deluge_icon
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -80,24 +81,22 @@ class EditTrackersDialog(object):
def __init__(self, torrent_id, parent=None): def __init__(self, torrent_id, parent=None):
self.torrent_id = torrent_id self.torrent_id = torrent_id
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
self.gtkui_config = ConfigManager('gtkui.conf') self.gtkui_config = ConfigManager('gtk3ui.conf')
# Main dialog # Main dialog
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(__package__, os.path.join('glade', 'edit_trackers.ui'))
'deluge.ui.gtkui', os.path.join('glade', 'edit_trackers.ui')
)
) )
# add tracker dialog # add tracker dialog
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'edit_trackers.add.ui') __package__, os.path.join('glade', 'edit_trackers.add.ui')
) )
) )
# edit tracker dialog # edit tracker dialog
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'edit_trackers.edit.ui') __package__, os.path.join('glade', 'edit_trackers.edit.ui')
) )
) )

View File

@ -21,14 +21,15 @@ import deluge.component as component
from deluge.common import open_file, show_file from deluge.common import open_file, show_file
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.common import FILE_PRIORITY from deluge.ui.common import FILE_PRIORITY
from deluge.ui.gtkui.common import (
from .common import (
listview_replace_treestore, listview_replace_treestore,
load_pickled_state_file, load_pickled_state_file,
reparent_iter, reparent_iter,
save_pickled_state_file, save_pickled_state_file,
) )
from deluge.ui.gtkui.torrentdetails import Tab from .torrentdetails import Tab
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size from .torrentview_data_funcs import cell_data_size
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -23,7 +23,8 @@ import deluge.component as component
from deluge.common import TORRENT_STATE, resource_filename from deluge.common import TORRENT_STATE, resource_filename
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.common import get_pixbuf, get_pixbuf_at_size
from .common import get_pixbuf, get_pixbuf_at_size
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -48,7 +49,7 @@ FILTER_COLUMN = 5
class FilterTreeView(component.Component): class FilterTreeView(component.Component):
def __init__(self): def __init__(self):
component.Component.__init__(self, 'FilterTreeView', interval=2) component.Component.__init__(self, 'FilterTreeView', interval=2)
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.tracker_icons = component.get('TrackerIcons') self.tracker_icons = component.get('TrackerIcons')
@ -107,9 +108,7 @@ class FilterTreeView(component.Component):
# filtertree menu # filtertree menu
builder = Gtk.Builder() builder = Gtk.Builder()
builder.add_from_file( builder.add_from_file(
resource_filename( resource_filename(__package__, os.path.join('glade', 'filtertree_menu.ui'))
'deluge.ui.gtkui', os.path.join('glade', 'filtertree_menu.ui')
)
) )
self.menu = builder.get_object('filtertree_menu') self.menu = builder.get_object('filtertree_menu')
builder.connect_signals(self) builder.connect_signals(self)

View File

@ -48,28 +48,30 @@ from deluge.common import (
from deluge.configmanager import ConfigManager, get_config_dir from deluge.configmanager import ConfigManager, get_config_dir
from deluge.error import DaemonRunningError from deluge.error import DaemonRunningError
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.addtorrentdialog import AddTorrentDialog
from deluge.ui.gtkui.common import associate_magnet_links
from deluge.ui.gtkui.connectionmanager import ConnectionManager
from deluge.ui.gtkui.dialogs import YesNoDialog
from deluge.ui.gtkui.filtertreeview import FilterTreeView
from deluge.ui.gtkui.ipcinterface import IPCInterface, process_args
from deluge.ui.gtkui.mainwindow import MainWindow
from deluge.ui.gtkui.menubar import MenuBar
from deluge.ui.gtkui.pluginmanager import PluginManager
from deluge.ui.gtkui.preferences import Preferences
from deluge.ui.gtkui.queuedtorrents import QueuedTorrents
from deluge.ui.gtkui.sidebar import SideBar
from deluge.ui.gtkui.statusbar import StatusBar
from deluge.ui.gtkui.systemtray import SystemTray
from deluge.ui.gtkui.toolbar import ToolBar
from deluge.ui.gtkui.torrentdetails import TorrentDetails
from deluge.ui.gtkui.torrentview import TorrentView
from deluge.ui.hostlist import LOCALHOST from deluge.ui.hostlist import LOCALHOST
from deluge.ui.sessionproxy import SessionProxy from deluge.ui.sessionproxy import SessionProxy
from deluge.ui.tracker_icons import TrackerIcons from deluge.ui.tracker_icons import TrackerIcons
from deluge.ui.translations_util import set_language, setup_translations from deluge.ui.translations_util import set_language, setup_translations
# isort:imports-localfolder
from .addtorrentdialog import AddTorrentDialog
from .common import associate_magnet_links
from .connectionmanager import ConnectionManager
from .dialogs import YesNoDialog
from .filtertreeview import FilterTreeView
from .ipcinterface import IPCInterface, process_args
from .mainwindow import MainWindow
from .menubar import MenuBar
from .pluginmanager import PluginManager
from .preferences import Preferences
from .queuedtorrents import QueuedTorrents
from .sidebar import SideBar
from .statusbar import StatusBar
from .systemtray import SystemTray
from .toolbar import ToolBar
from .torrentdetails import TorrentDetails
from .torrentview import TorrentView
set_prgname('deluge') set_prgname('deluge')
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -175,12 +177,12 @@ class GtkUI(object):
# if already set by another program. # if already set by another program.
associate_magnet_links(False) associate_magnet_links(False)
# Make sure gtkui.conf has at least the defaults set # Make sure gtk3ui.conf has at least the defaults set
self.config = ConfigManager('gtkui.conf', DEFAULT_PREFS) self.config = ConfigManager('gtk3ui.conf', DEFAULT_PREFS)
# Make sure the gtkui state folder has been created # Make sure the gtkui state folder has been created
if not os.path.exists(os.path.join(get_config_dir(), 'gtkui_state')): if not os.path.exists(os.path.join(get_config_dir(), 'gtk3ui_state')):
os.makedirs(os.path.join(get_config_dir(), 'gtkui_state')) os.makedirs(os.path.join(get_config_dir(), 'gtk3ui_state'))
# Set language # Set language
if self.config['language'] is not None: if self.config['language'] is not None:
@ -222,7 +224,7 @@ class GtkUI(object):
process_args([filename]) process_args([filename])
self.osxapp.connect('NSApplicationOpenFile', nsapp_open_file) self.osxapp.connect('NSApplicationOpenFile', nsapp_open_file)
from deluge.ui.gtkui.menubar_osx import menubar_osx from .menubar_osx import menubar_osx
menubar_osx(self, self.osxapp) menubar_osx(self, self.osxapp)
self.osxapp.ready() self.osxapp.ready()

View File

@ -46,7 +46,7 @@ class IPCProtocolServer(Protocol):
pass pass
def dataReceived(self, data): # NOQA: N802 def dataReceived(self, data): # NOQA: N802
config = ConfigManager('gtkui.conf') config = ConfigManager('gtk3ui.conf')
data = rencode.loads(data, decode_utf8=True) data = rencode.loads(data, decode_utf8=True)
if not data or config['focus_main_window_on_add']: if not data or config['focus_main_window_on_add']:
component.get('MainWindow').present() component.get('MainWindow').present()
@ -192,7 +192,7 @@ def process_args(args):
log.debug('Not connected to host.. Adding to queue.') log.debug('Not connected to host.. Adding to queue.')
component.get('QueuedTorrents').add_to_queue(args) component.get('QueuedTorrents').add_to_queue(args)
return return
config = ConfigManager('gtkui.conf') config = ConfigManager('gtk3ui.conf')
for arg in args: for arg in args:
if not arg.strip(): if not arg.strip():

View File

@ -16,7 +16,8 @@ from gi.repository.Gdk import Event # pylint: disable=ungrouped-imports
from gi.repository.GObject import SIGNAL_RUN_LAST, TYPE_NONE, signal_new from gi.repository.GObject import SIGNAL_RUN_LAST, TYPE_NONE, signal_new
from deluge.common import decode_bytes from deluge.common import decode_bytes
from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file
from .common import load_pickled_state_file, save_pickled_state_file
# FIXME: ? # FIXME: ?
signal_new( signal_new(
@ -26,12 +27,8 @@ signal_new(
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class ListViewColumnState: # pylint: disable=old-style-class class ListViewColumnState(object):
""" """Class used for saving/loading column state."""
Class used for saving/loading column state.
Note: This must be old style class to avoid breaking existing user state file.
"""
def __init__(self, name, position, width, visible, sort, sort_order): def __init__(self, name, position, width, visible, sort, sort_order):
self.name = name self.name = name

View File

@ -19,12 +19,13 @@ from twisted.internet import reactor
from twisted.internet.error import ReactorNotRunning from twisted.internet.error import ReactorNotRunning
import deluge.component as component import deluge.component as component
import deluge.ui.gtkui.common
from deluge.common import fspeed, resource_filename from deluge.common import fspeed, resource_filename
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.dialogs import PasswordDialog
from deluge.ui.gtkui.ipcinterface import process_args from .common import get_deluge_icon
from .dialogs import PasswordDialog
from .ipcinterface import process_args
try: try:
import gi import gi
@ -66,7 +67,7 @@ class MainWindow(component.Component):
if Wnck: if Wnck:
self.screen = Wnck.Screen.get_default() self.screen = Wnck.Screen.get_default()
component.Component.__init__(self, 'MainWindow', interval=2) component.Component.__init__(self, 'MainWindow', interval=2)
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.main_builder = Gtk.Builder() self.main_builder = Gtk.Builder()
# Patch this GtkBuilder to avoid connecting signals from elsewhere # Patch this GtkBuilder to avoid connecting signals from elsewhere
@ -86,19 +87,20 @@ class MainWindow(component.Component):
self.main_builder.connect_signals = patched_connect_signals self.main_builder.connect_signals = patched_connect_signals
# Get Gtk Builder files Main Window, New release dialog, and Tabs. # Get Gtk Builder files Main Window, New release dialog, and Tabs.
for filename in ( ui_filenames = [
'main_window.ui', 'main_window.ui',
'main_window.new_release.ui', 'main_window.new_release.ui',
'main_window.tabs.ui', 'main_window.tabs.ui',
'main_window.tabs.menu_file.ui', 'main_window.tabs.menu_file.ui',
'main_window.tabs.menu_peer.ui', 'main_window.tabs.menu_peer.ui',
): ]
for filename in ui_filenames:
self.main_builder.add_from_file( self.main_builder.add_from_file(
resource_filename('deluge.ui.gtkui', os.path.join('glade', filename)) resource_filename(__package__, os.path.join('glade', filename))
) )
self.window = self.main_builder.get_object('main_window') self.window = self.main_builder.get_object('main_window')
self.window.set_icon(deluge.ui.gtkui.common.get_deluge_icon()) self.window.set_icon(get_deluge_icon())
self.vpaned = self.main_builder.get_object('vpaned') self.vpaned = self.main_builder.get_object('vpaned')
self.initial_vpaned_position = self.config['window_pane_position'] self.initial_vpaned_position = self.config['window_pane_position']
@ -330,7 +332,7 @@ class MainWindow(component.Component):
def on_newversionavailable_event(self, new_version): def on_newversionavailable_event(self, new_version):
if self.config['show_new_releases']: if self.config['show_new_releases']:
from deluge.ui.gtkui.new_release_dialog import NewReleaseDialog from .new_release_dialog import NewReleaseDialog
reactor.callLater(5.0, NewReleaseDialog().show, new_version) reactor.callLater(5.0, NewReleaseDialog().show, new_version)

View File

@ -20,8 +20,9 @@ import deluge.common
import deluge.component as component import deluge.component as component
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.dialogs import ErrorDialog, OtherDialog
from deluge.ui.gtkui.path_chooser import PathChooser from .dialogs import ErrorDialog, OtherDialog
from .path_chooser import PathChooser
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -32,25 +33,25 @@ class MenuBar(component.Component):
component.Component.__init__(self, 'MenuBar') component.Component.__init__(self, 'MenuBar')
self.mainwindow = component.get('MainWindow') self.mainwindow = component.get('MainWindow')
self.main_builder = self.mainwindow.get_builder() self.main_builder = self.mainwindow.get_builder()
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
# Get the torrent menu from the gtk builder file # Get the torrent menu from the gtk builder file
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'torrent_menu.ui') __package__, os.path.join('glade', 'torrent_menu.ui')
) )
) )
# Get the torrent options menu from the gtk builder file # Get the torrent options menu from the gtk builder file
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'torrent_menu.options.ui') __package__, os.path.join('glade', 'torrent_menu.options.ui')
) )
) )
# Get the torrent queue menu from the gtk builder file # Get the torrent queue menu from the gtk builder file
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'torrent_menu.queue.ui') __package__, os.path.join('glade', 'torrent_menu.queue.ui')
) )
) )
@ -249,7 +250,7 @@ class MenuBar(component.Component):
def on_menuitem_createtorrent_activate(self, data=None): def on_menuitem_createtorrent_activate(self, data=None):
log.debug('on_menuitem_createtorrent_activate') log.debug('on_menuitem_createtorrent_activate')
from deluge.ui.gtkui.createtorrentdialog import CreateTorrentDialog from .createtorrentdialog import CreateTorrentDialog
CreateTorrentDialog().show() CreateTorrentDialog().show()
@ -287,7 +288,7 @@ class MenuBar(component.Component):
def on_menuitem_edittrackers_activate(self, data=None): def on_menuitem_edittrackers_activate(self, data=None):
log.debug('on_menuitem_edittrackers_activate') log.debug('on_menuitem_edittrackers_activate')
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog from .edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog( dialog = EditTrackersDialog(
component.get('TorrentView').get_selected_torrent(), self.mainwindow.window component.get('TorrentView').get_selected_torrent(), self.mainwindow.window
@ -298,7 +299,7 @@ class MenuBar(component.Component):
log.debug('on_menuitem_remove_activate') log.debug('on_menuitem_remove_activate')
torrent_ids = component.get('TorrentView').get_selected_torrents() torrent_ids = component.get('TorrentView').get_selected_torrents()
if torrent_ids: if torrent_ids:
from deluge.ui.gtkui.removetorrentdialog import RemoveTorrentDialog from .removetorrentdialog import RemoveTorrentDialog
RemoveTorrentDialog(torrent_ids).run() RemoveTorrentDialog(torrent_ids).run()
@ -332,7 +333,7 @@ class MenuBar(component.Component):
builder = Gtk.Builder() builder = Gtk.Builder()
builder.add_from_file( builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'move_storage_dialog.ui') __package__, os.path.join('glade', 'move_storage_dialog.ui')
) )
) )
# Keep it referenced: # Keep it referenced:
@ -411,7 +412,7 @@ class MenuBar(component.Component):
def on_menuitem_about_activate(self, data=None): def on_menuitem_about_activate(self, data=None):
log.debug('on_menuitem_about_activate') log.debug('on_menuitem_about_activate')
from deluge.ui.gtkui.aboutdialog import AboutDialog from .aboutdialog import AboutDialog
AboutDialog().run() AboutDialog().run()

View File

@ -31,7 +31,7 @@ def menubar_osx(gtkui, osxapp):
menubar = main_builder.get_object('menubar') menubar = main_builder.get_object('menubar')
group = accel_groups_from_object(gtkui.mainwindow.window)[0] group = accel_groups_from_object(gtkui.mainwindow.window)[0]
config = ConfigManager('gtkui.conf') config = ConfigManager('gtk3ui.conf')
# NOTE: accel maps doesn't work with glade file format # NOTE: accel maps doesn't work with glade file format
# because of libglade not setting MenuItem accel groups # because of libglade not setting MenuItem accel groups

View File

@ -20,7 +20,7 @@ class NewReleaseDialog(object):
pass pass
def show(self, available_version): def show(self, available_version):
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
main_builder = component.get('MainWindow').get_builder() main_builder = component.get('MainWindow').get_builder()
self.dialog = main_builder.get_object('new_release_dialog') self.dialog = main_builder.get_object('new_release_dialog')
# Set the version labels # Set the version labels

View File

@ -14,8 +14,9 @@ from gi.repository.Gdk import keyval_name
import deluge.component as component import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.path_chooser import PathChooser
from deluge.ui.gtkui.torrentdetails import Tab from .path_chooser import PathChooser
from .torrentdetails import Tab
class OptionsTab(Tab): class OptionsTab(Tab):

View File

@ -13,7 +13,8 @@ import logging
import deluge.component as component import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.path_combo_chooser import PathChooserComboBox
from .path_combo_chooser import PathChooserComboBox
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -1141,7 +1141,7 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
self.popup_buttonbox = self.builder.get_object('buttonbox') self.popup_buttonbox = self.builder.get_object('buttonbox')
self.builder.add_from_file( self.builder.add_from_file(
resource_filename( resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'path_combo_chooser.ui') __package__, os.path.join('glade', 'path_combo_chooser.ui')
) )
) )
self.button_toggle = self.builder.get_object('button_toggle_dropdown') self.button_toggle = self.builder.get_object('button_toggle_dropdown')

View File

@ -27,14 +27,15 @@ import deluge.common
import deluge.component as component import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.countries import COUNTRIES from deluge.ui.countries import COUNTRIES
from deluge.ui.gtkui.common import (
from .common import (
icon_downloading, icon_downloading,
icon_seeding, icon_seeding,
load_pickled_state_file, load_pickled_state_file,
save_pickled_state_file, save_pickled_state_file,
) )
from deluge.ui.gtkui.torrentdetails import Tab from .torrentdetails import Tab
from deluge.ui.gtkui.torrentview_data_funcs import ( from .torrentview_data_funcs import (
cell_data_peer_progress, cell_data_peer_progress,
cell_data_speed_down, cell_data_speed_down,
cell_data_speed_up, cell_data_speed_up,
@ -369,7 +370,7 @@ class PeersTab(Tab):
builder = Builder() builder = Builder()
builder.add_from_file( builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'connect_peer_dialog.ui') __package__, os.path.join('glade', 'connect_peer_dialog.ui')
) )
) )
peer_dialog = builder.get_object('connect_peer_dialog') peer_dialog = builder.get_object('connect_peer_dialog')

View File

@ -41,7 +41,7 @@ class PiecesBar(DrawingArea):
del pb, pb_style del pb, pb_style
self.set_size_request(-1, 25) self.set_size_request(-1, 25)
self.gtkui_config = ConfigManager('gtkui.conf') self.gtkui_config = ConfigManager('gtk3ui.conf')
self.width = self.prev_width = 0 self.width = self.prev_width = 0
self.height = self.prev_height = 0 self.height = self.prev_height = 0

View File

@ -22,9 +22,9 @@ log = logging.getLogger(__name__)
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Component): class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Component):
def __init__(self): def __init__(self):
component.Component.__init__(self, 'PluginManager') component.Component.__init__(self, 'PluginManager')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
deluge.pluginmanagerbase.PluginManagerBase.__init__( deluge.pluginmanagerbase.PluginManagerBase.__init__(
self, 'gtkui.conf', 'deluge.plugin.gtkui' self, 'gtk3ui.conf', 'deluge.plugin.gtk3'
) )
self.hooks = {'on_apply_prefs': [], 'on_show_prefs': []} self.hooks = {'on_apply_prefs': [], 'on_show_prefs': []}

View File

@ -23,20 +23,12 @@ from deluge.configmanager import ConfigManager, get_config_dir
from deluge.error import AuthManagerError, NotAuthorizedError from deluge.error import AuthManagerError, NotAuthorizedError
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.common import DISK_CACHE_KEYS, PREFS_CATOG_TRANS from deluge.ui.common import DISK_CACHE_KEYS, PREFS_CATOG_TRANS
from deluge.ui.gtkui.common import (
associate_magnet_links,
get_clipboard_text,
get_deluge_icon,
)
from deluge.ui.gtkui.dialogs import (
AccountDialog,
ErrorDialog,
InformationDialog,
YesNoDialog,
)
from deluge.ui.gtkui.path_chooser import PathChooser
from deluge.ui.translations_util import get_languages from deluge.ui.translations_util import get_languages
from .common import associate_magnet_links, get_clipboard_text, get_deluge_icon
from .dialogs import AccountDialog, ErrorDialog, InformationDialog, YesNoDialog
from .path_chooser import PathChooser
try: try:
from urllib.parse import urlparse from urllib.parse import urlparse
except ImportError: except ImportError:
@ -67,7 +59,7 @@ class Preferences(component.Component):
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'preferences_dialog.ui') __package__, os.path.join('glade', 'preferences_dialog.ui')
) )
) )
self.pref_dialog = self.builder.get_object('pref_dialog') self.pref_dialog = self.builder.get_object('pref_dialog')
@ -75,7 +67,7 @@ class Preferences(component.Component):
self.pref_dialog.set_icon(get_deluge_icon()) self.pref_dialog.set_icon(get_deluge_icon())
self.treeview = self.builder.get_object('treeview') self.treeview = self.builder.get_object('treeview')
self.notebook = self.builder.get_object('notebook') self.notebook = self.builder.get_object('notebook')
self.gtkui_config = ConfigManager('gtkui.conf') self.gtkui_config = ConfigManager('gtk3ui.conf')
self.window_open = False self.window_open = False
self.load_pref_dialog_state() self.load_pref_dialog_state()
@ -178,7 +170,7 @@ class Preferences(component.Component):
# Radio buttons to choose between systray and appindicator # Radio buttons to choose between systray and appindicator
self.builder.get_object('alignment_tray_type').set_visible(bool(appindicator)) self.builder.get_object('alignment_tray_type').set_visible(bool(appindicator))
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS from .gtkui import DEFAULT_PREFS
self.COLOR_DEFAULTS = {} self.COLOR_DEFAULTS = {}
for key in ('missing', 'waiting', 'downloading', 'completed'): for key in ('missing', 'waiting', 'downloading', 'completed'):

View File

@ -24,8 +24,9 @@ from gi.repository.Gtk import (
import deluge.common import deluge.common
import deluge.component as component import deluge.component as component
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.gtkui.common import get_logo
from deluge.ui.gtkui.ipcinterface import process_args from .common import get_logo
from .ipcinterface import process_args
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -38,11 +39,11 @@ class QueuedTorrents(component.Component):
self.queue = [] self.queue = []
self.status_item = None self.status_item = None
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.builder = Builder() self.builder = Builder()
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'queuedtorrents.ui') __package__, os.path.join('glade', 'queuedtorrents.ui')
) )
) )
self.builder.get_object('chk_autoadd').set_active(self.config['autoadd_queued']) self.builder.get_object('chk_autoadd').set_active(self.config['autoadd_queued'])

View File

@ -45,7 +45,7 @@ class RemoveTorrentDialog(object):
self.builder = Gtk.Builder() self.builder = Gtk.Builder()
self.builder.add_from_file( self.builder.add_from_file(
deluge.common.resource_filename( deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'remove_torrent_dialog.ui') __package__, os.path.join('glade', 'remove_torrent_dialog.ui')
) )
) )

View File

@ -31,7 +31,7 @@ class SideBar(component.Component):
main_builder = component.get('MainWindow').get_builder() main_builder = component.get('MainWindow').get_builder()
self.notebook = main_builder.get_object('sidebar_notebook') self.notebook = main_builder.get_object('sidebar_notebook')
self.hpaned = main_builder.get_object('main_window_hpaned') self.hpaned = main_builder.get_object('main_window_hpaned')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
# self.hpaned_position = self.hpaned.get_position() # self.hpaned_position = self.hpaned.get_position()
# Tabs holds references to the Tab widgets by their name # Tabs holds references to the Tab widgets by their name

View File

@ -14,8 +14,9 @@ import logging
import deluge.component as component import deluge.component as component
from deluge.common import fpeer from deluge.common import fpeer
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.gtkui.piecesbar import PiecesBar
from deluge.ui.gtkui.tab_data_funcs import ( from .piecesbar import PiecesBar
from .tab_data_funcs import (
fdate_or_never, fdate_or_never,
fpcnt, fpcnt,
fratio, fratio,
@ -24,7 +25,7 @@ from deluge.ui.gtkui.tab_data_funcs import (
ftime_or_dash, ftime_or_dash,
ftotal_sized, ftotal_sized,
) )
from deluge.ui.gtkui.torrentdetails import Tab, TabWidget from .torrentdetails import Tab, TabWidget
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -33,7 +34,7 @@ class StatusTab(Tab):
def __init__(self): def __init__(self):
super(StatusTab, self).__init__('Status', 'status_tab', 'status_tab_label') super(StatusTab, self).__init__('Status', 'status_tab', 'status_tab_label')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
self.progressbar = self.main_builder.get_object('progressbar') self.progressbar = self.main_builder.get_object('progressbar')
self.piecesbar = None self.piecesbar = None

View File

@ -18,7 +18,9 @@ import deluge.component as component
from deluge.common import fsize, fspeed, get_pixmap from deluge.common import fsize, fspeed, get_pixmap
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui import common, dialogs
from .common import build_menu_radio_list
from .dialogs import OtherDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -111,7 +113,7 @@ class StatusBar(component.Component):
component.Component.__init__(self, 'StatusBar', interval=3) component.Component.__init__(self, 'StatusBar', interval=3)
main_builder = component.get('MainWindow').get_builder() main_builder = component.get('MainWindow').get_builder()
self.statusbar = main_builder.get_object('statusbar') self.statusbar = main_builder.get_object('statusbar')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
# Status variables that are updated via callback # Status variables that are updated via callback
self.max_connections_global = -1 self.max_connections_global = -1
@ -495,14 +497,14 @@ class StatusBar(component.Component):
if response_id == Gtk.ResponseType.OK: if response_id == Gtk.ResponseType.OK:
set_value(dialog.get_value()) set_value(dialog.get_value())
dialog = dialogs.OtherDialog(*other_dialog_info[core_key]) dialog = OtherDialog(*other_dialog_info[core_key])
dialog.run().addCallback(set_value) dialog.run().addCallback(set_value)
else: else:
value = widget.get_children()[0].get_text().split(' ')[0] value = widget.get_children()[0].get_text().split(' ')[0]
set_value(value) set_value(value)
def _on_download_item_clicked(self, widget, event): def _on_download_item_clicked(self, widget, event):
menu = common.build_menu_radio_list( menu = build_menu_radio_list(
self.config['tray_download_speed_list'], self.config['tray_download_speed_list'],
self._on_set_download_speed, self._on_set_download_speed,
self.max_download_speed, self.max_download_speed,
@ -518,7 +520,7 @@ class StatusBar(component.Component):
self.set_limit_value(widget, 'max_download_speed') self.set_limit_value(widget, 'max_download_speed')
def _on_upload_item_clicked(self, widget, event): def _on_upload_item_clicked(self, widget, event):
menu = common.build_menu_radio_list( menu = build_menu_radio_list(
self.config['tray_upload_speed_list'], self.config['tray_upload_speed_list'],
self._on_set_upload_speed, self._on_set_upload_speed,
self.max_upload_speed, self.max_upload_speed,
@ -534,7 +536,7 @@ class StatusBar(component.Component):
self.set_limit_value(widget, 'max_upload_speed') self.set_limit_value(widget, 'max_upload_speed')
def _on_connection_item_clicked(self, widget, event): def _on_connection_item_clicked(self, widget, event):
menu = common.build_menu_radio_list( menu = build_menu_radio_list(
self.config['connection_limit_list'], self.config['connection_limit_list'],
self._on_set_connection_limit, self._on_set_connection_limit,
self.max_connections_global, self.max_connections_global,

View File

@ -24,8 +24,9 @@ from deluge.common import (
) )
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui import dialogs
from deluge.ui.gtkui.common import build_menu_radio_list, get_logo from .common import build_menu_radio_list, get_logo
from .dialogs import OtherDialog
try: try:
import appindicator import appindicator
@ -39,7 +40,7 @@ class SystemTray(component.Component):
def __init__(self): def __init__(self):
component.Component.__init__(self, 'SystemTray', interval=4) component.Component.__init__(self, 'SystemTray', interval=4)
self.mainwindow = component.get('MainWindow') self.mainwindow = component.get('MainWindow')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
# List of widgets that need to be hidden when not connected to a host # List of widgets that need to be hidden when not connected to a host
self.hide_widget_list = [ self.hide_widget_list = [
'menuitem_add_torrent', 'menuitem_add_torrent',
@ -76,7 +77,7 @@ class SystemTray(component.Component):
"""Enables the system tray icon.""" """Enables the system tray icon."""
self.builder = Builder() self.builder = Builder()
self.builder.add_from_file( self.builder.add_from_file(
resource_filename('deluge.ui.gtkui', os.path.join('glade', 'tray_menu.ui')) resource_filename(__package__, os.path.join('glade', 'tray_menu.ui'))
) )
self.builder.connect_signals(self) self.builder.connect_signals(self)
@ -436,7 +437,7 @@ class SystemTray(component.Component):
if widget.get_name() == 'unlimited': if widget.get_name() == 'unlimited':
set_value(-1) set_value(-1)
elif widget.get_name() == 'other': elif widget.get_name() == 'other':
dialog = dialogs.OtherDialog(header, text, _('K/s'), image, default) dialog = OtherDialog(header, text, _('K/s'), image, default)
dialog.run().addCallback(set_value) dialog.run().addCallback(set_value)
else: else:
set_value(widget.get_children()[0].get_text().split(' ')[0]) set_value(widget.get_children()[0].get_text().split(' ')[0])

View File

@ -26,7 +26,7 @@ class ToolBar(component.Component):
mainwindow = component.get('MainWindow') mainwindow = component.get('MainWindow')
self.main_builder = mainwindow.get_builder() self.main_builder = mainwindow.get_builder()
self.toolbar = self.main_builder.get_object('toolbar') self.toolbar = self.main_builder.get_object('toolbar')
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtk3ui.conf')
# Connect main window Signals # # Connect main window Signals #
mainwindow.connect_signals(self) mainwindow.connect_signals(self)
self.change_sensitivity = [ self.change_sensitivity = [

View File

@ -18,7 +18,8 @@ from gi.repository.Gtk import CheckMenuItem, Menu, SeparatorMenuItem
import deluge.component as component import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file
from .common import load_pickled_state_file, save_pickled_state_file
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -111,12 +112,12 @@ class TorrentDetails(component.Component):
self.tabs = {} self.tabs = {}
# Add the default tabs # Add the default tabs
from deluge.ui.gtkui.status_tab import StatusTab from .status_tab import StatusTab
from deluge.ui.gtkui.details_tab import DetailsTab from .details_tab import DetailsTab
from deluge.ui.gtkui.files_tab import FilesTab from .files_tab import FilesTab
from deluge.ui.gtkui.peers_tab import PeersTab from .peers_tab import PeersTab
from deluge.ui.gtkui.options_tab import OptionsTab from .options_tab import OptionsTab
from deluge.ui.gtkui.trackers_tab import TrackersTab from .trackers_tab import TrackersTab
default_tabs = { default_tabs = {
'Status': StatusTab, 'Status': StatusTab,

View File

@ -20,9 +20,10 @@ from twisted.internet import reactor
import deluge.component as component import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.gtkui import torrentview_data_funcs as funcs
from deluge.ui.gtkui.listview import ListView from . import torrentview_data_funcs as funcs
from deluge.ui.gtkui.removetorrentdialog import RemoveTorrentDialog from .listview import ListView
from .removetorrentdialog import RemoveTorrentDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -14,7 +14,8 @@ from functools import partial
import deluge.common as common import deluge.common as common
import deluge.component as component import deluge.component as component
from deluge.ui.gtkui.common import (
from .common import (
create_blank_pixbuf, create_blank_pixbuf,
get_pixbuf_at_size, get_pixbuf_at_size,
icon_alert, icon_alert,

View File

@ -13,8 +13,9 @@ import logging
import deluge.component as component import deluge.component as component
from deluge.common import ftime from deluge.common import ftime
from deluge.ui.gtkui.tab_data_funcs import fcount, ftranslate, fyes_no
from deluge.ui.gtkui.torrentdetails import Tab from .tab_data_funcs import fcount, ftranslate, fyes_no
from .torrentdetails import Tab
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -67,7 +68,7 @@ class TrackersTab(Tab):
def on_button_edit_trackers_clicked(self, button): def on_button_edit_trackers_clicked(self, button):
torrent_id = component.get('TorrentView').get_selected_torrent() torrent_id = component.get('TorrentView').get_selected_torrent()
if torrent_id: if torrent_id:
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog from .edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog(torrent_id, component.get('MainWindow').window) dialog = EditTrackersDialog(torrent_id, component.get('MainWindow').window)
dialog.run() dialog.run()

View File

@ -101,6 +101,7 @@ autodoc_mock_imports = [
'pango', 'pango',
'cairo', 'cairo',
'pangocairo', 'pangocairo',
'gi',
'curses', 'curses',
'win32api', 'win32api',
'win32file', 'win32file',

View File

@ -22,7 +22,7 @@ known_third_party =
# Ignore Windows specific modules. # Ignore Windows specific modules.
bbfreeze, win32verstamp, bbfreeze, win32verstamp,
# Ignore gtk modules, primarily for tox testing. # Ignore gtk modules, primarily for tox testing.
pygtk, gtk, gobject, gtk.gdk, pango, cairo, pangocairo, pygtk, gtk, gobject, gtk.gdk, pango, cairo, pangocairo, gi
# Ignore other module dependencies for pre-commit isort. # Ignore other module dependencies for pre-commit isort.
twisted, OpenSSL, pytest, recommonmark, chardet, pkg_resources, zope, mock, twisted, OpenSSL, pytest, recommonmark, chardet, pkg_resources, zope, mock,
sphinx sphinx
@ -39,7 +39,7 @@ use_parentheses=True
[flake8] [flake8]
max-line-length = 120 max-line-length = 120
builtins = _,_n,__request__ builtins = _,_n,__request__
exclude = .git,.tox,dist,build exclude = .git,.tox,.eggs,dist,build
ignore = ignore =
# A003 Class attribute is a python builtin. # A003 Class attribute is a python builtin.
A003, A003,

View File

@ -502,16 +502,16 @@ if windows_check():
) )
_entry_points['gui_scripts'] = [ _entry_points['gui_scripts'] = [
'deluge = deluge.ui.ui_entry:start_ui', 'deluge = deluge.ui.ui_entry:start_ui',
'deluge-gtk = deluge.ui.gtkui:start', 'deluge-gtk = deluge.ui.gtk3:start',
] ]
_entry_points['deluge.ui'] = [ _entry_points['deluge.ui'] = [
'console = deluge.ui.console:Console', 'console = deluge.ui.console:Console',
'web = deluge.ui.web:Web', 'web = deluge.ui.web:Web',
'gtk = deluge.ui.gtkui:Gtk', 'gtk = deluge.ui.gtk3:Gtk',
] ]
_package_data['deluge'] = [ _package_data['deluge.ui'] = [
'ui/data/pixmaps/*.png', 'ui/data/pixmaps/*.png',
'ui/data/pixmaps/*.svg', 'ui/data/pixmaps/*.svg',
'ui/data/pixmaps/*.ico', 'ui/data/pixmaps/*.ico',
@ -535,7 +535,7 @@ _package_data['deluge.ui.web'] = [
'themes/images/*/*/*.gif', 'themes/images/*/*/*.gif',
'themes/images/*/*/*.png', 'themes/images/*/*/*.png',
] ]
_package_data['deluge.ui.gtkui'] = ['glade/*.ui'] _package_data['deluge.ui.gtk3'] = ['glade/*.ui']
setup_requires = ['setuptools', 'wheel'] setup_requires = ['setuptools', 'wheel']
install_requires = [ install_requires = [