From 957ac9839e687edddac661e795a64d0b327e4231 Mon Sep 17 00:00:00 2001 From: Gerard J. Cerchio Date: Tue, 11 Dec 2007 17:47:04 +0000 Subject: The activity now works as a physical board would. Two players may play locally or through the network right click remvoves stones, initiator is always white --- diff --git a/NEWS b/NEWS index 166cb58..36a9852 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +21 +* board graphics and stone graphics complete +* can now play using the board just like any physical board, +* at connect initiator is always white turn phrases at bottom do not work +* remove stones with right click for now + 20 * morph Connect into Go most of the boardwidget is complete, * you can click play on a single machine (sortof) diff --git a/PlayGo-1.xo b/PlayGo-1.xo index 9eb2880..0a1f6f1 100644 --- a/PlayGo-1.xo +++ b/PlayGo-1.xo Binary files differ diff --git a/activity.py b/activity.py index 756a712..4b40c0e 100755 --- a/activity.py +++ b/activity.py @@ -12,24 +12,24 @@ from sugar.presence import presenceservice import sugar.logger import boardwidget -import game +from game import SERVICE, GoBoard, GoGame from sugar.presence.tubeconn import TubeConnection from buddiespanel import BuddiesPanel from infopanel import InfoPanel -logger = logging.getLogger('connect-activity') +logger = logging.getLogger('PlayGO') class PlayGo(Activity): def __init__(self, handle): Activity.__init__(self, handle) - logger.debug('Starting Connect activity...') + logger.debug('Starting Playgo activity...') - board = game.GoBoard( 19 ) - self.grid = boardwidget.BoardWidget( board ) + board = GoBoard( 19 ) + self.boardWidget = boardwidget.BoardWidget( board ) self.buddies_panel = BuddiesPanel() @@ -41,8 +41,8 @@ class PlayGo(Activity): hbox = hippo.CanvasBox(spacing=4, orientation=hippo.ORIENTATION_HORIZONTAL) + hbox.append(hippo.CanvasWidget(widget=self.boardWidget), hippo.PACK_EXPAND ) hbox.append(self.buddies_panel) - hbox.append(hippo.CanvasWidget(widget=self.grid), hippo.PACK_EXPAND) vbox.append(hbox, hippo.PACK_EXPAND) vbox.append(self.info_panel, hippo.PACK_END) @@ -59,6 +59,7 @@ class PlayGo(Activity): self.pservice = presenceservice.get_instance() owner = self.pservice.get_owner() self.owner = owner + self.shared = False # This displays the buddies_panel even if we fail to connect: self.buddies_panel.add_watcher(owner) @@ -120,6 +121,7 @@ class PlayGo(Activity): def _shared_cb(self, activity): logger.debug('My Connect activity was shared') + self.shared = True self.initiating = True self._setup() @@ -186,7 +188,7 @@ class PlayGo(Activity): tube_conn = TubeConnection(self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) - self.game = GoGame(tube_conn, self.grid, self.initiating, + self.game = GoGame(tube_conn, self.boardWidget, self.initiating, self.buddies_panel, self.info_panel, self.owner, self._get_buddy, self) diff --git a/activity/activity.info b/activity/activity.info index f5ed3b4..274c415 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = PlayGo -service_name = org.laptop.Playg +service_name = org.laptop.PlayGo class = activity.PlayGo icon = activity-go activity_version = 1 diff --git a/boardwidget.py b/boardwidget.py index 373a898..a2b868d 100755 --- a/boardwidget.py +++ b/boardwidget.py @@ -2,11 +2,12 @@ import logging import cairo import gobject import gtk +import random import game -logger = logging.getLogger('PlayGo-activity.gridwidget') +logger = logging.getLogger('PlayGo.boardwidget') class BoardWidget(gtk.EventBox): @@ -33,17 +34,22 @@ class BoardWidget(gtk.EventBox): self.columns = aBoard.size self.rows = aBoard.size self.lastUnit = 0 + self.lastDat = 0 + self.lastX = 0 + self.lastY = 0 + self.lastCmap = None self.myBoard = aBoard + self.myGame = None self.lastColor = 1 # get the bitmap for genuine simulated wooden board - input = open("./images/board.gif") - imagebuf = input.read() - pixbufloader = gtk.gdk.PixbufLoader() - pixbufloader.write(imagebuf) - pixbufloader.close() - self.pixBoard = pixbufloader.get_pixbuf() +# input = open("./images/board.gif") +# imagebuf = input.read() +# pixbufloader = gtk.gdk.PixbufLoader() +# pixbufloader.write(imagebuf) +# pixbufloader.close() +# self.pixBoard = pixbufloader.get_pixbuf() # get the bitmap for genuine simulated white stone input = open("./images/white.gif") @@ -60,24 +66,53 @@ class BoardWidget(gtk.EventBox): pixbufloader.write(imagebuf) pixbufloader.close() self.pixBlack = pixbufloader.get_pixbuf() + + logger.debug( "baord widget starts" ) + +# for x in range( 19 ): +# for y in range( 19 ): +# self.myBoard.setPointi(x, y, random.randint( 0, 3 ) ) + + def check_coord (self, i, j): return i >= 0 and i < self.rows and j >= 0 and j < self.columns - def insert(self, column, value): + def insert(self, dat, value): """Return: None : no winner 0, 1: player 0/1 wins the game """ - discs = [row[column] for row in self.grid] + color = dat >> 16 + y = dat & 0xff + x = ( dat >> 8 ) & 0xff + + logger.debug( 'stone event x=%d y=%d col=%d value=%d', x,y, dat, color ) + + assert x < self.myBoard.size + assert y < self.myBoard.size + + self.myBoard.setPointi( x, y, color ) - if -1 not in discs: - raise ValueError('Column is full') - row = self.rows - list(reversed(discs)).index(-1) - 1 - self.grid[row][column] = value + return None - return self.check_winner(row, column, value) + + def remove(self, column, value): + """Return: + None : no winner + 0, 1: player 0/1 wins the game + """ + y = column & 0xff + x = column >> 8 + + logger.debug( 'remove stone event x=%d y=%d col=%d value=%d', x,y,column, value ) + + assert x < self.myBoard.size + assert y < self.myBoard.size + + self.myBoard.setPointi( x, y, 0 ) + return None def draw_background(self, rect, unit, ctx): @@ -122,9 +157,7 @@ class BoardWidget(gtk.EventBox): for y in seq : ctx.arc( unit * x, unit * y, 3, 0, -1e-10) ctx.fill_preserve() - ctx.stroke() - - + ctx.stroke() def draw_stone(self, x, y, color, unit, ctx): @@ -137,6 +170,7 @@ class BoardWidget(gtk.EventBox): ct.set_source_pixbuf(self.pixWhiteSized, unit*x - unit/2, unit*y - unit/2, ) ctx.paint() + def draw_stones( self, ctx ): @@ -155,27 +189,79 @@ class BoardWidget(gtk.EventBox): def get_mouse_event_col(self, event): unit, x0, y0 = self.get_coordinates(self.get_allocation()) - col = ( event.x - x0 ) / unit - row = ( event.y - y0 ) / unit + col = ( ( event.x - x0 ) / unit ) - 0.5 + row = ( ( event.y - y0 ) / unit ) - 0.5 return int(row), int(col) def motion_cb(self, event): - col = self.get_mouse_event_col(event) + y, x = self.get_mouse_event_col(event) + dat = ( y << 8 ) + x + + if dat == self.lastDat : + return + + ctx = self.myWidget.window.cairo_create() + ctx.save() + + unit, x0, y0 = self.get_coordinates(self.get_allocation()) + ctx.translate( x0, y0 ) + + + #ctx.set_source_rgba(0, 0, 0, 0 ) + #ctx.arc( self.lastX, self.lastY, 16, 0, -1e-10) + #self.myWidget.window.clear_area( self.lastX + ( unit ), self.lastY, unit, unit ) + #if self.lastCmap : + # self.myWidget.window.draw_image( ctx, self.lastCmap, 0, 0, self.lastX, self.lastY, unit, unit ) + + #self.myWidget.window.clear_area( int(self.lastX), int(self.lastY), int(unit), int(unit) ) + + + ctx.set_source_rgba(0, 0, 0, .5 ) + self.lastX =unit * x + self.lastY =unit * y + #ctx.arc( self.lastX, self.lastY, 16, 0, -1e-10) + #ctx.fill_preserve() + #ctx.stroke() + ctx.restore() def button_release_cb(self, event): - self.motion_cb(event) - row, col = self.get_mouse_event_col(event) + x, y = self.get_mouse_event_col(event) + dat = ( y << 8 ) + x - self.myBoard.setPointi( col, row, self.lastColor ) - if self.lastColor == 1: - self.lastColor = 2 - else : - self.lastColor = 1 + if self.myGame is None : + if event.button != 3 : + if self.lastColor is 1: + dat = dat | 0x10000 + self.lastColor = 2; + else : + dat = dat | 0x20000 + self.lastColor = 1; + + self.insert( dat, 1 ) + + else: + + if event.button != 3 : + if self.myGame.is_initiator : + dat = dat | 0x10000 + else : + dat = dat | 0x20000 + + self.emit('insert-requested', dat ) + + logger.debug( 'mouse up button event x=%d y=%d row=%d col=%d value=%x', event.x, event.y, x, y, dat ) + + +# self.myBoard.setPointi( col, row, self.lastColor ) +# if self.lastColor == 1: +# self.lastColor = 2 +# else : +# self.lastColor = 1 +# self.window.invalidate_rect(self.get_allocation(), True) - #self.emit('insert-requested', col) def queue_draw(self): self.output.queue_draw() @@ -184,6 +270,8 @@ class BoardWidget(gtk.EventBox): """Returns tuple (unit size, origin x, origin y) suitable for drawing a grid within @rect.""" + rect = self.get_allocation() + if rect.height / float(self.rows) < rect.width / float(self.columns): # wide unit = rect.height / float(self.rows) @@ -195,37 +283,65 @@ class BoardWidget(gtk.EventBox): x0 = rect.x y0 = rect.y + (rect.height - self.rows * unit) / 2.0 - # now shrink the size for a 1 unit boarder + # now shrink the size for a 1 unit border unit = unit - unit / self.rows - return unit, x0, y0 - - def draw(self, rect, ctx): - """Draw a grid using the cairo context @ctx within the rectangle + #return unit, x0, y0 + return unit, 0, 0 + + def draw(self, rect, ctx, win): + """Draw a board using the cairo context @ctx within the rectangle @rect.""" - ctx.save() + #ctx.save() ctx.set_line_cap(cairo.LINE_CAP_ROUND) unit, x0, y0 = self.get_coordinates(rect) # I could not find the resize event so... if self.lastUnit != unit : + + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size("./images/board.gif", rect.width, rect.height ) + pixmap, mask = pixbuf.render_pixmap_and_mask() + del pixbuf + + pctx = pixmap.cairo_create() + self.draw_lines( rect, unit, pctx ) + win.set_back_pixmap(pixmap, False ) + del pixmap + del pctx + + # now resize the stones self.pixBlackSized = self.pixBlack.scale_simple( int(unit), int(unit), gtk.gdk.INTERP_BILINEAR ) self.pixWhiteSized = self.pixWhite.scale_simple( int(unit), int(unit), gtk.gdk.INTERP_BILINEAR ) self.lastUnit = unit + + # redraw it all + win.invalidate_rect( rect, False ) # bx, by = self.pixBoard.get_size() # if rect.height > by : # self.pixBoard = self.pixBoard.scaleSimple( bx, by, gtk.gdk.INTERP_BILINEAR ) ctx.translate( x0, y0 ) - self.draw_background( rect, unit, ctx ) - self.draw_lines( rect, unit, ctx ) - self.draw_stones( ctx ) - ctx.restore() + #self.draw_background( rect, unit, ctx ) + #self.draw_lines( rect, unit, ctx ) + self.draw_stones( ctx ) + + self.myWidget.window.set_cursor( gtk.gdk.Cursor(gtk.gdk.CIRCLE) ) + #ctx.restore() def expose_cb(self, widget, event): + rect = self.get_allocation() + if rect.height != rect.width : + if rect.height > rect.width : + widget.window.resize( rect.width, rect.width ) + else : + widget.window.resize( rect.height, rect.height ) +# + self.myWidget = widget ctx = widget.window.cairo_create() + ctx.save() rect = self.get_allocation() - self.draw(rect, ctx) + self.draw(rect, ctx, widget.window ) + ctx.restore() diff --git a/buddiespanel.py b/buddiespanel.py index 5787f5c..4067b8c 100755 --- a/buddiespanel.py +++ b/buddiespanel.py @@ -79,11 +79,11 @@ class BuddiesPanel(hippo.CanvasBox): vbox = self._create_buddy_vbox(buddy) hbox.append(vbox) - count_font = style.FONT_BOLD.get_pango_desc() - count_font.set_size(30000) - count = hippo.CanvasText(text="0", color=style.COLOR_WHITE.get_int(), - font_desc=count_font) - hbox.append(count) +# count_font = style.FONT_BOLD.get_pango_desc() +# count_font.set_size(30000) +# count = hippo.CanvasText(text="0", color=style.COLOR_WHITE.get_int(), +# font_desc=count_font) +# hbox.append(count) self.players_box.append(hbox) diff --git a/game.py b/game.py index 1af1040..72fbece 100755 --- a/game.py +++ b/game.py @@ -83,11 +83,13 @@ class GoBoard( object ) : class GoGame(ExportedGObject): - def __init__(self, tube, grid, is_initiator, buddies_panel, info_panel, + def __init__(self, tube, boardwidget, is_initiator, buddies_panel, info_panel, owner, get_buddy, activity): + super(GoGame, self).__init__(tube, PATH) + self.tube = tube - self.grid = grid + self.boardWidget = boardwidget self.is_initiator = is_initiator self.entered = False self.player_id = None @@ -96,6 +98,8 @@ class GoGame(ExportedGObject): self.owner = owner self._get_buddy = get_buddy self.activity = activity + + boardwidget.myGame = self # list indexed by player ID # 0, 1 are players 0, 1 @@ -103,7 +107,7 @@ class GoGame(ExportedGObject): self.ordered_bus_names = [] self.tube.watch_participants(self.participant_change_cb) - self.grid.connect('insert-requested', self.insert_requested_cb) + self.boardWidget.connect('insert-requested', self.insert_requested_cb) def participant_change_cb(self, added, removed): # Initiator is player 0, other player is player 1. @@ -149,7 +153,7 @@ class GoGame(ExportedGObject): """ @method(dbus_interface=IFACE, in_signature='aanas', out_signature='') - def Welcome(self, grid, bus_names): + def Welcome(self, aBoard, bus_names): """To be called on the incoming player by the other players to inform them of the game state. @@ -159,10 +163,9 @@ class GoGame(ExportedGObject): cheating/bugs """ if self.player_id is None: - _logger.debug('Welcomed to the game. Player bus names are %r', - bus_names) - self.grid.grid = grid - dump_grid(grid) + _logger.debug('Welcomed to the game. Player bus names are %r', bus_names) + self.boardWidget.myBoard.board = aBoard + dump_grid( aBoard ) self.ordered_bus_names = bus_names self.player_id = bus_names.index(self.tube.get_unique_name()) # OK, now I'm synched with the game, I can welcome others @@ -177,7 +180,7 @@ class GoGame(ExportedGObject): _logger.debug("It's my turn already!") self.change_turn() - redraw(self.grid) + redraw( self.boardWidget ) else: _logger.debug("I've already been welcomed, doing nothing") @@ -185,27 +188,31 @@ class GoGame(ExportedGObject): self.tube.add_signal_receiver(self.hello_cb, 'Hello', IFACE, path=PATH, sender_keyword='sender') - @signal(dbus_interface=IFACE, signature='n') + @signal(dbus_interface=IFACE, signature='i') def Insert(self, column): """Signal that the local player has placed a disc.""" - assert column >= 0 - assert column < 7 + #assert column >= self.boardWidget.myBoard.size + #assert column < self.boardWidget.myBoard.size def hello_cb(self, sender=None): + """Tell the newcomer what's going on.""" _logger.debug('Newcomer %s has joined', sender) self.ordered_bus_names.append(sender) + if len(self.ordered_bus_names) == 2: buddy = self._get_buddy(self.tube.bus_name_to_handle[sender]) self.buddies_panel.add_player(buddy) + _logger.debug('Bus names are now: %r', self.ordered_bus_names) _logger.debug('Welcoming newcomer and sending them the game state') - self.tube.get_object(sender, PATH).Welcome(self.grid.grid, + + self.tube.get_object(sender, PATH).Welcome(self.boardWidget.myBoard.board, self.ordered_bus_names, dbus_interface=IFACE) + if (self.player_id == 0 and len(self.ordered_bus_names) == 2): - _logger.debug("This is my game and an opponent has joined. " - "I go first") + _logger.debug("This is my game and an opponent has joined. I go first") self.change_turn() def insert_cb(self, column, sender=None): @@ -218,16 +225,16 @@ class GoGame(ExportedGObject): return try: - winner = self.grid.insert(column, self.get_active_player()) + winner = self.boardWidget.insert(column, self.get_active_player()) except ValueError: return - dump_grid(self.grid.grid) + dump_grid(self.boardWidget.myBoard.board) if winner is not None: _logger.debug('Player with handle %d wins', handle) self.info_panel.show(_('The other player wins!')) - redraw(self.grid) + redraw(self.boardWidget) return self.change_turn() @@ -244,60 +251,48 @@ class GoGame(ExportedGObject): if self.get_active_player() == self.player_id: _logger.debug('It\'s my turn now') self.info_panel.show(_('Your turn')) - self.grid.selected_column = 3 self.activity.grab_focus() else: _logger.debug('It\'s not my turn') - self.grid.selected_column = None + self.boardWidget.selected_column = None - redraw(self.grid) + redraw(self.boardWidget) def get_active_player(self): - count = {} - - for row in self.grid.grid: - for player in row: - if player > -1: - count[player] = count.get(player, 0) + 1 - - if count.get(0, 0) > count.get(1, 0): + return 1 - else: - return 0 def key_press_event(self, widget, event): - if self.grid.selected_column is None: - _logger.debug('Ignoring keypress - not my turn') - return - + _logger.debug('Keypress: keyval %s', event.keyval) if event.keyval in (gtk.keysyms.Left,): _logger.debug('<--') - if self.grid.selected_column > 0: - self.grid.selected_column -= 1 - redraw(self.grid) + if self.boardWidget.selected_column > 0: + self.boardWidget.selected_column -= 1 + redraw(self.boardWidget) elif event.keyval in (gtk.keysyms.Right,): _logger.debug('-->') - if self.grid.selected_column < 6: - self.grid.selected_column += 1 - redraw(self.grid) + if self.boardWidget.selected_column < 6: + self.boardWidget.selected_column += 1 + redraw(self.boardWidget) elif event.keyval in (gtk.keysyms.Down, gtk.keysyms.space): _logger.debug('v') - self.insert_requested_cb(self.grid, self.grid.selected_column) + self.insert_requested_cb(self.boardWidget, self.boardWidget.selected_column) def insert_requested_cb(self, grid, col): + + _logger.debug('Inserting at %d', col) winner = grid.insert(col, self.player_id) if winner == -1: return - - _logger.debug('Inserting at %d', col) - dump_grid(grid.grid) + + dump_grid(grid.myBoard.board) redraw(grid) self.Insert(col) - + self.change_turn() - + if winner is not None: _logger.debug("I win") self.info_panel.show(_('You win!')) diff --git a/locale/ar/LC_MESSAGES/org.laptop.Connect.mo b/locale/ar/LC_MESSAGES/org.laptop.Connect.mo deleted file mode 100644 index 24d15c3..0000000 --- a/locale/ar/LC_MESSAGES/org.laptop.Connect.mo +++ /dev/null Binary files differ diff --git a/locale/ar/LC_MESSAGES/org.laptop.Playg.mo b/locale/ar/LC_MESSAGES/org.laptop.Playg.mo deleted file mode 100644 index 24d15c3..0000000 --- a/locale/ar/LC_MESSAGES/org.laptop.Playg.mo +++ /dev/null Binary files differ diff --git a/locale/ar/activity.linfo b/locale/ar/activity.linfo deleted file mode 100644 index 97bb718..0000000 --- a/locale/ar/activity.linfo +++ /dev/null @@ -1,2 +0,0 @@ -[Activity] -name = PlayGo diff --git a/locale/de/LC_MESSAGES/org.laptop.Connect.mo b/locale/de/LC_MESSAGES/org.laptop.Connect.mo deleted file mode 100644 index 79cbe9f..0000000 --- a/locale/de/LC_MESSAGES/org.laptop.Connect.mo +++ /dev/null Binary files differ diff --git a/locale/de/LC_MESSAGES/org.laptop.Playg.mo b/locale/de/LC_MESSAGES/org.laptop.Playg.mo deleted file mode 100644 index 79cbe9f..0000000 --- a/locale/de/LC_MESSAGES/org.laptop.Playg.mo +++ /dev/null Binary files differ diff --git a/locale/de/activity.linfo b/locale/de/activity.linfo deleted file mode 100644 index 97bb718..0000000 --- a/locale/de/activity.linfo +++ /dev/null @@ -1,2 +0,0 @@ -[Activity] -name = PlayGo diff --git a/locale/el/LC_MESSAGES/org.laptop.Connect.mo b/locale/el/LC_MESSAGES/org.laptop.Connect.mo deleted file mode 100644 index 6493eb9..0000000 --- a/locale/el/LC_MESSAGES/org.laptop.Connect.mo +++ /dev/null Binary files differ diff --git a/locale/el/LC_MESSAGES/org.laptop.Playg.mo b/locale/el/LC_MESSAGES/org.laptop.Playg.mo deleted file mode 100644 index 6493eb9..0000000 --- a/locale/el/LC_MESSAGES/org.laptop.Playg.mo +++ /dev/null Binary files differ diff --git a/locale/el/activity.linfo b/locale/el/activity.linfo deleted file mode 100644 index 97bb718..0000000 --- a/locale/el/activity.linfo +++ /dev/null @@ -1,2 +0,0 @@ -[Activity] -name = PlayGo diff --git a/locale/es/LC_MESSAGES/org.laptop.Connect.mo b/locale/es/LC_MESSAGES/org.laptop.Connect.mo deleted file mode 100644 index a0fae11..0000000 --- a/locale/es/LC_MESSAGES/org.laptop.Connect.mo +++ /dev/null Binary files differ diff --git a/locale/es/LC_MESSAGES/org.laptop.Playg.mo b/locale/es/LC_MESSAGES/org.laptop.Playg.mo deleted file mode 100644 index a0fae11..0000000 --- a/locale/es/LC_MESSAGES/org.laptop.Playg.mo +++ /dev/null Binary files differ diff --git a/locale/es/activity.linfo b/locale/es/activity.linfo deleted file mode 100644 index 97bb718..0000000 --- a/locale/es/activity.linfo +++ /dev/null @@ -1,2 +0,0 @@ -[Activity] -name = PlayGo diff --git a/widgettest.py b/widgettest.py index 7803dab..310499c 100755 --- a/widgettest.py +++ b/widgettest.py @@ -1,12 +1,18 @@ - +import logging import gtk import random - +import hippo +import dbus import game import boardwidget +#from buddiespanel import BuddiesPanel +from infopanel import InfoPanel + board = game.GoBoard( 19 ) +logger = logging.getLogger('PlayGO') + def redraw(grid): """Utility function to force a redraw of a Gtk widget.""" grid.window.invalidate_rect(grid.get_allocation(), True) @@ -40,17 +46,50 @@ def key_press_cb(window, event, grid, player): gtk.main_quit() def main(): - + + logger.setLevel( logging.DEBUG ) + for x in range( 19 ): board.setPoint(x, 0, 'White' ) - grid = boardwidget.BoardWidget( board ) - window = gtk.Window() - window.connect('destroy', gtk.main_quit) - window.connect('key-press-event', key_press_cb, grid, [1]) - window.add(grid) + window.resize( 1200, 850 ) + boardWidget = boardwidget.BoardWidget( board ) + + info_panels = InfoPanel() + info_panels.show( " hello there I am the side layout test ") + + info_panel = InfoPanel() + info_panel.show( " hello there I am the lower layout test ") + + vbox = hippo.CanvasBox(spacing=4, + orientation=hippo.ORIENTATION_VERTICAL) + + hbox = hippo.CanvasBox(spacing=4, + orientation=hippo.ORIENTATION_HORIZONTAL) + + hbox.append(hippo.CanvasWidget(widget=boardWidget), hippo.PACK_EXPAND ) + hbox.append(info_panels) + + vbox.append(hbox, hippo.PACK_EXPAND) + vbox.append(info_panel, hippo.PACK_END) + + canvas = hippo.Canvas() + canvas.set_root(vbox) + + window.add( canvas ) window.show_all() + window.connect('key-press-event', key_press_cb, boardWidget, [1]) + + +# simple single window test +# +# window = gtk.Window() +# window.resize( 800, 800 ) +# window.connect('destroy', gtk.main_quit) +# window.connect('key-press-event', key_press_cb, boardWidget, [1]) +# window.add(boardWidget) +# window.show_all() try: gtk.main() -- cgit v0.9.1