Skip to content

Commit

Permalink
Restore support for span
Browse files Browse the repository at this point in the history
Blitting is not used in matplotlib GTK3Cairo backend, disabled here as well.
SpanSelector and RectangleSelector now have same properties "active" and "visible" (see matplotlib/matplotlib#3376 )
FIXME: On layout change, more than one SpanSelector appears on Graph
  • Loading branch information
agardelein committed Nov 11, 2014
1 parent 042a0e4 commit 3b69386
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/oscopy_ipython/gui/gtk_figure.py
Expand Up @@ -321,23 +321,26 @@ def set_layout(self, layout='quad'):
iter = self.cbx_store.iter_next(iter)
if self._layout == 'horiz':
g.span = SpanSelector(g, g.onselect, 'horizontal',
useblit=True)
useblit=False)
g.span.visible = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
g.span.active = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
self.hbar.set_sensitive(True)
self.hbar.show()
self.vbar.set_sensitive(False)
self.vbar.hide()
elif self._layout == 'vert':
g.span = SpanSelector(g, g.onselect, 'vertical',
useblit=True)
useblit=False)
g.span.visible = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
g.span.active = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
self.hbar.set_sensitive(False)
self.hbar.hide()
self.vbar.set_sensitive(True)
self.vbar.show()
elif self._layout == 'quad':
g.span = MyRectangleSelector(g, g.onselect, rectprops=dict(facecolor='red', edgecolor = 'black', alpha=0.5, fill=True),
useblit=True)
useblit=False)
g.span.visible = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
g.span.active = self.cbx_store.get_value(iter, IOSCOPY_COL_SPAN)
self.hbar.set_sensitive(True)
self.hbar.show()
Expand Down Expand Up @@ -435,16 +438,12 @@ def span_toggle_btn_toggled(self, span_toggle_btn):
grnum = int(store.get_string_from_iter(iter))
if grnum > len(self.graphs):
break
if hasattr(self.graphs[grnum - 1].span, 'active'):
self.graphs[grnum - 1].span.active = a
elif hasattr(self.graphs[grnum - 1].span, 'visible'):
self.graphs[grnum - 1].span.visible = a
iter = store.iter_next(iter)
else:
if hasattr(self.graphs[grnum - 1].span, 'active'):
self.graphs[grnum - 1].span.active = a
elif hasattr(self.graphs[grnum - 1].span, 'visible'):
self.graphs[grnum - 1].span.visible = a
iter = store.iter_next(iter)
else:
self.graphs[grnum - 1].span.active = a
self.graphs[grnum - 1].span.visible = a
self.canvas.draw()

def save_fig_btn_clicked(self, save_fig_btn):
Expand Down

0 comments on commit 3b69386

Please sign in to comment.