Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activity.py6
-rw-r--r--cardtable.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/activity.py b/activity.py
index c18e5dc..87a9142 100644
--- a/activity.py
+++ b/activity.py
@@ -141,6 +141,7 @@ class MemorizeActivity(Activity):
self.connect('key-press-event', self.table.key_press_event)
self.table.connect('card-flipped', self.game.card_flipped)
self.table.connect('card-highlighted', self.game.card_highlighted)
+ self.table.connect('resize-table', self.__resize_table_cb)
self.game.connect('set-border', self.table.set_border)
self.game.connect('flop-card', self.table.flop_card)
@@ -238,6 +239,11 @@ class MemorizeActivity(Activity):
self.table.resize(width, height - style.GRID_CELL_SIZE)
self.show_all()
+ def __resize_table_cb(self, widget):
+ # need reset the game
+ # because we reload the cards in the table
+ self.game.last_flipped = -1
+
def _change_mode_bt(self, button):
if button.get_active():
self._change_mode(_MODE_CREATE)
diff --git a/cardtable.py b/cardtable.py
index ad292bc..b2afd5c 100644
--- a/cardtable.py
+++ b/cardtable.py
@@ -37,7 +37,9 @@ class CardTable(Gtk.EventBox):
'card-flipped': (GObject.SignalFlags.RUN_FIRST,
None, [int, GObject.TYPE_PYOBJECT]),
'card-highlighted': (GObject.SignalFlags.RUN_FIRST,
- None, [int, GObject.TYPE_PYOBJECT]), }
+ None, [int, GObject.TYPE_PYOBJECT]),
+ 'resize-table': (GObject.SignalFlags.RUN_FIRST,
+ None, []), }
def __init__(self):
Gtk.EventBox.__init__(self)
@@ -82,6 +84,7 @@ class CardTable(Gtk.EventBox):
self.change_game(None, self.data, self.cards_data)
else:
self.load_game(None, self.data, self.cards_data)
+ self.emit('resize-table')
def _allocate_cb(self, widget, allocation):
size = allocation.height