Make GoGame widgets cleaner, tie them to actual functions
This commit is contained in:
parent
38b298ec45
commit
cb0fdcf017
2
pygo.py
2
pygo.py
|
@ -56,8 +56,6 @@ class Pygo():
|
||||||
self.gogame.show_all()
|
self.gogame.show_all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_net_direct(self, widget):
|
def on_net_direct(self, widget):
|
||||||
print 'stub: Pygo.on_menu_net_direct()'
|
print 'stub: Pygo.on_menu_net_direct()'
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,10 @@ class GoGame(gtk.HBox):
|
||||||
def __init__(self, goban):
|
def __init__(self, goban):
|
||||||
super(GoGame, self).__init__()
|
super(GoGame, self).__init__()
|
||||||
|
|
||||||
if GoGame._img_res is None:
|
|
||||||
GoGame._img_res = _build_img_res()
|
|
||||||
|
|
||||||
self.goban = goban
|
self.goban = goban
|
||||||
|
|
||||||
|
if GoGame._img_res is None:
|
||||||
|
GoGame._img_res = _build_img_res()
|
||||||
self._init_widgets()
|
self._init_widgets()
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,34 +32,36 @@ class GoGame(gtk.HBox):
|
||||||
info_box = gtk.VBox()
|
info_box = gtk.VBox()
|
||||||
info_rows = []
|
info_rows = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
info_rows.append(gtk.VBox())
|
info_rows.append(gtk.HBox())
|
||||||
|
|
||||||
to_move_label = gtk.Label('To Move:')
|
to_move_label = gtk.Label('To Move:')
|
||||||
black_cap_label = gtk.Label('Black Captures:')
|
black_cap_label = gtk.Label('Black Captures:')
|
||||||
white_cap_label = gtk.Label('White Captures:')
|
white_cap_label = gtk.Label('White Captures:')
|
||||||
|
|
||||||
self.to_move_value = gtk.Label()
|
self.to_move_value = gtk.Label('None')
|
||||||
self.black_cap_value = gtk.Label()
|
self.black_cap_value = gtk.Label('0')
|
||||||
self.white_cap_value = gtk.Label()
|
self.white_cap_value = gtk.Label('0')
|
||||||
|
|
||||||
info_rows[0].pack_start(to_move_label)
|
info_rows[0].pack_start(to_move_label, expand=False, padding=5)
|
||||||
info_rows[1].pack_start(black_cap_label)
|
info_rows[1].pack_start(black_cap_label, expand=False, padding=5)
|
||||||
info_rows[2].pack_start(white_cap_label)
|
info_rows[2].pack_start(white_cap_label, expand=False, padding=5)
|
||||||
info_rows[0].pack_end(self.to_move_value)
|
info_rows[0].pack_end(self.to_move_value, expand=False, padding=5)
|
||||||
info_rows[1].pack_end(self.black_cap_value)
|
info_rows[1].pack_end(self.black_cap_value, expand=False, padding=5)
|
||||||
info_rows[2].pack_end(self.white_cap_value)
|
info_rows[2].pack_end(self.white_cap_value, expand=False, padding=5)
|
||||||
|
|
||||||
for row in info_rows:
|
for row in info_rows:
|
||||||
info_box.pack_start(row)
|
info_box.pack_start(row, expand=False)
|
||||||
|
|
||||||
self.pass_button = gtk.Button('Pass')
|
self.pass_button = gtk.Button('Pass')
|
||||||
self.resign_button = gtk.Button('Resign')
|
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_start(self.pass_button, expand=False, padding=10)
|
||||||
info_box.pack_end(self.resign_button)
|
info_box.pack_start(self.resign_button, expand=False, padding=10)
|
||||||
|
|
||||||
self.pack_start(self.board_area)
|
self.pack_start(self.board_area)
|
||||||
self.pack_end(info_box)
|
self.pack_end(info_box, expand=False)
|
||||||
|
|
||||||
|
|
||||||
def _draw_board(self):
|
def _draw_board(self):
|
||||||
|
@ -68,6 +69,14 @@ class GoGame(gtk.HBox):
|
||||||
|
|
||||||
# gtk.gdk.gdk_pixbuf_scale_simple(img, new_width, new_height, GDK_INTERP_BILINEAR)
|
# 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'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user