Add toolbar support to plots, with home made selection support <phew>.

This commit is contained in:
2006-04-26 12:11:23 +00:00
parent 490038d9bf
commit 21edeecdc3
2 changed files with 179 additions and 41 deletions

View File

@@ -24,6 +24,8 @@ class FluentApp:
# Application variables
self.project = None
self.current_data = None
self._last_view = None
self._plot_toolbar = None
gtk.glade.set_custom_handler(self.custom_object_factory)
self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow')
@@ -52,10 +54,29 @@ class FluentApp:
return self.log_view
def create_main_view(self, str1, str2, int1, int2):
self.main_view = plots.MainView()
self.main_view = plots.MainView(self._update_toolbar)
self.main_view.show()
return self.main_view
def _update_toolbar(self, view):
logger.log("debug", "view changed to %s" % view)
# don't do anything on no change
if self._last_view == view:
return
self._last_view = view
window = self.widget_tree.get_widget('plot_toolbar_dock')
if self._plot_toolbar:
print "removing", self._plot_toolbar
window.remove(self._plot_toolbar)
self._plot_toolbar = view.get_toolbar()
if self._plot_toolbar:
print "adding", self._plot_toolbar
window.add(self._plot_toolbar)
print "window contents:", window.get_children()
def create_small_view(self, str1, str2, int1, int2):
self.small_view = plots.SmallView()
self.small_view.show()