diff options
author | Marinus Schraal <mschraal@gnome.org> | 2020-06-08 16:27:55 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2020-10-07 21:25:24 +0000 |
commit | 5657e6239e4069fd22e9dddbf00d700944213236 (patch) | |
tree | 4225e7ae72da4e3dd61faa4d55b1af2e0a4a3d9b /gi | |
parent | c945c99fbadb4496ff0fc01d42efd786abf5fba8 (diff) | |
download | pygobject-5657e6239e4069fd22e9dddbf00d700944213236.tar.gz |
gtk overrides: Remove Container use for GTK4wip/mschraal/gtk4-container-removal
Diffstat (limited to 'gi')
-rw-r--r-- | gi/overrides/Gtk.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 64a5088e..5092bca2 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -165,24 +165,23 @@ Widget = override(Widget) __all__.append('Widget') -class Container(Gtk.Container, Widget): +if Gtk._version in ("2.0", "3.0"): + class Container(Gtk.Container, Widget): - def __len__(self): - return len(self.get_children()) + def __len__(self): + return len(self.get_children()) - def __contains__(self, child): - return child in self.get_children() + def __contains__(self, child): + return child in self.get_children() - def __iter__(self): - return iter(self.get_children()) + def __iter__(self): + return iter(self.get_children()) - def __bool__(self): - return True + def __bool__(self): + return True - # alias for Python 2.x object protocol - __nonzero__ = __bool__ - - if Gtk._version in ("2.0", "3.0"): + # alias for Python 2.x object protocol + __nonzero__ = __bool__ def child_get_property(self, child, property_name, value=None): if value is None: @@ -207,9 +206,11 @@ class Container(Gtk.Container, Widget): get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain) - -Container = override(Container) -__all__.append('Container') + Container = override(Container) + __all__.append('Container') +else: + class Container(object): + pass class Editable(Gtk.Editable): |