diff options
author | Wade Brainerd <wadetb@gmail.com> | 2010-06-27 17:18:58 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2010-06-27 17:18:58 (GMT) |
commit | d3f13b941ac97695fdf83efb272f41f468c88bf7 (patch) | |
tree | 6a894df59b58aa27ac3c58c6bed89ad48be29213 /sugargame/canvas.py | |
parent | a330a055320aad2c726243e39a0bb9bfe7f71f6f (diff) |
Fixes for event handling issues. Also clean up the test activity slightly.
Diffstat (limited to 'sugargame/canvas.py')
-rw-r--r-- | sugargame/canvas.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sugargame/canvas.py b/sugargame/canvas.py index cf99a13..980cb73 100644 --- a/sugargame/canvas.py +++ b/sugargame/canvas.py @@ -7,13 +7,20 @@ import event CANVAS = None class PygameCanvas(gtk.EventBox): - def __init__(self, mainwindow): + + """ + mainwindow is the activity intself. + """ + def __init__(self, mainwindow, pointer_hint = True): gtk.EventBox.__init__(self) global CANVAS assert CANVAS == None, "Only one PygameCanvas can be created, ever." CANVAS = self + # Initialize Events translator before widget gets "realized". + self.translator = event.Translator(mainwindow, self) + self._mainwindow = mainwindow self.set_flags(gtk.CAN_FOCUS) @@ -38,15 +45,14 @@ class PygameCanvas(gtk.EventBox): pygame.init() # Restore the default cursor. - self._socket.get_window().set_cursor(None) + self._socket.window.set_cursor(None) # Initialize the Pygame window. r = self.get_allocation() pygame.display.set_mode((r.width, r.height), pygame.RESIZABLE) # Hook certain Pygame functions with GTK equivalents. - translator = event.Translator(self._mainwindow, self) - translator.hook_pygame() + self.translator.hook_pygame() # Run the Pygame main loop. main_fn() |