Factored some relevant data into the GoGame class, made Game -> Close work correctly
This commit is contained in:
parent
00b65a65df
commit
f596e0f3ee
21
pygo.py
21
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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user