Toolbars now get automatically updated from the global mode setting when
the mouse enters a plot.
This commit is contained in:
parent
b1bfe1fe3e
commit
f826931105
|
@ -99,6 +99,8 @@ class FluentApp:
|
|||
def change_plots(self, plots):
|
||||
"""Changes all plots."""
|
||||
self['main_view'].set_all_plots(plots)
|
||||
v = self.get_active_view_frame().get_view()
|
||||
self._update_toolbar(v)
|
||||
|
||||
def get_active_view_frame(self):
|
||||
return self['main_view'].get_active_view_frame()
|
||||
|
|
|
@ -199,7 +199,13 @@ class MainView (gtk.Notebook):
|
|||
if vf.focused:
|
||||
return vf
|
||||
return None
|
||||
|
||||
|
||||
def get_active_view_frame(self):
|
||||
if self.get_current_page() == 0:
|
||||
return self.get_active_small_view()
|
||||
else:
|
||||
return self._large_view
|
||||
|
||||
def goto_large(self):
|
||||
if self.get_current_page() == 1:
|
||||
return
|
||||
|
@ -953,7 +959,7 @@ class PlotToolbar(gtk.Toolbar):
|
|||
|
||||
self.set_property('show-arrow', False)
|
||||
|
||||
#canvas.connect('enter-notify-event', self.on_enter_notify)
|
||||
self.canvas.connect('enter-notify-event', self.on_enter_notify)
|
||||
self.show()
|
||||
self.add_mode(DefaultPlotMode(self.plot))
|
||||
self.add_mode(PanPlotMode(self.plot))
|
||||
|
@ -1032,6 +1038,8 @@ class PlotToolbar(gtk.Toolbar):
|
|||
if self.get_button(mode_name) and \
|
||||
not self.get_button(mode_name).get_active():
|
||||
self.get_button(mode_name).set_active(True)
|
||||
|
||||
globals()['active_mode'] = mode_name
|
||||
return self._current_mode
|
||||
|
||||
|
||||
|
@ -1042,6 +1050,9 @@ class PlotToolbar(gtk.Toolbar):
|
|||
def _on_freeze_toggle(self, button):
|
||||
self.plot.set_frozen(button.get_active())
|
||||
|
||||
def on_enter_notify(self, widget, event):
|
||||
self.set_mode(active_mode)
|
||||
|
||||
|
||||
# Create a view-changed signal that should be emitted every time
|
||||
# the active view changes.
|
||||
|
|
Reference in New Issue