Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alan Aguiar
Test
Commits
7bdd385d
Commit
7bdd385d
authored
Mar 03, 2014
by
Alan Aguiar
Browse files
add sugar toolbar
parent
14118e1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
activity.py
View file @
7bdd385d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
gtk
import
sugargame
import
sugargame.canvas
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
...
...
@@ -13,8 +18,31 @@ class Activity(activity.Activity):
activity
.
Activity
.
__init__
(
self
,
handle
)
self
.
max_participants
=
1
self
.
actividad
=
main
.
Flappy
()
self
.
build_toolbar
()
self
.
_pygamecanvas
=
sugargame
.
canvas
.
PygameCanvas
(
self
)
self
.
set_canvas
(
self
.
_pygamecanvas
)
self
.
_pygamecanvas
.
grab_focus
()
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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment