~ubuntu-branches/ubuntu/trusty/libgrip/trusty

« back to all changes in this revision

Viewing changes to examples/pygrip/pygrip.py

  • Committer: Package Import Robot
  • Author(s): Automatic PS uploader, Mathieu Trudel-Lapierre, Didier Roche, Automatic PS uploader
  • Date: 2013-02-26 02:02:10 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20130226020210-mi8h1lzrsp6jg9w0
Tags: 0.3.6daily13.02.26-0ubuntu1
[ Mathieu Trudel-Lapierre ]
* debian/control:
  - Update Vcs-Bzr, Vcs-Browser and add a notice to uploaders.
  - Update style: use trailing commas at the end of dependency lists. 
  - Drop Build-Depends on cdbs.
  - Bump Build-Depends on debhelper to (>= 9).
  - Reorganize Build-Depends for clarity.
  - Add a Build-Depends on gnome-common.
  - Add a Build-Depends on dh-autoreconf.
  - Add a Pre-Depends: multiarch-support for libgrip0.
  - Drop the unneeded old Breaks/Replaces lines.
* debian/compat: bump compat level to 9.
* debian/rules:
  - Convert to using the dh9 sequencer.
  - Add and export DPKG_GENSYMBOLS_CHECK_LEVEL.
  - Explicitly remove grip-test binary to avoid dh_install failing the build.
* debian/*.install: update paths for multiarch.
* debian/source/format: migrate back to source format 1.0.

[ Didier Roche ]
* Automatic snapshot from revision 73 (bootstrap)

[ Automatic PS uploader ]
* Automatic snapshot from revision 74

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
from gi.repository import Gtk
 
3
Gtk.require_version('2.0')
 
4
from gi.repository import Grip
 
5
 
 
6
 
 
7
# XXX For now, we'll use Grip directly. Once we have a good sense of what's
 
8
# going to be needed in general for general Python code using Grip, we might
 
9
# want to put that stuff in a wrapper grip module, and import everything from
 
10
# there instead.
 
11
 
 
12
 
 
13
class GestureTester(object):
 
14
 
 
15
    def __init__(self):
 
16
        builder = Gtk.Builder()
 
17
        builder.add_from_file("pygrip-gestures.xml")
 
18
        builder.connect_signals(self)
 
19
        self.window = builder.get_object("window1")
 
20
        self.gesture_manager = Grip.GestureManager()
 
21
        self.window.show()
 
22
 
 
23
    def window_mapped(self, widget, data=None):
 
24
        # The gesture manager is only going to be needed for GTK2, since GTK3
 
25
        # will have the gesture API natively. Conversely, pygrip will only be
 
26
        # for GTK2, since PyGTK3 will having the bindings.
 
27
 
 
28
        finger_count = 2
 
29
        self.gesture_manager.register_window(widget, Grip.GestureType.PINCH, finger_count, self.callback, None)
 
30
 
 
31
    def callback(self, window, time_type, gesture_event, data):
 
32
        print "received gesture"
 
33
 
 
34
    def quit(self, widget, data=None):
 
35
        Gtk.main_quit()
 
36
 
 
37
 
 
38
if __name__ == "__main__":
 
39
    app = GestureTester()
 
40
    Gtk.main()