changeset 135:9e86c37f5506

Added context menu to the inventory.
author KarstenBock@gmx.net
date Sat, 08 Oct 2011 14:25:48 +0200
parents 73b7188a461d
children 9397f3e4516d
files gui/containergui_base.py gui/inventorygui.py
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gui/containergui_base.py	Sat Oct 08 14:19:35 2011 +0200
+++ b/gui/containergui_base.py	Sat Oct 08 14:25:48 2011 +0200
@@ -124,8 +124,9 @@
            @return: None"""
         if event.getButton() == event.RIGHT:
             item = widget.item
-            if item:                
-                item = item.entity
+            if item:
+                if not isinstance(item, General):
+                    item = item.entity
                 actions = {}
                 if item.usable:
                     actions = deepcopy(item.usable.actions)
--- a/gui/inventorygui.py	Sat Oct 08 14:19:35 2011 +0200
+++ b/gui/inventorygui.py	Sat Oct 08 14:25:48 2011 +0200
@@ -156,9 +156,10 @@
             widget = self.grid.getSlot(counter)
             slot_name = widget.name
             widget.index = counter
-            events_to_map[slot_name + "/mousePressed"] = self.mousePressedOnSlot
-            #events_to_map[slot_name + "/mouseReleased"] = \
-            #                                self.showContextMenu
+            events_to_map[slot_name + "/mousePressed"] = (
+                self.mousePressedOnSlot
+            )
+            events_to_map[slot_name + "/mouseReleased"] = self.showContextMenu
 
         self.grid.mapEvents(events_to_map)