Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-06-10 21:20:46 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-06-10 21:20:46 (GMT)
commit4590f28a206bee298efa523f0c2f90f8d3f97040 (patch)
tree9eac0459dd14d953e06344ae9e092e108ca11ba5
parent6da68b08c94f321a755140c59e30c823ada72f67 (diff)
Games without color information
For example a downloaded game won't have color information
-rw-r--r--activity.py6
-rw-r--r--memorizetoolbar.py7
2 files changed, 11 insertions, 2 deletions
diff --git a/activity.py b/activity.py
index aba9d9b..deb6e17 100644
--- a/activity.py
+++ b/activity.py
@@ -158,7 +158,11 @@ class MemorizeActivity(Activity):
if self.metadata['mime_type'] == 'application/x-memorize-project':
self.toolbox.set_current_toolbar(_TOOLBAR_PLAY)
- self.game.change_game(None, file_path, 4, 'file', self.metadata['title'], self.metadata['icon-color'])
+ if self.metadata.has_key('icon-color'):
+ color = self.metadata['icon-color']
+ else:
+ color = profile.get_color().to_string()
+ self.game.change_game(None, file_path, 4, 'file', self.metadata['title'], color)
def change_mode(self, notebook, index):
if index == _TOOLBAR_CREATE:
diff --git a/memorizetoolbar.py b/memorizetoolbar.py
index 058a397..b525b95 100644
--- a/memorizetoolbar.py
+++ b/memorizetoolbar.py
@@ -22,6 +22,8 @@ from gettext import gettext as _
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolcombobox import ToolComboBox
from sugar.graphics.objectchooser import ObjectChooser
+from sugar import profile
+
import logging
from gobject import SIGNAL_RUN_FIRST, TYPE_PYOBJECT
@@ -129,7 +131,10 @@ class MemorizeToolbar(gtk.Toolbar):
if jobject and jobject.file_path:
title = jobject.metadata['title']
- color = jobject.metadata['icon-color']
+ if jobject.metadata.has_key('icon-color'):
+ color = jobject.metadata['icon-color']
+ else:
+ color = profile.get_color().to_string()
self.emit('game_changed', jobject.file_path, 4, 'file', title, color)
if self.jobject != None: