[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.
This commit is contained in:
parent
1022448e4f
commit
f331b6c754
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Reference in New Issue