Fixed a bug when dragging a plot into the active ViewFrame.
This commit is contained in:
parent
a6186d7cb6
commit
a374510cfc
|
@ -84,6 +84,7 @@ class ViewFrame (gtk.Frame):
|
||||||
def focus(self):
|
def focus(self):
|
||||||
"""Gets focus and ensures that no other window is in focus."""
|
"""Gets focus and ensures that no other window is in focus."""
|
||||||
if self.focused:
|
if self.focused:
|
||||||
|
self.emit('focus-changed', self, True)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
for frame in self.view_frames:
|
for frame in self.view_frames:
|
||||||
|
@ -123,7 +124,8 @@ class ViewFrame (gtk.Frame):
|
||||||
if self._button_event:
|
if self._button_event:
|
||||||
self._view.disconnect(self._button_event)
|
self._view.disconnect(self._button_event)
|
||||||
|
|
||||||
self._button_event = view.connect("button-press-event", self.on_button_press_event)
|
self._button_event = view.connect("button-press-event",
|
||||||
|
self.on_button_press_event)
|
||||||
|
|
||||||
# remove old view, set new view
|
# remove old view, set new view
|
||||||
self._view.hide()
|
self._view.hide()
|
||||||
|
@ -143,7 +145,8 @@ class ViewFrame (gtk.Frame):
|
||||||
if not self.focused:
|
if not self.focused:
|
||||||
self.focus()
|
self.focus()
|
||||||
|
|
||||||
def on_drag_data_received(self, widget, drag_context, x, y, selection, info, timestamp):
|
def on_drag_data_received(self, widget, drag_context, x, y,
|
||||||
|
selection, info, timestamp):
|
||||||
treestore, path = selection.tree_get_row_drag_data()
|
treestore, path = selection.tree_get_row_drag_data()
|
||||||
iter = treestore.get_iter(path)
|
iter = treestore.get_iter(path)
|
||||||
obj = treestore.get_value(iter,2)
|
obj = treestore.get_value(iter,2)
|
||||||
|
@ -294,6 +297,7 @@ class EmptyView (Plot):
|
||||||
class NavToolbar(NavigationToolbar2):
|
class NavToolbar(NavigationToolbar2):
|
||||||
toolitems = (('Select', 'Select within rectangle', 'zoom_to_rect.png',
|
toolitems = (('Select', 'Select within rectangle', 'zoom_to_rect.png',
|
||||||
'select'),) + NavigationToolbar2.toolitems
|
'select'),) + NavigationToolbar2.toolitems
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
NavigationToolbar2.__init__(self, *args)
|
NavigationToolbar2.__init__(self, *args)
|
||||||
self._select_callback = None
|
self._select_callback = None
|
||||||
|
|
Reference in New Issue