From 551625bebfa97c7cdefe4376885d0fa66fc8da03 Mon Sep 17 00:00:00 2001 From: Andrés Ambrois Date: Fri, 15 Aug 2008 06:28:37 +0000 Subject: *** Cleaned master branch *** old code moved to arch/old_master --- diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 0fcc7dc..0000000 --- a/MANIFEST +++ /dev/null @@ -1,20 +0,0 @@ -activity.py -boardwidget.py -buddiespanel.py -game.py -infopanel.py -activity/activity-go.svg -activity/activity.info -images/b.gif -images/black.gif -images/board.gif -images/BsTurn.gif -images/bw.gif -images/w.gif -images/white.gif -images/WsTurn.gif -po/ar.po -po/PlayGo.pot -po/de.po -po/el.po -po/es.po diff --git a/NEWS b/NEWS deleted file mode 100644 index d6ea652..0000000 --- a/NEWS +++ /dev/null @@ -1,95 +0,0 @@ -23 -* edge prisoners are recognized & removed -* allow any board size -* info panel reflects whose move -* renamed pot file - -22 -* first test on XO works local no buddy panel -* got rid of a stone placement bugs -* improved performance of the ghost stone - - -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) - -19 - -* #4663: fix and use _get_buddy again to convert handles into buddies - (morgs) - -18 - -* Fixes in usage of sugar.presence API (morgs) - -17 - -* Remove Tubes boilerplate and rely on #4503 having been fixed in - sugar.presence (smcv) - -- this depends on sugar snapshot 8c89bfaed7 - -16 - -* Remove self.set_title() (morgs) -* #3492: Don't quit on escape (cassidy) - -15 - -* #3557: Updated spanish translation (morgs) - -14 - -* Updated spanish translation (morgs) -* Add spanish translation (xavi) - -13 - -* #2349 Suggests sharing or inviting someone to play (morgs) -* #3194 Detect win with more than 4 in a row (morgs) - -12 - -* New activity icon, Fix for #2829 (erikos) - -11 - -* Port to new tubes API (cassidy) - -10 - -* Fix sugar.graphics change to CanvasIcon (morgs) -* Add greek translation. (simosx) -* Add arabic translation. (khaled) - -9 - -* Fix buddy icon (morgs) -* Use tubeconn from sugar.presence (morgs) -* Use sugar.graphics.style instead of sugar.graphics.color (danw) -* #2579 German translation (morgs) - -8 - -* Add gettext for i18n (morgs) -* #1625, #2420: Fix activity icon (danw, cassidy) - -7 - -* 1960, #1624: Show the activity toolbox and sidebar when PS not connected - (morgs) - -6 - -* Adapt to sugar API change (marco) - -5 - -* Fix buddy handles for Salut (Link Local) channels (smcv) -* UI improvement to show whose turn it is, below grid (morgs) diff --git a/PlayGo-1.xo b/PlayGo-1.xo deleted file mode 100644 index a597aad..0000000 --- a/PlayGo-1.xo +++ /dev/null Binary files differ diff --git a/README b/README deleted file mode 100644 index f7d9c25..0000000 --- a/README +++ /dev/null @@ -1,7 +0,0 @@ -PlayGo activity for the OLPC - -Author: Gerard J. Cerchio, - www.circlesoft.com - -Copyright under the GNU GPL - diff --git a/activity.py b/activity.py deleted file mode 100755 index b5f091a..0000000 --- a/activity.py +++ /dev/null @@ -1,232 +0,0 @@ -import logging -from gettext import gettext as _ - -import dbus -import gtk -import telepathy -import telepathy.client - -from sugar.activity.activity import Activity, ActivityToolbox -from sugar.presence import presenceservice -import sugar.logger - -import boardwidget -from game import SERVICE, abstractBoard, GoGame - -from sugar.presence.tubeconn import TubeConnection -from buddiespanel import BuddiesPanel -from infopanel import InfoPanel - - -logger = logging.getLogger('PlayGO') - - -class PlayGo(Activity): - """ - Enter the PlayGo activity. - 1. intialize our parent object - 2. create an empty abstract board - 3. create the graphic objects, boardWidget, buddyPanel, InfoPanel - 4. group them in layout containers - 5. create an ActivityToolBox - 6. open a channel to the presence server - 7.1 if creating the game, make me the only player and go into local play mode - 7.2 if connecting to a neighborhood game, call the activity connection methods - """ - def __init__(self, handle): - Activity.__init__(self, handle) - self._name = handle - - self.set_title('PlayGo') - - logger.debug('Starting Playgo activity...') - - toolbox = ActivityToolbox(self) - self.set_toolbox(toolbox) - - board = abstractBoard( 19 ) - self.boardWidget = boardwidget.BoardWidget( board, self ) - self.buddies_panel = BuddiesPanel() - self.info_panel = InfoPanel() - - #Prepare the main box - 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) - - self.info_panel = InfoPanel() - - 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) - - #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() - - 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) - self.info_panel.show(_('Place a black stone to play locally. You may share or invite to play remotely')) - - self.initiating = None - - self.game = None - - self.connect('shared', self._shared_cb) - - if self._shared_activity: - # we are joining the activity - self.buddies_panel.add_watcher(owner) - self.connect('joined', self._joined_cb) - self._shared_activity.connect('buddy-joined', self._buddy_joined_cb) - self._shared_activity.connect('buddy-left', self._buddy_left_cb) - if self.get_shared(): - # oh, OK, we've already joined - self._joined_cb() - else: - # we are creating the activity - self.buddies_panel.remove_watcher(owner) - self.buddies_panel.add_player(owner) - #self.buddies_panel.set_is_playing(owner) - #self.buddies_panel.set_count(owner, 69) - - 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 - # to track handles of buddies, and use that instead - logger.debug('Trying to find owner of handle %u...', cs_handle) - group = self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP] - my_csh = group.GetSelfHandle() - logger.debug('My handle in that group is %u', my_csh) - if my_csh == cs_handle: - handle = self.conn.GetSelfHandle() - logger.debug('CS handle %u belongs to me, %u', cs_handle, handle) - elif group.GetGroupFlags() & telepathy.CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES: - handle = group.GetHandleOwners([cs_handle])[0] - logger.debug('CS handle %u belongs to %u', cs_handle, handle) - else: - handle = cs_handle - logger.debug('non-CS handle %u belongs to itself', handle) - - # XXX: deal with failure to get the handle owner - assert handle != 0 - - return self.pservice.get_buddy_by_telepathy_handle( - self.conn.service_name, self.conn.object_path, handle) - - def key_press_cb(self, widget, event): - logger.debug('Keypress: %r, %r', widget, event) - - if self.game is not None: - self.game.key_press_event(widget, event) - - def _shared_cb(self, activity): - logger.debug('My PlayGo activity was shared') - self.shared = True - self.initiating = True - self._setup() - - for buddy in self._shared_activity.get_joined_buddies(): - self.buddies_panel.add_watcher(buddy) - - self._shared_activity.connect('buddy-joined', self._buddy_joined_cb) - self._shared_activity.connect('buddy-left', self._buddy_left_cb) - - logger.debug('This is my activity: making a tube...') - id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube( - SERVICE, {}) - self.info_panel.show(_('Waiting for another player to join.')) - - def _setup(self): - if self._shared_activity is None: - logger.error('Failed to share or join activity') - return - - self.conn = self._shared_activity.telepathy_conn - self.tubes_chan = self._shared_activity.telepathy_tubes_chan - self.text_chan = self._shared_activity.telepathy_text_chan - - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal( - 'NewTube', self._new_tube_cb) - - def _list_tubes_reply_cb(self, tubes): - for tube_info in tubes: - self._new_tube_cb(*tube_info) - - def _list_tubes_error_cb(self, e): - logger.error('ListTubes() failed: %s', e) - - def _joined_cb(self, activity): - if self.game is not None: - return - - if not self._shared_activity: - return - - for buddy in self._shared_activity.get_joined_buddies(): - self.buddies_panel.add_watcher(buddy) - - logger.debug('Joined an existing Connect game') - self.info_panel.show(_('Joined a game. Waiting for my turn...')) - self.initiating = False - self._setup() - - logger.debug('This is not my activity: waiting for a tube...') - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes( - reply_handler=self._list_tubes_reply_cb, - error_handler=self._list_tubes_error_cb) - - def _new_tube_cb(self, id, initiator, type, service, params, state): - logger.debug('New tube: ID=%d initator=%d type=%d service=%s ' - 'params=%r state=%d', id, initiator, type, service, - params, state) - - if (self.game is None and type == telepathy.TUBE_TYPE_DBUS and - service == SERVICE): - if state == telepathy.TUBE_STATE_LOCAL_PENDING: - self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) - - 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.boardWidget, self.initiating, - self.buddies_panel, self.info_panel, self.owner, - self._get_buddy, self) - - def _buddy_joined_cb (self, activity, buddy): - logger.debug("buddy joined") - self.buddies_panel.add_watcher(buddy) - - def _buddy_left_cb (self, activity, buddy): - logger.debug("buddy left") - self.buddies_panel.remove_watcher(buddy) diff --git a/activity/activity-go.svg b/activity/activity-go.svg deleted file mode 100644 index 4348e85..0000000 --- a/activity/activity-go.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - ]> -image/svg+xml - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/activity/activity-helloworld.svg b/activity/activity-helloworld.svg deleted file mode 100644 index b9278b0..0000000 --- a/activity/activity-helloworld.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - -]> - - - diff --git a/activity/activity.info b/activity/activity.info deleted file mode 100644 index 274c415..0000000 --- a/activity/activity.info +++ /dev/null @@ -1,7 +0,0 @@ -[Activity] -name = PlayGo -service_name = org.laptop.PlayGo -class = activity.PlayGo -icon = activity-go -activity_version = 1 -show_launcher = yes diff --git a/boardwidget.py b/boardwidget.py deleted file mode 100755 index 4ea9cdd..0000000 --- a/boardwidget.py +++ /dev/null @@ -1,416 +0,0 @@ -import logging -from gettext import gettext as _ -import cairo -import gobject -import gtk -import random - -import game - - -logger = logging.getLogger('PlayGo.boardwidget') - - -class BoardWidget(gtk.EventBox): - "Gtk widget for drawing the graphical board.""" - - __gsignals__ = { - 'insert-requested': (gobject.SIGNAL_RUN_FIRST, None, [int]), - } - - def __init__( self, aBoard, activity ): - """ - Startup the board widget - 1. setup our signals: expose, insert, button and mouse movement - 2. initialize the tracking variables - 3. read in the stone source bitmaps - """ - - gtk.EventBox.__init__( self ) - - self.output = gtk.DrawingArea() - self.set_property('child', self.output) - - self.output.connect('expose-event', self.expose_cb) - self.add_events(gtk.gdk.POINTER_MOTION_MASK) - - self.connect('button-release-event', self.__class__.button_release_cb) - self.connect('motion-notify-event', self.__class__.motion_cb) - #self.connect('size-request', self.__class__.sizeRequest_cb) - - self.activity = activity - self.drawCoords = 1 - self.size = aBoard.size - self.lastUnit = 0 - self.lastDat = -1 - self.lastX = 0 - self.lastY = 0 - self.myBoard = aBoard - self.myGame = None - - self.lastColor = 2 - - logger.setLevel( logging.DEBUG ) - - # get the bitmap for genuine simulated white stone - input = open("./images/white.gif") - imagebuf = input.read() - pixbufloader = gtk.gdk.PixbufLoader() - pixbufloader.write(imagebuf) - pixbufloader.close() - self.pixWhite = pixbufloader.get_pixbuf() - - # get the bitmap for genuine simulated black stone - input = open("./images/black.gif") - imagebuf = input.read() - pixbufloader = gtk.gdk.PixbufLoader() - pixbufloader.write(imagebuf) - pixbufloader.close() - self.pixBlack = pixbufloader.get_pixbuf() - - logger.debug( "baord widget started" ) - - - def sizeRequest_cb(self, requistion ): - requistion.width = 8 - requistion.height = 8 - - - def check_coord (self, x, y): - """ - check to see if x and y are within the board grid - """ - return x >= 0 and x < self.size and y >= 0 and y < self.size - - - def insert(self, dat, value): - """ - Perform a Stone placement, this is called directly from self - when playing a local game or from the tube to a remote player - managed in game.py - """ - color = dat >> 16 - x = dat & 0xff - y = ( 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 ) - self.update_score(self.myBoard.score) - return None - - def update_score(self, score): - if score == 0: - return 0 - self.activity.info_panel.show_score(_("Score is: Whites %(W)d - Blacks %(B)d" % score)) - -# 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): - """ - set the board window's background to the board image - """ - - ct = gtk.gdk.CairoContext(ctx) - ct.set_source_pixbuf(self.pixBoard,0,0) - ctx.paint() - ctx.stroke() - - - def draw_lines(self, rect, unit, ctx): - """ - draw the grid and star points onto the board bitmap - """ - - # single width balck lines - ctx.set_line_width(1) - ctx.set_source_rgba(0, 0, 0, 1) - - for i in xrange(self.size + 1): - ctx.move_to( unit, i * unit) - ctx.line_to(self.size * unit, i * unit ) - - for i in xrange(self.size + 1): - ctx.move_to(i * unit, unit ) - ctx.line_to(i * unit, self.size * unit) - - ctx.stroke() - - # star point coords per board size - if self.size == 19 : - seq = [ 4, 10, 16 ] - elif self.size == 13 : - seq = [ 4, 7, 10 ] - elif self.size == 9 : - seq = [ 3, 7 ] - # set the middle singleton - ctx.arc( unit * 5, unit * 5, 3, 0, -1e-10) - ctx.fill_preserve() - ctx.stroke() - else : - seq = [] - - # stroke in the star points - #TODO: adjust size for teeny boards - for x in seq : - for y in seq : - ctx.arc( unit * x, unit * y, 3, 0, -1e-10) - ctx.fill_preserve() - ctx.stroke() - - def draw_stone(self, x, y, color, unit, ctx): - """ - paint a single stone on a point - """ - x = x + 1 - y = y + 1 - ct = gtk.gdk.CairoContext(ctx) - if color == 0 : - ct.set_source_pixbuf(self.pixBlackSized, unit*x - unit/2, unit*y - unit/2 ) - else : - ct.set_source_pixbuf(self.pixWhiteSized, unit*x - unit/2, unit*y - unit/2 ) - - ctx.paint() - - - def draw_stones( self, ctx ): - """ - paint all the stones on the board - """ - - for x in self.myBoard.status.keys() : - if self.myBoard.status[x] == 'B' : - self.draw_stone( x[0], x[1], 1, self.lastUnit, ctx ) - else : - self.draw_stone( x[0], x[1], 0, self.lastUnit, ctx ) - - ctx.stroke() - - def get_mouse_event_col(self, event): - """ - calculate the x and y position on the board given pixel address - """ - - unit, x0, y0 = self.get_coordinates(self.get_allocation()) - x = ( ( event.x - x0 ) / unit ) - 0.5 - y = ( ( event.y - y0 ) / unit ) - 0.5 - return int(x), int(y) - - - def legal(self, x, y ): - """ - boolean check if the stone play is legal - """ - if self.myBoard.status.has_key( (x,y) ) : - self.activity.info_panel.show(_("There already is a stone there!")) - return False - - c = 'W' - if self.lastColor is 1 : - c = 'B' - - if not self.myBoard.legal( (x,y), c ) : - self.activity.info_panel.show(_("Illegal move")) - return False - - if self.myBoard.checkKo( (x, y), c): - self.activity.info_panel.show(_("Ko violation!")) - return False - - logger.debug( " returning legal ") - return True - - def motion_cb(self, event): - """ - When the mouse moves, find out if it is a legal point - if it is a legal point place the transparent stone on - the point and erase the previously placed transparent - stone - """ - - x, y = self.get_mouse_event_col(event) - dat = ( y << 8 ) + x - - if not self.check_coord( x, y ) : - return - - if dat == self.lastDat : - return - - if self.lastX is not -1 : - self.myWidget.window.clear_area( int(self.lastX - self.lastUnit/2), int(self.lastY - self.lastUnit/2), int(self.lastUnit), int(self.lastUnit) ) - - if self.myBoard.status.has_key( (x,y) ) : - self.lastX = -1 - return - - # the board is zero based and there is a 1 unit border so bump x&y - x += 1 - y += 1 - - # we need a cario context for drawing on top of the board bitmap - ctx = self.myWidget.window.cairo_create() - - # decide whether black or white and set transparent - if ( ( self.myGame is None ) and ( self.lastColor == 2 ) ) or \ - ( self.myGame and not self.myGame.is_initiator ) : - ctx.set_source_rgba(0, 0, 0, .5 ) - else : - ctx.set_source_rgba(0xff, 0xff, 0xff, .5 ) - - # rember our state - self.lastDat = dat - self.lastX = self.lastUnit * x - self.lastY = self.lastUnit * y - - # now draw a transparent stone a 4 pixels smaller than the unit - ctx.arc( self.lastX, self.lastY, self.lastUnit/2 -4, 0, -1e-10) - ctx.fill_preserve() - ctx.stroke() - del ctx - - - def button_release_cb(self, event): - """ - When the mouse button is released drop a stone on the board - """ - - x, y = self.get_mouse_event_col(event) - dat = ( y << 8 ) + x - - logger.debug( 'Button release event x=%d y=%d, pixx=%d pixy=%d', x,y, event.x, event.y ) - - if self.myGame is None : - - if ( event.button != 3 ) : - #if self.myBoard.status.has_key( (x,y) ): - if not self.legal( x, y ) : - return - else : - if self.lastColor is 1: - dat = dat | 0x10000 - self.lastColor = 2; - self.activity.info_panel.show(_("Black's turn ")) - else : - dat = dat | 0x20000 - self.lastColor = 1; - self.activity.info_panel.show(_("White's turn ")) - - self.lastX = 0; - self.insert( dat, 1 ) - - else: - - if event.button != 3 : - if self.myGame.is_initiator : - dat = dat | 0x10000 - else : - dat = dat | 0x20000 - - self.lastX = -1; - self.emit('insert-requested', dat ) - - self.window.invalidate_rect(self.get_allocation(), True) - - def queue_draw(self): - self.output.queue_draw() - - def get_coordinates(self, rect): - """Returns tuple (unit size, origin x, origin y) suitable for drawing - a grid within @rect.""" - - rect = self.get_allocation() - - unit = rect.height / float(self.size ) - x0 = rect.x + (rect.width - self.size * unit) / 2.0 - y0 = rect.y - -# if rect.height / float(self.rows) < rect.width / float(self.size): -# # wide -# unit = rect.height / float(self.rows) -# x0 = rect.x + (rect.width - self.size * unit) / 2.0 -# y0 = rect.y -# else: -# # narrow -# unit = rect.width / float(self.size) -# x0 = rect.x -# y0 = rect.y + (rect.height - self.rows * unit) / 2.0 -# - # now shrink the size for a 1 unit border - unit = unit - unit / self.size - - #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.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_stones( ctx ) - - - def expose_cb(self, widget, event): - - rect = self.get_allocation() - unit, x0, y0 = self.get_coordinates(rect) - if self.lastUnit != unit : - logger.debug( 'resizing the window to %d', rect.height ) - self.lastUnit = -1 - 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, widget.window ) - ctx.restore() diff --git a/buddiespanel.py b/buddiespanel.py deleted file mode 100755 index 4067b8c..0000000 --- a/buddiespanel.py +++ /dev/null @@ -1,132 +0,0 @@ -import gtk -import hippo -import logging -from sugar.graphics.icon import CanvasIcon -from sugar.graphics.xocolor import XoColor -from sugar.graphics import style - -logger = logging.getLogger('PlayGo.buddiespanel') - -class BuddiesPanel(hippo.CanvasBox): - def __init__(self): - hippo.CanvasBox.__init__(self, spacing=4, padding=5, - orientation=hippo.ORIENTATION_VERTICAL) - - self.players_box = hippo.CanvasBox(spacing=4, padding=5, - orientation=hippo.ORIENTATION_VERTICAL) - - self.watchers_box = hippo.CanvasBox(spacing=4, padding=5, - orientation=hippo.ORIENTATION_VERTICAL) - - self.append(self.players_box) - self.append(hippo.CanvasWidget(widget=gtk.HSeparator())) - self.append(self.watchers_box, hippo.PACK_EXPAND) - - self.players = {} - self.watchers = {} - - def _create_buddy_vbox (self, buddy): - buddy_color = buddy.props.color - if not buddy_color: - buddy_color = "#000000,#ffffff" - - icon = CanvasIcon( - icon_name='computer-xo', - xo_color=XoColor(buddy_color)) - - nick = buddy.props.nick - if not nick: - nick = "" - name = hippo.CanvasText(text=nick, color=style.COLOR_WHITE.get_int()) - - vbox = hippo.CanvasBox(padding=5) - vbox.append(icon) - vbox.append(name) - - return vbox - - def add_watcher(self, buddy): - op = buddy.object_path() - if self.watchers.get(op) is not None: - return - # if the watcher is also a player, don't add them - if self.players.get(op) is not None: - return - - vbox = self._create_buddy_vbox (buddy) - - logger.debug("add watcher %s" % op) - self.watchers_box.append(vbox) - - self.watchers[op] = vbox - - def add_player(self, buddy): - op = buddy.object_path() - if self.players.get(op) is not None: - return - # if the player is also a watcher, drop them from the watchers - widget = self.watchers.pop(op, None) - if widget is not None: - self.watchers_box.remove(widget) - - logger.debug("add player %s" % op) - - assert len(self.players) < 2 - - hbox = hippo.CanvasBox(spacing=4, padding=5, - orientation=hippo.ORIENTATION_HORIZONTAL) - - 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) - - self.players_box.append(hbox) - - self.players[op] = hbox - - def set_is_playing(self, buddy): - op = buddy.object_path() - for player, hbox in self.players.items(): - vbox = hbox.get_children()[0] - icon, name = vbox.get_children() - if player == op: - name.props.font_desc = style.FONT_BOLD.get_pango_desc() - else: - name.props.font_desc = style.FONT_NORMAL.get_pango_desc() - - def set_count(self, buddy, val): - hbox = self.players.get(buddy.object_path()) - if hbox is None: - return - - count = hbox.get_children()[1] - count.props.text = str(val) - - def remove_watcher(self, buddy): - op = buddy.object_path() - widget = self.watchers[op] - if widget is None: - return - - self.watchers_box.remove(widget) - del self.watchers[op] - - # removing someone from the game entirely should also remove them - # from the players - self.remove_player(buddy) - - def remove_player(self, buddy): - op = buddy.object_path() - widget = self.players.get(op) - if widget is None: - return - - self.players_box.remove(widget) - del self.players[op] - - self.add_watcher(buddy) diff --git a/game.py b/game.py deleted file mode 100755 index cb51a1c..0000000 --- a/game.py +++ /dev/null @@ -1,434 +0,0 @@ -import logging - -from gettext import gettext as _ -import gtk - -from dbus import Interface -from dbus.service import method, signal -from dbus.gobject_service import ExportedGObject - - -# XXX: I'm not convinced this is in the right namespace -SERVICE = "org.freedesktop.Telepathy.Tube.Connect" -IFACE = SERVICE -PATH = "/org/freedesktop/Telepathy/Tube/Connect" - - -_logger = logging.getLogger('PlayGo') - - -def redraw(grid): - """Utility function to force a redraw of a Gtk widget.""" - grid.queue_draw() - - -def dump_grid(seq): - grid = '' - for row in seq: - row_str = '' - for col in row: - if col == -1: - row_str += ' |' - else: - row_str += '%d|' % col - grid = '%s%s\n' % (grid, row_str) - _logger.debug('Grid state is now:\n%s', grid) - - -## This abstractBoard is part of Kombilo, a go database program -## It contains a class implementing an abstract go board -## Copyright (C) 2001-3 Ulrich Goertz (u@g0ertz.de) - -class abstractBoard: - """ This class administrates a go board. - It keeps track of the stones currently on the board in the dictionary self.status, - and of the moves played so far in self.undostack - - It has methods to clear the board, play a stone, undo a move. """ - - def __init__(self, boardSize = 19): - self.size = boardSize #TODO: get rid of this - self.status = {} - self.undostack = [] - self.boardSize = boardSize - self.score = {'B' : 0, 'W' : 0} - _logger.setLevel( logging.DEBUG ) - _logger.debug( "init board size %d", boardSize ) - - def increase_score(self, color): - self.score[color] = self.score[color] + 1 - - def neighbors(self,x): - """ Returns the coordinates of the 4 (resp. 3 resp. 2 at the side 1 in the corner) intersections - adjacent to the given one. """ - if x[0]== 0 : l0 = [1] - elif x[0]== self.boardSize-1 : l0 = [self.boardSize-2] - else: l0 = [x[0]-1, x[0]+1] - - if x[1]== 0 : l1 = [1] - elif x[1]== self.boardSize-1 : l1 = [self.boardSize-2] - else: l1 = [x[1]-1, x[1]+1] - - l = [] - for i in l0: l.append((i,x[1])) - for j in l1: l.append((x[0],j)) - - return l - - def clear(self): - """ Clear the board """ - self.status = {} - self.undostack=[] - - def play(self,pos,color): - """ This plays a color=black/white stone at pos, if that is a legal move - (disregarding ko), and deletes stones captured by that move. - It returns 1 if the move has been played, 0 if not. """ - if self.status.has_key(pos): # check if empty - return 0 - - if self.legal(pos,color): # legal move? - self.status[pos] = color - captures = self.get_captures(pos, color) - if captures: - for x in captures: - del self.status[x] # remove captured stones, if any - self.increase_score(self.invert(color)) - self.undostack.append((pos,color,captures)) # remember move + captured stones for easy undo - return self.score - else: - return 0 - - def get_captures(self, pos, color): - """Returns a list of captured stones resulting from placing a color stone at pos """ - c = [] # captured stones - - for x in self.neighbors(pos): - if self.status.has_key(x) and self.status[x]==self.invert(color): - c = c + self.hasNoLibExcP(x, self.invert(color), pos) - - if c: - captures = [] - for x in c: - if not x in captures: captures.append(x) - return captures - - return 0 - - def checkKo(self, pos, color): - ''' - Check if a move by color at pos would be a basic Ko infraction - ''' - # Basically what we need to check, is if the current play would undo - # all that was done by the last entry in undostack (capture what was placed - # and place what was captured). - if self.undostack: - lastpos, lastcolor, lastcaptures = self.undostack[-1] - currentcaptures = self.get_captures(pos, color) - if lastcaptures != 0 and currentcaptures != 0: - if lastcolor != color and lastcaptures[0] == pos and lastpos == currentcaptures[0]: - return 1 - return 0 - - def legal(self, pos, color): - """ Check if a play by color at pos would be a legal move. """ - if self.status.has_key(pos): - return 0 - - # If the play at pos would leave that stone without liberties, we have two possibilities: - # 1- It's a capturing move - # 2- It's an illegal move - if self.hasNoLibExcP(pos, color): - # Check if it would capture any stones - if self.get_captures(pos, color): - return 1 - # It didnt, so I guess it's illegal - return 0 - else: return 1 - - def hasNoLibExcP(self, pos, color, exc = None): - """ This function checks if the string (=solidly connected) of stones containing - the stone at pos has a liberty (resp. has a liberty besides that at exc). - If no liberties are found, a list of all stones in the string is returned. - - The algorithm is a non-recursive implementation of a simple flood-filling: - starting from the stone at pos, the main while-loop looks at the intersections - directly adjacent to the stones found so far, for liberties or other stones that belong - to the string. Then it looks at the neighbors of those newly found stones, and so - on, until it finds a liberty, or until it doesn't find any new stones belonging - to the string, which means that there are no liberties. - Once a liberty is found, the function returns immediately. """ - - st = [] # in the end, this list will contain all stones solidly connected to the - # one at pos, if this string has no liberties - newlyFound = [pos] # in the while loop, we will look at the neighbors of stones in newlyFound - foundNew = 1 - - while foundNew: - foundNew = 0 - n = [] # this will contain the stones found in this iteration of the loop - for x in newlyFound: - for y in self.neighbors(x): - if not self.status.has_key(y) and y != exc and y != pos: # found a liberty - return [] - elif self.status.has_key(y) and self.status[y]==color \ - and not y in newlyFound and not y in st: # found another stone of same color - n.append(y) - foundNew = 1 - - st[:0] = newlyFound - newlyFound = n - - return st # no liberties found, return list of all stones connected to the original one - - def undo(self, no=1): - """ Undo the last no moves. """ - for i in range(no): - if self.undostack: - pos, color, captures = self.undostack.pop() - del self.status[pos] - if captures: - for p in captures: self.status[p] = self.invert(color) - - def remove(self, pos): - """ Remove a stone form the board, and store this action in undostack. """ - - self.undostack.append(((-1,-1), self.invert(self.status[pos]), [pos])) - del self.status[pos] - - def invert(self,color): - if color == 'B': return 'W' - else: return 'B' - - def setPointi( self, x, y, value ): - - color = 'W' - if value == 1 : color = 'B' - - _logger.debug( "Setting Point %d, %d to color %s", x, y, color ) - - return self.play( (x,y), color ) - - - - -class GoGame(ExportedGObject): - - 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.boardWidget = boardwidget - self.is_initiator = is_initiator - self.entered = False - self.player_id = None - self.active_player = 1 - self.buddies_panel = buddies_panel - self.info_panel = info_panel - 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 - # 2+ are the spectator queue, 2 is to play next - self.ordered_bus_names = [] - - self.tube.watch_participants(self.participant_change_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. - - _logger.debug('adding participants: %r', added) - _logger.debug('removing participants: %r', removed) - - for handle, bus_name in added: - buddy = self._get_buddy(handle) - _logger.debug('Buddy %r was added', buddy) - if buddy is not None: - self.buddies_panel.add_watcher(buddy) - - for handle in removed: - buddy = self._get_buddy(handle) - _logger.debug('Buddy %r was removed', buddy) - if buddy is not None: - self.buddies_panel.remove_watcher(buddy) - try: - self.ordered_bus_names.remove(self.tube.participants[handle]) - except ValueError: - # already absent - pass - - if not self.entered: - self.tube.add_signal_receiver(self.insert_cb, 'Insert', IFACE, - path=PATH, sender_keyword='sender') - if self.is_initiator: - _logger.debug('I am the initiator, so making myself player 0') - self.add_hello_handler() - self.ordered_bus_names = [self.tube.get_unique_name()] - self.player_id = 0 - self.buddies_panel.add_player(self.owner) - else: - _logger.debug('Hello, everyone! What did I miss?') - self.Hello() - self.entered = True - - @signal(dbus_interface=IFACE, signature='') - def Hello(self): - """Request that this player's Welcome method is called to bring it - up to date with the game state. - """ - - @method(dbus_interface=IFACE, in_signature='aanas', out_signature='') - def Welcome(self, aBoard, bus_names): - """To be called on the incoming player by the other players to - inform them of the game state. - - FIXME: nominate a "referee" (initially the initiator) responsible - for saying Welcome, elect a new referee when the current referee - leaves? This could also be used to make the protocol robust against - cheating/bugs - """ - if self.player_id is None: - _logger.debug('Welcomed to the game. Player bus names are %r', bus_names) - self.boardWidget.myBoard.board = aBoard - dump_grid( self.boardWidget.myBoard.status ) - 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 - self.add_hello_handler() - - buddy = self._get_buddy(self.tube.bus_name_to_handle[bus_names[0]]) - self.buddies_panel.add_player(buddy) - buddy = self._get_buddy(self.tube.bus_name_to_handle[bus_names[1]]) - self.buddies_panel.add_player(buddy) - - if self.get_active_player() == self.player_id: - _logger.debug("It's my turn already!") - self.change_turn() - - redraw( self.boardWidget ) - else: - _logger.debug("I've already been welcomed, doing nothing") - - def add_hello_handler(self): - self.tube.add_signal_receiver(self.hello_cb, 'Hello', IFACE, - path=PATH, sender_keyword='sender') - - @signal(dbus_interface=IFACE, signature='i') - def Insert(self, column): - """Signal that the local player has placed a disc.""" - #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:') - dump_grid( self.boardWidget.myBoard.status ) - - self.tube.get_object(sender, PATH).Welcome(self.boardWidget.myBoard.status, - 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") - self.change_turn() - - def insert_cb(self, column, sender=None): - # Someone placed a stone - handle = self.tube.bus_name_to_handle[sender] - _logger.debug('Insert(%d) from %s', column, sender) - - if self.tube.self_handle == handle: - _logger.debug('Ignoring Insert signal from myself: %d', column) - return - - try: - winner = self.boardWidget.insert(column, self.get_active_player()) - except ValueError: - return - - dump_grid(self.boardWidget.myBoard.status) - - if winner is not None: - _logger.debug('Player with handle %d wins', handle) - self.info_panel.show(_('The other player wins!')) - redraw(self.boardWidget) - return - - self.change_turn() - - def change_turn(self): - try: - bus_name = self.ordered_bus_names[self.get_active_player()] - buddy = self._get_buddy(self.tube.bus_name_to_handle[bus_name]) - self.buddies_panel.set_is_playing(buddy) - except: - _logger.error('argh!', exc_info=1) - raise - - if self.get_active_player() == self.player_id: - _logger.debug('It\'s my turn now') - self.info_panel.show(_('Your turn')) - self.activity.grab_focus() - else: - _logger.debug('It\'s not my turn') - self.boardWidget.selected_column = None - - redraw(self.boardWidget) - - def get_active_player(self): - - return 1 - - def key_press_event(self, widget, event): - - _logger.debug('Keypress: keyval %s', event.keyval) - - if event.keyval in (gtk.keysyms.Left,): - _logger.debug('<--') - 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.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.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 - - dump_grid(grid.myBoard.status) - redraw(grid) - self.Insert(col) - - self.change_turn() - - if winner is not None: - _logger.debug("I win") - self.info_panel.show(_('You win!')) - else: - self.info_panel.show(_('Other player\'s turn')) diff --git a/images/BsTurn.gif b/images/BsTurn.gif deleted file mode 100644 index 52edae7..0000000 --- a/images/BsTurn.gif +++ /dev/null Binary files differ diff --git a/images/README b/images/README deleted file mode 100644 index cca19e0..0000000 --- a/images/README +++ /dev/null @@ -1,7 +0,0 @@ -OLPC PlayGo Activity image library - -These images are from Ulrich Goertz's (u@g0ertz.de) uliGo 0.3 - -They are published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. - -(C) Ulrich Goertz (u@g0ertz.de), 2001-2003. \ No newline at end of file diff --git a/images/WsTurn.gif b/images/WsTurn.gif deleted file mode 100644 index ab00f50..0000000 --- a/images/WsTurn.gif +++ /dev/null Binary files differ diff --git a/images/b.gif b/images/b.gif deleted file mode 100644 index e56bc98..0000000 --- a/images/b.gif +++ /dev/null Binary files differ diff --git a/images/black.gif b/images/black.gif deleted file mode 100644 index 1719614..0000000 --- a/images/black.gif +++ /dev/null Binary files differ diff --git a/images/board.gif b/images/board.gif deleted file mode 100644 index c253991..0000000 --- a/images/board.gif +++ /dev/null Binary files differ diff --git a/images/bw.gif b/images/bw.gif deleted file mode 100644 index eb069a0..0000000 --- a/images/bw.gif +++ /dev/null Binary files differ diff --git a/images/w.gif b/images/w.gif deleted file mode 100644 index 1374cba..0000000 --- a/images/w.gif +++ /dev/null Binary files differ diff --git a/images/white.gif b/images/white.gif deleted file mode 100644 index 03e3bf7..0000000 --- a/images/white.gif +++ /dev/null Binary files differ diff --git a/infopanel.py b/infopanel.py deleted file mode 100755 index 783c111..0000000 --- a/infopanel.py +++ /dev/null @@ -1,20 +0,0 @@ -import gtk -import pango -from sugar.graphics import style - -class InfoPanel(gtk.VBox): - def __init__(self): - gtk.VBox.__init__(self) - self.status_label = gtk.Label('Status') - self.pack_start(self.status_label, True, True, 10) - self.score_label = gtk.Label('Score') - self.pack_start(self.score_label, True, True, 10) - self.show_all() - - def show(self, text): - self.status_label.set_text(text) - - def show_score(self, text): - self.score_label.set_text(text) - - diff --git a/po/PlayGo.pot b/po/PlayGo.pot deleted file mode 100644 index a6709f7..0000000 --- a/po/PlayGo.pot +++ /dev/null @@ -1,54 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-22 16:14-0800\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: activity.py:77 -msgid "" -"Place a black stone to play locally. You may share or invite to play remotely" -msgstr "" - -#: activity.py:148 -msgid "Waiting for another player to join." -msgstr "" - -#: activity.py:180 -msgid "Joined a game. Waiting for my turn..." -msgstr "" - -#: boardwidget.py:300 -msgid "Black's turn " -msgstr "" - -#: boardwidget.py:304 -msgid "White's turn " -msgstr "" - -#: game.py:335 -msgid "The other player wins!" -msgstr "" - -#: game.py:352 -msgid "Your turn" -msgstr "" - -#: game.py:397 -msgid "You win!" -msgstr "" - -#: game.py:399 -msgid "Other player's turn" -msgstr "" diff --git a/po/ar.po b/po/ar.po deleted file mode 100644 index ace3d98..0000000 --- a/po/ar.po +++ /dev/null @@ -1,63 +0,0 @@ -# translation of Connect.master.po to Arabic -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# -# Khaled Hosny , 2007. -msgid "" -msgstr "" -"Project-Id-Version: Connect.master\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-31 13:04+0200\n" -"PO-Revision-Date: 2007-08-16 01:03+0300\n" -"Last-Translator: Khaled Hosny \n" -"Language-Team: Arabic \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.11.4\n" -"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " -"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" -"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? " -"3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" - -#: activity/activity.info:2 -#, fuzzy -msgid "Connect" -msgstr "نشاط التوصيل" - -#: activity.py:63 -msgid "To play, share or invite someone." -msgstr "" - -#: activity.py:133 -msgid "Waiting for another player to join." -msgstr "بانتظار انضمام لاعب آخر." - -#: activity.py:164 -msgid "Joined a game. Waiting for my turn..." -msgstr "انضممت للعبة. أنتظر دوري..." - -#: game.py:183 -msgid "The other player wins!" -msgstr "فاز اللاعب الآخر!" - -#: game.py:200 -msgid "Your turn" -msgstr "دورك" - -#: game.py:257 -msgid "You win!" -msgstr "فزت!" - -#: game.py:259 -msgid "Other player's turn" -msgstr "دور اللاعب الآخر" - -#~ msgid "Connect Activity" -#~ msgstr "نشاط التوصيل" - -#~ msgid "Offline" -#~ msgstr "بدون اتصال" - -#~ msgid "To play, share!" -#~ msgstr "لتلعب، شارِك!" diff --git a/po/de.po b/po/de.po deleted file mode 100644 index 09988ac..0000000 --- a/po/de.po +++ /dev/null @@ -1,58 +0,0 @@ -# This file is distributed under the same license as the PACKAGE package. -# Fabian Affolter , 2007. -# -# -msgid "" -msgstr "" -"Project-Id-Version: connect\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-31 13:04+0200\n" -"PO-Revision-Date: 2007-07-30 10:44+0100\n" -"Last-Translator: Fabian Affolter \n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-Language: German\n" - -#: activity/activity.info:2 -#, fuzzy -msgid "Connect" -msgstr "Verbindungs-Aktivität" - -#: activity.py:63 -msgid "To play, share or invite someone." -msgstr "" - -#: activity.py:133 -msgid "Waiting for another player to join." -msgstr "Warte auf andere Spieleum beizutreten." - -#: activity.py:164 -msgid "Joined a game. Waiting for my turn..." -msgstr "Einem Spiel begetreten. Warte auf meinen Zug..." - -#: game.py:183 -msgid "The other player wins!" -msgstr "Der andere Spieler gewinnt!" - -#: game.py:200 -msgid "Your turn" -msgstr "Dein Zug" - -#: game.py:257 -msgid "You win!" -msgstr "Du gewinnst!" - -#: game.py:259 -msgid "Other player's turn" -msgstr "Der andere Spieler ist am Zug" - -#~ msgid "Connect Activity" -#~ msgstr "Verbindungs-Aktivität" - -#~ msgid "Offline" -#~ msgstr "Offline" - -#~ msgid "To play, share!" -#~ msgstr "Zum Spielen, teile!" diff --git a/po/el.po b/po/el.po deleted file mode 100644 index a15c023..0000000 --- a/po/el.po +++ /dev/null @@ -1,58 +0,0 @@ -# Greek translation of Connect activity. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# Simos Xenitellis , 2007. -# -msgid "" -msgstr "" -"Project-Id-Version: Connect activity\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-31 13:04+0200\n" -"PO-Revision-Date: 2007-08-20 17:08+0100\n" -"Last-Translator: Simos Xenitellis \n" -"Language-Team: Greek \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: activity/activity.info:2 -#, fuzzy -msgid "Connect" -msgstr "Δραστηριότητα Συνδεθείτε" - -#: activity.py:63 -msgid "To play, share or invite someone." -msgstr "" - -#: activity.py:133 -msgid "Waiting for another player to join." -msgstr "Σε αναμονή για τη σύνδεση άλλου παίκτη." - -#: activity.py:164 -msgid "Joined a game. Waiting for my turn..." -msgstr "Σε σύνδεση σε παιχνίδι. Αναμένουμε για τη σειρά μας..." - -#: game.py:183 -msgid "The other player wins!" -msgstr "Η άλλη πλευρά κερδίζει!" - -#: game.py:200 -msgid "Your turn" -msgstr "Η σειρά σου" - -#: game.py:257 -msgid "You win!" -msgstr "Κέρδισες!" - -#: game.py:259 -msgid "Other player's turn" -msgstr "Η σειρά της άλλης πλευράς" - -#~ msgid "Connect Activity" -#~ msgstr "Δραστηριότητα Συνδεθείτε" - -#~ msgid "Offline" -#~ msgstr "Εκτός σύνδεσης" - -#~ msgid "To play, share!" -#~ msgstr "Για να παίξετε, να μοιραστείτε!" diff --git a/po/es.po b/po/es.po deleted file mode 100644 index eb6fcea..0000000 --- a/po/es.po +++ /dev/null @@ -1,58 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: Actividad Conectar\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-31 13:04+0200\n" -"PO-Revision-Date: 2007-09-18 09:24-0300\n" -"Last-Translator: Domingo Becker \n" -"Language-Team: Fedora Spanish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-Language: Spanish\n" - -#: activity/activity.info:2 -msgid "Connect" -msgstr "Conectar" - -#: activity.py:63 -msgid "To play, share or invite someone." -msgstr "Para jugar, compartir o invitar a alguien." - -#: activity.py:133 -msgid "Waiting for another player to join." -msgstr "Esperando que otro jugador se conecte." - -#: activity.py:164 -msgid "Joined a game. Waiting for my turn..." -msgstr "Jugando. Esperando mi turno..." - -#: game.py:183 -msgid "The other player wins!" -msgstr "El otro jugador ganó!" - -#: game.py:200 -msgid "Your turn" -msgstr "Tu turno" - -#: game.py:257 -msgid "You win!" -msgstr "Ganaste!" - -#: game.py:259 -msgid "Other player's turn" -msgstr "Turno del otro jugador" - -#~ msgid "Connect Activity" -#~ msgstr "Actividad Conectar" - -#~ msgid "Offline" -#~ msgstr "Fuera de línea" - -#~ msgid "To play, share!" -#~ msgstr "Para jugar, comparte!" diff --git a/setup.py b/setup.py deleted file mode 100755 index d07fb3d..0000000 --- a/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2006, Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from sugar.activity import bundlebuilder - -if __name__ == "__main__": - bundlebuilder.start('PlayGo') diff --git a/widgettest.py b/widgettest.py deleted file mode 100755 index 4df01ca..0000000 --- a/widgettest.py +++ /dev/null @@ -1,119 +0,0 @@ -import logging -from gettext import gettext as _ -import gtk -import random -import hippo -import dbus -import game -import boardwidget - -#from buddiespanel import BuddiesPanel -from infopanel import InfoPanel - -boardSize = 9 -board = game.abstractBoard( boardSize ) - -logger = logging.getLogger('PlayGO') - -class dummyActivity : - - def __init__(self): - - self.info_panel = InfoPanel() - - -def redraw(grid): - """Utility function to force a redraw of a Gtk widget.""" - grid.window.invalidate_rect(grid.get_allocation(), True) - - -def key_press_cb(window, event, grid, player): - - key = gtk.gdk.keyval_name(event.keyval) - - if key in ('Left',): - for x in range( boardSize ): - board.play( (x, 3), 'W' ) - redraw(grid) - - elif key in ('Right',): - for x in range( boardSize ): - board.play( ( x, 3 ), 'B' ) - redraw(grid) - - elif key in ( 'r', ): - for x in range( boardSize ): - for y in range( boardSize ): - board.setPointi( x, y, random.randint( 0, 3 ) ) - - redraw(grid) - - elif key in ( 'd' ): - game.dump_grid( board.status ) - - elif key in ( 'c', ): - board.clear() - redraw(grid) - - elif gtk.gdk.keyval_name(event.keyval) in ('Escape', 'q'): - gtk.main_quit() - -def main(): - - console = logging.StreamHandler() - logging.getLogger('').addHandler(console) - logger.setLevel( logging.DEBUG ) - logger.debug( "Start widget test" ) - - for x in range( boardSize ): - board.play( ( x, 0 ), 'W' ) - - window = gtk.Window() - window.resize( 1200, 850 ) - - dummyMe = dummyActivity() - dummyMe.info_panel.show( " click to begin" ) - boardWidget = boardwidget.BoardWidget( board, dummyMe ) - - info_panels = InfoPanel() - info_panels.show( " hello there I am the side 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( dummyMe.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() - except KeyboardInterrupt: - pass - -if __name__ == '__main__': - main() - -- cgit v0.9.1