[pygobject] Adds overrides modules from PyBank.
- From: Johan Dahlin <johan src gnome org>
- To: svn-commits-list gnome org
- Subject: [pygobject] Adds overrides modules from PyBank.
- Date: Mon, 8 Jun 2009 13:52:59 -0400 (EDT)
commit abe4828f52c7eb3a08f5b592e7ced1e97a58ef5c
Author: Simon van der Linden <simon vanderlinden student uclouvain be>
Date: Wed Jun 3 10:47:58 2009 +0200
Adds overrides modules from PyBank.
---
girepository/Makefile.am | 3 +++
girepository/importer.py | 3 +--
girepository/overrides/Gdk.py | 14 ++++++++++++++
girepository/overrides/Gtk.py | 8 ++++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/girepository/Makefile.am b/girepository/Makefile.am
index 656795d..047b898 100644
--- a/girepository/Makefile.am
+++ b/girepository/Makefile.am
@@ -21,6 +21,9 @@ pygirepository_PYTHON = \
repository.py \
btypes.py
+pygioverridesdir = $(pkgpyexecdir)/overrides
+pygioverrides_PYTHON = overrides/*.py
+
# linker flags
common_ldflags = -module -avoid-version
if PLATFORM_WIN32
diff --git a/girepository/importer.py b/girepository/importer.py
index c371f79..5a91867 100644
--- a/girepository/importer.py
+++ b/girepository/importer.py
@@ -39,8 +39,7 @@ class DynamicImporter(object):
from .module import DynamicModule
module_name = 'girepository.overrides.%s' % (name,)
try:
- d = {}
- module = __import__(module_name, d, d, ' ', 2)
+ module = __import__(module_name)
modtype = getattr(module, name + 'Module')
except ImportError, e:
modtype = DynamicModule
diff --git a/girepository/overrides/Gdk.py b/girepository/overrides/Gdk.py
new file mode 100644
index 0000000..e2f05d7
--- /dev/null
+++ b/girepository/overrides/Gdk.py
@@ -0,0 +1,14 @@
+from bank.module import DynamicModule
+
+class GdkModule(DynamicModule):
+ def created(self):
+ self.init_check(0, None)
+
+ def rectangle_new(self, x, y, width, height):
+ rectangle = self.Rectangle()
+ rectangle.x = x
+ rectangle.y = y
+ rectangle.width = width
+ rectangle.height = height
+ return rectangle
+
diff --git a/girepository/overrides/Gtk.py b/girepository/overrides/Gtk.py
new file mode 100644
index 0000000..1f718c3
--- /dev/null
+++ b/girepository/overrides/Gtk.py
@@ -0,0 +1,8 @@
+from bank.module import DynamicModule
+
+class GtkModule(DynamicModule):
+ def created(self):
+ self.init_check(0, None)
+ #if self.init_check(len(sys.argv), sys.argv):
+ # raise RuntimeError("could not open display")
+
diff --git a/girepository/overrides/__init__.py b/girepository/overrides/__init__.py
new file mode 100644
index 0000000..e69de29
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]