diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-05-09 16:03:46 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-05-09 16:03:46 (GMT) |
commit | c65f552b0f9e2901cf9857d67d9565771d89bf9e (patch) | |
tree | 225a5ec102d9e64a1dad308cadec28800f16a237 | |
parent | 6fe524933197a03fd7e14c3ff41c3237fcab51c0 (diff) |
fix for #3579
-rw-r--r-- | game.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -620,8 +620,20 @@ class Game(): self.grid.grid[k] = None move = 'abort' self.clicked[i].reset() + self._consistency_check() return move + def _consistency_check(self): + ''' Make sure that the cards in the grid are really in the grid ''' + # Root cause: a race condition? + for i in range(3): + spr = self.clicked[i].spr + if spr is not None: + if not self.grid.xy_in_match(spr.get_xy()): + _logger.debug('card in both the grid and \ +match area (%d)' % (i)) + spr.move(self.grid.match_to_xy(i)) + def process_selection(self, spr): ''' After a card has been selected... ''' if self.editing_word_list: # Edit label of selected card @@ -953,7 +965,10 @@ class Game(): self.match_list = [] for i in saved_match_list_indices: if i is not None: - self.match_list.append(self.deck.index_to_card(i).spr) + try: + self.match_list.append(self.deck.index_to_card(i).spr) + except AttributeError: + _logger.debug('index %s was not found in deck' % (str(i))) def _restore_word_list(self, saved_word_list): ''' Restore the word list upon resume or share. ''' |