Merge pull request #29 from MightyCreak/fix-gtk-deprecation-warnings

Fix a bunch of PyGTK+3 deprecation warnings
This commit is contained in:
Creak 2020-03-26 23:53:28 -04:00 committed by GitHub
commit b1f70363ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 18 deletions

View File

@ -177,7 +177,7 @@ class MessageDialog(Gtk.MessageDialog):
buttons = Gtk.ButtonsType.OK buttons = Gtk.ButtonsType.OK
else: else:
buttons = Gtk.ButtonsType.OK_CANCEL 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) self.set_title(APP_NAME)
# report error messages # report error messages
@ -6641,12 +6641,12 @@ class FileDiffViewer(Gtk.Grid):
self._mergeBoth(True) self._mergeBoth(True)
# create 'title_changed' signal for FileDiffViewer # create 'title_changed' signal for FileDiffViewer
GObject.signal_new('swapped-panes', 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.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (int, )) GObject.signal_new('num-edits-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (int, ))
GObject.signal_new('mode-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) GObject.signal_new('mode-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ())
GObject.signal_new('cursor-changed', FileDiffViewer, GObject.SIGNAL_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.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (str, )) GObject.signal_new('syntax-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, ))
GObject.signal_new('format-changed', FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (int, int)) GObject.signal_new('format-changed', FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (int, int))
# dialogue used to search for text # dialogue used to search for text
class SearchDialog(Gtk.Dialog): class SearchDialog(Gtk.Dialog):
@ -6888,7 +6888,7 @@ class Diffuse(Gtk.Window):
# pane header # pane header
class PaneHeader(Gtk.Box): class PaneHeader(Gtk.Box):
def __init__(self): 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, [ appendButtons(self, Gtk.IconSize.MENU, [
[ Gtk.STOCK_OPEN, self.button_cb, 'open', _('Open File...') ], [ Gtk.STOCK_OPEN, self.button_cb, 'open', _('Open File...') ],
[ Gtk.STOCK_REFRESH, self.button_cb, 'reload', _('Reload File') ], [ Gtk.STOCK_REFRESH, self.button_cb, 'reload', _('Reload File') ],
@ -6941,8 +6941,7 @@ class Diffuse(Gtk.Window):
# pane footer # pane footer
class PaneFooter(Gtk.Box): class PaneFooter(Gtk.Box):
def __init__(self): 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 = label = Gtk.Label.new()
self.cursor.set_size_request(-1, -1) self.cursor.set_size_request(-1, -1)
self.pack_start(label, False, False, 0) self.pack_start(label, False, False, 0)
@ -7418,7 +7417,7 @@ class Diffuse(Gtk.Window):
self.footers[f].setFormat(format) self.footers[f].setFormat(format)
def __init__(self, rc_dir): 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')) self.prefs = Preferences(os.path.join(rc_dir, 'prefs'))
# number of created viewers (used to label some tabs) # number of created viewers (used to label some tabs)
@ -8337,13 +8336,13 @@ class Diffuse(Gtk.Window):
dialog.run() dialog.run()
dialog.destroy() dialog.destroy()
GObject.signal_new('title-changed', Diffuse.FileDiffViewer, GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (str, )) GObject.signal_new('title-changed', Diffuse.FileDiffViewer, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, ))
GObject.signal_new('status-changed', Diffuse.FileDiffViewer, GObject.SIGNAL_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.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ()) GObject.signal_new('title-changed', Diffuse.FileDiffViewer.PaneHeader, GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ())
GObject.signal_new('open', Diffuse.FileDiffViewer.PaneHeader, GObject.SIGNAL_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.SIGNAL_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.SIGNAL_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.SIGNAL_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 # create nested subdirectories and return the complete path
def make_subdirs(p, ss): def make_subdirs(p, ss):