Merge lp:~ken-vandine/libgrip/python_gi_override into lp:~bratsche/libgrip/python-fixage-wip

Proposed by Ken VanDine
Status: Merged
Merged at revision: 24
Proposed branch: lp:~ken-vandine/libgrip/python_gi_override
Merge into: lp:~bratsche/libgrip/python-fixage-wip
Diff against target: 165 lines (+73/-6)
7 files modified
Makefile.am (+1/-1)
bindings/Makefile.am (+1/-0)
bindings/python/Grip.py (+52/-0)
bindings/python/Makefile.am (+9/-0)
configure.ac (+4/-0)
examples/pygrip/pygrip.py (+3/-4)
src/Makefile.am (+3/-1)
To merge this branch: bzr merge lp:~ken-vandine/libgrip/python_gi_override
Reviewer Review Type Date Requested Status
Cody Russell Approve
Review via email: mp+47294@code.launchpad.net

Description of the change

* Added python overrides for gi
* Fixed pygrip example

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) wrote :

Awesome, thanks for the fix!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.am'
--- Makefile.am 2010-11-22 14:49:44 +0000
+++ Makefile.am 2011-01-24 19:13:59 +0000
@@ -4,7 +4,7 @@
4Q = $(V:1=)4Q = $(V:1=)
5QUIET_GEN = $(Q:@=@echo ' GEN '$@;)5QUIET_GEN = $(Q:@=@echo ' GEN '$@;)
66
7SUBDIRS = build src examples/rectangle-mover7SUBDIRS = build src bindings examples/rectangle-mover
88
9libgrip-0.1.pc: libgrip.pc9libgrip-0.1.pc: libgrip.pc
10 $(QUIET_GEN) cp -f libgrip.pc libgrip-0.1.pc10 $(QUIET_GEN) cp -f libgrip.pc libgrip-0.1.pc
1111
=== added directory 'bindings'
=== added file 'bindings/Makefile.am'
--- bindings/Makefile.am 1970-01-01 00:00:00 +0000
+++ bindings/Makefile.am 2011-01-24 19:13:59 +0000
@@ -0,0 +1,1 @@
1SUBDIRS = python
02
=== added directory 'bindings/python'
=== added file 'bindings/python/Grip.py'
--- bindings/python/Grip.py 1970-01-01 00:00:00 +0000
+++ bindings/python/Grip.py 2011-01-24 19:13:59 +0000
@@ -0,0 +1,52 @@
1#
2# Copyright 2010 Canonical, Ltd.
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of either or both of the following licenses:
6#
7# 1) the GNU Lesser General Public License version 3, as published by the
8# Free Software Foundation; and/or
9# 2) the GNU Lesser General Public License version 2.1, as published by
10# the Free Software Foundation.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
15# PURPOSE. See the applicable version of the GNU Lesser General Public
16# License for more details.
17#
18# You should have received a copy of both the GNU Lesser General Public
19# License version 3 and version 2.1 along with this program. If not, see
20# <http://www.gnu.org/licenses/>
21#
22# Authors:
23# Cody Russell <crussell@canonical.com>
24#
25
26from ..overrides import override
27from ..importer import modules
28
29Grip = modules['Grip'].introspection_module
30
31__all__ = []
32
33class GestureEvent(Grip.GestureEvent):
34 _UNION_MEMBERS = {
35 Grip.GestureType.DRAG: 'drag',
36 Grip.GestureType.PINCH: 'pinch',
37 Grip.GestureType.ROTATE: 'rotate',
38 Grip.GestureType.TAP: 'tap'
39 }
40
41 def __new__(cls, *args, **kwargs):
42 return Grip.GestureEvent.__new__(cls)
43
44 def __getattr__(self, name):
45 real_event = getattr(self, '_UNION_MEMBERS').get(self.type)
46 if real_event:
47 return getattr(getattr(self, real_event), name)
48 else:
49 return getattr(self, name)
50
51GestureEvent = override(GestureEvent)
52__all__.append('GestureEvent')
053
=== added file 'bindings/python/Makefile.am'
--- bindings/python/Makefile.am 1970-01-01 00:00:00 +0000
+++ bindings/python/Makefile.am 2011-01-24 19:13:59 +0000
@@ -0,0 +1,9 @@
1PLATFORM_VERSION = 2.0
2
3pkgpyexecdir = $(pyexecdir)/gi
4
5pygioverridesdir = $(pkgpyexecdir)/overrides
6pygioverrides_PYTHON = \
7 Grip.py
8
9EXTRA_DIST = Grip.py
010
=== modified file 'configure.ac'
--- configure.ac 2011-01-03 19:12:52 +0000
+++ configure.ac 2011-01-24 19:13:59 +0000
@@ -27,6 +27,8 @@
27AM_INIT_AUTOMAKE([1.9])27AM_INIT_AUTOMAKE([1.9])
28AM_MAINTAINER_MODE28AM_MAINTAINER_MODE
2929
30AM_PATH_PYTHON
31
30GRIP_MAJOR_VERSION=grip_major_version32GRIP_MAJOR_VERSION=grip_major_version
31GRIP_MINOR_VERSION=grip_minor_version33GRIP_MINOR_VERSION=grip_minor_version
32GRIP_MICRO_VERSION=grip_micro_version34GRIP_MICRO_VERSION=grip_micro_version
@@ -119,6 +121,8 @@
119 build/autotools/shave-libtool121 build/autotools/shave-libtool
120 build/autotools/shave122 build/autotools/shave
121 src/Makefile123 src/Makefile
124 bindings/python/Makefile
125 bindings/Makefile
122 examples/rectangle-mover/Makefile126 examples/rectangle-mover/Makefile
123 libgrip.pc127 libgrip.pc
124])128])
125129
=== modified file 'examples/pygrip/pygrip.py' (properties changed: -x to +x)
--- examples/pygrip/pygrip.py 2011-01-21 17:19:26 +0000
+++ examples/pygrip/pygrip.py 2011-01-24 19:13:59 +0000
@@ -1,3 +1,4 @@
1#!/usr/bin/python
1from gi.repository import Gtk2from gi.repository import Gtk
2Gtk.require_version('2.0')3Gtk.require_version('2.0')
3from gi.repository import Grip4from gi.repository import Grip
@@ -16,20 +17,18 @@
16 builder.add_from_file("pygrip-gestures.xml")17 builder.add_from_file("pygrip-gestures.xml")
17 builder.connect_signals(self)18 builder.connect_signals(self)
18 self.window = builder.get_object("window1")19 self.window = builder.get_object("window1")
20 self.gesture_manager = Grip.GestureManager()
19 self.window.show()21 self.window.show()
2022
21 def window_mapped(self, widget, data=None):23 def window_mapped(self, widget, data=None):
22 # The gesture manager is only going to be needed for GTK2, since GTK324 # The gesture manager is only going to be needed for GTK2, since GTK3
23 # will have the gesture API natively. Conversely, pygrip will only be25 # will have the gesture API natively. Conversely, pygrip will only be
24 # for GTK2, since PyGTK3 will having the bindings.26 # for GTK2, since PyGTK3 will having the bindings.
25 gesture_manager = Grip.GestureManager()
26 27
27 finger_count = 228 finger_count = 2
28# import epdb; epdb.st();29 self.gesture_manager.register_window(widget, Grip.GestureType.PINCH, finger_count, self.callback, None)
29 gesture_manager.register_window(self.window, Grip.GestureType.PINCH, finger_count, self.callback, None)
3030
31 def callback(self, window, time_type, gesture_event, data):31 def callback(self, window, time_type, gesture_event, data):
32# import epdb; epdb.st();
33 print "received gesture"32 print "received gesture"
3433
35 def quit(self, widget, data=None):34 def quit(self, widget, data=None):
3635
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-11-22 14:49:44 +0000
+++ src/Makefile.am 2011-01-24 19:13:59 +0000
@@ -38,6 +38,7 @@
38 $(INTROSPECTION_SCANNER) \38 $(INTROSPECTION_SCANNER) \
39 -v --namespace Grip \39 -v --namespace Grip \
40 --nsversion=0.1 \40 --nsversion=0.1 \
41 --warn-all \
41 --add-include-path=$(srcdir) $(GTK_CFLAGS) \42 --add-include-path=$(srcdir) $(GTK_CFLAGS) \
42 --include=GObject-2.0 \43 --include=GObject-2.0 \
43 --include=GLib-2.0 \44 --include=GLib-2.0 \
@@ -104,4 +105,5 @@
104DISTCLEANFILES = \105DISTCLEANFILES = \
105 stamp-griptypebuiltins.h \106 stamp-griptypebuiltins.h \
106 griptypebuiltins.h \107 griptypebuiltins.h \
107 griptypebuiltins.c
108\ No newline at end of file108\ No newline at end of file
109 griptypebuiltins.c
110

Subscribers

People subscribed via source and target branches

to all changes: