From 6bdefa3ca240c2271441dd272346b1c532285572 Mon Sep 17 00:00:00 2001 From: Derek Scherger Date: Wed, 12 Feb 2020 21:12:20 -0700 Subject: [PATCH] fix a bunch of PyGTK+3 deprecation warnings --- src/usr/bin/diffuse | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 0fa3d28..0208c17 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -177,7 +177,7 @@ class MessageDialog(Gtk.MessageDialog): buttons = Gtk.ButtonsType.OK else: buttons = Gtk.ButtonsType.OK_CANCEL - Gtk.MessageDialog.__init__(self, parent, Gtk.DialogFlags.DESTROY_WITH_PARENT, type, buttons, s) + Gtk.MessageDialog.__init__(self, parent = parent, destroy_with_parent = True, message_type = type, buttons = buttons, text = s) self.set_title(APP_NAME) # report error messages @@ -6641,12 +6641,12 @@ class FileDiffViewer(Gtk.Grid): self._mergeBoth(True) # create 'title_changed' signal for FileDiffViewer -GObject.signal_new('swapped-panes', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (int, int)) -GObject.signal_new('num-edits-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (int, )) -GObject.signal_new('mode-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('cursor-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('syntax-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (str, )) -GObject.signal_new('format-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (int, int)) +GObject.signal_new('swapped-panes', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (int, int)) +GObject.signal_new('num-edits-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (int, )) +GObject.signal_new('mode-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('cursor-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('syntax-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, )) +GObject.signal_new('format-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (int, int)) # dialogue used to search for text class SearchDialog(Gtk.Dialog): @@ -6888,7 +6888,7 @@ class Diffuse(Gtk.Window): # pane header class PaneHeader(Gtk.Box): def __init__(self): - Gtk.Box.__init__(self, Gtk.Orientation.HORIZONTAL, 0) + Gtk.Box.__init__(self, orientation = Gtk.Orientation.HORIZONTAL, spacing = 0) appendButtons(self, Gtk.IconSize.MENU, [ [ Gtk.STOCK_OPEN, self.button_cb, 'open', _('Open File...') ], [ Gtk.STOCK_REFRESH, self.button_cb, 'reload', _('Reload File') ], @@ -6941,8 +6941,7 @@ class Diffuse(Gtk.Window): # pane footer class PaneFooter(Gtk.Box): def __init__(self): - Gtk.Box.__init__(self, Gtk.Orientation.HORIZONTAL, 0) - + Gtk.Box.__init__(self, orientation = Gtk.Orientation.HORIZONTAL, spacing = 0) self.cursor = label = Gtk.Label.new() self.cursor.set_size_request(-1, -1) self.pack_start(label, False, False, 0) @@ -7418,7 +7417,7 @@ class Diffuse(Gtk.Window): self.footers[f].setFormat(format) def __init__(self, rc_dir): - Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL) + Gtk.Window.__init__(self, type = Gtk.WindowType.TOPLEVEL) self.prefs = Preferences(os.path.join(rc_dir, 'prefs')) # number of created viewers (used to label some tabs) @@ -8337,13 +8336,13 @@ class Diffuse(Gtk.Window): dialog.run() dialog.destroy() -GObject.signal_new('title-changed', Diffuse.FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (str, )) -GObject.signal_new('status-changed', Diffuse.FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (str, )) -GObject.signal_new('title-changed', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('open', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('reload', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('save', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) -GObject.signal_new('save-as', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('title-changed', Diffuse.FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, )) +GObject.signal_new('status-changed', Diffuse.FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, )) +GObject.signal_new('title-changed', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('open', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('reload', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('save', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) +GObject.signal_new('save-as', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) # create nested subdirectories and return the complete path def make_subdirs(p, ss):