Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgnacio Rodríguez <ignaciorodriguez@sugarlabs.org>2013-12-06 15:10:14 (GMT)
committer Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org>2013-12-06 15:10:14 (GMT)
commitd6dd98b04dea43bb58ca44e212f0e082237bce41 (patch)
tree538b0b1a3ad8956e882e06021adc89aaf6949b3e
parented96496170a4a2ba868f002f8ff8eface6177716 (diff)
Enable game key support
-rw-r--r--activity.py2
-rw-r--r--stopwatch.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/activity.py b/activity.py
index 6660fa7..ce99523 100644
--- a/activity.py
+++ b/activity.py
@@ -92,7 +92,7 @@ class StopWatchActivity(Activity):
self.tubebox = dobject.TubeBox()
self.timer = dobject.TimeHandler("main", self.tubebox)
- self.gui = stopwatch.GUIView(self.tubebox, self.timer)
+ self.gui = stopwatch.GUIView(self.tubebox, self.timer, self)
self.set_canvas(self.gui.display)
self.show_all()
diff --git a/stopwatch.py b/stopwatch.py
index ddb4c3c..6d4971e 100644
--- a/stopwatch.py
+++ b/stopwatch.py
@@ -145,7 +145,7 @@ class WatchModel():
thread.start_new_thread(self._view_listener, (self._state,))
class OneWatchView():
- def __init__(self, mywatch, myname, mymarks, timer):
+ def __init__(self, mywatch, myname, mymarks, timer, activity):
self._logger = logging.getLogger('stopwatch.OneWatchView')
self._watch_model = mywatch
self._name_model = myname
@@ -245,7 +245,7 @@ class OneWatchView():
self.display.connect('focus-in-event', self._got_focus_cb)
self.display.connect('focus-out-event', self._lost_focus_cb)
self.display.add_events(gtk.gdk.ALL_EVENTS_MASK)
- self.display.connect('key-press-event', self._keypress_cb)
+ activity.connect('key-press-event', self._keypress_cb)
#self.display.connect('key-release-event', self._keyrelease_cb)
self._watch_model.register_view_listener(self.update_state)
@@ -407,7 +407,7 @@ class OneWatchView():
class GUIView():
NUM_WATCHES = 9
- def __init__(self, tubebox, timer):
+ def __init__(self, tubebox, timer, activity):
self.timer = timer
self._views = []
self._names = []
@@ -423,7 +423,7 @@ class GUIView():
marks_handler = dobject.UnorderedHandler("marks"+str(i), tubebox)
marks_model = dobject.AddOnlySet(marks_handler, translator = dobject.float_translator)
self._markers.append(marks_model)
- watch_view = OneWatchView(watch_model, name_model, marks_model, timer)
+ watch_view = OneWatchView(watch_model, name_model, marks_model, timer, activity)
self._views.append(watch_view)
self.display = gtk.VBox()