Added a way to close the currently open game, to ease transition to multiple games running at once

This commit is contained in:
2012-04-17 01:46:55 -04:00
parent cb0fdcf017
commit 00b65a65df
3 changed files with 30 additions and 16 deletions

View File

@ -13,19 +13,19 @@ class GoGame(gtk.HBox):
It also handles moves and other operations on the goban.
"""
_img_res = None
img_res = None
def __init__(self, goban):
super(GoGame, self).__init__()
self.goban = goban
if GoGame._img_res is None:
GoGame._img_res = _build_img_res()
self._init_widgets()
if GoGame.img_res is None:
GoGame.img_res = _build_img_res()
self.init_widgets()
def _init_widgets(self):
def init_widgets(self):
self.board_area = gtk.DrawingArea()
# All of this is to create the info box along the right side of the board
@ -54,8 +54,8 @@ class GoGame(gtk.HBox):
self.pass_button = gtk.Button('Pass')
self.resign_button = gtk.Button('Resign')
self.pass_button.connect('clicked', self._on_pass)
self.resign_button.connect('clicked', self._on_resign)
self.pass_button.connect('clicked', self.on_pass)
self.resign_button.connect('clicked', self.on_resign)
info_box.pack_start(self.pass_button, expand=False, padding=10)
info_box.pack_start(self.resign_button, expand=False, padding=10)
@ -64,18 +64,18 @@ class GoGame(gtk.HBox):
self.pack_end(info_box, expand=False)
def _draw_board(self):
def draw_board(self):
gc = self.board_area.get_style().fg_gc[gtk.STATE_NORMAL]
# gtk.gdk.gdk_pixbuf_scale_simple(img, new_width, new_height, GDK_INTERP_BILINEAR)
def _on_pass(self, widget):
print 'GoGame._on_pass(): stub'
def on_pass(self, widget):
print 'GoGame.on_pass(): stub'
def _on_resign(self, widget):
print 'GoGame._on_resign(): stub'
def on_resign(self, widget):
print 'GoGame.on_resign(): stub'