# HG changeset patch # User KarstenBock@gmx.net # Date 1317910080 -7200 # Node ID b96607c8be7f5e6dccccca5c94ad870e66c1e41b # Parent 2ba7c6d8f738c9ca8fc900c0bfe7c1d1af5148b1 Fixed bug that dropping an item onto another would not set the drag_data to the replaced item, which caused this to be lost. diff -r 2ba7c6d8f738 -r b96607c8be7f src/parpg/gui/containergui.py --- a/src/parpg/gui/containergui.py Thu Oct 06 16:04:48 2011 +0200 +++ b/src/parpg/gui/containergui.py Thu Oct 06 16:08:00 2011 +0200 @@ -67,12 +67,8 @@ # get the up and down images of the widget up_image = drag_widget.up_image down_image = drag_widget.down_image - # set the mouse cursor to be the widget's image - self.controller.setMouseCursor(up_image.source, down_image.source) - data_drag.dragged_image = up_image.source - data_drag.dragging = True - data_drag.dragged_widget = drag_widget - data_drag.source_container = self.container + self.setDragData(drag_widget.item, down_image, up_image, + self.container) container.take_item(self.container, drag_widget.item.slot) # after dragging the 'item', set the widgets' images @@ -99,13 +95,18 @@ container.put_item(self.container, drag_item, drop_index) ) - drop_widget.item = drag_item - self.updateImage(drop_widget) #if there was no item the stop dragging and reset cursor - if replace_item == None: + if replace_item: + up_image = drop_widget.up_image + down_image = drop_widget.down_image + self.setDragData(replace_item, down_image, up_image, + self.container) + else: data_drag.dragging = False #reset the mouse cursor to the normal cursor self.controller.resetMouseCursor() + drop_widget.item = drag_item + self.updateImage(drop_widget) except (container.BulkLimitError): #Do we want to notify the player why the item can't be dropped? pass