Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2013-05-14 23:24:15 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2013-05-14 23:24:15 (GMT)
commit35bca066c916b5264d6fb956b18c8306c5f119b8 (patch)
treea039da61b3ebf61741f9d2d426a34644eab52662
parentee35c7d88c55b67b77661e146056fc5559f12186 (diff)
show current player
-rwxr-xr-xactivity.py19
-rwxr-xr-xmain.py3
2 files changed, 19 insertions, 3 deletions
diff --git a/activity.py b/activity.py
index 7e9495f..d028243 100755
--- a/activity.py
+++ b/activity.py
@@ -27,7 +27,6 @@ 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
from sugar.graphics.colorbutton import ColorToolButton
from sugar.graphics.toolbarbox import ToolbarButton
@@ -61,9 +60,21 @@ class Activity(activity.Activity):
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
+ # toolbars
self.build_size_toolbar(toolbar_box)
self.build_colors_toolbar(toolbar_box)
+ separator = gtk.SeparatorToolItem()
+ toolbar_box.toolbar.insert(separator, -1)
+ separator.show()
+
+ #current
+ item = gtk.ToolItem()
+ self.current_label = gtk.Label()
+ self.current_label.set_text(' %s ' % _('Player 1'))
+ item.add(self.current_label)
+ toolbar_box.toolbar.insert(item, -1)
+
# end separator
separator = gtk.SeparatorToolItem()
separator.props.draw = False
@@ -254,6 +265,12 @@ class Activity(activity.Activity):
b = color.blue *255 / 65536
return (r, g, b)
+ def set_current_player(self, player):
+ if player == 'A':
+ self.current_label.set_text(' %s ' % _('Player 1'))
+ else:
+ self.current_label.set_text(' %s ' % _('Player 2'))
+
def read_file(self, file_path):
pass
diff --git a/main.py b/main.py
index 841d223..85a0356 100755
--- a/main.py
+++ b/main.py
@@ -308,13 +308,12 @@ class Game:
elif event.type == pygame.MOUSEBUTTONDOWN:
pos = event.pos
ret = self.where(pos)
- print ret
if ret == False:
if self.current == 'A':
self.current = 'B'
else:
self.current = 'A'
- print self.current
+ self.parent.set_current_player(self.current)
pygame.display.flip()