Status: | Merged |
---|---|
Merged at revision: | 142 |
Proposed branch: | lp:~bregma/geis/lp-617301 |
Merge into: | lp:geis |
Diff against target: |
2876 lines (+2731/-3) 21 files modified
.bzrignore (+1/-0) ChangeLog (+12/-0) Makefile.am (+1/-1) configure.ac (+6/-2) python/Makefile.am (+44/-0) python/_geis_bindings/_geis_bindings.c (+165/-0) python/geis/__init__.py (+234/-0) python/geis/geis_v2.py (+640/-0) python/pygeis (+136/-0) python/run_pygeis (+11/-0) tools/Makefile.am (+23/-0) tools/geisview/Makefile.am (+46/-0) tools/geisview/__init__.py (+24/-0) tools/geisview/defaults.py.in (+62/-0) tools/geisview/deviceview.py (+46/-0) tools/geisview/filter_definition.py (+135/-0) tools/geisview/filter_definition.ui (+329/-0) tools/geisview/filter_list.py (+59/-0) tools/geisview/filter_list.ui (+174/-0) tools/geisview/geisview (+250/-0) tools/geisview/geisview.ui (+333/-0) |
To merge this branch: | bzr merge lp:~bregma/geis/lp-617301 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jussi Pakkanen (community) | Needs Fixing | ||
Review via email: mp+61883@code.launchpad.net |
Commit message
Description of the change
Added Python bindings and the start of a Python-based "geisview" tool to visualize gesture events.
To post a comment you must log in.
lp:~bregma/geis/lp-617301
updated
- 153. By Stephen M. Webb
-
Fixed tools/geisview/
defaults. py.in licensing and descriptive comment for geis.Group class. - 154. By Stephen M. Webb
-
Fixed some pyflakes warnings.
- 155. By Stephen M. Webb
-
Silenced some pylint whinings.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-03-17 04:06:04 +0000 | |||
3 | +++ .bzrignore 2011-05-27 15:36:38 +0000 | |||
4 | @@ -21,6 +21,7 @@ | |||
5 | 21 | debian/libutouch-geis1 | 21 | debian/libutouch-geis1 |
6 | 22 | debian/libutouch-geis1-dbg | 22 | debian/libutouch-geis1-dbg |
7 | 23 | debian/tmp | 23 | debian/tmp |
8 | 24 | defaults.py | ||
9 | 24 | doc/api | 25 | doc/api |
10 | 25 | doc/docbook-xsl.css | 26 | doc/docbook-xsl.css |
11 | 26 | doc/geisspec-1.0.html | 27 | doc/geisspec-1.0.html |
12 | 27 | 28 | ||
13 | === modified file 'ChangeLog' | |||
14 | --- ChangeLog 2011-05-03 16:29:45 +0000 | |||
15 | +++ ChangeLog 2011-05-27 15:36:38 +0000 | |||
16 | @@ -1,3 +1,15 @@ | |||
17 | 1 | 2011-03-31 Stephen M. Webb <stephen.webb@canonical.com> | ||
18 | 2 | |||
19 | 3 | Add initial python bindings. | ||
20 | 4 | |||
21 | 5 | * python/Makefile.am: new file | ||
22 | 6 | * python/_geis_bindings/_geis_bindings.c: new file | ||
23 | 7 | * python/geis/__init__.py: new file | ||
24 | 8 | * python/geis/geis_v2.py: new file | ||
25 | 9 | * python/pygeis: new script | ||
26 | 10 | * Makefile.am (SUBDIRS): added python | ||
27 | 11 | * configure.ac (AC_CONFIG_FILES): added new generated files | ||
28 | 12 | |||
29 | 1 | 2011-04-10 Stephen M. Webb <stephen.webb@canonical.com> | 13 | 2011-04-10 Stephen M. Webb <stephen.webb@canonical.com> |
30 | 2 | 14 | ||
31 | 3 | Repaired a callback persistence problem (LP: #754135). | 15 | Repaired a callback persistence problem (LP: #754135). |
32 | 4 | 16 | ||
33 | === modified file 'Makefile.am' | |||
34 | --- Makefile.am 2011-03-17 04:06:04 +0000 | |||
35 | +++ Makefile.am 2011-05-27 15:36:38 +0000 | |||
36 | @@ -21,7 +21,7 @@ | |||
37 | 21 | 21 | ||
38 | 22 | ACLOCAL_MFLAGS = -I m4 | 22 | ACLOCAL_MFLAGS = -I m4 |
39 | 23 | 23 | ||
41 | 24 | SUBDIRS = include libs libutouch-geis testsuite examples doc | 24 | SUBDIRS = include libs libutouch-geis testsuite python tools examples doc |
42 | 25 | 25 | ||
43 | 26 | doc-%: | 26 | doc-%: |
44 | 27 | $(MAKE) -C doc $@ | 27 | $(MAKE) -C doc $@ |
45 | 28 | 28 | ||
46 | === modified file 'configure.ac' | |||
47 | --- configure.ac 2011-05-05 08:20:51 +0000 | |||
48 | +++ configure.ac 2011-05-27 15:36:38 +0000 | |||
49 | @@ -31,7 +31,7 @@ | |||
50 | 31 | 31 | ||
51 | 32 | # Checks for programs. | 32 | # Checks for programs. |
52 | 33 | AM_PROG_CC_C_O | 33 | AM_PROG_CC_C_O |
54 | 34 | AM_PATH_PYTHON([2.5]) | 34 | AM_PATH_PYTHON([2.7]) |
55 | 35 | 35 | ||
56 | 36 | LT_PREREQ([2.2.6b]) | 36 | LT_PREREQ([2.2.6b]) |
57 | 37 | LT_INIT | 37 | LT_INIT |
58 | @@ -47,6 +47,7 @@ | |||
59 | 47 | AC_MSG_ERROR([X11-XCB development libraries not found])) | 47 | AC_MSG_ERROR([X11-XCB development libraries not found])) |
60 | 48 | PKG_CHECK_MODULES([XI2], [xi >= 1.3], , | 48 | PKG_CHECK_MODULES([XI2], [xi >= 1.3], , |
61 | 49 | AC_MSG_ERROR([XI2 development libraries not found])) | 49 | AC_MSG_ERROR([XI2 development libraries not found])) |
62 | 50 | PKG_CHECK_MODULES([PYTHON], [python >= 2.7]) | ||
63 | 50 | 51 | ||
64 | 51 | AX_ENABLE_XI2 | 52 | AX_ENABLE_XI2 |
65 | 52 | 53 | ||
66 | @@ -101,5 +102,8 @@ | |||
67 | 101 | testsuite/geis2/Makefile | 102 | testsuite/geis2/Makefile |
68 | 102 | testsuite/geis1/Makefile | 103 | testsuite/geis1/Makefile |
69 | 103 | testsuite/geistest/Makefile | 104 | testsuite/geistest/Makefile |
71 | 104 | examples/Makefile]) | 105 | examples/Makefile |
72 | 106 | python/Makefile | ||
73 | 107 | tools/Makefile | ||
74 | 108 | tools/geisview/Makefile]) | ||
75 | 105 | AC_OUTPUT | 109 | AC_OUTPUT |
76 | 106 | 110 | ||
77 | === added directory 'python' | |||
78 | === added file 'python/Makefile.am' | |||
79 | --- python/Makefile.am 1970-01-01 00:00:00 +0000 | |||
80 | +++ python/Makefile.am 2011-05-27 15:36:38 +0000 | |||
81 | @@ -0,0 +1,44 @@ | |||
82 | 1 | # | ||
83 | 2 | # @file python/Makefile.am | ||
84 | 3 | # @brief automake recipe for the libgeis python bindings | ||
85 | 4 | # | ||
86 | 5 | # Copyright 2011 Canonical, Ltd. | ||
87 | 6 | # | ||
88 | 7 | # This file is part of the utouch-geis library. This library is free software; | ||
89 | 8 | # you can redistribute it and/or modify it under the terms of the GNU Lesser | ||
90 | 9 | # General Public License as published by the Free Software Foundation; either | ||
91 | 10 | # version 3 of the License, or (at your option) any later version. | ||
92 | 11 | # | ||
93 | 12 | # This library is distributed in the hope that it will be useful, but WITHOUT | ||
94 | 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
95 | 14 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
96 | 15 | # details. | ||
97 | 16 | # | ||
98 | 17 | # You should have received a copy of the GNU Lesser General Public License | ||
99 | 18 | # along with this program; if not, write to the Free Software Foundation, Inc., | ||
100 | 19 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
101 | 20 | |||
102 | 21 | dist_bin_SCRIPTS = pygeis | ||
103 | 22 | |||
104 | 23 | dist_noinst_SCRIPTS = run_pygeis | ||
105 | 24 | |||
106 | 25 | nobase_python_PYTHON = \ | ||
107 | 26 | geis/__init__.py \ | ||
108 | 27 | geis/geis_v2.py | ||
109 | 28 | |||
110 | 29 | pyexec_LTLIBRARIES = _geis_bindings.la | ||
111 | 30 | |||
112 | 31 | _geis_bindings_la_SOURCES = \ | ||
113 | 32 | _geis_bindings/_geis_bindings.c | ||
114 | 33 | |||
115 | 34 | _geis_bindings_la_CFLAGS = \ | ||
116 | 35 | -I$(top_srcdir)/include \ | ||
117 | 36 | -I$(top_srcdir)/libutouch-geis \ | ||
118 | 37 | $(PYTHON_CFLAGS) | ||
119 | 38 | |||
120 | 39 | _geis_bindings_la_LDFLAGS = \ | ||
121 | 40 | -module -avoid-version \ | ||
122 | 41 | -export-symbols-regex init_geis_bindings \ | ||
123 | 42 | $(top_builddir)/libutouch-geis/libutouch-geis.la \ | ||
124 | 43 | $(PYTHON_LDFLAGS) | ||
125 | 44 | |||
126 | 0 | 45 | ||
127 | === added directory 'python/_geis_bindings' | |||
128 | === added file 'python/_geis_bindings/_geis_bindings.c' | |||
129 | --- python/_geis_bindings/_geis_bindings.c 1970-01-01 00:00:00 +0000 | |||
130 | +++ python/_geis_bindings/_geis_bindings.c 2011-05-27 15:36:38 +0000 | |||
131 | @@ -0,0 +1,165 @@ | |||
132 | 1 | #include <Python.h> | ||
133 | 2 | |||
134 | 3 | #include <geis/geis.h> | ||
135 | 4 | |||
136 | 5 | |||
137 | 6 | PyDoc_STRVAR(module_doc, | ||
138 | 7 | "Low-level python bindings for libutouch-geis.\n" | ||
139 | 8 | "Do not use this module directly " | ||
140 | 9 | "-- the public API is provided by the 'geis' module." | ||
141 | 10 | ); | ||
142 | 11 | |||
143 | 12 | |||
144 | 13 | static PyMethodDef exported_functions[] = { | ||
145 | 14 | { NULL, NULL, 0, NULL } | ||
146 | 15 | }; | ||
147 | 16 | |||
148 | 17 | PyMODINIT_FUNC | ||
149 | 18 | init_geis_bindings(void) | ||
150 | 19 | { | ||
151 | 20 | PyObject *this_module; | ||
152 | 21 | |||
153 | 22 | this_module = Py_InitModule3("_geis_bindings", exported_functions, module_doc); | ||
154 | 23 | if (!this_module) | ||
155 | 24 | return; | ||
156 | 25 | |||
157 | 26 | /* Global status values. */ | ||
158 | 27 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_SUCCESS", | ||
159 | 28 | GEIS_STATUS_SUCCESS); | ||
160 | 29 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_CONTINUE", | ||
161 | 30 | GEIS_STATUS_CONTINUE); | ||
162 | 31 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_EMPTY", | ||
163 | 32 | GEIS_STATUS_EMPTY); | ||
164 | 33 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_NOT_SUPPORTED", | ||
165 | 34 | GEIS_STATUS_NOT_SUPPORTED); | ||
166 | 35 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_BAD_ARGUMENT", | ||
167 | 36 | GEIS_STATUS_BAD_ARGUMENT); | ||
168 | 37 | PyModule_AddIntConstant(this_module, "GEIS_STATUS_UNKNOWN_ERROR", | ||
169 | 38 | GEIS_STATUS_UNKNOWN_ERROR); | ||
170 | 39 | |||
171 | 40 | /* Attribute types */ | ||
172 | 41 | PyModule_AddIntConstant(this_module, "GEIS_ATTR_TYPE_BOOLEAN", | ||
173 | 42 | GEIS_ATTR_TYPE_BOOLEAN); | ||
174 | 43 | PyModule_AddIntConstant(this_module, "GEIS_ATTR_TYPE_FLOAT", | ||
175 | 44 | GEIS_ATTR_TYPE_FLOAT); | ||
176 | 45 | PyModule_AddIntConstant(this_module, "GEIS_ATTR_TYPE_INTEGER", | ||
177 | 46 | GEIS_ATTR_TYPE_INTEGER); | ||
178 | 47 | PyModule_AddIntConstant(this_module, "GEIS_ATTR_TYPE_POINTER", | ||
179 | 48 | GEIS_ATTR_TYPE_POINTER); | ||
180 | 49 | PyModule_AddIntConstant(this_module, "GEIS_ATTR_TYPE_STRING", | ||
181 | 50 | GEIS_ATTR_TYPE_STRING); | ||
182 | 51 | |||
183 | 52 | /* Initialization Options */ | ||
184 | 53 | PyModule_AddStringMacro(this_module, GEIS_INIT_SERVICE_PROVIDER); | ||
185 | 54 | PyModule_AddStringMacro(this_module, GEIS_INIT_TRACK_DEVICES); | ||
186 | 55 | PyModule_AddStringMacro(this_module, GEIS_INIT_TRACK_GESTURE_CLASSES); | ||
187 | 56 | PyModule_AddStringMacro(this_module, GEIS_INIT_UTOUCH_MOCK_ENGINE); | ||
188 | 57 | PyModule_AddStringMacro(this_module, GEIS_INIT_UTOUCH_XCB); | ||
189 | 58 | |||
190 | 59 | /* Configuration Items */ | ||
191 | 60 | PyModule_AddStringMacro(this_module, GEIS_CONFIGURATION_FD); | ||
192 | 61 | PyModule_AddStringMacro(this_module, GEIS_CONFIG_UTOUCH_MAX_EVENTS); | ||
193 | 62 | |||
194 | 63 | /* Device Constants */ | ||
195 | 64 | PyModule_AddStringMacro(this_module, GEIS_EVENT_ATTRIBUTE_DEVICE); | ||
196 | 65 | PyModule_AddStringMacro(this_module, GEIS_DEVICE_ATTRIBUTE_NAME); | ||
197 | 66 | PyModule_AddStringMacro(this_module, GEIS_DEVICE_ATTRIBUTE_ID); | ||
198 | 67 | PyModule_AddStringMacro(this_module, GEIS_DEVICE_ATTRIBUTE_TOUCHES); | ||
199 | 68 | PyModule_AddStringMacro(this_module, GEIS_DEVICE_ATTRIBUTE_DIRECT_TOUCH); | ||
200 | 69 | PyModule_AddStringMacro(this_module, GEIS_DEVICE_ATTRIBUTE_INDEPENDENT_TOUCH); | ||
201 | 70 | |||
202 | 71 | /* Gesture Class Constants */ | ||
203 | 72 | PyModule_AddStringMacro(this_module, GEIS_EVENT_ATTRIBUTE_CLASS); | ||
204 | 73 | PyModule_AddStringMacro(this_module, GEIS_CLASS_ATTRIBUTE_NAME); | ||
205 | 74 | PyModule_AddStringMacro(this_module, GEIS_CLASS_ATTRIBUTE_ID); | ||
206 | 75 | |||
207 | 76 | /* Region Constants */ | ||
208 | 77 | PyModule_AddStringMacro(this_module, GEIS_REGION_ATTRIBUTE_WINDOWID); | ||
209 | 78 | PyModule_AddStringMacro(this_module, GEIS_REGION_X11_ROOT); | ||
210 | 79 | PyModule_AddStringMacro(this_module, GEIS_REGION_X11_WINDOWID); | ||
211 | 80 | |||
212 | 81 | /* Gesture Constants */ | ||
213 | 82 | PyModule_AddStringMacro(this_module, GEIS_EVENT_ATTRIBUTE_GROUPSET); | ||
214 | 83 | PyModule_AddStringMacro(this_module, GEIS_EVENT_ATTRIBUTE_TOUCHSET); | ||
215 | 84 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_ANGLE); | ||
216 | 85 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA); | ||
217 | 86 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY); | ||
218 | 87 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1); | ||
219 | 88 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2); | ||
220 | 89 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1); | ||
221 | 90 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2); | ||
222 | 91 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID); | ||
223 | 92 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_DELTA_X); | ||
224 | 93 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_DELTA_Y); | ||
225 | 94 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID); | ||
226 | 95 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_EVENT_WINDOW_ID); | ||
227 | 96 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_FOCUS_X); | ||
228 | 97 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y); | ||
229 | 98 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME); | ||
230 | 99 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_POSITION_X); | ||
231 | 100 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_POSITION_Y); | ||
232 | 101 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY); | ||
233 | 102 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_RADIUS); | ||
234 | 103 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA); | ||
235 | 104 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_ROOT_WINDOW_ID); | ||
236 | 105 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TAP_TIME); | ||
237 | 106 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP); | ||
238 | 107 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_0_ID); | ||
239 | 108 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_0_X); | ||
240 | 109 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_0_Y); | ||
241 | 110 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_1_ID); | ||
242 | 111 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_1_X); | ||
243 | 112 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_1_Y); | ||
244 | 113 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_2_ID); | ||
245 | 114 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_2_X); | ||
246 | 115 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_2_Y); | ||
247 | 116 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_3_ID); | ||
248 | 117 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_3_X); | ||
249 | 118 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_3_Y); | ||
250 | 119 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_4_ID); | ||
251 | 120 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_4_X); | ||
252 | 121 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCH_4_Y); | ||
253 | 122 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_TOUCHES); | ||
254 | 123 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_VELOCITY_X); | ||
255 | 124 | PyModule_AddStringMacro(this_module, GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y); | ||
256 | 125 | PyModule_AddStringMacro(this_module, GEIS_TOUCH_ATTRIBUTE_ID); | ||
257 | 126 | PyModule_AddStringMacro(this_module, GEIS_TOUCH_ATTRIBUTE_X); | ||
258 | 127 | PyModule_AddStringMacro(this_module, GEIS_TOUCH_ATTRIBUTE_Y); | ||
259 | 128 | |||
260 | 129 | /* Event Types */ | ||
261 | 130 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_DEVICE_AVAILABLE", | ||
262 | 131 | GEIS_EVENT_DEVICE_AVAILABLE); | ||
263 | 132 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_DEVICE_UNAVAILABLE", | ||
264 | 133 | GEIS_EVENT_DEVICE_UNAVAILABLE); | ||
265 | 134 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_CLASS_AVAILABLE", | ||
266 | 135 | GEIS_EVENT_CLASS_AVAILABLE); | ||
267 | 136 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_CLASS_CHANGED", | ||
268 | 137 | GEIS_EVENT_CLASS_CHANGED); | ||
269 | 138 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_CLASS_UNAVAILABLE", | ||
270 | 139 | GEIS_EVENT_CLASS_UNAVAILABLE); | ||
271 | 140 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_GESTURE_BEGIN", | ||
272 | 141 | GEIS_EVENT_GESTURE_BEGIN); | ||
273 | 142 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_GESTURE_UPDATE", | ||
274 | 143 | GEIS_EVENT_GESTURE_UPDATE); | ||
275 | 144 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_GESTURE_END", | ||
276 | 145 | GEIS_EVENT_GESTURE_END); | ||
277 | 146 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_INIT_COMPLETE", | ||
278 | 147 | GEIS_EVENT_INIT_COMPLETE); | ||
279 | 148 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_USER_DEFINED", | ||
280 | 149 | GEIS_EVENT_USER_DEFINED); | ||
281 | 150 | PyModule_AddIntConstant(this_module, "GEIS_EVENT_ERROR", | ||
282 | 151 | GEIS_EVENT_ERROR); | ||
283 | 152 | |||
284 | 153 | /* Filtery Bits */ | ||
285 | 154 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_DEVICE", GEIS_FILTER_DEVICE); | ||
286 | 155 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_CLASS", GEIS_FILTER_CLASS); | ||
287 | 156 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_REGION", GEIS_FILTER_REGION); | ||
288 | 157 | |||
289 | 158 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_EQ", GEIS_FILTER_OP_EQ); | ||
290 | 159 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_NE", GEIS_FILTER_OP_NE); | ||
291 | 160 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_GT", GEIS_FILTER_OP_GT); | ||
292 | 161 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_GE", GEIS_FILTER_OP_GE); | ||
293 | 162 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_LT", GEIS_FILTER_OP_LT); | ||
294 | 163 | PyModule_AddIntConstant(this_module, "GEIS_FILTER_OP_LE", GEIS_FILTER_OP_LE); | ||
295 | 164 | } | ||
296 | 165 | |||
297 | 0 | 166 | ||
298 | === added directory 'python/geis' | |||
299 | === added file 'python/geis/__init__.py' | |||
300 | --- python/geis/__init__.py 1970-01-01 00:00:00 +0000 | |||
301 | +++ python/geis/__init__.py 2011-05-27 15:36:38 +0000 | |||
302 | @@ -0,0 +1,234 @@ | |||
303 | 1 | # Copyright (C) 2011 Canonical Ltd | ||
304 | 2 | # | ||
305 | 3 | # This program is free software; you can redistribute it and/or modify | ||
306 | 4 | # it under the terms of the GNU General Public License as published by | ||
307 | 5 | # the Free Software Foundation; either version 3 of the License, or | ||
308 | 6 | # (at your option) any later version. | ||
309 | 7 | # | ||
310 | 8 | # This program is distributed in the hope that it will be useful, | ||
311 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
312 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
313 | 11 | # GNU General Public License for more details. | ||
314 | 12 | # | ||
315 | 13 | # You should have received a copy of the GNU General Public License | ||
316 | 14 | # along with this program; if not, write to the Free Software | ||
317 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
318 | 16 | |||
319 | 17 | """Python bindings for the GEIS gesture recognition interface. | ||
320 | 18 | """ | ||
321 | 19 | |||
322 | 20 | __all__ = ( | ||
323 | 21 | 'Geis', 'Event', 'Filter', 'Subscription', | ||
324 | 22 | 'NoMoreEvents', | ||
325 | 23 | 'GEIS_STATUS_SUCCESS', | ||
326 | 24 | 'GEIS_STATUS_CONTINUE', | ||
327 | 25 | 'GEIS_STATUS_EMPTY', | ||
328 | 26 | 'GEIS_STATUS_NOT_SUPPORTED', | ||
329 | 27 | 'GEIS_STATUS_BAD_ARGUMENT', | ||
330 | 28 | 'GEIS_STATUS_UNKNOWN_ERROR', | ||
331 | 29 | 'GEIS_ATTR_TYPE_BOOLEAN', | ||
332 | 30 | 'GEIS_ATTR_TYPE_FLOAT', | ||
333 | 31 | 'GEIS_ATTR_TYPE_INTEGER', | ||
334 | 32 | 'GEIS_ATTR_TYPE_POINTER', | ||
335 | 33 | 'GEIS_ATTR_TYPE_STRING', | ||
336 | 34 | 'GEIS_INIT_SERVICE_PROVIDER', | ||
337 | 35 | 'GEIS_INIT_TRACK_DEVICES', | ||
338 | 36 | 'GEIS_INIT_TRACK_GESTURE_CLASSES', | ||
339 | 37 | 'GEIS_INIT_UTOUCH_MOCK_ENGINE', | ||
340 | 38 | 'GEIS_INIT_UTOUCH_XCB', | ||
341 | 39 | 'GEIS_CLASS_ATTRIBUTE_ID', | ||
342 | 40 | 'GEIS_CLASS_ATTRIBUTE_NAME', | ||
343 | 41 | 'GEIS_CONFIGURATION_FD', | ||
344 | 42 | 'GEIS_CONFIG_UTOUCH_MAX_EVENTS', | ||
345 | 43 | 'GEIS_DEVICE_ATTRIBUTE_DIRECT_TOUCH', | ||
346 | 44 | 'GEIS_DEVICE_ATTRIBUTE_ID', | ||
347 | 45 | 'GEIS_DEVICE_ATTRIBUTE_INDEPENDENT_TOUCH', | ||
348 | 46 | 'GEIS_DEVICE_ATTRIBUTE_NAME', | ||
349 | 47 | 'GEIS_DEVICE_ATTRIBUTE_TOUCHES', | ||
350 | 48 | 'GEIS_EVENT_ATTRIBUTE_CLASS', | ||
351 | 49 | 'GEIS_EVENT_ATTRIBUTE_DEVICE', | ||
352 | 50 | 'GEIS_EVENT_ATTRIBUTE_GROUPSET', | ||
353 | 51 | 'GEIS_EVENT_ATTRIBUTE_GROUPSET', | ||
354 | 52 | 'GEIS_EVENT_ATTRIBUTE_TOUCHSET', | ||
355 | 53 | 'GEIS_EVENT_ATTRIBUTE_TOUCHSET', | ||
356 | 54 | 'GEIS_EVENT_CLASS_AVAILABLE', | ||
357 | 55 | 'GEIS_EVENT_CLASS_CHANGED', | ||
358 | 56 | 'GEIS_EVENT_CLASS_UNAVAILABLE', | ||
359 | 57 | 'GEIS_EVENT_DEVICE_AVAILABLE', | ||
360 | 58 | 'GEIS_EVENT_DEVICE_UNAVAILABLE', | ||
361 | 59 | 'GEIS_EVENT_ERROR', | ||
362 | 60 | 'GEIS_EVENT_GESTURE_BEGIN', | ||
363 | 61 | 'GEIS_EVENT_GESTURE_END', | ||
364 | 62 | 'GEIS_EVENT_GESTURE_UPDATE', | ||
365 | 63 | 'GEIS_EVENT_INIT_COMPLETE', | ||
366 | 64 | 'GEIS_EVENT_USER_DEFINED', | ||
367 | 65 | 'GEIS_GESTURE_ATTRIBUTE_ANGLE', | ||
368 | 66 | 'GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA', | ||
369 | 67 | 'GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY', | ||
370 | 68 | 'GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1', | ||
371 | 69 | 'GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2', | ||
372 | 70 | 'GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1', | ||
373 | 71 | 'GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2', | ||
374 | 72 | 'GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID', | ||
375 | 73 | 'GEIS_GESTURE_ATTRIBUTE_DELTA_X', | ||
376 | 74 | 'GEIS_GESTURE_ATTRIBUTE_DELTA_Y', | ||
377 | 75 | 'GEIS_GESTURE_ATTRIBUTE_DEVICE_ID', | ||
378 | 76 | 'GEIS_GESTURE_ATTRIBUTE_EVENT_WINDOW_ID', | ||
379 | 77 | 'GEIS_GESTURE_ATTRIBUTE_FOCUS_X', | ||
380 | 78 | 'GEIS_GESTURE_ATTRIBUTE_FOCUS_Y', | ||
381 | 79 | 'GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME', | ||
382 | 80 | 'GEIS_GESTURE_ATTRIBUTE_POSITION_X', | ||
383 | 81 | 'GEIS_GESTURE_ATTRIBUTE_POSITION_Y', | ||
384 | 82 | 'GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY', | ||
385 | 83 | 'GEIS_GESTURE_ATTRIBUTE_RADIUS', | ||
386 | 84 | 'GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA', | ||
387 | 85 | 'GEIS_GESTURE_ATTRIBUTE_ROOT_WINDOW_ID', | ||
388 | 86 | 'GEIS_GESTURE_ATTRIBUTE_TAP_TIME', | ||
389 | 87 | 'GEIS_GESTURE_ATTRIBUTE_TIMESTAMP', | ||
390 | 88 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_0_ID', | ||
391 | 89 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_0_X', | ||
392 | 90 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_0_Y', | ||
393 | 91 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_1_ID', | ||
394 | 92 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_1_X', | ||
395 | 93 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_1_Y', | ||
396 | 94 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_2_ID', | ||
397 | 95 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_2_X', | ||
398 | 96 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_2_Y', | ||
399 | 97 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_3_ID', | ||
400 | 98 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_3_X', | ||
401 | 99 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_3_Y', | ||
402 | 100 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_4_ID', | ||
403 | 101 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_4_X', | ||
404 | 102 | 'GEIS_GESTURE_ATTRIBUTE_TOUCH_4_Y', | ||
405 | 103 | 'GEIS_GESTURE_ATTRIBUTE_TOUCHES', | ||
406 | 104 | 'GEIS_GESTURE_ATTRIBUTE_VELOCITY_X', | ||
407 | 105 | 'GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y', | ||
408 | 106 | 'GEIS_REGION_ATTRIBUTE_WINDOWID', | ||
409 | 107 | 'GEIS_REGION_X11_ROOT', | ||
410 | 108 | 'GEIS_REGION_X11_WINDOWID', | ||
411 | 109 | 'GEIS_TOUCH_ATTRIBUTE_ID', | ||
412 | 110 | 'GEIS_TOUCH_ATTRIBUTE_ID', | ||
413 | 111 | 'GEIS_TOUCH_ATTRIBUTE_X', | ||
414 | 112 | 'GEIS_TOUCH_ATTRIBUTE_X', | ||
415 | 113 | 'GEIS_TOUCH_ATTRIBUTE_Y', | ||
416 | 114 | 'GEIS_TOUCH_ATTRIBUTE_Y', | ||
417 | 115 | 'GEIS_FILTER_DEVICE', | ||
418 | 116 | 'GEIS_FILTER_CLASS', | ||
419 | 117 | 'GEIS_FILTER_REGION', | ||
420 | 118 | 'GEIS_FILTER_OP_EQ', | ||
421 | 119 | 'GEIS_FILTER_OP_NE', | ||
422 | 120 | 'GEIS_FILTER_OP_GT', | ||
423 | 121 | 'GEIS_FILTER_OP_GE', | ||
424 | 122 | 'GEIS_FILTER_OP_LT', | ||
425 | 123 | 'GEIS_FILTER_OP_LE', | ||
426 | 124 | ) | ||
427 | 125 | |||
428 | 126 | from _geis_bindings import GEIS_STATUS_SUCCESS, \ | ||
429 | 127 | GEIS_STATUS_CONTINUE, \ | ||
430 | 128 | GEIS_STATUS_EMPTY, \ | ||
431 | 129 | GEIS_STATUS_NOT_SUPPORTED, \ | ||
432 | 130 | GEIS_STATUS_BAD_ARGUMENT, \ | ||
433 | 131 | GEIS_STATUS_UNKNOWN_ERROR | ||
434 | 132 | |||
435 | 133 | from _geis_bindings import GEIS_ATTR_TYPE_BOOLEAN, \ | ||
436 | 134 | GEIS_ATTR_TYPE_FLOAT, \ | ||
437 | 135 | GEIS_ATTR_TYPE_INTEGER, \ | ||
438 | 136 | GEIS_ATTR_TYPE_POINTER, \ | ||
439 | 137 | GEIS_ATTR_TYPE_STRING | ||
440 | 138 | |||
441 | 139 | from _geis_bindings import GEIS_INIT_SERVICE_PROVIDER, \ | ||
442 | 140 | GEIS_INIT_TRACK_DEVICES, \ | ||
443 | 141 | GEIS_INIT_TRACK_GESTURE_CLASSES, \ | ||
444 | 142 | GEIS_INIT_UTOUCH_MOCK_ENGINE, \ | ||
445 | 143 | GEIS_INIT_UTOUCH_XCB | ||
446 | 144 | |||
447 | 145 | from _geis_bindings import GEIS_CONFIGURATION_FD, \ | ||
448 | 146 | GEIS_CONFIG_UTOUCH_MAX_EVENTS | ||
449 | 147 | |||
450 | 148 | from _geis_bindings import GEIS_EVENT_ATTRIBUTE_DEVICE, \ | ||
451 | 149 | GEIS_DEVICE_ATTRIBUTE_NAME, \ | ||
452 | 150 | GEIS_DEVICE_ATTRIBUTE_ID, \ | ||
453 | 151 | GEIS_DEVICE_ATTRIBUTE_TOUCHES, \ | ||
454 | 152 | GEIS_DEVICE_ATTRIBUTE_DIRECT_TOUCH, \ | ||
455 | 153 | GEIS_DEVICE_ATTRIBUTE_INDEPENDENT_TOUCH | ||
456 | 154 | |||
457 | 155 | from _geis_bindings import GEIS_EVENT_ATTRIBUTE_CLASS, \ | ||
458 | 156 | GEIS_CLASS_ATTRIBUTE_NAME, \ | ||
459 | 157 | GEIS_CLASS_ATTRIBUTE_ID | ||
460 | 158 | |||
461 | 159 | from _geis_bindings import GEIS_REGION_ATTRIBUTE_WINDOWID, \ | ||
462 | 160 | GEIS_REGION_X11_ROOT, \ | ||
463 | 161 | GEIS_REGION_X11_WINDOWID | ||
464 | 162 | |||
465 | 163 | from _geis_bindings import GEIS_EVENT_ATTRIBUTE_GROUPSET, \ | ||
466 | 164 | GEIS_EVENT_ATTRIBUTE_TOUCHSET, \ | ||
467 | 165 | GEIS_TOUCH_ATTRIBUTE_ID, \ | ||
468 | 166 | GEIS_TOUCH_ATTRIBUTE_X, \ | ||
469 | 167 | GEIS_TOUCH_ATTRIBUTE_Y | ||
470 | 168 | |||
471 | 169 | from _geis_bindings import GEIS_EVENT_DEVICE_AVAILABLE, \ | ||
472 | 170 | GEIS_EVENT_DEVICE_UNAVAILABLE, \ | ||
473 | 171 | GEIS_EVENT_CLASS_AVAILABLE, \ | ||
474 | 172 | GEIS_EVENT_CLASS_CHANGED, \ | ||
475 | 173 | GEIS_EVENT_CLASS_UNAVAILABLE, \ | ||
476 | 174 | GEIS_EVENT_GESTURE_BEGIN, \ | ||
477 | 175 | GEIS_EVENT_GESTURE_UPDATE, \ | ||
478 | 176 | GEIS_EVENT_GESTURE_END, \ | ||
479 | 177 | GEIS_EVENT_INIT_COMPLETE, \ | ||
480 | 178 | GEIS_EVENT_USER_DEFINED, \ | ||
481 | 179 | GEIS_EVENT_ERROR | ||
482 | 180 | |||
483 | 181 | from _geis_bindings import GEIS_GESTURE_ATTRIBUTE_ANGLE, \ | ||
484 | 182 | GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA, \ | ||
485 | 183 | GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY, \ | ||
486 | 184 | GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1, \ | ||
487 | 185 | GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2, \ | ||
488 | 186 | GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1, \ | ||
489 | 187 | GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2, \ | ||
490 | 188 | GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID, \ | ||
491 | 189 | GEIS_GESTURE_ATTRIBUTE_DELTA_X, \ | ||
492 | 190 | GEIS_GESTURE_ATTRIBUTE_DELTA_Y, \ | ||
493 | 191 | GEIS_GESTURE_ATTRIBUTE_DEVICE_ID, \ | ||
494 | 192 | GEIS_GESTURE_ATTRIBUTE_EVENT_WINDOW_ID, \ | ||
495 | 193 | GEIS_GESTURE_ATTRIBUTE_FOCUS_X, \ | ||
496 | 194 | GEIS_GESTURE_ATTRIBUTE_FOCUS_Y, \ | ||
497 | 195 | GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME, \ | ||
498 | 196 | GEIS_GESTURE_ATTRIBUTE_POSITION_X, \ | ||
499 | 197 | GEIS_GESTURE_ATTRIBUTE_POSITION_Y, \ | ||
500 | 198 | GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY, \ | ||
501 | 199 | GEIS_GESTURE_ATTRIBUTE_RADIUS, \ | ||
502 | 200 | GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA, \ | ||
503 | 201 | GEIS_GESTURE_ATTRIBUTE_ROOT_WINDOW_ID, \ | ||
504 | 202 | GEIS_GESTURE_ATTRIBUTE_TAP_TIME, \ | ||
505 | 203 | GEIS_GESTURE_ATTRIBUTE_TIMESTAMP, \ | ||
506 | 204 | GEIS_GESTURE_ATTRIBUTE_TOUCH_0_ID, \ | ||
507 | 205 | GEIS_GESTURE_ATTRIBUTE_TOUCH_0_X, \ | ||
508 | 206 | GEIS_GESTURE_ATTRIBUTE_TOUCH_0_Y, \ | ||
509 | 207 | GEIS_GESTURE_ATTRIBUTE_TOUCH_1_ID, \ | ||
510 | 208 | GEIS_GESTURE_ATTRIBUTE_TOUCH_1_X, \ | ||
511 | 209 | GEIS_GESTURE_ATTRIBUTE_TOUCH_1_Y, \ | ||
512 | 210 | GEIS_GESTURE_ATTRIBUTE_TOUCH_2_ID, \ | ||
513 | 211 | GEIS_GESTURE_ATTRIBUTE_TOUCH_2_X, \ | ||
514 | 212 | GEIS_GESTURE_ATTRIBUTE_TOUCH_2_Y, \ | ||
515 | 213 | GEIS_GESTURE_ATTRIBUTE_TOUCH_3_ID, \ | ||
516 | 214 | GEIS_GESTURE_ATTRIBUTE_TOUCH_3_X, \ | ||
517 | 215 | GEIS_GESTURE_ATTRIBUTE_TOUCH_3_Y, \ | ||
518 | 216 | GEIS_GESTURE_ATTRIBUTE_TOUCH_4_ID, \ | ||
519 | 217 | GEIS_GESTURE_ATTRIBUTE_TOUCH_4_X, \ | ||
520 | 218 | GEIS_GESTURE_ATTRIBUTE_TOUCH_4_Y, \ | ||
521 | 219 | GEIS_GESTURE_ATTRIBUTE_TOUCHES, \ | ||
522 | 220 | GEIS_GESTURE_ATTRIBUTE_VELOCITY_X, \ | ||
523 | 221 | GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y | ||
524 | 222 | |||
525 | 223 | from _geis_bindings import GEIS_FILTER_DEVICE, \ | ||
526 | 224 | GEIS_FILTER_CLASS, \ | ||
527 | 225 | GEIS_FILTER_REGION, \ | ||
528 | 226 | GEIS_FILTER_OP_EQ, \ | ||
529 | 227 | GEIS_FILTER_OP_NE, \ | ||
530 | 228 | GEIS_FILTER_OP_GT, \ | ||
531 | 229 | GEIS_FILTER_OP_GE, \ | ||
532 | 230 | GEIS_FILTER_OP_LT, \ | ||
533 | 231 | GEIS_FILTER_OP_LE | ||
534 | 232 | |||
535 | 233 | from geis.geis_v2 import Geis, Event, Filter, Subscription, NoMoreEvents | ||
536 | 234 | |||
537 | 0 | 235 | ||
538 | === added file 'python/geis/geis_v2.py' | |||
539 | --- python/geis/geis_v2.py 1970-01-01 00:00:00 +0000 | |||
540 | +++ python/geis/geis_v2.py 2011-05-27 15:36:38 +0000 | |||
541 | @@ -0,0 +1,640 @@ | |||
542 | 1 | # Copyright (C) 2011 Canonical Ltd | ||
543 | 2 | # | ||
544 | 3 | # This program is free software; you can redistribute it and/or modify | ||
545 | 4 | # it under the terms of the GNU General Public License as published by | ||
546 | 5 | # the Free Software Foundation; either version 3 of the License, or | ||
547 | 6 | # (at your option) any later version. | ||
548 | 7 | # | ||
549 | 8 | # This program is distributed in the hope that it will be useful, | ||
550 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
551 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
552 | 11 | # GNU General Public License for more details. | ||
553 | 12 | # | ||
554 | 13 | # You should have received a copy of the GNU General Public License | ||
555 | 14 | # along with this program; if not, write to the Free Software | ||
556 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
557 | 16 | |||
558 | 17 | """Python bindings for the GEIS v2 gesture recognition interface. | ||
559 | 18 | |||
560 | 19 | Do not use this module directly -- the public API is provided by the 'geis' | ||
561 | 20 | module. | ||
562 | 21 | """ | ||
563 | 22 | |||
564 | 23 | import ctypes | ||
565 | 24 | import ctypes.util | ||
566 | 25 | import _geis_bindings | ||
567 | 26 | import re | ||
568 | 27 | import sys | ||
569 | 28 | |||
570 | 29 | |||
571 | 30 | class GeisError(Exception): | ||
572 | 31 | """ A general error has occurred internally in GEIS. | ||
573 | 32 | """ | ||
574 | 33 | def __init__(self, reason): | ||
575 | 34 | Exception.__init__(self, reason) | ||
576 | 35 | |||
577 | 36 | |||
578 | 37 | class NoMoreEvents(Exception): | ||
579 | 38 | """ Raised by the event dispatch mechanism to indicate there are no | ||
580 | 39 | pending events in the queue. | ||
581 | 40 | """ | ||
582 | 41 | |||
583 | 42 | def __init__(self): | ||
584 | 43 | Exception.__init__(self, 'geis event queue is empty') | ||
585 | 44 | |||
586 | 45 | |||
587 | 46 | |||
588 | 47 | def _check_null(ret, func, args): | ||
589 | 48 | """ Converts a NULL pointer return value into an Exception. | ||
590 | 49 | """ | ||
591 | 50 | if ret == 0: | ||
592 | 51 | raise GeisError("%s failed" % func.__name__) | ||
593 | 52 | return ret | ||
594 | 53 | |||
595 | 54 | _EventCallback = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, | ||
596 | 55 | ctypes.py_object) | ||
597 | 56 | |||
598 | 57 | _geis_lib = ctypes.CDLL(ctypes.util.find_library("utouch-geis")) | ||
599 | 58 | try: | ||
600 | 59 | _geis_new = _geis_lib.geis_new | ||
601 | 60 | _geis_new.restype = ctypes.c_void_p | ||
602 | 61 | _geis_new.errcheck = _check_null | ||
603 | 62 | _geis_delete = _geis_lib.geis_delete | ||
604 | 63 | _geis_get_configuration = _geis_lib.geis_get_configuration | ||
605 | 64 | _geis_dispatch_events = _geis_lib.geis_dispatch_events | ||
606 | 65 | _geis_register_class_callback = _geis_lib.geis_register_class_callback | ||
607 | 66 | _geis_register_device_callback = _geis_lib.geis_register_device_callback | ||
608 | 67 | _geis_register_event_callback = _geis_lib.geis_register_event_callback | ||
609 | 68 | _geis_next_event = _geis_lib.geis_next_event | ||
610 | 69 | |||
611 | 70 | _geis_subscription_new = _geis_lib.geis_subscription_new | ||
612 | 71 | _geis_subscription_new.restype = ctypes.c_void_p | ||
613 | 72 | _geis_subscription_new.errcheck = _check_null | ||
614 | 73 | _geis_subscription_delete = _geis_lib.geis_subscription_delete | ||
615 | 74 | _geis_subscription_activate = _geis_lib.geis_subscription_activate | ||
616 | 75 | _geis_subscription_deactivate = _geis_lib.geis_subscription_deactivate | ||
617 | 76 | _geis_subscription_name = _geis_lib.geis_subscription_name | ||
618 | 77 | |||
619 | 78 | _geis_attr_name = _geis_lib.geis_attr_name | ||
620 | 79 | _geis_attr_name.restype = ctypes.c_char_p | ||
621 | 80 | _geis_attr_type = _geis_lib.geis_attr_type | ||
622 | 81 | _geis_attr_value_to_pointer = _geis_lib.geis_attr_value_to_pointer | ||
623 | 82 | |||
624 | 83 | _geis_event_type = _geis_lib.geis_event_type | ||
625 | 84 | _geis_event_attr_count = _geis_lib.geis_event_attr_count | ||
626 | 85 | _geis_event_attr = _geis_lib.geis_event_attr | ||
627 | 86 | _geis_event_attr.restype = ctypes.c_void_p | ||
628 | 87 | |||
629 | 88 | _geis_gesture_class_unref = _geis_lib.geis_gesture_class_unref | ||
630 | 89 | _geis_gesture_class_name = _geis_lib.geis_gesture_class_name | ||
631 | 90 | _geis_gesture_class_name.restype = ctypes.c_char_p | ||
632 | 91 | _geis_gesture_class_id = _geis_lib.geis_gesture_class_id | ||
633 | 92 | _geis_gesture_class_attr_count = _geis_lib.geis_gesture_class_attr_count | ||
634 | 93 | _geis_gesture_class_attr = _geis_lib.geis_gesture_class_attr | ||
635 | 94 | _geis_gesture_class_attr.restype = ctypes.c_void_p | ||
636 | 95 | |||
637 | 96 | _geis_device_ref = _geis_lib.geis_device_ref | ||
638 | 97 | _geis_device_unref = _geis_lib.geis_device_unref | ||
639 | 98 | _geis_device_name = _geis_lib.geis_device_name | ||
640 | 99 | _geis_device_name.restype = ctypes.c_char_p | ||
641 | 100 | _geis_device_id = _geis_lib.geis_device_id | ||
642 | 101 | _geis_device_attr_count = _geis_lib.geis_device_attr_count | ||
643 | 102 | _geis_device_attr = _geis_lib.geis_device_attr | ||
644 | 103 | _geis_device_attr.restype = ctypes.c_void_p | ||
645 | 104 | |||
646 | 105 | _geis_touchset_touch_count = _geis_lib.geis_touchset_touch_count | ||
647 | 106 | _geis_touchset_touch = _geis_lib.geis_touchset_touch | ||
648 | 107 | _geis_touchset_touch.restype = ctypes.c_void_p | ||
649 | 108 | |||
650 | 109 | _geis_touch_attr_count = _geis_lib.geis_touch_attr_count | ||
651 | 110 | _geis_touch_attr = _geis_lib.geis_touch_attr | ||
652 | 111 | _geis_touch_attr.restype = ctypes.c_void_p | ||
653 | 112 | |||
654 | 113 | _geis_groupset_group_count = _geis_lib.geis_groupset_group_count | ||
655 | 114 | _geis_groupset_group = _geis_lib.geis_groupset_group | ||
656 | 115 | _geis_groupset_group.restype = ctypes.c_void_p | ||
657 | 116 | |||
658 | 117 | _geis_group_frame_count = _geis_lib.geis_group_frame_count | ||
659 | 118 | _geis_group_frame = _geis_lib.geis_group_frame | ||
660 | 119 | _geis_group_frame.restype = ctypes.c_void_p | ||
661 | 120 | |||
662 | 121 | _geis_frame_attr_count = _geis_lib.geis_frame_attr_count | ||
663 | 122 | _geis_frame_attr = _geis_lib.geis_frame_attr | ||
664 | 123 | _geis_frame_attr.restype = ctypes.c_void_p | ||
665 | 124 | _geis_frame_touchid_count = _geis_lib.geis_frame_touchid_count | ||
666 | 125 | _geis_frame_touchid = _geis_lib.geis_frame_touchid | ||
667 | 126 | |||
668 | 127 | except AttributeError as ex: | ||
669 | 128 | print ex | ||
670 | 129 | sys.exit(1) | ||
671 | 130 | |||
672 | 131 | |||
673 | 132 | class GestureClass(object): | ||
674 | 133 | """Describes a class of gestures. | ||
675 | 134 | """ | ||
676 | 135 | |||
677 | 136 | def __init__(self, attr): | ||
678 | 137 | self._class = _geis_attr_value_to_pointer(attr) | ||
679 | 138 | self._id = _geis_gesture_class_id(self._class) | ||
680 | 139 | self._name = _geis_gesture_class_name(self._class) | ||
681 | 140 | self._attr_count = _geis_gesture_class_attr_count(self._class) | ||
682 | 141 | self._attrs = {} | ||
683 | 142 | for i in range(self._attr_count): | ||
684 | 143 | attr = _geis_gesture_class_attr(self._class, i) | ||
685 | 144 | attr_name = _geis_attr_name(attr) | ||
686 | 145 | self._attrs[attr_name] = _attr_types.get(_geis_attr_type(attr), | ||
687 | 146 | _attr_type_unknown)(attr) | ||
688 | 147 | |||
689 | 148 | def id(self): | ||
690 | 149 | """ Gets the gesture class's system identifier (an integer). | ||
691 | 150 | """ | ||
692 | 151 | return self._id | ||
693 | 152 | |||
694 | 153 | def name(self): | ||
695 | 154 | """ Gets the gesture class's self-identified name. | ||
696 | 155 | """ | ||
697 | 156 | return self._name | ||
698 | 157 | |||
699 | 158 | def attrs(self): | ||
700 | 159 | """ Gets the named attributes associated with the gesture class. | ||
701 | 160 | """ | ||
702 | 161 | return self._attrs | ||
703 | 162 | |||
704 | 163 | |||
705 | 164 | class Device(object): | ||
706 | 165 | """Describes a touchable device. | ||
707 | 166 | """ | ||
708 | 167 | |||
709 | 168 | def __init__(self, attr): | ||
710 | 169 | self._device = _geis_attr_value_to_pointer(attr) | ||
711 | 170 | self._id = _geis_device_id(self._device) | ||
712 | 171 | self._name = _geis_device_name(self._device) | ||
713 | 172 | self._min_x = 0.0 | ||
714 | 173 | self._min_y = 0.0 | ||
715 | 174 | self._max_x = 0.0 | ||
716 | 175 | self._max_y = 0.0 | ||
717 | 176 | self._attr_count = _geis_device_attr_count(self._device) | ||
718 | 177 | self._attrs = {} | ||
719 | 178 | for i in range(self._attr_count): | ||
720 | 179 | attr = _geis_device_attr(self._device, i) | ||
721 | 180 | attr_name = _geis_attr_name(attr) | ||
722 | 181 | self._attrs[attr_name] = _attr_types.get(_geis_attr_type(attr), | ||
723 | 182 | _attr_type_unknown)(attr) | ||
724 | 183 | if re.search("Abs MT Position X \d+ min", attr_name): | ||
725 | 184 | self._min_x = self._attrs[attr_name] | ||
726 | 185 | if re.search("Abs MT Position X \d+ max", attr_name): | ||
727 | 186 | self._max_x = self._attrs[attr_name] | ||
728 | 187 | if re.search("Abs MT Position Y \d+ min", attr_name): | ||
729 | 188 | self._min_y = self._attrs[attr_name] | ||
730 | 189 | if re.search("Abs MT Position Y \d+ max", attr_name): | ||
731 | 190 | self._max_y = self._attrs[attr_name] | ||
732 | 191 | |||
733 | 192 | def id(self): | ||
734 | 193 | """ Gets the device's system identifier (an integer). | ||
735 | 194 | """ | ||
736 | 195 | return self._id | ||
737 | 196 | |||
738 | 197 | def name(self): | ||
739 | 198 | """ Gets the device's self-identified name. | ||
740 | 199 | """ | ||
741 | 200 | return self._name | ||
742 | 201 | |||
743 | 202 | def extents(self): | ||
744 | 203 | """ Gets the device's defined extents (bounding box). | ||
745 | 204 | |||
746 | 205 | Returns: A tuple of (min X, min Y, max X, max Y). | ||
747 | 206 | """ | ||
748 | 207 | return (self._min_x, self._min_y, self._max_x, self._max_y) | ||
749 | 208 | |||
750 | 209 | def attrs(self): | ||
751 | 210 | """ Gets the named attributes associated with the device. | ||
752 | 211 | """ | ||
753 | 212 | return self._attrs | ||
754 | 213 | |||
755 | 214 | |||
756 | 215 | class Touch(object): | ||
757 | 216 | """Represents a particular touch.""" | ||
758 | 217 | |||
759 | 218 | def __init__(self, touch): | ||
760 | 219 | self._touch = touch | ||
761 | 220 | self._attr_count = _geis_touch_attr_count(self._touch) | ||
762 | 221 | |||
763 | 222 | def id(self): | ||
764 | 223 | """ Gets the persistent identifier of the touch. | ||
765 | 224 | """ | ||
766 | 225 | return _geis_lib.geis_touch_id(self._touch) | ||
767 | 226 | |||
768 | 227 | def attrs(self): | ||
769 | 228 | """ Gets the attributes of the touch. | ||
770 | 229 | """ | ||
771 | 230 | attr_list = {} | ||
772 | 231 | for i in range(self._attr_count): | ||
773 | 232 | attr = _geis_touch_attr(self._touch, i) | ||
774 | 233 | attr_name = _geis_attr_name(attr) | ||
775 | 234 | attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr), | ||
776 | 235 | _attr_type_unknown)(attr) | ||
777 | 236 | return attr_list | ||
778 | 237 | |||
779 | 238 | |||
780 | 239 | class Touchset(object): | ||
781 | 240 | """A collection of Touch objects.""" | ||
782 | 241 | |||
783 | 242 | def __init__(self, attr): | ||
784 | 243 | self._touchset = _geis_attr_value_to_pointer(attr) | ||
785 | 244 | self._count = _geis_touchset_touch_count(self._touchset) | ||
786 | 245 | self._index = 0 | ||
787 | 246 | |||
788 | 247 | def __len__(self): | ||
789 | 248 | return self._count | ||
790 | 249 | |||
791 | 250 | def __iter__(self): | ||
792 | 251 | return self | ||
793 | 252 | |||
794 | 253 | def next(self): | ||
795 | 254 | """ Gets the next touch in the touchset as an iterable. | ||
796 | 255 | """ | ||
797 | 256 | if self._index == self._count: | ||
798 | 257 | raise StopIteration | ||
799 | 258 | touch = Touch(_geis_touchset_touch(self._touchset, self._index)) | ||
800 | 259 | self._index = self._index + 1 | ||
801 | 260 | return touch | ||
802 | 261 | |||
803 | 262 | |||
804 | 263 | class Groupset(object): | ||
805 | 264 | """A collection of Group objects.""" | ||
806 | 265 | |||
807 | 266 | def __init__(self, attr): | ||
808 | 267 | self._groupset = _geis_attr_value_to_pointer(attr) | ||
809 | 268 | self._count = _geis_groupset_group_count(self._groupset) | ||
810 | 269 | self._index = 0 | ||
811 | 270 | |||
812 | 271 | def __len__(self): | ||
813 | 272 | return self._count | ||
814 | 273 | |||
815 | 274 | def __iter__(self): | ||
816 | 275 | return self | ||
817 | 276 | |||
818 | 277 | def next(self): | ||
819 | 278 | """ Gets the next group in the groupset as an iterable. | ||
820 | 279 | """ | ||
821 | 280 | if self._index == self._count: | ||
822 | 281 | raise StopIteration | ||
823 | 282 | touch = Group(_geis_groupset_group(self._groupset, self._index)) | ||
824 | 283 | self._index = self._index + 1 | ||
825 | 284 | return touch | ||
826 | 285 | |||
827 | 286 | |||
828 | 287 | class Group(object): | ||
829 | 288 | """A set of Frame objects made up of a combination of touches.""" | ||
830 | 289 | |||
831 | 290 | def __init__(self, group): | ||
832 | 291 | self._group = group | ||
833 | 292 | self._count = _geis_group_frame_count(self._group) | ||
834 | 293 | self._index = 0 | ||
835 | 294 | |||
836 | 295 | def __len__(self): | ||
837 | 296 | return self._count | ||
838 | 297 | |||
839 | 298 | def __iter__(self): | ||
840 | 299 | return self | ||
841 | 300 | |||
842 | 301 | def id(self): | ||
843 | 302 | return _geis_lib.geis_group_id(self._group) | ||
844 | 303 | |||
845 | 304 | def next(self): | ||
846 | 305 | """ Gets the next frame in the group as an iterable. | ||
847 | 306 | """ | ||
848 | 307 | if self._index == self._count: | ||
849 | 308 | raise StopIteration | ||
850 | 309 | frame = Frame(_geis_group_frame(self._group, self._index)) | ||
851 | 310 | self._index = self._index + 1 | ||
852 | 311 | return frame | ||
853 | 312 | |||
854 | 313 | |||
855 | 314 | class Frame(object): | ||
856 | 315 | """A gesture frame.""" | ||
857 | 316 | |||
858 | 317 | def __init__(self, frame): | ||
859 | 318 | self._frame = frame | ||
860 | 319 | |||
861 | 320 | def id(self): | ||
862 | 321 | return _geis_lib.geis_frame_id(self._frame) | ||
863 | 322 | |||
864 | 323 | def attrs(self): | ||
865 | 324 | attr_list = {} | ||
866 | 325 | for i in range(_geis_frame_attr_count(self._frame)): | ||
867 | 326 | attr = _geis_frame_attr(self._frame, i) | ||
868 | 327 | attr_name = _geis_attr_name(attr) | ||
869 | 328 | attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr), | ||
870 | 329 | _attr_type_unknown)(attr) | ||
871 | 330 | return attr_list | ||
872 | 331 | |||
873 | 332 | def touches(self): | ||
874 | 333 | touch_list = [] | ||
875 | 334 | for i in range(_geis_frame_touchid_count(self._frame)): | ||
876 | 335 | touch_list.append(_geis_frame_touchid(self._frame, i)) | ||
877 | 336 | return touch_list | ||
878 | 337 | |||
879 | 338 | |||
880 | 339 | def _pointer_type_class(attr): | ||
881 | 340 | """ Converts a generic attr into a GestureClass object. | ||
882 | 341 | """ | ||
883 | 342 | return GestureClass(attr) | ||
884 | 343 | |||
885 | 344 | |||
886 | 345 | def _pointer_type_device(attr): | ||
887 | 346 | """ Converts a generic attr into a Device object. | ||
888 | 347 | """ | ||
889 | 348 | return Device(attr) | ||
890 | 349 | |||
891 | 350 | |||
892 | 351 | def _pointer_type_groupset(attr): | ||
893 | 352 | """ Converts a generic attr into a Groupset object. | ||
894 | 353 | """ | ||
895 | 354 | return Groupset(attr) | ||
896 | 355 | |||
897 | 356 | |||
898 | 357 | def _pointer_type_touchset(attr): | ||
899 | 358 | """ Converts a generic attr into a Touchset object. | ||
900 | 359 | """ | ||
901 | 360 | return Touchset(attr) | ||
902 | 361 | |||
903 | 362 | |||
904 | 363 | def _pointer_type_unknown(attr): | ||
905 | 364 | print "unknown pointer type", _geis_attr_name(attr) | ||
906 | 365 | return None | ||
907 | 366 | |||
908 | 367 | |||
909 | 368 | _attr_pointer_type = { | ||
910 | 369 | _geis_bindings.GEIS_EVENT_ATTRIBUTE_CLASS: _pointer_type_class, | ||
911 | 370 | _geis_bindings.GEIS_EVENT_ATTRIBUTE_DEVICE: _pointer_type_device, | ||
912 | 371 | _geis_bindings.GEIS_EVENT_ATTRIBUTE_GROUPSET: _pointer_type_groupset, | ||
913 | 372 | _geis_bindings.GEIS_EVENT_ATTRIBUTE_TOUCHSET: _pointer_type_touchset | ||
914 | 373 | } | ||
915 | 374 | |||
916 | 375 | |||
917 | 376 | def _attr_type_boolean(attr): | ||
918 | 377 | """ Extracts an attribute value as a boolean. | ||
919 | 378 | """ | ||
920 | 379 | return _geis_lib.geis_attr_value_to_boolean(attr) | ||
921 | 380 | |||
922 | 381 | |||
923 | 382 | def _attr_type_float(attr): | ||
924 | 383 | """ Extracts an attribute value as a float. | ||
925 | 384 | """ | ||
926 | 385 | geis_attr_value_to_float = _geis_lib.geis_attr_value_to_float | ||
927 | 386 | geis_attr_value_to_float.restype = ctypes.c_float | ||
928 | 387 | return geis_attr_value_to_float(attr) | ||
929 | 388 | |||
930 | 389 | |||
931 | 390 | def _attr_type_integer(attr): | ||
932 | 391 | """ Extracts an attribute value as a integer. | ||
933 | 392 | """ | ||
934 | 393 | return _geis_lib.geis_attr_value_to_integer(attr) | ||
935 | 394 | |||
936 | 395 | |||
937 | 396 | def _attr_type_pointer(attr): | ||
938 | 397 | """ Extracts an attribute value as an object. | ||
939 | 398 | """ | ||
940 | 399 | return _attr_pointer_type.get(_geis_attr_name(attr), _pointer_type_unknown)(attr) | ||
941 | 400 | |||
942 | 401 | |||
943 | 402 | def _attr_type_string(attr): | ||
944 | 403 | """ Extracts an attribute value as a string. | ||
945 | 404 | """ | ||
946 | 405 | geis_attr_value_to_string = _geis_lib.geis_attr_value_to_string | ||
947 | 406 | geis_attr_value_to_string.restype = ctypes.c_char_p | ||
948 | 407 | return geis_attr_value_to_string(attr) | ||
949 | 408 | |||
950 | 409 | |||
951 | 410 | def _attr_type_unknown(attr): | ||
952 | 411 | print "unknown attr type", _geis_attr_name(attr) | ||
953 | 412 | return None | ||
954 | 413 | |||
955 | 414 | |||
956 | 415 | _attr_types = { | ||
957 | 416 | _geis_bindings.GEIS_ATTR_TYPE_BOOLEAN: _attr_type_boolean, | ||
958 | 417 | _geis_bindings.GEIS_ATTR_TYPE_FLOAT: _attr_type_float, | ||
959 | 418 | _geis_bindings.GEIS_ATTR_TYPE_INTEGER: _attr_type_integer, | ||
960 | 419 | _geis_bindings.GEIS_ATTR_TYPE_POINTER: _attr_type_pointer, | ||
961 | 420 | _geis_bindings.GEIS_ATTR_TYPE_STRING: _attr_type_string | ||
962 | 421 | } | ||
963 | 422 | |||
964 | 423 | |||
965 | 424 | def _cb_wrapper(ignored, eptr, context): | ||
966 | 425 | """ A currying wrapper for event callbacks. | ||
967 | 426 | |||
968 | 427 | This is a currying function to wrap a Python callback with arbitrary | ||
969 | 428 | arguments so it can be invoked from a C callback. | ||
970 | 429 | |||
971 | 430 | :param ignored: This argumenet is ignored. | ||
972 | 431 | :param eptr: A C pointer to the internal GEIS event. | ||
973 | 432 | :param context: A tuple containing the Geis class instance, | ||
974 | 433 | the Python callable, and the argument list. | ||
975 | 434 | """ | ||
976 | 435 | (geis_instance, cb, args) = context | ||
977 | 436 | cb(geis_instance, Event(eptr), args[0]) | ||
978 | 437 | |||
979 | 438 | |||
980 | 439 | class Geis(object): | ||
981 | 440 | """A GEIS API instance. | ||
982 | 441 | """ | ||
983 | 442 | |||
984 | 443 | def __init__(self, *args): | ||
985 | 444 | """Create a GEIS instance. | ||
986 | 445 | |||
987 | 446 | This constructor takes a variable number of arguments (zero or more) | ||
988 | 447 | all of he geis.GEIS_INIT_... form. | ||
989 | 448 | |||
990 | 449 | On failure, an Exception is raised. | ||
991 | 450 | """ | ||
992 | 451 | terminator = 0, | ||
993 | 452 | va_args = args + terminator | ||
994 | 453 | self._instance = _geis_new(*va_args) | ||
995 | 454 | self._cb_wrapper = _EventCallback(_cb_wrapper) | ||
996 | 455 | self._class_curry = None | ||
997 | 456 | self._device_curry = None | ||
998 | 457 | self._event_curry = None | ||
999 | 458 | |||
1000 | 459 | def __del__(self): | ||
1001 | 460 | _geis_delete(self._instance) | ||
1002 | 461 | |||
1003 | 462 | @property | ||
1004 | 463 | def _as_parameter_(self): | ||
1005 | 464 | return self._instance | ||
1006 | 465 | |||
1007 | 466 | def get_configuration(self, item_name): | ||
1008 | 467 | """ Gets a named configuration value. """ | ||
1009 | 468 | if (item_name == _geis_bindings.GEIS_CONFIGURATION_FD): | ||
1010 | 469 | fd = ctypes.c_long() | ||
1011 | 470 | status = _geis_get_configuration(self._instance, | ||
1012 | 471 | item_name, | ||
1013 | 472 | ctypes.byref(fd)) | ||
1014 | 473 | if status != _geis_bindings.GEIS_STATUS_SUCCESS: | ||
1015 | 474 | raise GeisError('error retrieving GEIS fd') | ||
1016 | 475 | return fd.value | ||
1017 | 476 | raise ValueError('unsupported config item name') | ||
1018 | 477 | |||
1019 | 478 | def set_configuration(self, name, value): | ||
1020 | 479 | """ Sets a named configuration value. """ | ||
1021 | 480 | raise ValueError('unsupported config item name') | ||
1022 | 481 | |||
1023 | 482 | def register_class_callback(self, callback, *args): | ||
1024 | 483 | """ Registers a python callback to receive GEIS gesture class events. | ||
1025 | 484 | """ | ||
1026 | 485 | context = self, callback, args | ||
1027 | 486 | self._class_curry = ctypes.py_object(context) | ||
1028 | 487 | _geis_register_class_callback(self._instance, | ||
1029 | 488 | self._cb_wrapper, | ||
1030 | 489 | self._class_curry) | ||
1031 | 490 | |||
1032 | 491 | def register_device_callback(self, callback, *args): | ||
1033 | 492 | """ Registers a python callback to receive GEIS gesture device events. | ||
1034 | 493 | """ | ||
1035 | 494 | context = self, callback, args | ||
1036 | 495 | self._device_curry = ctypes.py_object(context) | ||
1037 | 496 | _geis_register_device_callback(self._instance, | ||
1038 | 497 | self._cb_wrapper, | ||
1039 | 498 | self._device_curry) | ||
1040 | 499 | |||
1041 | 500 | def register_event_callback(self, callback, *args): | ||
1042 | 501 | """ Registers a python callback to receive general GEIS events. | ||
1043 | 502 | """ | ||
1044 | 503 | self._event_curry = ctypes.py_object((self, callback, args)) | ||
1045 | 504 | _geis_register_event_callback(self._instance, | ||
1046 | 505 | self._cb_wrapper, | ||
1047 | 506 | self._event_curry) | ||
1048 | 507 | |||
1049 | 508 | def dispatch_events(self): | ||
1050 | 509 | """ Pumps the geis event loop. """ | ||
1051 | 510 | return _geis_dispatch_events(self._instance) | ||
1052 | 511 | |||
1053 | 512 | def next_event(self): | ||
1054 | 513 | """ Pulls the next event, if any, off the geis event queue. | ||
1055 | 514 | |||
1056 | 515 | :return: a geis.Event object | ||
1057 | 516 | :raise: geis.NoMoreEvents | ||
1058 | 517 | """ | ||
1059 | 518 | event = Event() | ||
1060 | 519 | status = _geis_next_event(self._instance, event) | ||
1061 | 520 | if status not in [_geis_bindings.GEIS_STATUS_CONTINUE, | ||
1062 | 521 | _geis_bindings.GEIS_STATUS_SUCCESS]: | ||
1063 | 522 | raise NoMoreEvents() | ||
1064 | 523 | return event | ||
1065 | 524 | |||
1066 | 525 | |||
1067 | 526 | class Event(object): | ||
1068 | 527 | """ An event returned from the GEIS API. | ||
1069 | 528 | """ | ||
1070 | 529 | |||
1071 | 530 | def __init__(self, internal=ctypes.c_void_p()): | ||
1072 | 531 | self._event = internal | ||
1073 | 532 | |||
1074 | 533 | @property | ||
1075 | 534 | def _as_parameter_(self): | ||
1076 | 535 | return ctypes.byref(self._event) | ||
1077 | 536 | |||
1078 | 537 | def type(self): | ||
1079 | 538 | """ Gets the type of the event. | ||
1080 | 539 | """ | ||
1081 | 540 | return _geis_event_type(self._event) | ||
1082 | 541 | |||
1083 | 542 | def attrs(self): | ||
1084 | 543 | """ Gets the attributes associated with the event. | ||
1085 | 544 | """ | ||
1086 | 545 | attr_list = {} | ||
1087 | 546 | for i in range(_geis_event_attr_count(self._event)): | ||
1088 | 547 | attr = _geis_event_attr(self._event, i) | ||
1089 | 548 | attr_name = _geis_attr_name(attr) | ||
1090 | 549 | attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr), | ||
1091 | 550 | _attr_type_unknown)(attr) | ||
1092 | 551 | return attr_list | ||
1093 | 552 | |||
1094 | 553 | |||
1095 | 554 | class Filter(object): | ||
1096 | 555 | """ A Geis Filter object. | ||
1097 | 556 | """ | ||
1098 | 557 | |||
1099 | 558 | def __init__(self, geis, name): | ||
1100 | 559 | self._filter = _geis_lib.geis_filter_new(geis, name) | ||
1101 | 560 | |||
1102 | 561 | def __del__(self): | ||
1103 | 562 | _geis_lib.geis_filter_delete(self._filter) | ||
1104 | 563 | |||
1105 | 564 | @property | ||
1106 | 565 | def _as_parameter_(self): | ||
1107 | 566 | return self._filter | ||
1108 | 567 | |||
1109 | 568 | def name(self): | ||
1110 | 569 | """ Gets the name of the filter. | ||
1111 | 570 | """ | ||
1112 | 571 | return _geis_lib.geis_filter_name(self._filter) | ||
1113 | 572 | |||
1114 | 573 | def add_term(self, facility, *terms): | ||
1115 | 574 | """ Adds a new term to the filter. | ||
1116 | 575 | |||
1117 | 576 | :param facility: the filter facility to which the terms belong | ||
1118 | 577 | :param terms: a collection of (name, operation, value) tuples | ||
1119 | 578 | """ | ||
1120 | 579 | for term in terms: | ||
1121 | 580 | if len(term) != 3: | ||
1122 | 581 | raise ValueError('invalid filter term') | ||
1123 | 582 | name, op, value = term | ||
1124 | 583 | _geis_lib.geis_filter_add_term(self._filter, facility, | ||
1125 | 584 | name, op, value, | ||
1126 | 585 | 0) | ||
1127 | 586 | |||
1128 | 587 | |||
1129 | 588 | class Subscription(object): | ||
1130 | 589 | """ A Geis subscription object. | ||
1131 | 590 | """ | ||
1132 | 591 | |||
1133 | 592 | def __init__(self, geis): | ||
1134 | 593 | """Constructs a GEIS subscription object. | ||
1135 | 594 | |||
1136 | 595 | A subscription is a request to the gesture recognizer to receive gesture | ||
1137 | 596 | events. | ||
1138 | 597 | |||
1139 | 598 | The default subscription is to receive all events from all devices for | ||
1140 | 599 | all regions. The domain of the events received can be restructed | ||
1141 | 600 | through the use of filters. | ||
1142 | 601 | |||
1143 | 602 | :param geis: The GEIS v2 instance. | ||
1144 | 603 | :raise: Exception | ||
1145 | 604 | """ | ||
1146 | 605 | object.__init__(self) | ||
1147 | 606 | self._sub = _geis_subscription_new(geis, "py", 0) | ||
1148 | 607 | |||
1149 | 608 | def __del__(self): | ||
1150 | 609 | _geis_subscription_delete(self._sub) | ||
1151 | 610 | |||
1152 | 611 | def activate(self): | ||
1153 | 612 | """ Activates the subscription. | ||
1154 | 613 | """ | ||
1155 | 614 | _geis_subscription_activate(self._sub) | ||
1156 | 615 | |||
1157 | 616 | def deactivate(self): | ||
1158 | 617 | """ Deactivates the subscription. | ||
1159 | 618 | """ | ||
1160 | 619 | _geis_subscription_deactivate(self._sub) | ||
1161 | 620 | |||
1162 | 621 | def name(self): | ||
1163 | 622 | """ Gets the name of the subscription. | ||
1164 | 623 | """ | ||
1165 | 624 | return _geis_subscription_name(self._sub) | ||
1166 | 625 | |||
1167 | 626 | def add_filter(self, filt): | ||
1168 | 627 | """Adds a filter to the subscription. | ||
1169 | 628 | |||
1170 | 629 | :param filter: the filter to add | ||
1171 | 630 | """ | ||
1172 | 631 | _geis_lib.geis_subscription_add_filter(self._sub, filt) | ||
1173 | 632 | |||
1174 | 633 | def remove_filter(self, filt): | ||
1175 | 634 | """ Removes a filter from the subscription. | ||
1176 | 635 | |||
1177 | 636 | :param filter: the filter to remove | ||
1178 | 637 | """ | ||
1179 | 638 | _geis_lib.geis_subscription_remove_filter(self._sub, filt) | ||
1180 | 639 | |||
1181 | 640 | |||
1182 | 0 | 641 | ||
1183 | === added file 'python/pygeis' | |||
1184 | --- python/pygeis 1970-01-01 00:00:00 +0000 | |||
1185 | +++ python/pygeis 2011-05-27 15:36:38 +0000 | |||
1186 | @@ -0,0 +1,136 @@ | |||
1187 | 1 | #!/usr/bin/python | ||
1188 | 2 | # | ||
1189 | 3 | # @file pygies | ||
1190 | 4 | # @brief a demo/test program for the GEIS python bindings | ||
1191 | 5 | # | ||
1192 | 6 | # Copyright (C) 2011 Canonical Ltd | ||
1193 | 7 | # | ||
1194 | 8 | # This program is free software; you can redistribute it and/or modify | ||
1195 | 9 | # it under the terms of the GNU General Public License as published by | ||
1196 | 10 | # the Free Software Foundation; either version 3 of the License, or | ||
1197 | 11 | # (at your option) any later version. | ||
1198 | 12 | # | ||
1199 | 13 | # This program is distributed in the hope that it will be useful, | ||
1200 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1201 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1202 | 16 | # GNU General Public License for more details. | ||
1203 | 17 | # | ||
1204 | 18 | # You should have received a copy of the GNU General Public License | ||
1205 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1206 | 20 | # | ||
1207 | 21 | |||
1208 | 22 | import argparse | ||
1209 | 23 | import geis | ||
1210 | 24 | import glib | ||
1211 | 25 | import sys | ||
1212 | 26 | |||
1213 | 27 | |||
1214 | 28 | def _print_gesture(attrs): | ||
1215 | 29 | touchset = attrs[geis.GEIS_EVENT_ATTRIBUTE_TOUCHSET] | ||
1216 | 30 | groupset = attrs[geis.GEIS_EVENT_ATTRIBUTE_GROUPSET] | ||
1217 | 31 | print " touches (" + str(len(touchset)) + "):" | ||
1218 | 32 | for touch in touchset: | ||
1219 | 33 | print " ", touch.id(), touch.attrs() | ||
1220 | 34 | print " groups:" | ||
1221 | 35 | for group in groupset: | ||
1222 | 36 | print " ", group.id(), ":" | ||
1223 | 37 | for frame in group: | ||
1224 | 38 | print " frame ", frame.id(), ":" | ||
1225 | 39 | for (k, v) in frame.attrs().iteritems(): | ||
1226 | 40 | print " " + k + ":", v | ||
1227 | 41 | print " touches: ", frame.touches() | ||
1228 | 42 | |||
1229 | 43 | def _do_init_complete(event, sub): | ||
1230 | 44 | print "init complete" | ||
1231 | 45 | sub.activate() | ||
1232 | 46 | |||
1233 | 47 | def _do_device_available(event, sub): | ||
1234 | 48 | print "device available" | ||
1235 | 49 | |||
1236 | 50 | def _do_gesture_begin(event, sub): | ||
1237 | 51 | print "gesture begin" | ||
1238 | 52 | _print_gesture(event.attrs()) | ||
1239 | 53 | |||
1240 | 54 | def _do_gesture_update(event, sub): | ||
1241 | 55 | print "gesture update" | ||
1242 | 56 | _print_gesture(event.attrs()) | ||
1243 | 57 | |||
1244 | 58 | def _do_gesture_end(event, sub): | ||
1245 | 59 | print "gesture end" | ||
1246 | 60 | _print_gesture(event.attrs()) | ||
1247 | 61 | |||
1248 | 62 | def _do_other_event(event, sub): | ||
1249 | 63 | print "unknown geis event received" | ||
1250 | 64 | |||
1251 | 65 | _geis_event_action = { | ||
1252 | 66 | geis.GEIS_EVENT_INIT_COMPLETE: _do_init_complete, | ||
1253 | 67 | geis.GEIS_EVENT_DEVICE_AVAILABLE: _do_device_available, | ||
1254 | 68 | geis.GEIS_EVENT_GESTURE_BEGIN: _do_gesture_begin, | ||
1255 | 69 | geis.GEIS_EVENT_GESTURE_UPDATE: _do_gesture_update, | ||
1256 | 70 | geis.GEIS_EVENT_GESTURE_END: _do_gesture_end | ||
1257 | 71 | } | ||
1258 | 72 | |||
1259 | 73 | |||
1260 | 74 | def _dispatch_geis_events(fd, condition, g): | ||
1261 | 75 | """ Performs GEIS event loop processing. """ | ||
1262 | 76 | status = g.dispatch_events() | ||
1263 | 77 | while status == geis.GEIS_STATUS_CONTINUE: | ||
1264 | 78 | status = g.dispatch_events() | ||
1265 | 79 | |||
1266 | 80 | try: | ||
1267 | 81 | while True: | ||
1268 | 82 | event = g.next_event() | ||
1269 | 83 | _geis_event_action.get(event.type(), _do_other_event)(event, None) | ||
1270 | 84 | except geis.NoMoreEvents: | ||
1271 | 85 | pass | ||
1272 | 86 | return True | ||
1273 | 87 | |||
1274 | 88 | |||
1275 | 89 | def _class_callback(g, event, sub): | ||
1276 | 90 | if event.type() == geis.GEIS_EVENT_CLASS_AVAILABLE: | ||
1277 | 91 | gclass = event.attrs()[geis.GEIS_EVENT_ATTRIBUTE_CLASS] | ||
1278 | 92 | name = gclass.name() | ||
1279 | 93 | print ".. adding class %s" % name | ||
1280 | 94 | filt = geis.Filter(g, name) | ||
1281 | 95 | filt.add_term(geis.GEIS_FILTER_CLASS, | ||
1282 | 96 | (geis.GEIS_CLASS_ATTRIBUTE_NAME, geis.GEIS_FILTER_OP_EQ, name), | ||
1283 | 97 | (geis.GEIS_GESTURE_ATTRIBUTE_TOUCHES, geis.GEIS_FILTER_OP_GT, 2)) | ||
1284 | 98 | sub.add_filter(filt) | ||
1285 | 99 | |||
1286 | 100 | |||
1287 | 101 | def _event_callback(geis, event, sub): | ||
1288 | 102 | _geis_event_action.get(event.type(), _do_other_event)(event, sub) | ||
1289 | 103 | |||
1290 | 104 | |||
1291 | 105 | class Options(argparse.ArgumentParser): | ||
1292 | 106 | |||
1293 | 107 | def __init__(self): | ||
1294 | 108 | argparse.ArgumentParser.__init__(self, | ||
1295 | 109 | description="monitor uTouch gestures") | ||
1296 | 110 | self.add_argument('-V', '--version', action='version', version='1.0') | ||
1297 | 111 | |||
1298 | 112 | |||
1299 | 113 | if __name__ == '__main__': | ||
1300 | 114 | options = Options() | ||
1301 | 115 | try: | ||
1302 | 116 | options.parse_args() | ||
1303 | 117 | except argparse.ArgumentError, ex: | ||
1304 | 118 | print ex | ||
1305 | 119 | sys.exit(1) | ||
1306 | 120 | |||
1307 | 121 | g = geis.Geis(geis.GEIS_INIT_TRACK_DEVICES, | ||
1308 | 122 | geis.GEIS_INIT_TRACK_GESTURE_CLASSES) | ||
1309 | 123 | geis_fd = g.get_configuration(geis.GEIS_CONFIGURATION_FD) | ||
1310 | 124 | sub = geis.Subscription(g) | ||
1311 | 125 | g.register_class_callback(_class_callback, sub) | ||
1312 | 126 | g.register_event_callback(_event_callback, sub) | ||
1313 | 127 | |||
1314 | 128 | try: | ||
1315 | 129 | ml = glib.MainLoop() | ||
1316 | 130 | glib.io_add_watch(geis_fd, glib.IO_IN, _dispatch_geis_events, g) | ||
1317 | 131 | ml.run() | ||
1318 | 132 | |||
1319 | 133 | except KeyboardInterrupt: | ||
1320 | 134 | pass | ||
1321 | 135 | |||
1322 | 136 | |||
1323 | 0 | 137 | ||
1324 | === added file 'python/run_pygeis' | |||
1325 | --- python/run_pygeis 1970-01-01 00:00:00 +0000 | |||
1326 | +++ python/run_pygeis 2011-05-27 15:36:38 +0000 | |||
1327 | @@ -0,0 +1,11 @@ | |||
1328 | 1 | #!/bin/sh | ||
1329 | 2 | # | ||
1330 | 3 | # Runs the pygeis program from inside the build tree. | ||
1331 | 4 | # | ||
1332 | 5 | tool_path=$(dirname $0) | ||
1333 | 6 | |||
1334 | 7 | LD_LIBRARY_PATH=$tool_path/../libutouch-geis/.libs | ||
1335 | 8 | PYTHONPATH=$tool_path/.libs | ||
1336 | 9 | |||
1337 | 10 | export LD_LIBRARY_PATH PYTHONPATH | ||
1338 | 11 | $tool_path/pygeis "$@" | ||
1339 | 0 | 12 | ||
1340 | === added directory 'tools' | |||
1341 | === added file 'tools/Makefile.am' | |||
1342 | --- tools/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1343 | +++ tools/Makefile.am 2011-05-27 15:36:38 +0000 | |||
1344 | @@ -0,0 +1,23 @@ | |||
1345 | 1 | # | ||
1346 | 2 | # @file tools/Makefile.am | ||
1347 | 3 | # @brief automake recipe for the GEIS tools | ||
1348 | 4 | # | ||
1349 | 5 | # | ||
1350 | 6 | # Copyright 2011 Canonical, Ltd. | ||
1351 | 7 | # | ||
1352 | 8 | # This file is part of the utouch-geis library. This library is free software; | ||
1353 | 9 | # you can redistribute it and/or modify it under the terms of the GNU Lesser | ||
1354 | 10 | # General Public License as published by the Free Software Foundation; either | ||
1355 | 11 | # version 3 of the License, or (at your option) any later version. | ||
1356 | 12 | # | ||
1357 | 13 | # This library is distributed in the hope that it will be useful, but WITHOUT | ||
1358 | 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1359 | 15 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
1360 | 16 | # details. | ||
1361 | 17 | # | ||
1362 | 18 | # You should have received a copy of the GNU General Public License | ||
1363 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1364 | 20 | # | ||
1365 | 21 | |||
1366 | 22 | SUBDIRS = geisview | ||
1367 | 23 | |||
1368 | 0 | 24 | ||
1369 | === added directory 'tools/geisview' | |||
1370 | === added file 'tools/geisview/Makefile.am' | |||
1371 | --- tools/geisview/Makefile.am 1970-01-01 00:00:00 +0000 | |||
1372 | +++ tools/geisview/Makefile.am 2011-05-27 15:36:38 +0000 | |||
1373 | @@ -0,0 +1,46 @@ | |||
1374 | 1 | # | ||
1375 | 2 | # @file tools/geisview/Makefile.am | ||
1376 | 3 | # @brief automake recipe for the geisview tool | ||
1377 | 4 | # | ||
1378 | 5 | # Copyright 2011 Canonical, Ltd. | ||
1379 | 6 | # | ||
1380 | 7 | # This file is part of the utouch-geis library. This library is free software; | ||
1381 | 8 | # you can redistribute it and/or modify it under the terms of the GNU Lesser | ||
1382 | 9 | # General Public License as published by the Free Software Foundation; either | ||
1383 | 10 | # version 3 of the License, or (at your option) any later version. | ||
1384 | 11 | # | ||
1385 | 12 | # This library is distributed in the hope that it will be useful, but WITHOUT | ||
1386 | 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1387 | 14 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
1388 | 15 | # details. | ||
1389 | 16 | # | ||
1390 | 17 | # You should have received a copy of the GNU Lesser General Public License | ||
1391 | 18 | # along with this program; if not, write to the Free Software Foundation, Inc., | ||
1392 | 19 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
1393 | 20 | |||
1394 | 21 | geisviewdir = $(pythondir)/geisview | ||
1395 | 22 | shareddir = $(datadir)/geisview | ||
1396 | 23 | xdgdir = $(datadir)/applications | ||
1397 | 24 | |||
1398 | 25 | dist_bin_SCRIPTS = geisview | ||
1399 | 26 | dist_shared_DATA = \ | ||
1400 | 27 | geisview.ui \ | ||
1401 | 28 | filter_definition.ui \ | ||
1402 | 29 | filter_list.ui | ||
1403 | 30 | |||
1404 | 31 | geisview_PYTHON = \ | ||
1405 | 32 | __init__.py \ | ||
1406 | 33 | defaults.py \ | ||
1407 | 34 | deviceview.py \ | ||
1408 | 35 | filter_definition.py \ | ||
1409 | 36 | filter_list.py | ||
1410 | 37 | |||
1411 | 38 | defaults.py: defaults.py.in Makefile | ||
1412 | 39 | $(AM_V_GEN)$(SED) \ | ||
1413 | 40 | -e 's,[@]shareddir[@],$(shareddir),g' \ | ||
1414 | 41 | $< >$@ | ||
1415 | 42 | |||
1416 | 43 | BUILT_SOURCES = defaults.py | ||
1417 | 44 | EXTRA_DIST = defaults.py.in | ||
1418 | 45 | CLEANFILES = $(BUILT_SOURCES) | ||
1419 | 46 | |||
1420 | 0 | 47 | ||
1421 | === added file 'tools/geisview/__init__.py' | |||
1422 | --- tools/geisview/__init__.py 1970-01-01 00:00:00 +0000 | |||
1423 | +++ tools/geisview/__init__.py 2011-05-27 15:36:38 +0000 | |||
1424 | @@ -0,0 +1,24 @@ | |||
1425 | 1 | #!/usr/bin/python | ||
1426 | 2 | # | ||
1427 | 3 | # @file geisview/__init__.py | ||
1428 | 4 | # @brief Module __init__ for geisview | ||
1429 | 5 | # | ||
1430 | 6 | # This program is a handy diagnostic tool for viewing the raw data produced | ||
1431 | 7 | # through the GEIS multi-touch and gesture interface. | ||
1432 | 8 | # | ||
1433 | 9 | # Copyright (C) 2011 Canonical Ltd | ||
1434 | 10 | # | ||
1435 | 11 | # This program is free software; you can redistribute it and/or modify | ||
1436 | 12 | # it under the terms of the GNU General Public License as published by | ||
1437 | 13 | # the Free Software Foundation; either version 3 of the License, or | ||
1438 | 14 | # (at your option) any later version. | ||
1439 | 15 | # | ||
1440 | 16 | # This program is distributed in the hope that it will be useful, | ||
1441 | 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1442 | 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1443 | 19 | # GNU General Public License for more details. | ||
1444 | 20 | # | ||
1445 | 21 | # You should have received a copy of the GNU General Public License | ||
1446 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1447 | 23 | # | ||
1448 | 24 | |||
1449 | 0 | 25 | ||
1450 | === added file 'tools/geisview/defaults.py.in' | |||
1451 | --- tools/geisview/defaults.py.in 1970-01-01 00:00:00 +0000 | |||
1452 | +++ tools/geisview/defaults.py.in 2011-05-27 15:36:38 +0000 | |||
1453 | @@ -0,0 +1,62 @@ | |||
1454 | 1 | # | ||
1455 | 2 | # @file geisview/defaults.py | ||
1456 | 3 | # @brief Default values for geisview. | ||
1457 | 4 | # | ||
1458 | 5 | # Copyright (C) 2011 Canonical Ltd | ||
1459 | 6 | # | ||
1460 | 7 | # This program is free software; you can redistribute it and/or modify | ||
1461 | 8 | # it under the terms of the GNU General Public License as published by | ||
1462 | 9 | # the Free Software Foundation; either version 3 of the License, or | ||
1463 | 10 | # (at your option) any later version. | ||
1464 | 11 | # | ||
1465 | 12 | # This program is distributed in the hope that it will be useful, | ||
1466 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1467 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1468 | 15 | # GNU General Public License for more details. | ||
1469 | 16 | # | ||
1470 | 17 | # You should have received a copy of the GNU General Public License | ||
1471 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1472 | 19 | # | ||
1473 | 20 | |||
1474 | 21 | import os | ||
1475 | 22 | import gettext | ||
1476 | 23 | |||
1477 | 24 | |||
1478 | 25 | root_dir = os.path.dirname(__file__) | ||
1479 | 26 | if os.path.exists(os.path.join(root_dir, "Makefile.am")): | ||
1480 | 27 | # running in source directory | ||
1481 | 28 | data_dir = root_dir | ||
1482 | 29 | locale_dir = os.path.join(data_dir, "locale") | ||
1483 | 30 | ui_dir = data_dir | ||
1484 | 31 | else: | ||
1485 | 32 | # running from installed | ||
1486 | 33 | data_dir = os.path.join("@shareddir@") | ||
1487 | 34 | locale_dir = os.path.join(data_dir, "locale") | ||
1488 | 35 | ui_dir = data_dir | ||
1489 | 36 | |||
1490 | 37 | |||
1491 | 38 | i18n_domain = "geisview" | ||
1492 | 39 | gettext.bindtextdomain(i18n_domain, locale_dir) | ||
1493 | 40 | gettext.textdomain(i18n_domain) | ||
1494 | 41 | from gettext import gettext as _ | ||
1495 | 42 | |||
1496 | 43 | version = "1.0" | ||
1497 | 44 | appname = _("GEIS Viewer") | ||
1498 | 45 | appname_short = _("geisview") | ||
1499 | 46 | copyright = 'Copyright 2011 Canonical, Ltd.' | ||
1500 | 47 | description = _("A GEIS data viewer.\n\nGEIS Viewer is a part of " | ||
1501 | 48 | "the Canonical uTouch gesture recognition stack.") | ||
1502 | 49 | authors = ["Stephen M. Webb <stephen.webb@canonical.com"] | ||
1503 | 50 | |||
1504 | 51 | LICENSE = _("%s is free software; you can redistribute it and/or modify " | ||
1505 | 52 | "it under the terms of the GNU General Public License as published by " | ||
1506 | 53 | "the Free Software Foundation; either version 2 of the License, or " | ||
1507 | 54 | "(at your option) any later version.\n\n").replace("%s", appname), | ||
1508 | 55 | _("%s is distributed in the hope that it will be useful, " | ||
1509 | 56 | "but WITHOUT ANY WARRANTY; without even the implied warranty of " | ||
1510 | 57 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " | ||
1511 | 58 | "GNU General Public License for more details.\n\n").replace("%s", appname), | ||
1512 | 59 | _("You should have received a copy of the GNU General Public License " | ||
1513 | 60 | "along with this program. If not, see <http://www.gnu.org/licenses/>.") | ||
1514 | 61 | |||
1515 | 62 | |||
1516 | 0 | 63 | ||
1517 | === added file 'tools/geisview/deviceview.py' | |||
1518 | --- tools/geisview/deviceview.py 1970-01-01 00:00:00 +0000 | |||
1519 | +++ tools/geisview/deviceview.py 2011-05-27 15:36:38 +0000 | |||
1520 | @@ -0,0 +1,46 @@ | |||
1521 | 1 | # | ||
1522 | 2 | # @file geisview/deviceview.py | ||
1523 | 3 | # @brief Device viewer for geisview. | ||
1524 | 4 | # | ||
1525 | 5 | # Copyright (C) 2011 Canonical Ltd | ||
1526 | 6 | # | ||
1527 | 7 | # This program is free software; you can redistribute it and/or modify | ||
1528 | 8 | # it under the terms of the GNU General Public License as published by | ||
1529 | 9 | # the Free Software Foundation; either version 3 of the License, or | ||
1530 | 10 | # (at your option) any later version. | ||
1531 | 11 | # | ||
1532 | 12 | # This program is distributed in the hope that it will be useful, | ||
1533 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1534 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1535 | 15 | # GNU General Public License for more details. | ||
1536 | 16 | # | ||
1537 | 17 | # You should have received a copy of the GNU General Public License | ||
1538 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1539 | 19 | # | ||
1540 | 20 | |||
1541 | 21 | import pygtk | ||
1542 | 22 | pygtk.require('2.0') | ||
1543 | 23 | import gtk | ||
1544 | 24 | |||
1545 | 25 | class DeviceView(gtk.Window): | ||
1546 | 26 | |||
1547 | 27 | def __init__(self, devices): | ||
1548 | 28 | gtk.Window.__init__(self) | ||
1549 | 29 | self.set_title("GEIS Devices") | ||
1550 | 30 | self.set_size_request(200, 200) | ||
1551 | 31 | |||
1552 | 32 | self._devices = devices | ||
1553 | 33 | self._tree_store = gtk.TreeStore(str) | ||
1554 | 34 | for device in devices: | ||
1555 | 35 | it = self._tree_store.append(None, ["%s" % device]) | ||
1556 | 36 | self._tree_view = gtk.TreeView(self._tree_store) | ||
1557 | 37 | self._tree_view.set_mode(gtk.SELECTION_SINGLE) | ||
1558 | 38 | cell = gtk.CellRendererText() | ||
1559 | 39 | col = gtk.TreeViewColumn('Label') | ||
1560 | 40 | col.pack_start(cell, True) | ||
1561 | 41 | col.add_attribute(cell, 'text', 0) | ||
1562 | 42 | self._tree_view.append_column(col) | ||
1563 | 43 | |||
1564 | 44 | self.add(self._tree_view) | ||
1565 | 45 | self.show_all() | ||
1566 | 46 | |||
1567 | 0 | 47 | ||
1568 | === added file 'tools/geisview/filter_definition.py' | |||
1569 | --- tools/geisview/filter_definition.py 1970-01-01 00:00:00 +0000 | |||
1570 | +++ tools/geisview/filter_definition.py 2011-05-27 15:36:38 +0000 | |||
1571 | @@ -0,0 +1,135 @@ | |||
1572 | 1 | # | ||
1573 | 2 | # @file geisview/filter_definition.py | ||
1574 | 3 | # @brief A GEIS filter definition dialog | ||
1575 | 4 | # | ||
1576 | 5 | # Copyright (C) 2011 Canonical Ltd | ||
1577 | 6 | # | ||
1578 | 7 | # This program is free software; you can redistribute it and/or modify | ||
1579 | 8 | # it under the terms of the GNU General Public License as published by | ||
1580 | 9 | # the Free Software Foundation; either version 3 of the License, or | ||
1581 | 10 | # (at your option) any later version. | ||
1582 | 11 | # | ||
1583 | 12 | # This program is distributed in the hope that it will be useful, | ||
1584 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1585 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1586 | 15 | # GNU General Public License for more details. | ||
1587 | 16 | # | ||
1588 | 17 | # You should have received a copy of the GNU General Public License | ||
1589 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1590 | 19 | # | ||
1591 | 20 | |||
1592 | 21 | import geis | ||
1593 | 22 | import geisview.defaults | ||
1594 | 23 | import os | ||
1595 | 24 | import pygtk | ||
1596 | 25 | pygtk.require("2.0") | ||
1597 | 26 | import gtk | ||
1598 | 27 | |||
1599 | 28 | # A list of filter facilities to choose from | ||
1600 | 29 | geis_filter_facilities = ('GEIS_FILTER_REGION', | ||
1601 | 30 | 'GEIS_FILTER_DEVICE', | ||
1602 | 31 | 'GEIS_FILTER_CLASS') | ||
1603 | 32 | |||
1604 | 33 | geis_region_terms = ('GEIS_REGION_ATTRIBUTE_WINDOWID') | ||
1605 | 34 | |||
1606 | 35 | geis_device_terms = ('GEIS_DEVICE_ATTRIBUTE_ID', | ||
1607 | 36 | 'GEIS_DEVICE_ATTRIBUTE_DIRECT_TOUCH') | ||
1608 | 37 | |||
1609 | 38 | geis_gesture_terms = ('GEIS_GESTURE_ATTRIBUTE_TOUCHES', | ||
1610 | 39 | 'GEIS_CLASS_ATTRIBUTE_NAME') | ||
1611 | 40 | |||
1612 | 41 | geis_term_op = {'GEIS_FILTER_OP_EQ': '==', | ||
1613 | 42 | 'GEIS_FILTER_OP_NE': '!=', | ||
1614 | 43 | 'GEIS_FILTER_OP_GT': '>', | ||
1615 | 44 | 'GEIS_FILTER_OP_GE': '>=', | ||
1616 | 45 | 'GEIS_FILTER_OP_LT': '<', | ||
1617 | 46 | 'GEIS_FILTER_OP_LE': '<='} | ||
1618 | 47 | |||
1619 | 48 | facility_combo_name_col = 0 | ||
1620 | 49 | facility_combo_value_col = 1 | ||
1621 | 50 | |||
1622 | 51 | |||
1623 | 52 | def populate_term_op(store): | ||
1624 | 53 | for (name, symbol) in geis_term_op: | ||
1625 | 54 | row = store.append() | ||
1626 | 55 | store.set(row, symbol, geis.__dict__[name]) | ||
1627 | 56 | |||
1628 | 57 | |||
1629 | 58 | class FilterDefinition(object): | ||
1630 | 59 | |||
1631 | 60 | def __init__(self): | ||
1632 | 61 | print "FilterDefinition.__init__() begins" | ||
1633 | 62 | builder = gtk.Builder() | ||
1634 | 63 | builder.add_from_file(os.path.join(geisview.defaults.ui_dir, | ||
1635 | 64 | "filter_definition.ui")) | ||
1636 | 65 | builder.connect_signals(self) | ||
1637 | 66 | |||
1638 | 67 | # prime the name field | ||
1639 | 68 | self._dialog = builder.get_object("filter_definition"); | ||
1640 | 69 | self._name_entry = builder.get_object("name_entry"); | ||
1641 | 70 | |||
1642 | 71 | # prime the facility combo | ||
1643 | 72 | self._facility_store = builder.get_object("facility_store"); | ||
1644 | 73 | for fac in geis_filter_facilities: | ||
1645 | 74 | row = self._facility_store.append() | ||
1646 | 75 | self._facility_store.set(row, | ||
1647 | 76 | facility_combo_name_col, fac, | ||
1648 | 77 | facility_combo_value_col, geis.__dict__[fac]) | ||
1649 | 78 | self._facility_combo = builder.get_object("facility_combo"); | ||
1650 | 79 | self._facility_combo.set_active(0) | ||
1651 | 80 | |||
1652 | 81 | # prime the filter terms | ||
1653 | 82 | self._term_list_view = builder.get_object("term_list_view"); | ||
1654 | 83 | self._term_list_store = builder.get_object("term_list_store") | ||
1655 | 84 | |||
1656 | 85 | self._ok_button = builder.get_object("ok_button"); | ||
1657 | 86 | self._dialog.show_all() | ||
1658 | 87 | print "FilterDefinition.__init__() ends" | ||
1659 | 88 | |||
1660 | 89 | def run(self): | ||
1661 | 90 | print "FilterDefinition.run() begins" | ||
1662 | 91 | response = self._dialog.run() | ||
1663 | 92 | if (response): | ||
1664 | 93 | name = self._name_entry.get_text() | ||
1665 | 94 | print "FilterDefinition.run() name=%s" % name | ||
1666 | 95 | print "FilterDefinition.run() facility=%s" % self._facility_store[self._facility_combo.get_active()][facility_combo_value_col] | ||
1667 | 96 | self._dialog.destroy() | ||
1668 | 97 | print "FilterDefinition.run() ends, response=%s" % response | ||
1669 | 98 | |||
1670 | 99 | def on_name_changed(self, widget, data=None): | ||
1671 | 100 | name = self._name_entry.get_text() | ||
1672 | 101 | if len(name) > 0: | ||
1673 | 102 | self._ok_button.set_sensitive(True) | ||
1674 | 103 | else: | ||
1675 | 104 | self._ok_button.set_sensitive(False) | ||
1676 | 105 | |||
1677 | 106 | def on_add_term(self, widget, data=None): | ||
1678 | 107 | print "FilterDefinition.on_add_term()" | ||
1679 | 108 | row = self._term_list_store.append() | ||
1680 | 109 | self._term_list_store.set(row, | ||
1681 | 110 | 0, "<attr name>", | ||
1682 | 111 | 1, "==", | ||
1683 | 112 | 2, "<value>") | ||
1684 | 113 | |||
1685 | 114 | def on_edit_term(self, widget, data=None): | ||
1686 | 115 | print "FilterDefinition.on_edit_term()" | ||
1687 | 116 | |||
1688 | 117 | def on_remove_term(self, widget, data=None): | ||
1689 | 118 | print "FilterDefinition.on_remove_term()" | ||
1690 | 119 | |||
1691 | 120 | def on_term_attr_editing_started(self, widget, entry, path, data=None): | ||
1692 | 121 | print "FilterDefinition.on_term_attr_editing_started()" | ||
1693 | 122 | choices = gtk.ListStore(str, str) | ||
1694 | 123 | for c in geis_gesture_terms: | ||
1695 | 124 | choices.append([c, geis.__dict__[c]]) | ||
1696 | 125 | completion = gtk.EntryCompletion() | ||
1697 | 126 | completion.set_model(choices) | ||
1698 | 127 | completion.set_text_column(0) | ||
1699 | 128 | completion.set_inline_completion(True) | ||
1700 | 129 | completion.set_popup_completion(False) | ||
1701 | 130 | entry.set_completion(completion) | ||
1702 | 131 | entry.set_text("") | ||
1703 | 132 | |||
1704 | 133 | def on_term_op_edited(self, widget, path, new_text, data=None): | ||
1705 | 134 | print "FilterDefinition.on_term_op_edited(%s, %s, %s)" % (widget, path, new_text) | ||
1706 | 135 | |||
1707 | 0 | 136 | ||
1708 | === added file 'tools/geisview/filter_definition.ui' | |||
1709 | --- tools/geisview/filter_definition.ui 1970-01-01 00:00:00 +0000 | |||
1710 | +++ tools/geisview/filter_definition.ui 2011-05-27 15:36:38 +0000 | |||
1711 | @@ -0,0 +1,329 @@ | |||
1712 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1713 | 2 | <interface> | ||
1714 | 3 | <requires lib="gtk+" version="2.24"/> | ||
1715 | 4 | <!-- interface-naming-policy project-wide --> | ||
1716 | 5 | <object class="GtkListStore" id="facility_store"> | ||
1717 | 6 | <columns> | ||
1718 | 7 | <!-- column-name name --> | ||
1719 | 8 | <column type="gchararray"/> | ||
1720 | 9 | <!-- column-name value --> | ||
1721 | 10 | <column type="gint"/> | ||
1722 | 11 | </columns> | ||
1723 | 12 | </object> | ||
1724 | 13 | <object class="GtkDialog" id="filter_definition"> | ||
1725 | 14 | <property name="can_focus">False</property> | ||
1726 | 15 | <property name="border_width">5</property> | ||
1727 | 16 | <property name="modal">True</property> | ||
1728 | 17 | <property name="window_position">center-on-parent</property> | ||
1729 | 18 | <property name="default_width">320</property> | ||
1730 | 19 | <property name="default_height">260</property> | ||
1731 | 20 | <property name="destroy_with_parent">True</property> | ||
1732 | 21 | <property name="type_hint">dialog</property> | ||
1733 | 22 | <child internal-child="vbox"> | ||
1734 | 23 | <object class="GtkVBox" id="dialog-vbox1"> | ||
1735 | 24 | <property name="visible">True</property> | ||
1736 | 25 | <property name="can_focus">False</property> | ||
1737 | 26 | <property name="spacing">2</property> | ||
1738 | 27 | <child internal-child="action_area"> | ||
1739 | 28 | <object class="GtkHButtonBox" id="dialog-action_area1"> | ||
1740 | 29 | <property name="visible">True</property> | ||
1741 | 30 | <property name="can_focus">False</property> | ||
1742 | 31 | <property name="layout_style">end</property> | ||
1743 | 32 | <child> | ||
1744 | 33 | <object class="GtkButton" id="cancel"> | ||
1745 | 34 | <property name="label">gtk-cancel</property> | ||
1746 | 35 | <property name="visible">True</property> | ||
1747 | 36 | <property name="can_focus">True</property> | ||
1748 | 37 | <property name="receives_default">True</property> | ||
1749 | 38 | <property name="use_action_appearance">False</property> | ||
1750 | 39 | <property name="use_stock">True</property> | ||
1751 | 40 | </object> | ||
1752 | 41 | <packing> | ||
1753 | 42 | <property name="expand">False</property> | ||
1754 | 43 | <property name="fill">False</property> | ||
1755 | 44 | <property name="position">0</property> | ||
1756 | 45 | </packing> | ||
1757 | 46 | </child> | ||
1758 | 47 | <child> | ||
1759 | 48 | <object class="GtkButton" id="ok_button"> | ||
1760 | 49 | <property name="label">gtk-ok</property> | ||
1761 | 50 | <property name="visible">True</property> | ||
1762 | 51 | <property name="sensitive">False</property> | ||
1763 | 52 | <property name="can_focus">True</property> | ||
1764 | 53 | <property name="can_default">True</property> | ||
1765 | 54 | <property name="has_default">True</property> | ||
1766 | 55 | <property name="receives_default">True</property> | ||
1767 | 56 | <property name="use_action_appearance">False</property> | ||
1768 | 57 | <property name="use_stock">True</property> | ||
1769 | 58 | </object> | ||
1770 | 59 | <packing> | ||
1771 | 60 | <property name="expand">False</property> | ||
1772 | 61 | <property name="fill">False</property> | ||
1773 | 62 | <property name="position">1</property> | ||
1774 | 63 | </packing> | ||
1775 | 64 | </child> | ||
1776 | 65 | </object> | ||
1777 | 66 | <packing> | ||
1778 | 67 | <property name="expand">False</property> | ||
1779 | 68 | <property name="fill">True</property> | ||
1780 | 69 | <property name="pack_type">end</property> | ||
1781 | 70 | <property name="position">0</property> | ||
1782 | 71 | </packing> | ||
1783 | 72 | </child> | ||
1784 | 73 | <child> | ||
1785 | 74 | <object class="GtkTable" id="table1"> | ||
1786 | 75 | <property name="visible">True</property> | ||
1787 | 76 | <property name="can_focus">False</property> | ||
1788 | 77 | <property name="n_rows">2</property> | ||
1789 | 78 | <property name="n_columns">2</property> | ||
1790 | 79 | <child> | ||
1791 | 80 | <object class="GtkLabel" id="label2"> | ||
1792 | 81 | <property name="visible">True</property> | ||
1793 | 82 | <property name="can_focus">False</property> | ||
1794 | 83 | <property name="xalign">0</property> | ||
1795 | 84 | <property name="label" translatable="yes">Filter _Name:</property> | ||
1796 | 85 | <property name="use_underline">True</property> | ||
1797 | 86 | </object> | ||
1798 | 87 | <packing> | ||
1799 | 88 | <property name="x_options">GTK_FILL</property> | ||
1800 | 89 | <property name="x_padding">6</property> | ||
1801 | 90 | </packing> | ||
1802 | 91 | </child> | ||
1803 | 92 | <child> | ||
1804 | 93 | <object class="GtkLabel" id="label3"> | ||
1805 | 94 | <property name="visible">True</property> | ||
1806 | 95 | <property name="can_focus">False</property> | ||
1807 | 96 | <property name="xalign">0</property> | ||
1808 | 97 | <property name="label" translatable="yes">Filter _Facility:</property> | ||
1809 | 98 | <property name="use_underline">True</property> | ||
1810 | 99 | </object> | ||
1811 | 100 | <packing> | ||
1812 | 101 | <property name="top_attach">1</property> | ||
1813 | 102 | <property name="bottom_attach">2</property> | ||
1814 | 103 | <property name="x_options">GTK_FILL</property> | ||
1815 | 104 | <property name="x_padding">6</property> | ||
1816 | 105 | </packing> | ||
1817 | 106 | </child> | ||
1818 | 107 | <child> | ||
1819 | 108 | <object class="GtkEntry" id="name_entry"> | ||
1820 | 109 | <property name="visible">True</property> | ||
1821 | 110 | <property name="can_focus">True</property> | ||
1822 | 111 | <property name="invisible_char">•</property> | ||
1823 | 112 | <signal name="changed" handler="on_name_changed" swapped="no"/> | ||
1824 | 113 | </object> | ||
1825 | 114 | <packing> | ||
1826 | 115 | <property name="left_attach">1</property> | ||
1827 | 116 | <property name="right_attach">2</property> | ||
1828 | 117 | <property name="y_options"></property> | ||
1829 | 118 | </packing> | ||
1830 | 119 | </child> | ||
1831 | 120 | <child> | ||
1832 | 121 | <object class="GtkComboBox" id="facility_combo"> | ||
1833 | 122 | <property name="visible">True</property> | ||
1834 | 123 | <property name="can_focus">True</property> | ||
1835 | 124 | <property name="model">facility_store</property> | ||
1836 | 125 | <property name="active">0</property> | ||
1837 | 126 | <child> | ||
1838 | 127 | <object class="GtkCellRendererText" id="name"/> | ||
1839 | 128 | <attributes> | ||
1840 | 129 | <attribute name="text">0</attribute> | ||
1841 | 130 | </attributes> | ||
1842 | 131 | </child> | ||
1843 | 132 | </object> | ||
1844 | 133 | <packing> | ||
1845 | 134 | <property name="left_attach">1</property> | ||
1846 | 135 | <property name="right_attach">2</property> | ||
1847 | 136 | <property name="top_attach">1</property> | ||
1848 | 137 | <property name="bottom_attach">2</property> | ||
1849 | 138 | <property name="y_options"></property> | ||
1850 | 139 | </packing> | ||
1851 | 140 | </child> | ||
1852 | 141 | </object> | ||
1853 | 142 | <packing> | ||
1854 | 143 | <property name="expand">False</property> | ||
1855 | 144 | <property name="fill">False</property> | ||
1856 | 145 | <property name="position">1</property> | ||
1857 | 146 | </packing> | ||
1858 | 147 | </child> | ||
1859 | 148 | <child> | ||
1860 | 149 | <object class="GtkVBox" id="vbox1"> | ||
1861 | 150 | <property name="visible">True</property> | ||
1862 | 151 | <property name="can_focus">False</property> | ||
1863 | 152 | <child> | ||
1864 | 153 | <object class="GtkLabel" id="label1"> | ||
1865 | 154 | <property name="visible">True</property> | ||
1866 | 155 | <property name="can_focus">False</property> | ||
1867 | 156 | <property name="xalign">0</property> | ||
1868 | 157 | <property name="label" translatable="yes">Filter _Terms:</property> | ||
1869 | 158 | <property name="use_underline">True</property> | ||
1870 | 159 | </object> | ||
1871 | 160 | <packing> | ||
1872 | 161 | <property name="expand">False</property> | ||
1873 | 162 | <property name="fill">True</property> | ||
1874 | 163 | <property name="padding">6</property> | ||
1875 | 164 | <property name="position">0</property> | ||
1876 | 165 | </packing> | ||
1877 | 166 | </child> | ||
1878 | 167 | <child> | ||
1879 | 168 | <object class="GtkHBox" id="hbox1"> | ||
1880 | 169 | <property name="visible">True</property> | ||
1881 | 170 | <property name="can_focus">False</property> | ||
1882 | 171 | <child> | ||
1883 | 172 | <object class="GtkScrolledWindow" id="scrolledwindow1"> | ||
1884 | 173 | <property name="visible">True</property> | ||
1885 | 174 | <property name="can_focus">True</property> | ||
1886 | 175 | <property name="hscrollbar_policy">automatic</property> | ||
1887 | 176 | <property name="vscrollbar_policy">automatic</property> | ||
1888 | 177 | <property name="shadow_type">etched-in</property> | ||
1889 | 178 | <child> | ||
1890 | 179 | <object class="GtkTreeView" id="term_list_view"> | ||
1891 | 180 | <property name="visible">True</property> | ||
1892 | 181 | <property name="can_focus">True</property> | ||
1893 | 182 | <property name="model">term_list_store</property> | ||
1894 | 183 | <child> | ||
1895 | 184 | <object class="GtkTreeViewColumn" id="attr"> | ||
1896 | 185 | <property name="title" translatable="yes">Attribute</property> | ||
1897 | 186 | <property name="clickable">True</property> | ||
1898 | 187 | <child> | ||
1899 | 188 | <object class="GtkCellRendererText" id="term_attr"> | ||
1900 | 189 | <property name="editable">True</property> | ||
1901 | 190 | <signal name="editing-started" handler="on_term_attr_editing_started" swapped="no"/> | ||
1902 | 191 | </object> | ||
1903 | 192 | <attributes> | ||
1904 | 193 | <attribute name="text">0</attribute> | ||
1905 | 194 | </attributes> | ||
1906 | 195 | </child> | ||
1907 | 196 | </object> | ||
1908 | 197 | </child> | ||
1909 | 198 | <child> | ||
1910 | 199 | <object class="GtkTreeViewColumn" id="op"> | ||
1911 | 200 | <property name="title" translatable="yes">Operator</property> | ||
1912 | 201 | <property name="clickable">True</property> | ||
1913 | 202 | <child> | ||
1914 | 203 | <object class="GtkCellRendererCombo" id="term_op"> | ||
1915 | 204 | <property name="editable">True</property> | ||
1916 | 205 | </object> | ||
1917 | 206 | <attributes> | ||
1918 | 207 | <attribute name="text">1</attribute> | ||
1919 | 208 | <attribute name="model">1</attribute> | ||
1920 | 209 | </attributes> | ||
1921 | 210 | </child> | ||
1922 | 211 | </object> | ||
1923 | 212 | </child> | ||
1924 | 213 | <child> | ||
1925 | 214 | <object class="GtkTreeViewColumn" id="value"> | ||
1926 | 215 | <property name="title" translatable="yes">Value</property> | ||
1927 | 216 | <property name="clickable">True</property> | ||
1928 | 217 | <child> | ||
1929 | 218 | <object class="GtkCellRendererText" id="term_value"> | ||
1930 | 219 | <property name="editable">True</property> | ||
1931 | 220 | </object> | ||
1932 | 221 | <attributes> | ||
1933 | 222 | <attribute name="text">2</attribute> | ||
1934 | 223 | </attributes> | ||
1935 | 224 | </child> | ||
1936 | 225 | </object> | ||
1937 | 226 | </child> | ||
1938 | 227 | </object> | ||
1939 | 228 | </child> | ||
1940 | 229 | </object> | ||
1941 | 230 | <packing> | ||
1942 | 231 | <property name="expand">True</property> | ||
1943 | 232 | <property name="fill">True</property> | ||
1944 | 233 | <property name="position">0</property> | ||
1945 | 234 | </packing> | ||
1946 | 235 | </child> | ||
1947 | 236 | <child> | ||
1948 | 237 | <object class="GtkVButtonBox" id="vbuttonbox1"> | ||
1949 | 238 | <property name="visible">True</property> | ||
1950 | 239 | <property name="can_focus">False</property> | ||
1951 | 240 | <property name="layout_style">start</property> | ||
1952 | 241 | <child> | ||
1953 | 242 | <object class="GtkButton" id="add_term"> | ||
1954 | 243 | <property name="label">gtk-add</property> | ||
1955 | 244 | <property name="visible">True</property> | ||
1956 | 245 | <property name="can_focus">True</property> | ||
1957 | 246 | <property name="receives_default">True</property> | ||
1958 | 247 | <property name="use_action_appearance">False</property> | ||
1959 | 248 | <property name="use_stock">True</property> | ||
1960 | 249 | <signal name="clicked" handler="on_add_term" swapped="no"/> | ||
1961 | 250 | </object> | ||
1962 | 251 | <packing> | ||
1963 | 252 | <property name="expand">False</property> | ||
1964 | 253 | <property name="fill">False</property> | ||
1965 | 254 | <property name="position">0</property> | ||
1966 | 255 | </packing> | ||
1967 | 256 | </child> | ||
1968 | 257 | <child> | ||
1969 | 258 | <object class="GtkButton" id="edit_term"> | ||
1970 | 259 | <property name="label">gtk-edit</property> | ||
1971 | 260 | <property name="visible">True</property> | ||
1972 | 261 | <property name="can_focus">True</property> | ||
1973 | 262 | <property name="receives_default">True</property> | ||
1974 | 263 | <property name="use_action_appearance">False</property> | ||
1975 | 264 | <property name="use_stock">True</property> | ||
1976 | 265 | <signal name="clicked" handler="on_edit_term" swapped="no"/> | ||
1977 | 266 | </object> | ||
1978 | 267 | <packing> | ||
1979 | 268 | <property name="expand">False</property> | ||
1980 | 269 | <property name="fill">False</property> | ||
1981 | 270 | <property name="position">1</property> | ||
1982 | 271 | </packing> | ||
1983 | 272 | </child> | ||
1984 | 273 | <child> | ||
1985 | 274 | <object class="GtkButton" id="remove_term"> | ||
1986 | 275 | <property name="label">gtk-remove</property> | ||
1987 | 276 | <property name="visible">True</property> | ||
1988 | 277 | <property name="can_focus">True</property> | ||
1989 | 278 | <property name="receives_default">True</property> | ||
1990 | 279 | <property name="use_action_appearance">False</property> | ||
1991 | 280 | <property name="use_stock">True</property> | ||
1992 | 281 | <signal name="clicked" handler="on_remove_term" swapped="no"/> | ||
1993 | 282 | </object> | ||
1994 | 283 | <packing> | ||
1995 | 284 | <property name="expand">False</property> | ||
1996 | 285 | <property name="fill">False</property> | ||
1997 | 286 | <property name="position">2</property> | ||
1998 | 287 | </packing> | ||
1999 | 288 | </child> | ||
2000 | 289 | </object> | ||
2001 | 290 | <packing> | ||
2002 | 291 | <property name="expand">False</property> | ||
2003 | 292 | <property name="fill">True</property> | ||
2004 | 293 | <property name="padding">6</property> | ||
2005 | 294 | <property name="position">1</property> | ||
2006 | 295 | </packing> | ||
2007 | 296 | </child> | ||
2008 | 297 | </object> | ||
2009 | 298 | <packing> | ||
2010 | 299 | <property name="expand">True</property> | ||
2011 | 300 | <property name="fill">True</property> | ||
2012 | 301 | <property name="position">1</property> | ||
2013 | 302 | </packing> | ||
2014 | 303 | </child> | ||
2015 | 304 | </object> | ||
2016 | 305 | <packing> | ||
2017 | 306 | <property name="expand">True</property> | ||
2018 | 307 | <property name="fill">True</property> | ||
2019 | 308 | <property name="padding">6</property> | ||
2020 | 309 | <property name="position">2</property> | ||
2021 | 310 | </packing> | ||
2022 | 311 | </child> | ||
2023 | 312 | </object> | ||
2024 | 313 | </child> | ||
2025 | 314 | <action-widgets> | ||
2026 | 315 | <action-widget response="0">cancel</action-widget> | ||
2027 | 316 | <action-widget response="1">ok_button</action-widget> | ||
2028 | 317 | </action-widgets> | ||
2029 | 318 | </object> | ||
2030 | 319 | <object class="GtkListStore" id="term_list_store"> | ||
2031 | 320 | <columns> | ||
2032 | 321 | <!-- column-name attr_name --> | ||
2033 | 322 | <column type="gchararray"/> | ||
2034 | 323 | <!-- column-name op --> | ||
2035 | 324 | <column type="gchararray"/> | ||
2036 | 325 | <!-- column-name value --> | ||
2037 | 326 | <column type="gchararray"/> | ||
2038 | 327 | </columns> | ||
2039 | 328 | </object> | ||
2040 | 329 | </interface> | ||
2041 | 0 | 330 | ||
2042 | === added file 'tools/geisview/filter_list.py' | |||
2043 | --- tools/geisview/filter_list.py 1970-01-01 00:00:00 +0000 | |||
2044 | +++ tools/geisview/filter_list.py 2011-05-27 15:36:38 +0000 | |||
2045 | @@ -0,0 +1,59 @@ | |||
2046 | 1 | # | ||
2047 | 2 | # @file geisview/filter_list.py | ||
2048 | 3 | # @brief A geisview filter list dialog | ||
2049 | 4 | # | ||
2050 | 5 | # Copyright (C) 2011 Canonical Ltd | ||
2051 | 6 | # | ||
2052 | 7 | # This program is free software; you can redistribute it and/or modify | ||
2053 | 8 | # it under the terms of the GNU General Public License as published by | ||
2054 | 9 | # the Free Software Foundation; either version 3 of the License, or | ||
2055 | 10 | # (at your option) any later version. | ||
2056 | 11 | # | ||
2057 | 12 | # This program is distributed in the hope that it will be useful, | ||
2058 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2059 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2060 | 15 | # GNU General Public License for more details. | ||
2061 | 16 | # | ||
2062 | 17 | # You should have received a copy of the GNU General Public License | ||
2063 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2064 | 19 | # | ||
2065 | 20 | |||
2066 | 21 | import geisview.defaults | ||
2067 | 22 | import geisview.filter_definition | ||
2068 | 23 | import os | ||
2069 | 24 | import pygtk | ||
2070 | 25 | pygtk.require("2.0") | ||
2071 | 26 | import gtk | ||
2072 | 27 | |||
2073 | 28 | class FilterList(object): | ||
2074 | 29 | |||
2075 | 30 | def __init__(self): | ||
2076 | 31 | self._builder = gtk.Builder() | ||
2077 | 32 | self._builder.add_from_file(os.path.join(geisview.defaults.ui_dir, | ||
2078 | 33 | "filter_list.ui")) | ||
2079 | 34 | self._builder.connect_signals(self) | ||
2080 | 35 | |||
2081 | 36 | self._dialog = self._builder.get_object("filter_list"); | ||
2082 | 37 | self._name_entry = self._builder.get_object("name_entry"); | ||
2083 | 38 | self._facility_combo = self._builder.get_object("facility_combo"); | ||
2084 | 39 | self._filter_list_store = self._builder.get_object("filter_list_store") | ||
2085 | 40 | |||
2086 | 41 | self._dialog.show_all() | ||
2087 | 42 | |||
2088 | 43 | def run(self): | ||
2089 | 44 | print "FilterList.run() begins" | ||
2090 | 45 | response = self._dialog.run() | ||
2091 | 46 | self._dialog.destroy() | ||
2092 | 47 | print "FilterList.run() ends, response=%s" % response | ||
2093 | 48 | |||
2094 | 49 | def on_add_filter(self, widget, data=None): | ||
2095 | 50 | print "FilterList.on_add_filter()" | ||
2096 | 51 | dlg = geisview.filter_definition.FilterDefinition() | ||
2097 | 52 | dlg.run() | ||
2098 | 53 | |||
2099 | 54 | def on_edit_filter(self, widget, data=None): | ||
2100 | 55 | print "FilterList.on_edit_filter()" | ||
2101 | 56 | |||
2102 | 57 | def on_remove_filter(self, widget, data=None): | ||
2103 | 58 | print "FilterList.on_remove_filter()" | ||
2104 | 59 | |||
2105 | 0 | 60 | ||
2106 | === added file 'tools/geisview/filter_list.ui' | |||
2107 | --- tools/geisview/filter_list.ui 1970-01-01 00:00:00 +0000 | |||
2108 | +++ tools/geisview/filter_list.ui 2011-05-27 15:36:38 +0000 | |||
2109 | @@ -0,0 +1,174 @@ | |||
2110 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2111 | 2 | <interface> | ||
2112 | 3 | <requires lib="gtk+" version="2.24"/> | ||
2113 | 4 | <!-- interface-naming-policy project-wide --> | ||
2114 | 5 | <object class="GtkDialog" id="filter_list"> | ||
2115 | 6 | <property name="can_focus">False</property> | ||
2116 | 7 | <property name="border_width">5</property> | ||
2117 | 8 | <property name="title" translatable="yes">GEIS Filters</property> | ||
2118 | 9 | <property name="modal">True</property> | ||
2119 | 10 | <property name="window_position">center-on-parent</property> | ||
2120 | 11 | <property name="destroy_with_parent">True</property> | ||
2121 | 12 | <property name="type_hint">dialog</property> | ||
2122 | 13 | <child internal-child="vbox"> | ||
2123 | 14 | <object class="GtkVBox" id="dialog-vbox1"> | ||
2124 | 15 | <property name="visible">True</property> | ||
2125 | 16 | <property name="can_focus">False</property> | ||
2126 | 17 | <child internal-child="action_area"> | ||
2127 | 18 | <object class="GtkHButtonBox" id="dialog-action_area1"> | ||
2128 | 19 | <property name="visible">True</property> | ||
2129 | 20 | <property name="can_focus">False</property> | ||
2130 | 21 | <property name="layout_style">end</property> | ||
2131 | 22 | <child> | ||
2132 | 23 | <object class="GtkButton" id="cancel"> | ||
2133 | 24 | <property name="label">gtk-cancel</property> | ||
2134 | 25 | <property name="visible">True</property> | ||
2135 | 26 | <property name="can_focus">True</property> | ||
2136 | 27 | <property name="receives_default">True</property> | ||
2137 | 28 | <property name="use_action_appearance">False</property> | ||
2138 | 29 | <property name="use_stock">True</property> | ||
2139 | 30 | </object> | ||
2140 | 31 | <packing> | ||
2141 | 32 | <property name="expand">False</property> | ||
2142 | 33 | <property name="fill">False</property> | ||
2143 | 34 | <property name="position">0</property> | ||
2144 | 35 | </packing> | ||
2145 | 36 | </child> | ||
2146 | 37 | <child> | ||
2147 | 38 | <object class="GtkButton" id="ok"> | ||
2148 | 39 | <property name="label">gtk-ok</property> | ||
2149 | 40 | <property name="visible">True</property> | ||
2150 | 41 | <property name="can_focus">True</property> | ||
2151 | 42 | <property name="can_default">True</property> | ||
2152 | 43 | <property name="has_default">True</property> | ||
2153 | 44 | <property name="receives_default">True</property> | ||
2154 | 45 | <property name="use_action_appearance">False</property> | ||
2155 | 46 | <property name="use_stock">True</property> | ||
2156 | 47 | </object> | ||
2157 | 48 | <packing> | ||
2158 | 49 | <property name="expand">False</property> | ||
2159 | 50 | <property name="fill">False</property> | ||
2160 | 51 | <property name="position">1</property> | ||
2161 | 52 | </packing> | ||
2162 | 53 | </child> | ||
2163 | 54 | </object> | ||
2164 | 55 | <packing> | ||
2165 | 56 | <property name="expand">False</property> | ||
2166 | 57 | <property name="fill">True</property> | ||
2167 | 58 | <property name="pack_type">end</property> | ||
2168 | 59 | <property name="position">0</property> | ||
2169 | 60 | </packing> | ||
2170 | 61 | </child> | ||
2171 | 62 | <child> | ||
2172 | 63 | <object class="GtkHBox" id="hbox1"> | ||
2173 | 64 | <property name="visible">True</property> | ||
2174 | 65 | <property name="can_focus">False</property> | ||
2175 | 66 | <property name="spacing">3</property> | ||
2176 | 67 | <child> | ||
2177 | 68 | <object class="GtkScrolledWindow" id="scrolledwindow1"> | ||
2178 | 69 | <property name="visible">True</property> | ||
2179 | 70 | <property name="can_focus">True</property> | ||
2180 | 71 | <property name="hscrollbar_policy">automatic</property> | ||
2181 | 72 | <property name="vscrollbar_policy">automatic</property> | ||
2182 | 73 | <property name="shadow_type">etched-in</property> | ||
2183 | 74 | <child> | ||
2184 | 75 | <object class="GtkTreeView" id="filter_list_view"> | ||
2185 | 76 | <property name="visible">True</property> | ||
2186 | 77 | <property name="can_focus">True</property> | ||
2187 | 78 | <property name="headers_visible">False</property> | ||
2188 | 79 | <property name="headers_clickable">False</property> | ||
2189 | 80 | </object> | ||
2190 | 81 | </child> | ||
2191 | 82 | </object> | ||
2192 | 83 | <packing> | ||
2193 | 84 | <property name="expand">True</property> | ||
2194 | 85 | <property name="fill">True</property> | ||
2195 | 86 | <property name="position">0</property> | ||
2196 | 87 | </packing> | ||
2197 | 88 | </child> | ||
2198 | 89 | <child> | ||
2199 | 90 | <object class="GtkVButtonBox" id="vbuttonbox1"> | ||
2200 | 91 | <property name="visible">True</property> | ||
2201 | 92 | <property name="can_focus">False</property> | ||
2202 | 93 | <property name="spacing">3</property> | ||
2203 | 94 | <property name="layout_style">start</property> | ||
2204 | 95 | <child> | ||
2205 | 96 | <object class="GtkButton" id="add_filter"> | ||
2206 | 97 | <property name="label">gtk-add</property> | ||
2207 | 98 | <property name="visible">True</property> | ||
2208 | 99 | <property name="can_focus">True</property> | ||
2209 | 100 | <property name="receives_default">True</property> | ||
2210 | 101 | <property name="use_action_appearance">False</property> | ||
2211 | 102 | <property name="use_stock">True</property> | ||
2212 | 103 | <signal name="clicked" handler="on_add_filter" swapped="no"/> | ||
2213 | 104 | </object> | ||
2214 | 105 | <packing> | ||
2215 | 106 | <property name="expand">False</property> | ||
2216 | 107 | <property name="fill">False</property> | ||
2217 | 108 | <property name="position">0</property> | ||
2218 | 109 | </packing> | ||
2219 | 110 | </child> | ||
2220 | 111 | <child> | ||
2221 | 112 | <object class="GtkButton" id="edit_filter"> | ||
2222 | 113 | <property name="label">gtk-edit</property> | ||
2223 | 114 | <property name="visible">True</property> | ||
2224 | 115 | <property name="can_focus">True</property> | ||
2225 | 116 | <property name="receives_default">True</property> | ||
2226 | 117 | <property name="use_action_appearance">False</property> | ||
2227 | 118 | <property name="use_stock">True</property> | ||
2228 | 119 | <signal name="clicked" handler="on_edit_filter" swapped="no"/> | ||
2229 | 120 | </object> | ||
2230 | 121 | <packing> | ||
2231 | 122 | <property name="expand">False</property> | ||
2232 | 123 | <property name="fill">False</property> | ||
2233 | 124 | <property name="position">1</property> | ||
2234 | 125 | </packing> | ||
2235 | 126 | </child> | ||
2236 | 127 | <child> | ||
2237 | 128 | <object class="GtkButton" id="remove_filter"> | ||
2238 | 129 | <property name="label">gtk-remove</property> | ||
2239 | 130 | <property name="visible">True</property> | ||
2240 | 131 | <property name="can_focus">True</property> | ||
2241 | 132 | <property name="receives_default">True</property> | ||
2242 | 133 | <property name="use_action_appearance">False</property> | ||
2243 | 134 | <property name="use_stock">True</property> | ||
2244 | 135 | <signal name="clicked" handler="on_remove_filter" swapped="no"/> | ||
2245 | 136 | </object> | ||
2246 | 137 | <packing> | ||
2247 | 138 | <property name="expand">False</property> | ||
2248 | 139 | <property name="fill">False</property> | ||
2249 | 140 | <property name="position">2</property> | ||
2250 | 141 | </packing> | ||
2251 | 142 | </child> | ||
2252 | 143 | </object> | ||
2253 | 144 | <packing> | ||
2254 | 145 | <property name="expand">False</property> | ||
2255 | 146 | <property name="fill">True</property> | ||
2256 | 147 | <property name="padding">6</property> | ||
2257 | 148 | <property name="position">1</property> | ||
2258 | 149 | </packing> | ||
2259 | 150 | </child> | ||
2260 | 151 | </object> | ||
2261 | 152 | <packing> | ||
2262 | 153 | <property name="expand">True</property> | ||
2263 | 154 | <property name="fill">True</property> | ||
2264 | 155 | <property name="position">1</property> | ||
2265 | 156 | </packing> | ||
2266 | 157 | </child> | ||
2267 | 158 | <child> | ||
2268 | 159 | <placeholder/> | ||
2269 | 160 | </child> | ||
2270 | 161 | </object> | ||
2271 | 162 | </child> | ||
2272 | 163 | <action-widgets> | ||
2273 | 164 | <action-widget response="0">cancel</action-widget> | ||
2274 | 165 | <action-widget response="1">ok</action-widget> | ||
2275 | 166 | </action-widgets> | ||
2276 | 167 | </object> | ||
2277 | 168 | <object class="GtkListStore" id="filter_list_model"> | ||
2278 | 169 | <columns> | ||
2279 | 170 | <!-- column-name name --> | ||
2280 | 171 | <column type="gchararray"/> | ||
2281 | 172 | </columns> | ||
2282 | 173 | </object> | ||
2283 | 174 | </interface> | ||
2284 | 0 | 175 | ||
2285 | === added file 'tools/geisview/geisview' | |||
2286 | --- tools/geisview/geisview 1970-01-01 00:00:00 +0000 | |||
2287 | +++ tools/geisview/geisview 2011-05-27 15:36:38 +0000 | |||
2288 | @@ -0,0 +1,250 @@ | |||
2289 | 1 | #!/usr/bin/python | ||
2290 | 2 | # | ||
2291 | 3 | # @file geisview | ||
2292 | 4 | # @brief A viewer for raw GEIS data. | ||
2293 | 5 | # | ||
2294 | 6 | # This program is a handy diagnostic tool for viewing the raw data produced | ||
2295 | 7 | # through the GEIS multi-touch and gesture interface. | ||
2296 | 8 | # | ||
2297 | 9 | # Copyright (C) 2011 Canonical Ltd | ||
2298 | 10 | # | ||
2299 | 11 | # This program is free software; you can redistribute it and/or modify | ||
2300 | 12 | # it under the terms of the GNU General Public License as published by | ||
2301 | 13 | # the Free Software Foundation; either version 3 of the License, or | ||
2302 | 14 | # (at your option) any later version. | ||
2303 | 15 | # | ||
2304 | 16 | # This program is distributed in the hope that it will be useful, | ||
2305 | 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2306 | 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2307 | 19 | # GNU General Public License for more details. | ||
2308 | 20 | # | ||
2309 | 21 | # You should have received a copy of the GNU General Public License | ||
2310 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2311 | 23 | # | ||
2312 | 24 | |||
2313 | 25 | import argparse | ||
2314 | 26 | import geis | ||
2315 | 27 | import geisview.defaults | ||
2316 | 28 | import geisview.deviceview | ||
2317 | 29 | import geisview.filter_list | ||
2318 | 30 | from gettext import gettext as _ | ||
2319 | 31 | import glib | ||
2320 | 32 | import os | ||
2321 | 33 | import sys | ||
2322 | 34 | |||
2323 | 35 | import pygtk | ||
2324 | 36 | pygtk.require("2.0") | ||
2325 | 37 | import gtk | ||
2326 | 38 | |||
2327 | 39 | |||
2328 | 40 | |||
2329 | 41 | class GeisViewer(object): | ||
2330 | 42 | """Provides a GUI client to display raw GEIS data. | ||
2331 | 43 | """ | ||
2332 | 44 | |||
2333 | 45 | def __init__(self): | ||
2334 | 46 | self._builder = gtk.Builder() | ||
2335 | 47 | self._builder.add_from_file(os.path.join(geisview.defaults.ui_dir, | ||
2336 | 48 | "geisview.ui")) | ||
2337 | 49 | self._builder.connect_signals(self) | ||
2338 | 50 | |||
2339 | 51 | self._main_window = self._builder.get_object("main_window") | ||
2340 | 52 | self._filters_dialog = self._builder.get_object("filters_dialog") | ||
2341 | 53 | |||
2342 | 54 | self._geis = geis.Geis(geis.GEIS_INIT_TRACK_DEVICES, | ||
2343 | 55 | geis.GEIS_INIT_TRACK_GESTURE_CLASSES) | ||
2344 | 56 | self._geis_event_store = self._builder.get_object("geis_event_store") | ||
2345 | 57 | |||
2346 | 58 | geis_fd = self._geis.get_configuration(geis.GEIS_CONFIGURATION_FD) | ||
2347 | 59 | glib.io_add_watch(geis_fd, glib.IO_IN, self._dispatch_geis_events) | ||
2348 | 60 | |||
2349 | 61 | self._devices = {} | ||
2350 | 62 | |||
2351 | 63 | self._sub = geis.Subscription(self._geis) | ||
2352 | 64 | |||
2353 | 65 | self._main_window.show() | ||
2354 | 66 | |||
2355 | 67 | def gtk_main_quit(self, widget, data=None): | ||
2356 | 68 | gtk.main_quit() | ||
2357 | 69 | |||
2358 | 70 | def on_menu_item_save(self, widget, data=None): | ||
2359 | 71 | print "on_menu_item_save" | ||
2360 | 72 | |||
2361 | 73 | def on_menu_item_save_as(self, widget, data=None): | ||
2362 | 74 | print "on_menu_item_save_as" | ||
2363 | 75 | |||
2364 | 76 | def on_edit_clear_events_menu_item(self, widget, data=None): | ||
2365 | 77 | self._geis_event_store.clear() | ||
2366 | 78 | |||
2367 | 79 | def on_edit_filters_menu_item_activate(self, widget, data=None): | ||
2368 | 80 | print "on_edit_filters_menu_item_activate" | ||
2369 | 81 | filter_list_dialog = geisview.filter_list.FilterList() | ||
2370 | 82 | filter_list_dialog.run() | ||
2371 | 83 | |||
2372 | 84 | def on_view_device_menu_item_activate(self, widget, data=None): | ||
2373 | 85 | device_view = geisview.deviceview.DeviceView(self._devices) | ||
2374 | 86 | |||
2375 | 87 | def on_menu_item_about(self, widget, data=None): | ||
2376 | 88 | about = gtk.AboutDialog() | ||
2377 | 89 | about.set_transient_for(self._main_window) | ||
2378 | 90 | about.set_name(geisview.defaults.appname) | ||
2379 | 91 | about.set_version(geisview.defaults.version) | ||
2380 | 92 | about.set_copyright(geisview.defaults.copyright) | ||
2381 | 93 | about.set_license(geisview.defaults.license) | ||
2382 | 94 | about.set_wrap_license(True) | ||
2383 | 95 | about.set_comments(geisview.defaults.description) | ||
2384 | 96 | about.set_authors(geisview.defaults.authors) | ||
2385 | 97 | about.set_logo_icon_name("geisview") | ||
2386 | 98 | about.set_translator_credits(geisview.defaults.translator_credit) | ||
2387 | 99 | about.connect("response", lambda d, r: d.destroy()) | ||
2388 | 100 | about.show() | ||
2389 | 101 | |||
2390 | 102 | def _detail_touches(self, event_row, touchset): | ||
2391 | 103 | count_label = _("touches: %i") % len(touchset) | ||
2392 | 104 | slot_label = _("touch slot %i") | ||
2393 | 105 | touch_row = self._geis_event_store.append(event_row) | ||
2394 | 106 | self._geis_event_store.set(touch_row, 0, count_label) | ||
2395 | 107 | for touch in touchset: | ||
2396 | 108 | slot_row = self._geis_event_store.append(touch_row) | ||
2397 | 109 | self._geis_event_store.set(slot_row, 0, slot_label % touch.id()) | ||
2398 | 110 | for (k, v) in touch.attrs().iteritems(): | ||
2399 | 111 | attr_row = self._geis_event_store.append(slot_row) | ||
2400 | 112 | self._geis_event_store.set(attr_row, 0, "%s: %s" % (k, v)) | ||
2401 | 113 | |||
2402 | 114 | def _detail_frame(self, group_row, frame): | ||
2403 | 115 | """Extracts and display the details of a gesture frame. | ||
2404 | 116 | """ | ||
2405 | 117 | frame_label = _("frame: %i") % frame.id() | ||
2406 | 118 | touch_label = _("touch indexes %s") % frame.touches() | ||
2407 | 119 | |||
2408 | 120 | dev = None | ||
2409 | 121 | |||
2410 | 122 | frame_row = self._geis_event_store.append(group_row) | ||
2411 | 123 | self._geis_event_store.set(frame_row, 0, frame_label) | ||
2412 | 124 | for (k, v) in frame.attrs().iteritems(): | ||
2413 | 125 | row = self._geis_event_store.append(frame_row) | ||
2414 | 126 | self._geis_event_store.set(row, 0, "%s: %s" % (k, v)) | ||
2415 | 127 | if k == geis.GEIS_GESTURE_ATTRIBUTE_DEVICE_ID and v in self._devices: | ||
2416 | 128 | dev = self._devices[v] | ||
2417 | 129 | self._geis_event_store.append(frame_row, [touch_label, None, None]) | ||
2418 | 130 | |||
2419 | 131 | if dev: | ||
2420 | 132 | print "device %s extents %s" % (dev.id(), dev.extents()) | ||
2421 | 133 | |||
2422 | 134 | |||
2423 | 135 | def _detail_gesture(self, event_row, attrs): | ||
2424 | 136 | touchset = attrs[geis.GEIS_EVENT_ATTRIBUTE_TOUCHSET] | ||
2425 | 137 | groupset = attrs[geis.GEIS_EVENT_ATTRIBUTE_GROUPSET] | ||
2426 | 138 | self._detail_touches(event_row, touchset) | ||
2427 | 139 | count_label = _("groups: %i") % len(touchset) | ||
2428 | 140 | group_label = _("group %i") | ||
2429 | 141 | it = self._geis_event_store.append(event_row, [count_label, None, None]) | ||
2430 | 142 | for group in groupset: | ||
2431 | 143 | group_row = self._geis_event_store.append(it, | ||
2432 | 144 | [group_label % group.id(), None, None]) | ||
2433 | 145 | for frame in group: | ||
2434 | 146 | self._detail_frame(group_row, frame) | ||
2435 | 147 | |||
2436 | 148 | def _detail_gesture_class(self, event_row, gesture_class): | ||
2437 | 149 | for (k, v) in gesture_class.attrs().iteritems(): | ||
2438 | 150 | row = self._geis_event_store.append(event_row) | ||
2439 | 151 | self._geis_event_store.set(row, 0, "%s: %s" % (k, v)) | ||
2440 | 152 | |||
2441 | 153 | def _detail_device(self, event_row, device): | ||
2442 | 154 | for (k, v) in device.attrs().iteritems(): | ||
2443 | 155 | row = self._geis_event_store.append(event_row) | ||
2444 | 156 | self._geis_event_store.set(row, 0, "%s: %s" % (k, v)) | ||
2445 | 157 | |||
2446 | 158 | def _do_gesture_begin(self, event): | ||
2447 | 159 | it = self._geis_event_store.append(None) | ||
2448 | 160 | self._geis_event_store.set(it, 0, _("Gesture Begin")) | ||
2449 | 161 | self._detail_gesture(it, event.attrs()) | ||
2450 | 162 | |||
2451 | 163 | def _do_gesture_update(self, event): | ||
2452 | 164 | it = self._geis_event_store.append(None) | ||
2453 | 165 | self._geis_event_store.set(it, 0, _("Gesture Update")) | ||
2454 | 166 | self._detail_gesture(it, event.attrs()) | ||
2455 | 167 | |||
2456 | 168 | def _do_gesture_end(self, event): | ||
2457 | 169 | it = self._geis_event_store.append(None) | ||
2458 | 170 | self._geis_event_store.set(it, 0, _("Gesture End")) | ||
2459 | 171 | self._detail_gesture(it, event.attrs()) | ||
2460 | 172 | |||
2461 | 173 | def _do_class_added(self, event): | ||
2462 | 174 | gclass = event.attrs()[geis.GEIS_EVENT_ATTRIBUTE_CLASS] | ||
2463 | 175 | it = self._geis_event_store.append(None) | ||
2464 | 176 | self._geis_event_store.set(it, | ||
2465 | 177 | 0, _("Class %s Added: %s") % (gclass.id(), gclass.name())) | ||
2466 | 178 | self._detail_gesture_class(it, gclass) | ||
2467 | 179 | |||
2468 | 180 | def _do_device_added(self, event): | ||
2469 | 181 | device = event.attrs()[geis.GEIS_EVENT_ATTRIBUTE_DEVICE] | ||
2470 | 182 | self._devices[device.id()] = device | ||
2471 | 183 | it = self._geis_event_store.append(None) | ||
2472 | 184 | self._geis_event_store.set(it, | ||
2473 | 185 | 0, _("Device %s Added: %s") % (device.id(), device.name())) | ||
2474 | 186 | self._detail_device(it, device) | ||
2475 | 187 | |||
2476 | 188 | def _do_init_complete(self, event): | ||
2477 | 189 | it = self._geis_event_store.append(None) | ||
2478 | 190 | self._geis_event_store.set(it, | ||
2479 | 191 | 0, _("GEIS initialization complete")) | ||
2480 | 192 | f = geis.Filter(self._geis, "filter") | ||
2481 | 193 | f.add_term(geis.GEIS_FILTER_CLASS, | ||
2482 | 194 | (geis.GEIS_GESTURE_ATTRIBUTE_TOUCHES, geis.GEIS_FILTER_OP_GE, 2)) | ||
2483 | 195 | self._sub.add_filter(f) | ||
2484 | 196 | self._sub.activate() | ||
2485 | 197 | |||
2486 | 198 | def _do_other_event(self, event): | ||
2487 | 199 | event_label = _("Unknown Event") | ||
2488 | 200 | it = self._geis_event_store.append(None, [event_label, None, None]) | ||
2489 | 201 | |||
2490 | 202 | def _dispatch_geis_events(self, fd, condition): | ||
2491 | 203 | """ Performs GEIS event loop processing. """ | ||
2492 | 204 | _geis_event_action = { | ||
2493 | 205 | geis.GEIS_EVENT_GESTURE_BEGIN: self._do_gesture_begin, | ||
2494 | 206 | geis.GEIS_EVENT_GESTURE_UPDATE: self._do_gesture_update, | ||
2495 | 207 | geis.GEIS_EVENT_GESTURE_END: self._do_gesture_end, | ||
2496 | 208 | geis.GEIS_EVENT_CLASS_AVAILABLE: self._do_class_added, | ||
2497 | 209 | geis.GEIS_EVENT_DEVICE_AVAILABLE: self._do_device_added, | ||
2498 | 210 | geis.GEIS_EVENT_INIT_COMPLETE: self._do_init_complete | ||
2499 | 211 | } | ||
2500 | 212 | |||
2501 | 213 | status = self._geis.dispatch_events() | ||
2502 | 214 | while status == geis.GEIS_STATUS_CONTINUE: | ||
2503 | 215 | status = self._geis.dispatch_events() | ||
2504 | 216 | |||
2505 | 217 | try: | ||
2506 | 218 | while True: | ||
2507 | 219 | event = self._geis.next_event() | ||
2508 | 220 | _geis_event_action.get(event.type(), self._do_other_event)(event) | ||
2509 | 221 | except geis.NoMoreEvents: | ||
2510 | 222 | pass | ||
2511 | 223 | return True | ||
2512 | 224 | |||
2513 | 225 | |||
2514 | 226 | |||
2515 | 227 | class Options(argparse.ArgumentParser): | ||
2516 | 228 | """Handles the geisviewer command-line arguments. | ||
2517 | 229 | """ | ||
2518 | 230 | |||
2519 | 231 | def __init__(self): | ||
2520 | 232 | argparse.ArgumentParser.__init__(self, | ||
2521 | 233 | description="monitor uTouch gestures") | ||
2522 | 234 | self.add_argument('-V', '--version', action='version', version='1.0') | ||
2523 | 235 | |||
2524 | 236 | |||
2525 | 237 | def main(): | ||
2526 | 238 | options = Options() | ||
2527 | 239 | try: | ||
2528 | 240 | options.parse_args() | ||
2529 | 241 | except argparse.ArgumentError, ex: | ||
2530 | 242 | print ex | ||
2531 | 243 | sys.exit(1) | ||
2532 | 244 | |||
2533 | 245 | geis_viewer = GeisViewer() | ||
2534 | 246 | gtk.main() | ||
2535 | 247 | |||
2536 | 248 | |||
2537 | 249 | if __name__ == '__main__': | ||
2538 | 250 | main() | ||
2539 | 0 | 251 | ||
2540 | === added file 'tools/geisview/geisview.ui' | |||
2541 | --- tools/geisview/geisview.ui 1970-01-01 00:00:00 +0000 | |||
2542 | +++ tools/geisview/geisview.ui 2011-05-27 15:36:38 +0000 | |||
2543 | @@ -0,0 +1,333 @@ | |||
2544 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2545 | 2 | <interface> | ||
2546 | 3 | <requires lib="gtk+" version="2.24"/> | ||
2547 | 4 | <!-- interface-naming-policy project-wide --> | ||
2548 | 5 | <object class="GtkListStore" id="geis_event_detail"> | ||
2549 | 6 | <columns> | ||
2550 | 7 | <!-- column-name label --> | ||
2551 | 8 | <column type="gchararray"/> | ||
2552 | 9 | <!-- column-name value --> | ||
2553 | 10 | <column type="gchararray"/> | ||
2554 | 11 | </columns> | ||
2555 | 12 | </object> | ||
2556 | 13 | <object class="GtkTreeStore" id="geis_event_store"> | ||
2557 | 14 | <columns> | ||
2558 | 15 | <!-- column-name event_type --> | ||
2559 | 16 | <column type="gchararray"/> | ||
2560 | 17 | <!-- column-name value --> | ||
2561 | 18 | <column type="gchararray"/> | ||
2562 | 19 | <!-- column-name data --> | ||
2563 | 20 | <column type="gpointer"/> | ||
2564 | 21 | </columns> | ||
2565 | 22 | </object> | ||
2566 | 23 | <object class="GtkImage" id="image1"> | ||
2567 | 24 | <property name="visible">True</property> | ||
2568 | 25 | <property name="can_focus">False</property> | ||
2569 | 26 | <property name="stock">gtk-missing-image</property> | ||
2570 | 27 | </object> | ||
2571 | 28 | <object class="GtkWindow" id="main_window"> | ||
2572 | 29 | <property name="can_focus">False</property> | ||
2573 | 30 | <property name="default_width">480</property> | ||
2574 | 31 | <property name="default_height">420</property> | ||
2575 | 32 | <signal name="destroy" handler="gtk_main_quit" swapped="no"/> | ||
2576 | 33 | <child> | ||
2577 | 34 | <object class="GtkVBox" id="vbox1"> | ||
2578 | 35 | <property name="visible">True</property> | ||
2579 | 36 | <property name="can_focus">False</property> | ||
2580 | 37 | <child> | ||
2581 | 38 | <object class="GtkMenuBar" id="menubar1"> | ||
2582 | 39 | <property name="visible">True</property> | ||
2583 | 40 | <property name="can_focus">False</property> | ||
2584 | 41 | <child> | ||
2585 | 42 | <object class="GtkMenuItem" id="menu_file"> | ||
2586 | 43 | <property name="visible">True</property> | ||
2587 | 44 | <property name="can_focus">False</property> | ||
2588 | 45 | <property name="use_action_appearance">False</property> | ||
2589 | 46 | <property name="label" translatable="yes">_File</property> | ||
2590 | 47 | <property name="use_underline">True</property> | ||
2591 | 48 | <child type="submenu"> | ||
2592 | 49 | <object class="GtkMenu" id="menu1"> | ||
2593 | 50 | <property name="visible">True</property> | ||
2594 | 51 | <property name="can_focus">False</property> | ||
2595 | 52 | <child> | ||
2596 | 53 | <object class="GtkImageMenuItem" id="menu_item_new"> | ||
2597 | 54 | <property name="label">gtk-new</property> | ||
2598 | 55 | <property name="visible">True</property> | ||
2599 | 56 | <property name="can_focus">False</property> | ||
2600 | 57 | <property name="use_action_appearance">False</property> | ||
2601 | 58 | <property name="use_underline">True</property> | ||
2602 | 59 | <property name="use_stock">True</property> | ||
2603 | 60 | </object> | ||
2604 | 61 | </child> | ||
2605 | 62 | <child> | ||
2606 | 63 | <object class="GtkImageMenuItem" id="menu_item_open"> | ||
2607 | 64 | <property name="label">gtk-open</property> | ||
2608 | 65 | <property name="visible">True</property> | ||
2609 | 66 | <property name="can_focus">False</property> | ||
2610 | 67 | <property name="use_action_appearance">False</property> | ||
2611 | 68 | <property name="use_underline">True</property> | ||
2612 | 69 | <property name="use_stock">True</property> | ||
2613 | 70 | </object> | ||
2614 | 71 | </child> | ||
2615 | 72 | <child> | ||
2616 | 73 | <object class="GtkImageMenuItem" id="menu_item_save"> | ||
2617 | 74 | <property name="label">gtk-save</property> | ||
2618 | 75 | <property name="visible">True</property> | ||
2619 | 76 | <property name="can_focus">False</property> | ||
2620 | 77 | <property name="use_action_appearance">False</property> | ||
2621 | 78 | <property name="use_underline">True</property> | ||
2622 | 79 | <property name="use_stock">True</property> | ||
2623 | 80 | <signal name="activate-item" handler="on_menu_item_save" swapped="no"/> | ||
2624 | 81 | </object> | ||
2625 | 82 | </child> | ||
2626 | 83 | <child> | ||
2627 | 84 | <object class="GtkImageMenuItem" id="menu_item_save_as"> | ||
2628 | 85 | <property name="label">gtk-save-as</property> | ||
2629 | 86 | <property name="visible">True</property> | ||
2630 | 87 | <property name="can_focus">False</property> | ||
2631 | 88 | <property name="use_action_appearance">False</property> | ||
2632 | 89 | <property name="use_underline">True</property> | ||
2633 | 90 | <property name="use_stock">True</property> | ||
2634 | 91 | <signal name="activate-item" handler="on_menu_item_save_as" swapped="no"/> | ||
2635 | 92 | </object> | ||
2636 | 93 | </child> | ||
2637 | 94 | <child> | ||
2638 | 95 | <object class="GtkSeparatorMenuItem" id="separatormenuitem1"> | ||
2639 | 96 | <property name="visible">True</property> | ||
2640 | 97 | <property name="can_focus">False</property> | ||
2641 | 98 | <property name="use_action_appearance">False</property> | ||
2642 | 99 | </object> | ||
2643 | 100 | </child> | ||
2644 | 101 | <child> | ||
2645 | 102 | <object class="GtkImageMenuItem" id="quit_menu_item"> | ||
2646 | 103 | <property name="label">gtk-quit</property> | ||
2647 | 104 | <property name="visible">True</property> | ||
2648 | 105 | <property name="can_focus">False</property> | ||
2649 | 106 | <property name="use_action_appearance">False</property> | ||
2650 | 107 | <property name="use_underline">True</property> | ||
2651 | 108 | <property name="use_stock">True</property> | ||
2652 | 109 | <signal name="activate-item" handler="gtk_main_quit" swapped="no"/> | ||
2653 | 110 | <signal name="activate" handler="gtk_main_quit" swapped="no"/> | ||
2654 | 111 | </object> | ||
2655 | 112 | </child> | ||
2656 | 113 | </object> | ||
2657 | 114 | </child> | ||
2658 | 115 | </object> | ||
2659 | 116 | </child> | ||
2660 | 117 | <child> | ||
2661 | 118 | <object class="GtkMenuItem" id="menu_edit"> | ||
2662 | 119 | <property name="visible">True</property> | ||
2663 | 120 | <property name="can_focus">False</property> | ||
2664 | 121 | <property name="use_action_appearance">False</property> | ||
2665 | 122 | <property name="label" translatable="yes">_Edit</property> | ||
2666 | 123 | <property name="use_underline">True</property> | ||
2667 | 124 | <child type="submenu"> | ||
2668 | 125 | <object class="GtkMenu" id="menu2"> | ||
2669 | 126 | <property name="visible">True</property> | ||
2670 | 127 | <property name="can_focus">False</property> | ||
2671 | 128 | <child> | ||
2672 | 129 | <object class="GtkImageMenuItem" id="menu_item_cut"> | ||
2673 | 130 | <property name="label">gtk-cut</property> | ||
2674 | 131 | <property name="visible">True</property> | ||
2675 | 132 | <property name="can_focus">False</property> | ||
2676 | 133 | <property name="use_action_appearance">False</property> | ||
2677 | 134 | <property name="use_underline">True</property> | ||
2678 | 135 | <property name="use_stock">True</property> | ||
2679 | 136 | </object> | ||
2680 | 137 | </child> | ||
2681 | 138 | <child> | ||
2682 | 139 | <object class="GtkImageMenuItem" id="menu_item_copy"> | ||
2683 | 140 | <property name="label">gtk-copy</property> | ||
2684 | 141 | <property name="visible">True</property> | ||
2685 | 142 | <property name="can_focus">False</property> | ||
2686 | 143 | <property name="use_action_appearance">False</property> | ||
2687 | 144 | <property name="use_underline">True</property> | ||
2688 | 145 | <property name="use_stock">True</property> | ||
2689 | 146 | </object> | ||
2690 | 147 | </child> | ||
2691 | 148 | <child> | ||
2692 | 149 | <object class="GtkImageMenuItem" id="menu_item_paste"> | ||
2693 | 150 | <property name="label">gtk-paste</property> | ||
2694 | 151 | <property name="visible">True</property> | ||
2695 | 152 | <property name="can_focus">False</property> | ||
2696 | 153 | <property name="use_action_appearance">False</property> | ||
2697 | 154 | <property name="use_underline">True</property> | ||
2698 | 155 | <property name="use_stock">True</property> | ||
2699 | 156 | </object> | ||
2700 | 157 | </child> | ||
2701 | 158 | <child> | ||
2702 | 159 | <object class="GtkImageMenuItem" id="menu_item_delete"> | ||
2703 | 160 | <property name="label">gtk-delete</property> | ||
2704 | 161 | <property name="visible">True</property> | ||
2705 | 162 | <property name="can_focus">False</property> | ||
2706 | 163 | <property name="use_action_appearance">False</property> | ||
2707 | 164 | <property name="use_underline">True</property> | ||
2708 | 165 | <property name="use_stock">True</property> | ||
2709 | 166 | </object> | ||
2710 | 167 | </child> | ||
2711 | 168 | <child> | ||
2712 | 169 | <object class="GtkMenuItem" id="edit_clear_events_menu_item"> | ||
2713 | 170 | <property name="visible">True</property> | ||
2714 | 171 | <property name="can_focus">False</property> | ||
2715 | 172 | <property name="use_action_appearance">False</property> | ||
2716 | 173 | <property name="label" translatable="yes">Clear Events</property> | ||
2717 | 174 | <property name="use_underline">True</property> | ||
2718 | 175 | <signal name="activate" handler="on_edit_clear_events_menu_item" swapped="no"/> | ||
2719 | 176 | </object> | ||
2720 | 177 | </child> | ||
2721 | 178 | <child> | ||
2722 | 179 | <object class="GtkMenuItem" id="edit_filters_menu_item"> | ||
2723 | 180 | <property name="visible">True</property> | ||
2724 | 181 | <property name="can_focus">False</property> | ||
2725 | 182 | <property name="use_action_appearance">False</property> | ||
2726 | 183 | <property name="label" translatable="yes">Filters...</property> | ||
2727 | 184 | <property name="use_underline">True</property> | ||
2728 | 185 | <signal name="activate" handler="on_edit_filters_menu_item_activate" swapped="no"/> | ||
2729 | 186 | </object> | ||
2730 | 187 | </child> | ||
2731 | 188 | </object> | ||
2732 | 189 | </child> | ||
2733 | 190 | </object> | ||
2734 | 191 | </child> | ||
2735 | 192 | <child> | ||
2736 | 193 | <object class="GtkMenuItem" id="menu_view"> | ||
2737 | 194 | <property name="visible">True</property> | ||
2738 | 195 | <property name="can_focus">False</property> | ||
2739 | 196 | <property name="use_action_appearance">False</property> | ||
2740 | 197 | <property name="label" translatable="yes">_View</property> | ||
2741 | 198 | <property name="use_underline">True</property> | ||
2742 | 199 | <child type="submenu"> | ||
2743 | 200 | <object class="GtkMenu" id="menu4"> | ||
2744 | 201 | <property name="visible">True</property> | ||
2745 | 202 | <property name="can_focus">False</property> | ||
2746 | 203 | <child> | ||
2747 | 204 | <object class="GtkImageMenuItem" id="view_device_menu_item"> | ||
2748 | 205 | <property name="label" translatable="yes">Show _Devices</property> | ||
2749 | 206 | <property name="visible">True</property> | ||
2750 | 207 | <property name="can_focus">False</property> | ||
2751 | 208 | <property name="use_action_appearance">False</property> | ||
2752 | 209 | <property name="use_underline">True</property> | ||
2753 | 210 | <property name="image">image1</property> | ||
2754 | 211 | <property name="use_stock">False</property> | ||
2755 | 212 | <signal name="activate" handler="on_view_device_menu_item_activate" swapped="no"/> | ||
2756 | 213 | </object> | ||
2757 | 214 | </child> | ||
2758 | 215 | </object> | ||
2759 | 216 | </child> | ||
2760 | 217 | </object> | ||
2761 | 218 | </child> | ||
2762 | 219 | <child> | ||
2763 | 220 | <object class="GtkMenuItem" id="menu_help"> | ||
2764 | 221 | <property name="visible">True</property> | ||
2765 | 222 | <property name="can_focus">False</property> | ||
2766 | 223 | <property name="use_action_appearance">False</property> | ||
2767 | 224 | <property name="label" translatable="yes">_Help</property> | ||
2768 | 225 | <property name="use_underline">True</property> | ||
2769 | 226 | <child type="submenu"> | ||
2770 | 227 | <object class="GtkMenu" id="menu3"> | ||
2771 | 228 | <property name="visible">True</property> | ||
2772 | 229 | <property name="can_focus">False</property> | ||
2773 | 230 | <child> | ||
2774 | 231 | <object class="GtkImageMenuItem" id="menu_item_about"> | ||
2775 | 232 | <property name="label">gtk-about</property> | ||
2776 | 233 | <property name="visible">True</property> | ||
2777 | 234 | <property name="can_focus">False</property> | ||
2778 | 235 | <property name="use_action_appearance">False</property> | ||
2779 | 236 | <property name="use_underline">True</property> | ||
2780 | 237 | <property name="use_stock">True</property> | ||
2781 | 238 | <signal name="activate-item" handler="gtk_main_quit" swapped="no"/> | ||
2782 | 239 | <signal name="activate" handler="on_menu_item_about" swapped="no"/> | ||
2783 | 240 | </object> | ||
2784 | 241 | </child> | ||
2785 | 242 | </object> | ||
2786 | 243 | </child> | ||
2787 | 244 | </object> | ||
2788 | 245 | </child> | ||
2789 | 246 | </object> | ||
2790 | 247 | <packing> | ||
2791 | 248 | <property name="expand">False</property> | ||
2792 | 249 | <property name="fill">True</property> | ||
2793 | 250 | <property name="position">0</property> | ||
2794 | 251 | </packing> | ||
2795 | 252 | </child> | ||
2796 | 253 | <child> | ||
2797 | 254 | <object class="GtkVPaned" id="vpaned1"> | ||
2798 | 255 | <property name="visible">True</property> | ||
2799 | 256 | <property name="can_focus">True</property> | ||
2800 | 257 | <child> | ||
2801 | 258 | <object class="GtkScrolledWindow" id="scrolledwindow1"> | ||
2802 | 259 | <property name="visible">True</property> | ||
2803 | 260 | <property name="can_focus">True</property> | ||
2804 | 261 | <property name="hscrollbar_policy">automatic</property> | ||
2805 | 262 | <property name="vscrollbar_policy">automatic</property> | ||
2806 | 263 | <property name="window_placement_set">True</property> | ||
2807 | 264 | <property name="shadow_type">etched-in</property> | ||
2808 | 265 | <child> | ||
2809 | 266 | <object class="GtkTreeView" id="event_treeview"> | ||
2810 | 267 | <property name="visible">True</property> | ||
2811 | 268 | <property name="can_focus">True</property> | ||
2812 | 269 | <property name="border_width">1</property> | ||
2813 | 270 | <property name="model">geis_event_store</property> | ||
2814 | 271 | <property name="headers_visible">False</property> | ||
2815 | 272 | <property name="headers_clickable">False</property> | ||
2816 | 273 | <child> | ||
2817 | 274 | <object class="GtkTreeViewColumn" id="label"> | ||
2818 | 275 | <property name="title" translatable="yes">column</property> | ||
2819 | 276 | <child> | ||
2820 | 277 | <object class="GtkCellRendererText" id="cellrenderertext1"/> | ||
2821 | 278 | <attributes> | ||
2822 | 279 | <attribute name="text">0</attribute> | ||
2823 | 280 | </attributes> | ||
2824 | 281 | </child> | ||
2825 | 282 | </object> | ||
2826 | 283 | </child> | ||
2827 | 284 | </object> | ||
2828 | 285 | </child> | ||
2829 | 286 | </object> | ||
2830 | 287 | <packing> | ||
2831 | 288 | <property name="resize">False</property> | ||
2832 | 289 | <property name="shrink">True</property> | ||
2833 | 290 | </packing> | ||
2834 | 291 | </child> | ||
2835 | 292 | <child> | ||
2836 | 293 | <object class="GtkScrolledWindow" id="scrolledwindow2"> | ||
2837 | 294 | <property name="can_focus">True</property> | ||
2838 | 295 | <property name="hscrollbar_policy">automatic</property> | ||
2839 | 296 | <property name="vscrollbar_policy">automatic</property> | ||
2840 | 297 | <property name="shadow_type">in</property> | ||
2841 | 298 | <child> | ||
2842 | 299 | <object class="GtkTreeView" id="treeview2"> | ||
2843 | 300 | <property name="visible">True</property> | ||
2844 | 301 | <property name="can_focus">True</property> | ||
2845 | 302 | <property name="model">geis_event_detail</property> | ||
2846 | 303 | </object> | ||
2847 | 304 | </child> | ||
2848 | 305 | </object> | ||
2849 | 306 | <packing> | ||
2850 | 307 | <property name="resize">True</property> | ||
2851 | 308 | <property name="shrink">True</property> | ||
2852 | 309 | </packing> | ||
2853 | 310 | </child> | ||
2854 | 311 | </object> | ||
2855 | 312 | <packing> | ||
2856 | 313 | <property name="expand">True</property> | ||
2857 | 314 | <property name="fill">True</property> | ||
2858 | 315 | <property name="position">1</property> | ||
2859 | 316 | </packing> | ||
2860 | 317 | </child> | ||
2861 | 318 | <child> | ||
2862 | 319 | <object class="GtkStatusbar" id="statusbar1"> | ||
2863 | 320 | <property name="visible">True</property> | ||
2864 | 321 | <property name="can_focus">False</property> | ||
2865 | 322 | <property name="spacing">2</property> | ||
2866 | 323 | </object> | ||
2867 | 324 | <packing> | ||
2868 | 325 | <property name="expand">False</property> | ||
2869 | 326 | <property name="fill">True</property> | ||
2870 | 327 | <property name="position">2</property> | ||
2871 | 328 | </packing> | ||
2872 | 329 | </child> | ||
2873 | 330 | </object> | ||
2874 | 331 | </child> | ||
2875 | 332 | </object> | ||
2876 | 333 | </interface> |
Looks fine, builds, installs and works. Some minor things:
Some Python files are still GPL 2+ (e.g. tools/geisview/ defaults. py.in).
The documentation for Group says this:
class Group(object):
"""Represents a particular group."""
Since group is a very common word, maybe some clarification would be in order. What is this a group of, exactly?