From dc08b0a63060a0a2dc03ac414bbad8480baec87f Mon Sep 17 00:00:00 2001 From: Andrés Ambrois Date: Thu, 24 Jul 2008 03:00:28 +0000 Subject: Added Pass and Undo buttons (not shown yet) Facilities for passing and undoing moves are not functional yet, so the buttons are not packed. --- diff --git a/activity.py b/activity.py index 204664c..b5f091a 100755 --- a/activity.py +++ b/activity.py @@ -50,23 +50,32 @@ class PlayGo(Activity): self.info_panel = InfoPanel() #Prepare the main box - self._main_view = gtk.HBox() + self._main_view = gtk.VBox() + + #Prepare the top box + self.top_view = gtk.HBox(False, 10) + self.boardWidget.set_size_request(770, 770) + self.top_view.pack_start(self.boardWidget, False) - #Prepare the left box - self.left_view = gtk.VBox(False) - self.left_view.pack_start(self.boardWidget) self.info_panel = InfoPanel() - self.left_view.pack_start(self.info_panel, False) - #Pack the left view - self._main_view.pack_start(self.left_view) - - #Prepare the right view - self.right_view = gtk.VBox() + self.buttons_box = gtk.VBox() + #Pass button + self.pass_button = gtk.Button(_('Pass')) + self.pass_button.connect("clicked", self.pass_cb) +# self.buttons_box.pack_start(self.pass_button, False, False, 10) - #Pack the right view - self._main_view.pack_end(self.right_view, False) + #Undo button + self.undo_button = gtk.Button(_('Undo')) + self.pass_button.connect("clicked", self.undo_cb) +# self.buttons_box.pack_start(self.undo_button, False, False, 10) + self.top_view.pack_start(self.buttons_box, False) + + #Pack the top box and the InfoPanel into the main box + self._main_view.pack_start(self.top_view) + self._main_view.pack_start(self.info_panel) + #Set canvas and show all self.set_canvas(self._main_view) self.show_all() @@ -104,6 +113,12 @@ class PlayGo(Activity): self.connect('key-press-event', self.key_press_cb) + def pass_cb(self, widget, data=None): + self.game.change_turn() + + def undo_cb(self, widget, data=None): + pass + def _get_buddy(self, cs_handle): """Get a Buddy from a channel specific handle.""" # FIXME: After Update.1, design a better API for sugar.presence diff --git a/infopanel.py b/infopanel.py index 557a175..783c111 100755 --- a/infopanel.py +++ b/infopanel.py @@ -6,9 +6,9 @@ class InfoPanel(gtk.VBox): def __init__(self): gtk.VBox.__init__(self) self.status_label = gtk.Label('Status') - self.pack_start(self.status_label, False, True, 10) + self.pack_start(self.status_label, True, True, 10) self.score_label = gtk.Label('Score') - self.pack_start(self.score_label, False, True, 10) + self.pack_start(self.score_label, True, True, 10) self.show_all() def show(self, text): -- cgit v0.9.1