diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-02-21 06:06:43 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-02-21 06:06:43 (GMT) |
commit | 5e068d9062129e939f0b903f14bbc78699794369 (patch) | |
tree | a3082f6873cfd091446ec8b60ab016412f4664da /editmap.py | |
parent | 2ff9cc16b223b38687a1c0c1c2798ce26aece7cf (diff) |
Start the functionality of adding furniture to the map
This patch only add the image to the map and the data structures,
but does not modifiy the size or position of the images.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'editmap.py')
-rw-r--r-- | editmap.py | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -46,12 +46,14 @@ class EditMapWin(gtk.HBox): self.load_resources() # furniture - self._furniture_store = gtk.ListStore(str, gtk.gdk.Pixbuf) + self._furniture_store = gtk.ListStore(str, gtk.gdk.Pixbuf, str) self._furniture_store.set_sort_column_id(0, gtk.SORT_ASCENDING) furniture_iconview = gtk.IconView(self._furniture_store) furniture_iconview.set_text_column(0) furniture_iconview.set_pixbuf_column(1) self.load_furniture() + furniture_iconview.connect("item-activated", + self.__furniture_activated_cb) scrolled1 = gtk.ScrolledWindow() scrolled1.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) @@ -88,4 +90,17 @@ class EditMapWin(gtk.HBox): logging.error('Adding %s', image_file_name) pxb = gtk.gdk.pixbuf_new_from_file_at_size(image_file_name, 100, 100) - self._furniture_store.append(['', pxb]) + self._furniture_store.append(['', pxb, image_file_name]) + + def __furniture_activated_cb(self, widget, item): + model = widget.get_model() + image_file_name = model[item][2] + logging.error('Image %s selected', image_file_name) + x = self.nav_view.x + y = self.nav_view.y + direction = self.nav_view.direction + wall_object = {'image_file_name': image_file_name, + 'x': 100, 'y': 100, 'width': 200, 'height': 200} + + self.game_map.add_object_to_wall(x, y, direction, wall_object) + self.nav_view.update_wall_info(x, y, direction) |