Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/activity.py b/activity.py
index 8bfd758..8bc679d 100644
--- a/activity.py
+++ b/activity.py
@@ -107,7 +107,7 @@ class MemorizeActivity(Activity):
# Play game mode
self.table = cardtable.CardTable()
self.scoreboard = scoreboard.Scoreboard()
- self.cardlist = cardlist.CardList()
+ self.cardlist = cardlist.CardList(self)
self.createcardpanel = createcardpanel.CreateCardPanel()
self.cardlist.connect('pair-selected',
self.createcardpanel.pair_selected)
@@ -127,7 +127,7 @@ class MemorizeActivity(Activity):
self._memorizeToolbarBuilder.reset)
self._createToolbarBuilder.connect('create_equal_pairs',
self.change_equal_pairs)
- self.game = game.MemorizeGame()
+ self.game = game.MemorizeGame(self)
self._edit_button.connect('toggled', self._change_mode_bt)
@@ -232,11 +232,16 @@ class MemorizeActivity(Activity):
def write_file(self, file_path):
logging.debug('WRITE_FILE is_demo %s', self.game.model.is_demo)
+
+ # We want to save the game-image for demo games too !!!
+ """
if self.game.model.is_demo:
# if is a demo game only want keep the metadata
self._jobject.set_file_path(None)
raise NotImplementedError
return
+ """
+
if self.cardlist.pair_list_modified:
self.cardlist.update_model(self.game.model)
@@ -285,6 +290,13 @@ class MemorizeActivity(Activity):
game_zip.close()
self.metadata['mime_type'] = 'application/x-memorize-project'
+ # Store the game image as a string - that is simpler instead of
+ # having to deal with the dbus-converted list.
+ # When reading back, we use "eval" to convert the string into
+ # the correct type ("list" in this case).
+ self.metadata['saved_game_data_image'] = str(self.game.model.grid)
+ self.metadata['size'] = int(self.game.model.data['size'])
+
def _complete_close(self):
self._remove_temp_files()
Activity._complete_close(self)