Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/editmap.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-02-13 01:03:07 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-02-13 01:03:07 (GMT)
commit03be821e6a5fcee2ad7a3dbd433276357ed4b8ae (patch)
tree9d0c61c0fbe7eaf273e736265b39aaf5e8c5546f /editmap.py
parent4ad228fbf024e6f7ca6026d367714533e07b5f4e (diff)
Add window to edit the map in the activity.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'editmap.py')
-rw-r--r--editmap.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/editmap.py b/editmap.py
new file mode 100644
index 0000000..0d35968
--- /dev/null
+++ b/editmap.py
@@ -0,0 +1,34 @@
+import gtk
+
+from game_map import GameMap
+from mapview import TopMapView
+from mapnav import MapNavView
+
+
+class EditMapWin(gtk.HBox):
+
+ def __init__(self, model):
+ gtk.HBox.__init__(self)
+ self.model = model
+
+ if not 'map_data' in self.model.data or \
+ self.model.data['map_data'] is None:
+ self.game_map = GameMap()
+ else:
+ self.game_map = GameMap(self.model.data['map_data'])
+
+ self.model.data['map_data'] = self.game_map.data
+
+ self.nav_view = MapNavView(self.game_map)
+ self.top_view = TopMapView(self.game_map, 150, 150)
+ self.top_view.show_position(self.nav_view.x, self.nav_view.y,
+ self.nav_view.direction)
+ self.nav_view.connect('position-changed', self.show_position,
+ self.top_view)
+ self.pack_start(self.nav_view, True, True)
+ self.pack_start(self.top_view, False, False)
+ self.nav_view.grab_focus()
+ self.show_all()
+
+ def show_position(self, nav_view, x, y, direction, top_view):
+ self.top_view.show_position(x, y, direction)