From dd2fc27b29b6e7feff9f68f4990ccd2168c0d1f4 Mon Sep 17 00:00:00 2001 From: Arnaud Gardelein Date: Sun, 25 Dec 2011 12:15:40 +0100 Subject: [PATCH] Pass Signals from Context using callback user arguments --- oscopy/ui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/oscopy/ui.py b/oscopy/ui.py index 69359e4..62e1f17 100755 --- a/oscopy/ui.py +++ b/oscopy/ui.py @@ -389,7 +389,7 @@ class App(dbus.service.Object): canvas.mpl_connect('axes_leave_event', self._axes_leave) canvas.mpl_connect('figure_enter_event', self._figure_enter) canvas.mpl_connect('figure_leave_event', self._figure_leave) - w.connect("drag_data_received", self._drag_data_received_cb) + w.connect("drag_data_received", self._drag_data_received_cb, self._ctxt.signals) w.connect('delete-event', lambda w, e: w.hide() or True) w.drag_dest_set(gtk.DEST_DEFAULT_MOTION |\ gtk.DEST_DEFAULT_HIGHLIGHT |\ @@ -679,9 +679,10 @@ class App(dbus.service.Object): # The multiple selection do work, but how to select signals # that are not neighbours in the list? Ctrl+left do not do # anything, neither alt+left or shift+left! + def _drag_data_received_cb(self, widget, drag_context, x, y, selection,\ - target_type, time): + target_type, time, ctxtsignals): # Event handling issue: this drag and drop callback is # processed before matplotlib callback _axes_enter. Therefore # when dropping, self._current_graph is not valid: it contains @@ -694,7 +695,7 @@ class App(dbus.service.Object): event = LocationEvent('axes_enter_event', canvas, x, my_y) signals = {} for name in selection.data.split(): - signals[name] = self._ctxt.signals[name] + signals[name] = ctxtsignals[name] if event.inaxes is not None: # Graph not found event.inaxes.insert(signals) -- 2.11.4.GIT