Mercurial > parpg-source
comparison gui/hud.py @ 126:f7543a85c2ea
The stopActions method in the Hud class now drops the item that is currently dragged onto the map.
author | KarstenBock@gmx.net |
---|---|
date | Fri, 07 Oct 2011 14:16:21 +0200 |
parents | adbcdb900fa9 |
children | d1c2d316cc25 |
comparison
equal
deleted
inserted
replaced
125:452bbc3d915d | 126:f7543a85c2ea |
---|---|
26 from parpg.gui.containergui import ContainerGUI | 26 from parpg.gui.containergui import ContainerGUI |
27 from parpg.gui.dialoguegui import DialogueGUI | 27 from parpg.gui.dialoguegui import DialogueGUI |
28 from parpg.gui import drag_drop_data as data_drag | 28 from parpg.gui import drag_drop_data as data_drag |
29 from parpg.gui.inventorygui import CharacterGUI | 29 from parpg.gui.inventorygui import CharacterGUI |
30 from actionsbox import ActionsBox | 30 from actionsbox import ActionsBox |
31 from parpg.components import container | 31 from parpg.objects.action import DropItemAction |
32 | |
32 logger = logging.getLogger('hud') | 33 logger = logging.getLogger('hud') |
33 class Hud(object): | 34 class Hud(object): |
34 """Main Hud class""" | 35 """Main Hud class""" |
35 def __init__(self, controller, settings, callbacks): | 36 def __init__(self, controller, settings, callbacks): |
36 """Initialise the instance. | 37 """Initialise the instance. |
302 like dragging an item. | 303 like dragging an item. |
303 This is done to be able to savely perform other actions that might | 304 This is done to be able to savely perform other actions that might |
304 interfere with current running ones.""" | 305 interfere with current running ones.""" |
305 #Reset dragging - move item back to its old container | 306 #Reset dragging - move item back to its old container |
306 if data_drag.dragging: | 307 if data_drag.dragging: |
307 data_drag.source_container.placeItem(data_drag.dragged_item) | 308 drag_item = data_drag.dragged_item |
308 data_drag.dragging = False | 309 data_drag.dragging = False |
309 data_drag.dragged_item = None | 310 data_drag.dragged_item = None |
311 DropItemAction(self.controller, drag_item).execute() | |
310 if self.inventory: | 312 if self.inventory: |
311 self.inventory.closeInventory() | 313 self.inventory.closeInventory() |
312 | 314 |
313 def newGame(self): | 315 def newGame(self): |
314 """Called when user request to start a new game. | 316 """Called when user request to start a new game. |