Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-05-01 02:48:21 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-05-01 02:48:21 (GMT)
commitcf09a02c2cbe4e0563b258e893281ec64a0fa47f (patch)
treeb00c02693f7f4fcc41e7ea323606a6589b6d92da
parent1bd819cf53913ec08109c62b9345b85b0378ad98 (diff)
Re draw flags after alert
-rw-r--r--terronesweeper.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/terronesweeper.py b/terronesweeper.py
index f09b240..ac9a5f5 100644
--- a/terronesweeper.py
+++ b/terronesweeper.py
@@ -122,6 +122,7 @@ class TerronesTable(gtk.Table):
new_row = []
for column in range(0, columns):
button = gtk.ToggleButton()
+ button.flag = False
button.connect('button-press-event',
self.button_event,
row,
@@ -171,11 +172,13 @@ class TerronesTable(gtk.Table):
widget.get_allocation()[-1] - 10)
image.set_from_pixbuf(pixbuf)
image.show()
+ widget.flag = True
widget.add(image)
widget.set_property("inconsistent", True)
self.array[row][column][3] = True
self.emit("flag-added")
else:
+ widget.flag = False
widget.set_property("inconsistent", False)
widget.remove(widget.get_children()[0])
self.array[row][column][3] = False
@@ -289,6 +292,17 @@ class TerronesTable(gtk.Table):
image.show()
bb[0].add(image)
+ if bb[0].flag:
+ image = gtk.Image()
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
+ "icons/terron-flag.svg",
+ bb[0].get_allocation()[-2] - 10,
+ bb[0].get_allocation()[-1] - 10)
+ image.set_from_pixbuf(pixbuf)
+ image.show()
+ bb[0].remove(bb[0].get_children()[0])
+ bb[0].add(image)
+
def win(self):
self.emit('game-over', True)
for b in self.array: