Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/model.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-03-17 23:31:03 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-03-17 23:31:03 (GMT)
commit476cffc9b69e1139fabb02a4513fb5884cf82c90 (patch)
tree03c8c81ffebb2abbea6782698a1c3442e759b1e4 /model.py
parentc92b89948ddd1ce7dbaf475be3e1a686592ad00d (diff)
Improve the resources dialog
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'model.py')
-rw-r--r--model.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/model.py b/model.py
index 04bbf9d..7d933fd 100644
--- a/model.py
+++ b/model.py
@@ -34,6 +34,13 @@ class GameModel:
self.data['last_resource_id'] = self.data['last_resource_id'] + 1
return self.data['last_resource_id']
+ def get_resource(self, id_resource):
+ for resource in self.data['resources']:
+ if resource['id_resource'] == int(id_resource):
+ return resource
+ logging.error('ERROR: resource %s not found', id_resource)
+ return None
+
def write(self, file_name):
instance_path = os.path.join(activity.get_activity_root(), 'instance')