From f596e0f3ee5101837fd0b562cc4b584ac52ac6af Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Tue, 17 Apr 2012 14:59:46 -0400 Subject: [PATCH] Factored some relevant data into the GoGame class, made Game -> Close work correctly --- pygo.py | 21 +++++++-------------- widgets/gogame.py | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pygo.py b/pygo.py index 857139f..e493903 100755 --- a/pygo.py +++ b/pygo.py @@ -18,10 +18,7 @@ class Pygo(): def __init__(self): self.resize = True - self.goban = None - - self.network_mode = False - self.our_color = None + self.go_game = None self.init_user_interface('./ui/default.glade') self.init_widgets() @@ -41,21 +38,17 @@ class Pygo(): def on_game_close(self, widget): - print 'Pygo.on_game_close(): stub' - - - def on_local_new(self, widget): if self.gogame: self.contents.remove(self.gogame) self.gogame = None - if self.goban: - self.goban = None - self.goban = goban.Goban() - self.network_mode = False - self.our_color = None - self.gogame = gogame.GoGame(self.goban) + def on_local_new(self, widget): + # Remove any existing game + # fixme - we'll remove this later and add a new concurrent game instead + self.on_game_close(None) + + self.gogame = gogame.GoGame(goban.Goban()) self.contents.pack_start(self.gogame) self.gogame.show_all() diff --git a/widgets/gogame.py b/widgets/gogame.py index 2027fb8..0909885 100644 --- a/widgets/gogame.py +++ b/widgets/gogame.py @@ -15,7 +15,7 @@ class GoGame(gtk.HBox): img_res = None - def __init__(self, goban): + def __init__(self, goban, network_mode=False, our_color=None): super(GoGame, self).__init__() self.goban = goban