Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/playerscoreboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'playerscoreboard.py')
-rw-r--r--playerscoreboard.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/playerscoreboard.py b/playerscoreboard.py
index 99b11bb..5c8db14 100644
--- a/playerscoreboard.py
+++ b/playerscoreboard.py
@@ -27,11 +27,12 @@ import theme
_logger = logging.getLogger('memorize-activity')
-class PlayerScoreboard(gtk.EventBox):
-
- def __init__(self, nick, fill_color, stroke_color, score = 0):
+
+class PlayerScoreboard(gtk.EventBox):
+
+ def __init__(self, nick, fill_color, stroke_color, score=0):
gtk.EventBox.__init__(self)
-
+
self.default_color = '#4c4d4f'
self.selected_color = '#818286'
self.current_color = '#4c4d4f'
@@ -43,24 +44,24 @@ class PlayerScoreboard(gtk.EventBox):
self.stroke_color = stroke_color
self.connect('size-allocate', self._allocate_cb)
-
+
# Set table
self.table = gtk.Table(2, 2, False)
self.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse(self.current_color))
- self.table.set_row_spacings(theme.PAD/2)
- self.table.set_col_spacings(theme.PAD/2)
+ self.table.set_row_spacings(theme.PAD / 2)
+ self.table.set_col_spacings(theme.PAD / 2)
self.table.set_border_width(theme.PAD)
-
+
# Score table
self.score_table = gtk.Table()
- self.score_table.set_row_spacings(theme.PAD/2)
- self.score_table.set_col_spacings(theme.PAD/2)
+ self.score_table.set_row_spacings(theme.PAD / 2)
+ self.score_table.set_col_spacings(theme.PAD / 2)
self.scores = []
self.current_x = 0
self.current_y = 0
-
+
# Set buddy icon
self.xo_buddy = join(dirname(__file__), 'images', 'stock-buddy.svg')
self.icon = svglabel.SvgLabel(self.xo_buddy, fill_color, stroke_color,
@@ -70,12 +71,12 @@ class PlayerScoreboard(gtk.EventBox):
self.waiting_icon = svglabel.SvgLabel(self.xo_buddy, \
self.default_color, '#ffffff', False, self.current_color,
theme.BODY_WIDTH, theme.BODY_HEIGHT)
-
+
# Set nick label
self.nick = gtk.Label(nick)
self.nick.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#ffffff'))
self.nick.set_alignment(0, 0.5)
-
+
# Set message label
self.msg = gtk.Label('Waiting for next game...')
self.msg.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#ffffff'))
@@ -102,7 +103,7 @@ class PlayerScoreboard(gtk.EventBox):
if self._score_cols == 0:
return
- rows = int(math.ceil(float(size/2) / self._score_cols))
+ rows = int(math.ceil(float(size / 2) / self._score_cols))
self.score_table.resize(rows, self._score_cols)
self.score_table.set_size_request(-1,
(theme.SCORE_SIZE + theme.PAD / 2) * (rows) - theme.PAD / 2)
@@ -116,19 +117,19 @@ class PlayerScoreboard(gtk.EventBox):
else:
score_pixbuf_unsel = None
score_pixbuf_sel = None
-
+
new_score = Score(self.fill_color, self.stroke_color,
score_pixbuf_sel, score_pixbuf_unsel, self.status)
self.scores.append(new_score)
new_score.show()
- self.score_table.attach(new_score, self.current_x , self.current_x + 1,
+ self.score_table.attach(new_score, self.current_x, self.current_x + 1,
self.current_y, self.current_y + 1, gtk.SHRINK, gtk.SHRINK)
self.current_x += 1
if self.current_x == self._score_cols:
self.current_x = 0
self.current_y += 1
self.queue_draw()
-
+
def set_selected(self, sel):
self.status = sel
if sel:
@@ -150,7 +151,7 @@ class PlayerScoreboard(gtk.EventBox):
del self.scores
self.scores = []
self.queue_draw()
-
+
def set_wait_mode(self, status):
if status:
self.table.remove(self.icon)
@@ -164,6 +165,6 @@ class PlayerScoreboard(gtk.EventBox):
if len(self.scores) == 0:
self.table.remove(self.msg)
self.queue_draw()
-
+
def set_message(self, msg):
self.msg.set_text(msg)