From 655029efa32ec3b921e7dc11231de1d6e6fe89dd Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 21 Jan 2009 18:13:54 +0000 Subject: Change the cursor while the drag happens --- diff --git a/canvas.py b/canvas.py index 19f9ae0..a65a03f 100644 --- a/canvas.py +++ b/canvas.py @@ -36,6 +36,7 @@ class Canvas(gtk.DrawingArea): gobject.GObject.__init__(self) self.dragging_started = dispatch.Signal() + self.dragging_motion = dispatch.Signal() self.dragging_finished = dispatch.Signal() self.add_events(gtk.gdk.BUTTON_PRESS_MASK | @@ -146,22 +147,26 @@ class Canvas(gtk.DrawingArea): self._dragging = False def __motion_notify_event_cb(self, widget, event): - if self._dragging or self._last_clicked_element is None: + if self._last_clicked_element is None: return True - + # if the mouse button is not pressed, no drag should occurr if not event.state & gtk.gdk.BUTTON1_MASK: self._cleanup_drag() return True - logging.debug('motion_notify_event_cb') - if event.is_hint: x, y, state_ = event.window.get_pointer() else: x = event.x y = event.y + if self._dragging: + self.dragging_motion.send(self, position=(x, y)) + return True + + logging.debug('motion_notify_event_cb') + if self.drag_check_threshold(int(self._press_start_x), int(self._press_start_y), int(x), diff --git a/view.py b/view.py index 20ebdac..326ced8 100644 --- a/view.py +++ b/view.py @@ -50,8 +50,10 @@ class MindMapView(Canvas): logging.debug('__dragging_started_cb %r %r' % (x, y)) thought = kwargs['element'] thought.dragging = True + self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1)) def __dragging_finished_cb(self, **kwargs): + self.window.set_cursor(None) x, y = kwargs['position'] thought = kwargs['element'] logging.debug('__dragging_finished_cb %r %r' % (x, y)) -- cgit v0.9.1