Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-02-19 06:48:15 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-02-19 06:48:15 (GMT)
commit00304e296a01eb6d38b8bc4caf9d9b25ddc9d6e2 (patch)
tree73039c6d5799d9d264cdb9af609f58be55afb915
parentfe33b50d74d209f07fcaa3caa6d29f9945808241 (diff)
Add a iconview to select the resources in the edition of the map
-rw-r--r--editmap.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/editmap.py b/editmap.py
index 0d35968..0395d30 100644
--- a/editmap.py
+++ b/editmap.py
@@ -1,3 +1,6 @@
+from gettext import gettext as _
+import logging
+
import gtk
from game_map import GameMap
@@ -26,9 +29,37 @@ class EditMapWin(gtk.HBox):
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)
+ rigth_vbox = gtk.VBox()
+ rigth_vbox.pack_start(self.top_view, False, False)
+ notebook = gtk.Notebook()
+ rigth_vbox.pack_start(notebook, False, False)
+
+ # resources
+ self._resources_store = gtk.ListStore(str, gtk.gdk.Pixbuf)
+ self._resources_store.set_sort_column_id(0, gtk.SORT_ASCENDING)
+ resources_iconview = gtk.IconView(self._resources_store)
+ resources_iconview.set_text_column(0)
+ resources_iconview.set_pixbuf_column(1)
+
+ # furniture
+ furniture_iconview = gtk.IconView()
+ self.load_resources()
+
+ notebook.append_page(resources_iconview, gtk.Label(_('Resources')))
+ notebook.append_page(furniture_iconview, gtk.Label(_('Furniture')))
+
+ self.pack_start(rigth_vbox, 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)
+
+ def load_resources(self):
+ logging.error('Loading resources')
+ for resource in self.model.data['resources']:
+ title = resource['title']
+ file_image = resource['file_image']
+ logging.error('Adding %s %s', title, file_image)
+ pxb = gtk.gdk.pixbuf_new_from_file_at_size(file_image, 100, 100)
+ self._resources_store.append([title, pxb])