Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/boardwidget.py
diff options
context:
space:
mode:
authorGerard J. Cerchio <gjpc@circlesoft.com>2007-12-11 23:34:34 (GMT)
committer Gerard J. Cerchio <gjpc@circlesoft.com>2007-12-11 23:34:34 (GMT)
commit5cec213d42f3c904fcc4cf16d9c0ef3c87faccc6 (patch)
tree68d3bb652ca2662007d64f6d388a47f22568ec65 /boardwidget.py
parent4589df13bbe68619d36c99c44d20dd38262ff494 (diff)
added a transparent stone graphic to indicate move
Diffstat (limited to 'boardwidget.py')
-rwxr-xr-xboardwidget.py58
1 files changed, 29 insertions, 29 deletions
diff --git a/boardwidget.py b/boardwidget.py
index 7da815c..c15c1c3 100755
--- a/boardwidget.py
+++ b/boardwidget.py
@@ -165,9 +165,9 @@ class BoardWidget(gtk.EventBox):
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, )
+ 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, )
+ ct.set_source_pixbuf(self.pixWhiteSized, unit*x - unit/2, unit*y - unit/2 )
ctx.paint()
@@ -197,29 +197,32 @@ class BoardWidget(gtk.EventBox):
if dat == self.lastDat :
return
+ if self.lastX :
+ 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 = 0
+ return
+
+ x += 1
+ y += 1
+ dat = self.lastDat
ctx = self.myWidget.window.cairo_create()
- ctx.save()
- unit, x0, y0 = self.get_coordinates(self.get_allocation())
- ctx.translate( x0, y0 )
+ 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 )
+
- #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()
+ self.lastX = self.lastUnit * x
+ self.lastY = self.lastUnit * y
+ ctx.arc( self.lastX, self.lastY, 16, 0, -1e-10)
+ ctx.fill_preserve()
+ ctx.stroke()
+ del ctx
def button_release_cb(self, event):
@@ -235,7 +238,8 @@ class BoardWidget(gtk.EventBox):
else :
dat = dat | 0x20000
self.lastColor = 1;
-
+
+ self.lastX = 0;
self.insert( dat, 1 )
else:
@@ -245,7 +249,8 @@ class BoardWidget(gtk.EventBox):
dat = dat | 0x10000
else :
dat = dat | 0x20000
-
+
+ self.lastX = 0;
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 )
@@ -311,13 +316,8 @@ class BoardWidget(gtk.EventBox):
# 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 )
-
- self.myWidget.window.set_cursor( gtk.gdk.Cursor(gtk.gdk.CIRCLE) )
- #ctx.restore()
-
+
def expose_cb(self, widget, event):