summaryrefslogtreecommitdiff
path: root/pygtkcompat
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-12-31 16:15:04 -0800
committerSimon Feltman <sfeltman@src.gnome.org>2014-08-05 21:38:19 -0700
commit5ca4d25eac0efcc12b02fe53f379ee41e69bf1d2 (patch)
tree70f7bedeebbc01bc4455f63e2c3706e1475a804f /pygtkcompat
parent9eaeba9079c23d7e2837f62e8ed2b26c018351b6 (diff)
downloadpygobject-5ca4d25eac0efcc12b02fe53f379ee41e69bf1d2.tar.gz
Update and deprecate gi.overrides.keysyms
Replace manually assigned keysyms with a dynamically generated version pulling names and values from Gdk via GI. Add a runtime warning when this module is imported. https://bugzilla.gnome.org/show_bug.cgi?id=721295
Diffstat (limited to 'pygtkcompat')
-rw-r--r--pygtkcompat/pygtkcompat.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py
index 7ee2de4d..e9763444 100644
--- a/pygtkcompat/pygtkcompat.py
+++ b/pygtkcompat/pygtkcompat.py
@@ -486,18 +486,12 @@ def enable_gtk(version='3.0'):
# gtk.keysyms
- class Keysyms(object):
- pass
- keysyms = Keysyms()
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=RuntimeWarning)
+ from gi.overrides import keysyms
+
sys.modules['gtk.keysyms'] = keysyms
Gtk.keysyms = keysyms
- for name in dir(Gdk):
- if name.startswith('KEY_'):
- target = name[4:]
- if target[0] in '0123456789':
- target = '_' + target
- value = getattr(Gdk, name)
- setattr(keysyms, target, value)
from . import generictreemodel
Gtk.GenericTreeModel = generictreemodel.GenericTreeModel