From 680104ed5cf2cf4d640516d400aa8b5dd1650300 Mon Sep 17 00:00:00 2001 From: Thomas Neele Date: Sat, 9 May 2020 13:02:52 +0200 Subject: [PATCH] Resolve several deprecation warnings --- src/usr/bin/diffuse | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 0eebfc8..a9ef801 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -721,9 +721,9 @@ def norm_encoding(e): return e.replace('-', '_').lower() # widget to help pick an encoding -class EncodingMenu(Gtk.HBox): +class EncodingMenu(Gtk.Box): def __init__(self, prefs, autodetect=False): - Gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.combobox = combobox = Gtk.ComboBoxText.new() self.encodings = prefs.getEncodings()[:] for e in self.encodings: @@ -745,9 +745,9 @@ class EncodingMenu(Gtk.HBox): return self.encodings[i] # text entry widget with a button to help pick file names -class FileEntry(Gtk.HBox): +class FileEntry(Gtk.Box): def __init__(self, parent, title): - Gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.toplevel = parent self.title = title self.entry = entry = Gtk.Entry.new() @@ -1068,7 +1068,7 @@ class Preferences: table.attach(label, 0, 1, i, i + 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL) label.show() if tpl[0] in [ 'Font', 'Integer' ]: - entry = Gtk.HBox.new(False, 0) + entry = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) if tpl[0] == 'Font': button = FontButton() button.set_font_name(self.string_prefs[tpl[1]]) @@ -1229,7 +1229,7 @@ def appendButtons(box, size, specs): box.pack_start(button, False, False, 0) button.show() else: - separator = Gtk.VSeparator.new() + separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL) box.pack_start(separator, False, False, 5) separator.show() @@ -2711,11 +2711,11 @@ class ScrolledWindow(Gtk.Grid): vport.set_hexpand(True) vport.show() - self.vbar = bar = Gtk.VScrollbar.new(vadj) + self.vbar = bar = Gtk.Scrollbar.new(Gtk.Orientation.VERTICAL, vadj) self.attach(bar, 1, 0, 1, 1) bar.show() - self.hbar = bar = Gtk.HScrollbar.new(hadj) + self.hbar = bar = Gtk.Scrollbar.new(Gtk.Orientation.HORIZONTAL, hadj) self.attach(bar, 0, 1, 1, 1) bar.show() @@ -6652,10 +6652,10 @@ class SearchDialog(Gtk.Dialog): def __init__(self, parent, pattern=None, history=None): Gtk.Dialog.__init__(self, _('Find...'), parent, Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) - vbox = Gtk.VBox.new(False, 0) + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) vbox.set_border_width(10) - hbox = Gtk.HBox.new(False, 0) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) label = Gtk.Label.new(_('Search For: ')) hbox.pack_start(label, False, False, 0) label.show() @@ -6718,7 +6718,7 @@ class FileChooserDialog(Gtk.FileChooserDialog): def __init__(self, title, parent, prefs, action, accept, rev=False): Gtk.FileChooserDialog.__init__(self, title, parent, action, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, accept, Gtk.ResponseType.OK)) self.prefs = prefs - hbox = Gtk.HBox.new(False, 0) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox.set_border_width(5) label = Gtk.Label.new(_('Encoding: ')) hbox.pack_start(label, False, False, 0) @@ -6757,10 +6757,10 @@ class NumericDialog(Gtk.Dialog): def __init__(self, parent, title, text, val, lower, upper, step=1, page=0): Gtk.Dialog.__init__(self, title, parent, Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) - vbox = Gtk.VBox.new(False, 0) + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) vbox.set_border_width(10) - hbox = Gtk.HBox.new(False, 0) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) label = Gtk.Label.new(text) hbox.pack_start(label, False, False, 0) label.show() @@ -6817,7 +6817,7 @@ class NotebookTab(Gtk.EventBox): def __init__(self, name, stock): Gtk.EventBox.__init__(self) self.set_visible_window(False) - hbox = Gtk.HBox.new(False, 0) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) if stock is not None: image = Gtk.Image.new() image.set_from_stock(stock, Gtk.IconSize.MENU) @@ -6825,7 +6825,7 @@ class NotebookTab(Gtk.EventBox): image.show() self.label = label = Gtk.Label.new(name) # left justify the widget - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) hbox.pack_start(label, True, True, 0) label.show() self.button = button = Gtk.Button.new() @@ -6945,19 +6945,19 @@ class Diffuse(Gtk.Window): self.cursor.set_size_request(-1, -1) self.pack_start(label, False, False, 0) - separator = Gtk.VSeparator.new() + separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL) self.pack_end(separator, False, False, 10) self.encoding = label = Gtk.Label.new() self.pack_end(label, False, False, 0) - separator = Gtk.VSeparator.new() + separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL) self.pack_end(separator, False, False, 10) self.format = label = Gtk.Label.new() self.pack_end(label, False, False, 0) - separator = Gtk.VSeparator.new() + separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL) self.pack_end(separator, False, False, 10) self.set_size_request(0, self.get_size_request()[1]) @@ -7440,8 +7440,8 @@ class Diffuse(Gtk.Window): self.connect('delete-event', self.delete_cb) accel_group = Gtk.AccelGroup() - # create a VBox for our contents - vbox = Gtk.VBox() + # create a Box for our contents + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) # create some custom icons for merging DIFFUSE_STOCK_NEW_2WAY_MERGE = 'diffuse-new-2way-merge' @@ -7611,7 +7611,7 @@ class Diffuse(Gtk.Window): menu_bar.show() # create button bar - hbox = Gtk.HBox.new(False, 0) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) appendButtons(hbox, Gtk.IconSize.LARGE_TOOLBAR, [ [ DIFFUSE_STOCK_NEW_2WAY_MERGE, self.new_2_way_file_merge_cb, None, _('New 2-Way File Merge') ], [ DIFFUSE_STOCK_NEW_3WAY_MERGE, self.new_3_way_file_merge_cb, None, _('New 3-Way File Merge') ],