summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-03-17 20:02:03 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-03-17 20:05:36 +0100
commit8458002bc8a679d16dff07f0f64bc98fbb643bc6 (patch)
tree651b575c71d0d6ea93b9eaeadb9127d847bd1a57
parenteeb63b029c5f2cd0baa16f202444ecb8b994ca14 (diff)
downloadpygobject-8458002bc8a679d16dff07f0f64bc98fbb643bc6.tar.gz
overrides: make them importable with current gtk4 master
Skip all the stuff no longer available in gtk master. No test fixes.
-rw-r--r--gi/overrides/Gdk.py51
-rw-r--r--gi/overrides/Gtk.py20
2 files changed, 41 insertions, 30 deletions
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index bf1b9af7..a1ef5f97 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -177,8 +177,9 @@ else:
Window = override(Window)
__all__.append('Window')
-Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS")
-Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS")
+if Gdk._version in ("2.0", "3.0"):
+ Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS")
+ Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS")
class Event(Gdk.Event):
@@ -188,8 +189,6 @@ class Event(Gdk.Event):
Gdk.EventType.EXPOSE: 'expose',
Gdk.EventType.MOTION_NOTIFY: 'motion',
Gdk.EventType.BUTTON_PRESS: 'button',
- Gdk.EventType._2BUTTON_PRESS: 'button',
- Gdk.EventType._3BUTTON_PRESS: 'button',
Gdk.EventType.BUTTON_RELEASE: 'button',
Gdk.EventType.KEY_PRESS: 'key',
Gdk.EventType.KEY_RELEASE: 'key',
@@ -199,22 +198,28 @@ class Event(Gdk.Event):
Gdk.EventType.CONFIGURE: 'configure',
Gdk.EventType.MAP: 'any',
Gdk.EventType.UNMAP: 'any',
- Gdk.EventType.PROPERTY_NOTIFY: 'property',
- Gdk.EventType.SELECTION_CLEAR: 'selection',
- Gdk.EventType.SELECTION_REQUEST: 'selection',
- Gdk.EventType.SELECTION_NOTIFY: 'selection',
Gdk.EventType.PROXIMITY_IN: 'proximity',
Gdk.EventType.PROXIMITY_OUT: 'proximity',
Gdk.EventType.DRAG_ENTER: 'dnd',
Gdk.EventType.DRAG_LEAVE: 'dnd',
Gdk.EventType.DRAG_MOTION: 'dnd',
- Gdk.EventType.DRAG_STATUS: 'dnd',
Gdk.EventType.DROP_START: 'dnd',
- Gdk.EventType.DROP_FINISHED: 'dnd',
- Gdk.EventType.CLIENT_EVENT: 'client',
- Gdk.EventType.VISIBILITY_NOTIFY: 'visibility',
}
+ if Gdk._version in ("2.0", "3.0"):
+ _UNION_MEMBERS.update({
+ Gdk.EventType._2BUTTON_PRESS: 'button',
+ Gdk.EventType._3BUTTON_PRESS: 'button',
+ Gdk.EventType.PROPERTY_NOTIFY: 'property',
+ Gdk.EventType.SELECTION_CLEAR: 'selection',
+ Gdk.EventType.SELECTION_REQUEST: 'selection',
+ Gdk.EventType.SELECTION_NOTIFY: 'selection',
+ Gdk.EventType.DRAG_STATUS: 'dnd',
+ Gdk.EventType.DROP_FINISHED: 'dnd',
+ Gdk.EventType.CLIENT_EVENT: 'client',
+ Gdk.EventType.VISIBILITY_NOTIFY: 'visibility',
+ })
+
if Gdk._version == '2.0':
_UNION_MEMBERS[Gdk.EventType.NO_EXPOSE] = 'no_expose'
@@ -258,7 +263,6 @@ module = sys.modules[modname]
# field info so manually list the class names
event_member_classes = ['EventAny',
'EventExpose',
- 'EventVisibility',
'EventMotion',
'EventButton',
'EventScroll',
@@ -266,15 +270,21 @@ event_member_classes = ['EventAny',
'EventCrossing',
'EventFocus',
'EventConfigure',
- 'EventProperty',
- 'EventSelection',
- 'EventOwnerChange',
'EventProximity',
'EventDND',
- 'EventWindowState',
'EventSetting',
'EventGrabBroken']
+if Gdk._version in ("2.0", "3.0"):
+ event_member_classes.extend([
+ 'EventVisibility',
+ 'EventProperty',
+ 'EventSelection',
+ 'EventOwnerChange',
+ 'EventWindowState',
+ 'EventVisibility',
+ ])
+
if Gdk._version == '2.0':
event_member_classes.append('EventNoExpose')
@@ -391,12 +401,13 @@ def _gdk_atom_repr(atom):
return '<Gdk.Atom(%i)>' % hash(atom)
-Gdk.Atom.__str__ = _gdk_atom_str
-Gdk.Atom.__repr__ = _gdk_atom_repr
+if Gdk._version in ("2.0", "3.0"):
+ Gdk.Atom.__str__ = _gdk_atom_str
+ Gdk.Atom.__repr__ = _gdk_atom_repr
# constants
-if Gdk._version >= '3.0':
+if Gdk._version == '3.0':
SELECTION_PRIMARY = Gdk.atom_intern('PRIMARY', True)
__all__.append('SELECTION_PRIMARY')
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 37092448..e15a0bb7 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -634,17 +634,17 @@ if Gtk._version in ("2.0", "3.0"):
__all__.append('FontSelectionDialog')
-class RecentChooserDialog(Gtk.RecentChooserDialog):
- # Note, the "manager" keyword must work across the entire 3.x series because
- # "recent_manager" is not backwards compatible with PyGObject versions prior to 3.10.
- __init__ = deprecated_init(Gtk.RecentChooserDialog.__init__,
- arg_names=('title', 'parent', 'recent_manager', 'buttons'),
- deprecated_aliases={'recent_manager': 'manager'},
- category=PyGTKDeprecationWarning)
-
+if Gtk._version in ("2.0", "3.0"):
+ class RecentChooserDialog(Gtk.RecentChooserDialog):
+ # Note, the "manager" keyword must work across the entire 3.x series because
+ # "recent_manager" is not backwards compatible with PyGObject versions prior to 3.10.
+ __init__ = deprecated_init(Gtk.RecentChooserDialog.__init__,
+ arg_names=('title', 'parent', 'recent_manager', 'buttons'),
+ deprecated_aliases={'recent_manager': 'manager'},
+ category=PyGTKDeprecationWarning)
-RecentChooserDialog = override(RecentChooserDialog)
-__all__.append('RecentChooserDialog')
+ RecentChooserDialog = override(RecentChooserDialog)
+ __all__.append('RecentChooserDialog')
class IconView(Gtk.IconView):