[gcompris] explore activities, minor, made backgroundx and backgroundy parameter mandatory in the config file
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] explore activities, minor, made backgroundx and backgroundy parameter mandatory in the config file
- Date: Sun, 9 Sep 2012 21:33:36 +0000 (UTC)
commit 5099f441f4ea86d51307bb5e4a7dc04f8655931c
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Sun Sep 9 21:14:51 2012 +0200
explore activities, minor, made backgroundx and backgroundy parameter mandatory in the config file
It makes the code easier to keep this mandatory.
src/explore-activity/explore.py | 29 ++++++++-----------
.../explore_world_animals/content.desktop.in | 2 +
.../explore_world_music/content.desktop.in | 2 +
3 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/src/explore-activity/explore.py b/src/explore-activity/explore.py
index 7501ba4..a21d76e 100644
--- a/src/explore-activity/explore.py
+++ b/src/explore-activity/explore.py
@@ -114,20 +114,11 @@ class Gcompris_explore:
if hasattr(self, 'SoundMatchingGameText'):
self.gcomprisBoard.maxlevel = 3
- # set x and y positions for the background image
- if not hasattr(self, 'backgroundx'):
- x = 10
- else:
- x = int(self.backgroundx)
- if not hasattr(self, 'backgroundy'):
- y = 10
- else:
- y = int(self.backgroundy)
-
self.map = goocanvas.Image(
- parent=self.rootitem,
- x=x, y=y,
- pixbuf=gcompris.utils.load_pixmap(self.activityDataFilePath + self.background)
+ parent = self.rootitem,
+ x = self.backgroundx,
+ y = self.backgroundy,
+ pixbuf = gcompris.utils.load_pixmap(self.activityDataFilePath + self.background)
)
if RECORD_LOCATIONS:
@@ -499,10 +490,14 @@ class Gcompris_explore:
except:pass
try: self.TextMatchingGameText = self.data.get('common', 'TextMatchingGameText')
except:pass
- try: self.backgroundx = self.data.get('common', 'backgroundx')
- except:pass
- try: self.backgroundy = self.data.get('common', 'backgroundy')
- except:pass
+ try: self.backgroundx = int(self.data.get('common', 'backgroundx'))
+ except:
+ print "ERROR: missing 'backgroundx' in the data file"
+ return
+ try: self.backgroundy = int(self.data.get('common', 'backgroundy'))
+ except:
+ print "ERROR: missing 'backgroundy' in the data file"
+ return
try: self.textBoxX = int(self.data.get('common', 'textBoxX'))
except:pass
try: self.textBoxY = int(self.data.get('common', 'textBoxY'))
diff --git a/src/explore_world_animals-activity/resources/explore_world_animals/content.desktop.in b/src/explore_world_animals-activity/resources/explore_world_animals/content.desktop.in
index 386e499..b48411d 100644
--- a/src/explore_world_animals-activity/resources/explore_world_animals/content.desktop.in
+++ b/src/explore_world_animals-activity/resources/explore_world_animals/content.desktop.in
@@ -1,5 +1,7 @@
[common]
background = world.jpg
+backgroundx = 10
+backgroundy = 10
credits = http://aliciac.hubpages.com, http://www.public-domain-image.com, http://www.publicdomainpictures.net
creator = Christina Hadley (with help from Beth Hadley)
locationpic = tux.png
diff --git a/src/explore_world_music-activity/resources/explore_world_music/content.desktop.in b/src/explore_world_music-activity/resources/explore_world_music/content.desktop.in
index 0a9ce35..3ae2f24 100644
--- a/src/explore_world_music-activity/resources/explore_world_music/content.desktop.in
+++ b/src/explore_world_music-activity/resources/explore_world_music/content.desktop.in
@@ -1,5 +1,7 @@
[common]
background = worldmap.jpg
+backgroundx = 10
+backgroundy = 10
credits = http://commons.wikimedia.org/wiki, http://archive.org
creator = Beth Hadley
locationpic = suitcase.png
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]