Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-21 18:13:54 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-21 18:13:54 (GMT)
commit655029efa32ec3b921e7dc11231de1d6e6fe89dd (patch)
tree72f06bc0a8fdbeb5db7a225224d62127caf57652
parent3cfa76ea9a229eb180410c7bd5359a1705c64b75 (diff)
Change the cursor while the drag happens
-rw-r--r--canvas.py13
-rw-r--r--view.py2
2 files changed, 11 insertions, 4 deletions
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))