fix some PyGI/DeprecationWarning
This commit is contained in:
parent
56f867d783
commit
a2030431c0
@ -309,8 +309,12 @@ class Gramplet(object):
|
||||
self.interrupt()
|
||||
self._generator = self.main()
|
||||
self._pause = False
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
if GObject.pygobject_version < (3,16,0):
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
priority=GObject.PRIORITY_LOW - 10)
|
||||
else:
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
priority=GLib.PRIORITY_LOW - 10)
|
||||
|
||||
def _updater(self):
|
||||
"""
|
||||
@ -364,8 +368,12 @@ class Gramplet(object):
|
||||
"""
|
||||
from gi.repository import GObject, GLib
|
||||
self._pause = False
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
if GObject.pygobject_version < (3,16,0):
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
priority=GObject.PRIORITY_LOW - 10)
|
||||
else:
|
||||
self._idle_id = GLib.idle_add(self._updater,
|
||||
priority=GLib.PRIORITY_LOW - 10)
|
||||
|
||||
def update_all(self, *args):
|
||||
"""
|
||||
|
@ -358,7 +358,8 @@ class ViewManager(CLIManager):
|
||||
|
||||
self.window = Gtk.Window()
|
||||
self.window.set_icon_from_file(ICON)
|
||||
self.window.set_has_resize_grip(True)
|
||||
if Gtk.get_minor_version() < 14:
|
||||
self.window.set_has_resize_grip(True)
|
||||
self.window.set_default_size(width, height)
|
||||
|
||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
|
@ -47,7 +47,11 @@ from gramps.gen.constfunc import has_display
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if has_display():
|
||||
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
|
||||
if Gtk.get_minor_version() < 16:
|
||||
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
|
||||
else:
|
||||
HAND_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.HAND2)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -197,14 +197,32 @@ GRABBERS_SWITCH = [
|
||||
|
||||
# cursors
|
||||
try:
|
||||
CURSOR_UPPER = Gdk.Cursor.new(Gdk.CursorType.TOP_SIDE)
|
||||
CURSOR_LOWER = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_SIDE)
|
||||
CURSOR_LEFT = Gdk.Cursor.new(Gdk.CursorType.LEFT_SIDE)
|
||||
CURSOR_RIGHT = Gdk.Cursor.new(Gdk.CursorType.RIGHT_SIDE)
|
||||
CURSOR_UPPER_LEFT = Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_CORNER)
|
||||
CURSOR_UPPER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.TOP_RIGHT_CORNER)
|
||||
CURSOR_LOWER_LEFT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_LEFT_CORNER)
|
||||
CURSOR_LOWER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_RIGHT_CORNER)
|
||||
if Gtk.get_minor_version() < 16:
|
||||
CURSOR_UPPER = Gdk.Cursor.new(Gdk.CursorType.TOP_SIDE)
|
||||
CURSOR_LOWER = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_SIDE)
|
||||
CURSOR_LEFT = Gdk.Cursor.new(Gdk.CursorType.LEFT_SIDE)
|
||||
CURSOR_RIGHT = Gdk.Cursor.new(Gdk.CursorType.RIGHT_SIDE)
|
||||
CURSOR_UPPER_LEFT = Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_CORNER)
|
||||
CURSOR_UPPER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.TOP_RIGHT_CORNER)
|
||||
CURSOR_LOWER_LEFT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_LEFT_CORNER)
|
||||
CURSOR_LOWER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_RIGHT_CORNER)
|
||||
else:
|
||||
CURSOR_UPPER = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.TOP_SIDE)
|
||||
CURSOR_LOWER = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.BOTTOM_SIDE)
|
||||
CURSOR_LEFT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.LEFT_SIDE)
|
||||
CURSOR_RIGHT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.RIGHT_SIDE)
|
||||
CURSOR_UPPER_LEFT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.TOP_LEFT_CORNER)
|
||||
CURSOR_UPPER_RIGHT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.TOP_RIGHT_CORNER)
|
||||
CURSOR_LOWER_LEFT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.BOTTOM_LEFT_CORNER)
|
||||
CURSOR_LOWER_RIGHT = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.BOTTOM_RIGHT_CORNER)
|
||||
except:
|
||||
CURSOR_UPPER = None
|
||||
CURSOR_LOWER = None
|
||||
|
@ -57,7 +57,11 @@ from ..utils import rgb_to_hex
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
if has_display():
|
||||
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
|
||||
if Gtk.get_minor_version() < 16:
|
||||
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
|
||||
else:
|
||||
HAND_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
|
||||
Gdk.CursorType.HAND2)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -171,14 +171,14 @@ class SelectionWidget(Gtk.ScrolledWindow):
|
||||
"""
|
||||
|
||||
__gsignals__ = {
|
||||
"region-modified": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"region-created": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"region-selected": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"selection-cleared": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"right-button-clicked": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"zoomed-in": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
"zoomed-out": (GObject.SIGNAL_RUN_FIRST, None, ())
|
||||
}
|
||||
"region-modified": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"region-created": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"region-selected": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"selection-cleared": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"right-button-clicked": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"zoomed-in": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||
"zoomed-out": (GObject.SignalFlags.RUN_FIRST, None, ())
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
|
@ -1116,16 +1116,21 @@ class ValidatableMaskedEntry(MaskedEntry):
|
||||
'changed': 'override',
|
||||
}
|
||||
|
||||
if GLib.MINOR_VERSION < 42:
|
||||
__gparam = GObject.PARAM_READWRITE
|
||||
else:
|
||||
__gparam = GObject.ParamFlags.READWRITE
|
||||
|
||||
__gproperties__ = {
|
||||
'data-type': (GObject.TYPE_PYOBJECT,
|
||||
'Data Type of the widget',
|
||||
'Type object',
|
||||
GObject.PARAM_READWRITE),
|
||||
__gparam),
|
||||
'mandatory': (GObject.TYPE_BOOLEAN,
|
||||
'Mandatory',
|
||||
'Mandatory',
|
||||
False,
|
||||
GObject.PARAM_READWRITE),
|
||||
__gparam),
|
||||
}
|
||||
|
||||
# FIXME put the data type support back
|
||||
|
Loading…
Reference in New Issue
Block a user