Make GoGame widgets cleaner, tie them to actual functions

This commit is contained in:
Anna Rose 2012-04-17 01:39:16 -04:00
parent 38b298ec45
commit cb0fdcf017
2 changed files with 26 additions and 19 deletions

View File

@ -56,8 +56,6 @@ class Pygo():
self.gogame.show_all()
def on_net_direct(self, widget):
print 'stub: Pygo.on_menu_net_direct()'

View File

@ -18,11 +18,10 @@ class GoGame(gtk.HBox):
def __init__(self, goban):
super(GoGame, self).__init__()
if GoGame._img_res is None:
GoGame._img_res = _build_img_res()
self.goban = goban
if GoGame._img_res is None:
GoGame._img_res = _build_img_res()
self._init_widgets()
@ -33,34 +32,36 @@ class GoGame(gtk.HBox):
info_box = gtk.VBox()
info_rows = []
for i in range(3):
info_rows.append(gtk.VBox())
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()
self.black_cap_value = gtk.Label()
self.white_cap_value = gtk.Label()
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)
info_rows[1].pack_start(black_cap_label)
info_rows[2].pack_start(white_cap_label)
info_rows[0].pack_end(self.to_move_value)
info_rows[1].pack_end(self.black_cap_value)
info_rows[2].pack_end(self.white_cap_value)
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)
info_box.pack_start(row, expand=False)
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)
info_box.pack_end(self.pass_button)
info_box.pack_end(self.resign_button)
info_box.pack_start(self.pass_button, expand=False, padding=10)
info_box.pack_start(self.resign_button, expand=False, padding=10)
self.pack_start(self.board_area)
self.pack_end(info_box)
self.pack_end(info_box, expand=False)
def _draw_board(self):
@ -69,6 +70,14 @@ class GoGame(gtk.HBox):
# 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_resign(self, widget):
print 'GoGame._on_resign(): stub'
# pixmap.draw_pixbuf(None, pixbuf, 0, 0, x, y, -1, -1, gtk.gdk.RGB_DITHER_NONE, 0, 0)