Commit 7bdd385d authored by Alan Aguiar's avatar Alan Aguiar
Browse files

add sugar toolbar

parent 14118e1b
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import gtk
import sugargame import sugargame
import sugargame.canvas import sugargame.canvas
from sugar.activity import activity from sugar.activity import activity
from sugar.graphics.toolbarbox import ToolbarBox
from sugar.activity.widgets import ActivityToolbarButton
from sugar.graphics.toolbutton import ToolButton
from sugar.activity.widgets import StopButton
import main import main
...@@ -13,8 +18,31 @@ class Activity(activity.Activity): ...@@ -13,8 +18,31 @@ class Activity(activity.Activity):
activity.Activity.__init__(self, handle) activity.Activity.__init__(self, handle)
self.max_participants = 1 self.max_participants = 1
self.actividad = main.Flappy() self.actividad = main.Flappy()
self.build_toolbar()
self._pygamecanvas = sugargame.canvas.PygameCanvas(self) self._pygamecanvas = sugargame.canvas.PygameCanvas(self)
self.set_canvas(self._pygamecanvas) self.set_canvas(self._pygamecanvas)
self._pygamecanvas.grab_focus() self._pygamecanvas.grab_focus()
self._pygamecanvas.run_pygame(self.actividad.main) self._pygamecanvas.run_pygame(self.actividad.main)
def build_toolbar(self):
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.show_all()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment