summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2021-02-20 17:25:42 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2021-02-20 17:29:36 +0000
commitf331b6c754dc23797b1ebccda1e38dd048ed0468 (patch)
tree15f2631bbb5dd115e98d08c3987c056461db5c12
parent1022448e4fbd7934b69b28abb3ff0c474b7b16ec (diff)
downloaddeluge-f331b6c754dc23797b1ebccda1e38dd048ed0468.tar.gz
deluge-f331b6c754dc23797b1ebccda1e38dd048ed0468.tar.bz2
deluge-f331b6c754dc23797b1ebccda1e38dd048ed0468.zip
[GTKUI] Fix torrentdetails tab bar position not saving
The GTKUI tests were failing and the saved config for the tab bar position was not being restored. Fixed by moving the setting of notebook.tabs_pos to TorrentDetail init. Replaced more deprecated methods that were showing up in tests.
-rw-r--r--deluge/i18n/util.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py1
-rw-r--r--deluge/ui/gtk3/filtertreeview.py8
-rw-r--r--deluge/ui/gtk3/gtkui.py2
-rw-r--r--deluge/ui/gtk3/listview.py1
-rw-r--r--deluge/ui/gtk3/mainwindow.py4
-rw-r--r--deluge/ui/gtk3/preferences.py9
-rw-r--r--deluge/ui/gtk3/statusbar.py7
-rw-r--r--deluge/ui/gtk3/torrentdetails.py5
9 files changed, 16 insertions, 23 deletions
diff --git a/deluge/i18n/util.py b/deluge/i18n/util.py
index 90568fc5b..d33acaadf 100644
--- a/deluge/i18n/util.py
+++ b/deluge/i18n/util.py
@@ -108,7 +108,6 @@ def setup_translation():
locale.textdomain(I18N_DOMAIN)
gettext.bindtextdomain(I18N_DOMAIN, translations_path)
- gettext.bind_textdomain_codeset(I18N_DOMAIN, 'UTF-8')
gettext.textdomain(I18N_DOMAIN)
# Workaround for Python 2 unicode gettext (keyword removed in Py3).
@@ -139,7 +138,6 @@ def setup_translation():
I18N_DOMAIN, translations_path.encode(sys.getfilesystemencoding())
)
libintl.textdomain(I18N_DOMAIN)
- libintl.bind_textdomain_codeset(I18N_DOMAIN, 'UTF-8')
libintl.gettext.restype = ctypes.c_char_p
except Exception as ex:
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
index 16f0f7a30..35531419b 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
@@ -453,7 +453,6 @@ class GtkUI(Gtk3PluginBase):
self.treeView = Gtk.TreeView(self.store)
self.treeView.connect('cursor-changed', self.on_listitem_activated)
self.treeView.connect('row-activated', self.on_edit_button_clicked)
- self.treeView.set_rules_hint(True)
self.create_columns(self.treeView)
sw.add(self.treeView)
diff --git a/deluge/ui/gtk3/filtertreeview.py b/deluge/ui/gtk3/filtertreeview.py
index 7ca6a9d0d..a7b6aa87c 100644
--- a/deluge/ui/gtk3/filtertreeview.py
+++ b/deluge/ui/gtk3/filtertreeview.py
@@ -89,10 +89,10 @@ class FilterTreeView(component.Component):
self.treeview.set_headers_visible(False)
self.treeview.set_level_indentation(-21)
# Force theme to use expander-size so we don't cut out entries due to indentation hack.
- Gtk.rc_parse_string(
- """style "treeview-style" {GtkTreeView::expander-size = 7}
- class "GtkTreeView" style "treeview-style" """
- )
+ provider = Gtk.CssProvider()
+ provider.load_from_data('* {-GtkTreeView-expander-size: 9;}'.encode())
+ context = self.treeview.get_style_context()
+ context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
self.treeview.set_model(self.treestore)
self.treeview.get_selection().connect('changed', self.on_selection_changed)
diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py
index c3593da16..ebb78e8b2 100644
--- a/deluge/ui/gtk3/gtkui.py
+++ b/deluge/ui/gtk3/gtkui.py
@@ -121,7 +121,7 @@ DEFAULT_PREFS = {
'show_toolbar': True,
'show_statusbar': True,
'show_tabsbar': True,
- 'tabsbar_tab_pos': 'left',
+ 'tabsbar_tab_pos': 'top',
'tabsbar_position': 235,
'sidebar_show_zero': False,
'sidebar_show_trackers': True,
diff --git a/deluge/ui/gtk3/listview.py b/deluge/ui/gtk3/listview.py
index 7b1cba810..07b366978 100644
--- a/deluge/ui/gtk3/listview.py
+++ b/deluge/ui/gtk3/listview.py
@@ -144,7 +144,6 @@ class ListView(object):
self.liststore = None
self.model_filter = None
- self.treeview.set_rules_hint(True)
self.treeview.set_reorderable(False)
self.treeview.set_rubber_banding(True) # Enable mouse multi-row selection.
self.treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py
index b0135bdc9..740a9d13a 100644
--- a/deluge/ui/gtk3/mainwindow.py
+++ b/deluge/ui/gtk3/mainwindow.py
@@ -155,10 +155,6 @@ class MainWindow(component.Component):
self.main_builder.prev_connect_signals(self.gtk_builder_signals_holder)
self.sidebar_pane.set_position(self.config['sidebar_position'])
self.tabsbar_pane.set_position(self.config['tabsbar_position'])
- tab_pos = self.config['tabsbar_tab_pos']
- self.tabsbar_torrent_info.set_tab_pos(
- getattr(Gtk.PositionType, tab_pos.upper())
- )
if not (
self.config['start_in_tray'] and self.config['enable_system_tray']
diff --git a/deluge/ui/gtk3/preferences.py b/deluge/ui/gtk3/preferences.py
index a4d63aaa8..daa046a15 100644
--- a/deluge/ui/gtk3/preferences.py
+++ b/deluge/ui/gtk3/preferences.py
@@ -255,11 +255,10 @@ class Preferences(component.Component):
vbox.pack_start(label, False, True, 0)
sep = Gtk.HSeparator()
vbox.pack_start(sep, False, True, 0)
- align = Gtk.Alignment()
- align.set_padding(5, 0, 0, 0)
- align.set(0, 0, 1, 1)
- align.add(widget)
- vbox.pack_start(align, True, True, 0)
+ widget.set_margin_top(7)
+ widget.set_vexpand(True)
+ widget.set_hexpand(True)
+ vbox.pack_start(widget, True, True, 0)
scrolled = Gtk.ScrolledWindow()
viewport = Gtk.Viewport()
viewport.set_shadow_type(Gtk.ShadowType.NONE)
diff --git a/deluge/ui/gtk3/statusbar.py b/deluge/ui/gtk3/statusbar.py
index 265e7c886..18db753fa 100644
--- a/deluge/ui/gtk3/statusbar.py
+++ b/deluge/ui/gtk3/statusbar.py
@@ -142,12 +142,11 @@ class StatusBar(component.Component):
self.current_warnings = []
# Add hbox to the statusbar after removing the initial label widget
self.hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, spacing=10)
- align = Gtk.Alignment()
- align.set_padding(2, 0, 3, 0)
- align.add(self.hbox)
+ self.hbox.set_margin_top(2)
+ self.hbox.set_margin_bottom(3)
frame = self.statusbar.get_children()[0]
frame.remove(frame.get_children()[0])
- frame.add(align)
+ frame.add(self.hbox)
self.statusbar.show_all()
# Create the not connected item
self.not_connected_item = StatusBarItem(
diff --git a/deluge/ui/gtk3/torrentdetails.py b/deluge/ui/gtk3/torrentdetails.py
index 34e966f7b..a586c2997 100644
--- a/deluge/ui/gtk3/torrentdetails.py
+++ b/deluge/ui/gtk3/torrentdetails.py
@@ -110,6 +110,9 @@ class TorrentDetails(component.Component):
self.config = component.get('MainWindow').config
self.notebook = main_builder.get_object('torrent_info')
+ self.notebook.set_tab_pos(
+ getattr(PositionType, self.config['tabsbar_tab_pos'].upper())
+ )
# This is the menu item we'll attach the tabs checklist menu to
self.menu_tabs = main_builder.get_object('menu_tabs')
@@ -324,7 +327,7 @@ class TorrentDetails(component.Component):
def create_tab_pos_menuitem(self):
"""Returns a menu to select which side of the notebook the tabs should be shown"""
tab_pos_menu = Menu()
- tab_pos_menuitem = MenuItem(_('Position'))
+ tab_pos_menuitem = MenuItem.new_with_label(_('Position'))
group = []
for pos in ('top', 'right', 'bottom', 'left'):
menuitem = RadioMenuItem.new_with_mnemonic(group, _(pos.capitalize()))