From 9b564472adc3040047783dc0815396090de48266 Mon Sep 17 00:00:00 2001 From: mike Date: Sun, 06 Dec 2009 02:48:54 +0000 Subject: Actions : Correcting drag and drop behaviour on elements that don't support it --- diff --git a/tutorius/actions.py b/tutorius/actions.py index a809980..cf586f2 100644 --- a/tutorius/actions.py +++ b/tutorius/actions.py @@ -87,6 +87,14 @@ class DragWrapper(object): pxbuf.get_from_drawable(px,gtk.gdk.colormap_get_system(), 0, 0, 0, 0, -1, -1) drag_context.set_icon_pixbuf(pxbuf,0,0) + + def _drag_fail(self, *args): + """ + Callback to prevent the animation that brings back the dragged item to + its initial position. + """ + LOGGER.debug("DragWrapper :: Drag fail event was raised") + return True def _drag_end(self, widget, context, *args): """Callback for end of drag (stolen focus).""" @@ -102,7 +110,6 @@ class DragWrapper(object): self.update_action_cb('position', self.position) - def set_draggable(self, value): """Setter for the draggable property""" if bool(value) ^ bool(self._drag_on): @@ -121,6 +128,8 @@ class DragWrapper(object): self._handles.append(self._eventbox.connect( "drag-begin", self._drag_begin)) self._handles.append(self._eventbox.connect( + "drag-failed", self._drag_fail)) + self._handles.append(self._eventbox.connect( "drag-end", self._drag_end)) else: while len(self._handles): -- cgit v0.9.1