Index: client/common_lib/factory_test.py |
diff --git a/client/common_lib/factory_test.py b/client/common_lib/factory_test.py |
index 988d1b12fe16bdba2a735f5015336263b666a718..e356f01bd29a3905e7524fc687df74f846a00947 100644 |
--- a/client/common_lib/factory_test.py |
+++ b/client/common_lib/factory_test.py |
@@ -20,7 +20,7 @@ import sys |
def XXX_log(s): |
- print >> sys.stderr, '--- XXX : ' + s |
+ print >> sys.stderr, 'FACTORY: ' + s |
_BLACK = gtk.gdk.color_parse('black') |
@@ -50,9 +50,11 @@ def test_switch_on_trigger(event): |
def run_test_widget(test_widget=None, test_widget_size=None, |
- window_registration_callback=None): |
+ invisible_cursor=True, |
+ window_registration_callback=None, |
+ cleanup_callback=None): |
+ |
window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
- window.connect('destroy', lambda _: gtk.main_quit()) |
window.modify_bg(gtk.STATE_NORMAL, _BLACK) |
window.set_size_request(*test_widget_size) |
@@ -65,11 +67,11 @@ def run_test_widget(test_widget=None, test_widget_size=None, |
gtk.gdk.pointer_grab(window.window, confine_to=window.window) |
gtk.gdk.keyboard_grab(window.window) |
- # create and use an invisible cursor |
- pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) |
- color = gtk.gdk.Color() |
- cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) |
- window.window.set_cursor(cursor) |
+ if invisible_cursor: |
+ pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) |
+ color = gtk.gdk.Color() |
+ cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) |
+ window.window.set_cursor(cursor) |
if window_registration_callback is not None: |
window_registration_callback(window) |
@@ -78,6 +80,9 @@ def run_test_widget(test_widget=None, test_widget_size=None, |
gtk.main() |
XXX_log('factory_test quit gtk.main') |
+ if cleanup_callback is not None: |
+ cleanup_callback() |
+ |
gtk.gdk.pointer_ungrab() |
gtk.gdk.keyboard_ungrab() |