From 8e573f1a867d380994dd0f3d13b49788df6b60a9 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Mon, 23 Apr 2012 21:30:31 -0400 Subject: [PATCH] Hide 'to move' information when the game is over --- widgets/gogame.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/widgets/gogame.py b/widgets/gogame.py index c49c425..5a24af6 100644 --- a/widgets/gogame.py +++ b/widgets/gogame.py @@ -29,26 +29,20 @@ class GoGame(gtk.HBox): # All of this is to create the info box along the right side of the board info_box = gtk.VBox() info_rows = [] - for i in range(3): + for i in range(2): info_rows.append(gtk.HBox()) to_move_label = gtk.Label('To Move:') black_cap_label = gtk.Label('Black Captures:') white_cap_label = gtk.Label('White Captures:') - self.to_move_value = gtk.Label('None') self.black_cap_value = gtk.Label('0') self.white_cap_value = gtk.Label('0') - info_rows[0].pack_start(to_move_label, expand=False, padding=5) - info_rows[1].pack_start(black_cap_label, expand=False, padding=5) - info_rows[2].pack_start(white_cap_label, expand=False, padding=5) - info_rows[0].pack_end(self.to_move_value, expand=False, padding=5) - info_rows[1].pack_end(self.black_cap_value, expand=False, padding=5) - info_rows[2].pack_end(self.white_cap_value, expand=False, padding=5) - - for row in info_rows: - info_box.pack_start(row, expand=False) + self.to_move_box = gtk.HBox() + self.to_move_value = gtk.Label('None') + self.to_move_box.pack_start(to_move_label, expand=False, padding=5) + self.to_move_box.pack_end(self.to_move_value, expand=False, padding=5) self.winner_box = gtk.HBox() self.winner_value = gtk.Label('None') @@ -56,6 +50,15 @@ class GoGame(gtk.HBox): self.winner_box.pack_end(self.winner_value, expand=False, padding=5) info_box.pack_start(self.winner_box, expand=False) + info_box.pack_start(self.to_move_box, expand=False) + + info_rows[0].pack_start(black_cap_label, expand=False, padding=5) + info_rows[1].pack_start(white_cap_label, expand=False, padding=5) + info_rows[0].pack_end(self.black_cap_value, expand=False, padding=5) + info_rows[1].pack_end(self.white_cap_value, expand=False, padding=5) + + for row in info_rows: + info_box.pack_start(row, expand=False) self.pass_button = gtk.Button('Pass') self.resign_button = gtk.Button('Resign') @@ -188,10 +191,13 @@ class GoGame(gtk.HBox): def update_info(self): if self.goban.to_move == goban.Goban.BLACK: move = 'Black' + self.to_move_box.show() elif self.goban.to_move == goban.Goban.WHITE: move = 'White' + self.to_move_box.show() else: move = 'None' + self.to_move_box.hide() if self.goban.winner != goban.Goban.EMPTY: if self.goban.winner == goban.Goban.BLACK: