Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/boardwidget.py
diff options
context:
space:
mode:
Diffstat (limited to 'boardwidget.py')
-rw-r--r--boardwidget.py53
1 files changed, 51 insertions, 2 deletions
diff --git a/boardwidget.py b/boardwidget.py
index b78b842..a41b9c9 100644
--- a/boardwidget.py
+++ b/boardwidget.py
@@ -85,6 +85,16 @@ class GoBoardWidget(gtk.Widget):
# Load the black stone pixmap
self.BlackPixbuf = gtk.gdk.pixbuf_new_from_file("./images/black.gif")
+ self.XBlackPixbuf = gtk.gdk.pixbuf_new_from_file("./images/XBlack.gif")
+ self.XWhitePixbuf = gtk.gdk.pixbuf_new_from_file("./images/XWhite.gif")
+ self.CircleBlackPixbuf = gtk.gdk.pixbuf_new_from_file("./images/CircleBlack.gif")
+ self.CircleWhitePixbuf = gtk.gdk.pixbuf_new_from_file("./images/CircleWhite.gif")
+ self.TriangleBlackPixbuf = gtk.gdk.pixbuf_new_from_file("./images/TriangleBlack.gif")
+ self.TriangleWhitePixbuf = gtk.gdk.pixbuf_new_from_file("./images/TriangleWhite.gif")
+ self.SquareBlackPixbuf = gtk.gdk.pixbuf_new_from_file("./images/SquareBlack.gif")
+ self.SquareWhitePixbuf = gtk.gdk.pixbuf_new_from_file("./images/SquareWhite.gif")
+
+
self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
self.connect('button-release-event', self.button_release_cb)
@@ -163,6 +173,18 @@ class GoBoardWidget(gtk.Widget):
self.unit = (min(self.allocation.height, self.allocation.width)+10)/(self.size + 1)
self.ScaledBlackPixbuf = self.BlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
self.ScaledWhitePixbuf = self.WhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+
+
+ self.ScaledXBlackPixbuf = self.XBlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledXWhitePixbuf = self.XWhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledCircleBlackPixbuf = self.CircleBlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledCircleWhitePixbuf = self.CircleWhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledTriangleBlackPixbuf = self.TriangleBlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledTriangleWhitePixbuf = self.TriangleWhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledSquareBlackPixbuf = self.SquareBlackPixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+ self.ScaledSquareWhitePixbuf = self.SquareWhitePixbuf.scale_simple( int(self.unit), int(self.unit), gtk.gdk.INTERP_BILINEAR )
+
+
#Draw the board
self.window.draw_drawable(self.gc, self.BoardPixmap, 0, 0, 0, 0, self.allocation.width, self.allocation.height)
#Draw the lines
@@ -221,10 +243,36 @@ class GoBoardWidget(gtk.Widget):
y = y + 1
ctx = self.window.cairo_create()
ct = gtk.gdk.CairoContext(ctx)
- if color == 'B':
+ #######################################################################################################
+ #if color == 'B':
+ # ct.set_source_pixbuf(self.ScaledBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ #else:
+ # ct.set_source_pixbuf(self.ScaledWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ #######################################################################################################
+
+
+ # draw stone for when the icons of the editor are ready
+ if color == 'B':
ct.set_source_pixbuf(self.ScaledBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
- else:
+ elif color == 'W':
ct.set_source_pixbuf(self.ScaledWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'X':
+ ct.set_source_pixbuf(self.ScaledXBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'Y':
+ ct.set_source_pixbuf(self.ScaledXWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'T':
+ ct.set_source_pixbuf(self.ScaledTriangleBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'U':
+ ct.set_source_pixbuf(self.ScaledTriangleWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'C':
+ ct.set_source_pixbuf(self.ScaledCircleBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'D':
+ ct.set_source_pixbuf(self.ScaledCircleWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ elif color == 'S':
+ ct.set_source_pixbuf(self.ScaledSquareBlackPixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+ else:
+ ct.set_source_pixbuf(self.ScaledSquareWhitePixbuf, self.unit*x - self.unit/2, self.unit*y - self.unit/2 )
+
ctx.paint()
def draw_stones(self, status):
@@ -274,3 +322,4 @@ class GoBoardWidget(gtk.Widget):
self.lastX = -1
self.lastY = -1
self.do_expose_event()
+