diff --git a/deluge/ui/gtk3/glade/path_combo_chooser.ui b/deluge/ui/gtk3/glade/path_combo_chooser.ui index 26a2d7f55..dac61f6ba 100644 --- a/deluge/ui/gtk3/glade/path_combo_chooser.ui +++ b/deluge/ui/gtk3/glade/path_combo_chooser.ui @@ -867,7 +867,7 @@ - + False diff --git a/deluge/ui/gtk3/path_combo_chooser.py b/deluge/ui/gtk3/path_combo_chooser.py index 754240c44..c27cb1684 100755 --- a/deluge/ui/gtk3/path_combo_chooser.py +++ b/deluge/ui/gtk3/path_combo_chooser.py @@ -19,7 +19,7 @@ from gi.repository import Gdk, GObject, Gtk from gi.repository.GObject import SignalFlags import deluge.component as component -from deluge.common import resource_filename +from deluge.common import PY2, resource_filename from deluge.path_chooser_common import get_completion_paths @@ -592,20 +592,20 @@ class PathChooserPopup(object): height_extra = 8 buttonbox_width = 0 - height = self.popup_window.get_preferred_size().height - width = self.popup_window.get_preferred_size().width + height = self.popup_window.get_preferred_height()[1] + width = self.popup_window.get_preferred_width()[1] if self.popup_buttonbox: buttonbox_height = max( - self.popup_buttonbox.get_preferred_size().height, + self.popup_buttonbox.get_preferred_height()[1], self.popup_buttonbox.get_allocation().height, ) buttonbox_width = max( - self.popup_buttonbox.get_preferred_size().width, + self.popup_buttonbox.get_preferred_width()[1], self.popup_buttonbox.get_allocation().width, ) - treeview_width = self.treeview.get_preferred_size().width - # After removing an element from the tree store, self.treeview.get_preferred_size()[0] + treeview_width = self.treeview.get_preferred_width()[1] + # After removing an element from the tree store, self.treeview.get_preferred_width()[0] # returns -1 for some reason, so the requested width cannot be used until the treeview # has been displayed once. if treeview_width != -1: @@ -619,12 +619,12 @@ class PathChooserPopup(object): width = self.alignment_widget.get_allocation().width # 10 is extra spacing - content_width = self.treeview.get_preferred_size().width + buttonbox_width + 10 + content_width = self.treeview.get_preferred_width()[1] + buttonbox_width + 10 # Adjust height according to number of list items if len(self.tree_store) > 0 and self.max_visible_rows > 0: # The height for one row in the list - self.row_height = self.treeview.get_preferred_size().height / len( + self.row_height = self.treeview.get_preferred_height()[1] / len( self.tree_store ) # Set height to number of rows @@ -1110,18 +1110,23 @@ GtkGI = get_introspection_module('Gtk') class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject): __gsignals__ = { - b'list-value-added': (SignalFlags.RUN_FIRST, None, (object,)), - b'list-value-removed': (SignalFlags.RUN_FIRST, None, (object,)), - b'list-values-reordered': (SignalFlags.RUN_FIRST, None, (object,)), - b'list-values-changed': (SignalFlags.RUN_FIRST, None, (object,)), - b'auto-complete-enabled-toggled': (SignalFlags.RUN_FIRST, None, (object,)), - b'show-filechooser-toggled': (SignalFlags.RUN_FIRST, None, (object,)), - b'show-path-entry-toggled': (SignalFlags.RUN_FIRST, None, (object,)), - b'show-folder-name-on-button': (SignalFlags.RUN_FIRST, None, (object,)), - b'show-hidden-files-toggled': (SignalFlags.RUN_FIRST, None, (object,)), - b'accelerator-set': (SignalFlags.RUN_FIRST, None, (object,)), - b'max-rows-changed': (SignalFlags.RUN_FIRST, None, (object,)), - b'text-changed': (SignalFlags.RUN_FIRST, None, (object,)), + signal + if not PY2 + else signal.encode(): (SignalFlags.RUN_FIRST, GObject.TYPE_NONE, (object,)) + for signal in [ + 'text-changed', + 'accelerator-set', + 'max-rows-changed', + 'list-value-added', + 'list-value-removed', + 'list-values-changed', + 'list-values-reordered', + 'show-path-entry-toggled', + 'show-filechooser-toggled', + 'show-hidden-files-toggled', + 'show-folder-name-on-button', + 'auto-complete-enabled-toggled', + ] } def __init__( @@ -1157,10 +1162,10 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject): self.button_properties = self.builder.get_object('button_properties') # FIXME: These are commented out but should be fixed. - # self.combobox_window = self.builder.get_object('combobox_window') + self.combobox_window = self.builder.get_object('combobox_window') self.combo_hbox = self.builder.get_object('entry_combobox_hbox') # Change the parent of the hbox from the glade Window to this hbox. - # self.combobox_window.remove(self.combo_hbox) + self.combobox_window.remove(self.combo_hbox) self.combobox_window = self.get_window() self.add(self.combo_hbox) StoredValuesPopup.__init__( @@ -1687,7 +1692,7 @@ if __name__ == '__main__': w.set_title('ComboEntry example') w.connect('delete-event', Gtk.main_quit) - box1 = Gtk.VBox(False, 0) + box1 = Gtk.Box(Gtk.Orientation.VERTICAL, 0) def get_resource2(filename): return '%s/glade/%s' % (os.path.abspath(os.path.dirname(sys.argv[0])), filename)