diff --git a/system/dialogs.py b/system/dialogs.py index e952dae..b09a11e 100644 --- a/system/dialogs.py +++ b/system/dialogs.py @@ -8,7 +8,7 @@ from system import logger, project, workflow import workflows DATADIR = os.path.dirname(sys.modules['system'].__file__) -GLADEFILENAME = os.path.join(DATADIR, 'fluent.glade') +GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade') class CreateProjectDruid(gtk.Window): """A druid for creating a new project. diff --git a/system/fluents.py b/system/fluents.py index 9c2e7cd..d0ec843 100755 --- a/system/fluents.py +++ b/system/fluents.py @@ -18,7 +18,7 @@ from system import project, workflow, dataset, logger, plots, navigator, dialogs PROGRAM_NAME = 'fluents' VERSION = '0.1.0' DATADIR = os.path.dirname(sys.modules['system'].__file__) -GLADEFILENAME = os.path.join(DATADIR, 'fluent.glade') +GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade') class FluentApp: @@ -115,7 +115,10 @@ class FluentApp: 'on_workflow_refresh_clicked' : (self.on_workflow_refresh_clicked), 'on_index1_activate' : (self.on_help_index), 'on_about1_activate' : (self.on_help_about), - 'on_report_bug1_activate' : (self.on_help_report_bug)} + 'on_report_bug1_activate' : (self.on_help_report_bug), + 'on_small_view1_activate' : (self.on_multiple_view), + 'on_large_view1_activate' : (self.on_single_view), + } self.widget_tree.signal_autoconnect(signals) # Log that we've set up the app now @@ -125,11 +128,11 @@ class FluentApp: pt = self.widget_tree.get_widget('main_view') pt.insert_view(plot) - def on_single_view(self, button): + def on_single_view(self, *ignored): nb = self.widget_tree.get_widget('main_view') nb.goto_large() - def on_multiple_view(self, button): + def on_multiple_view(self, *ignored): nb = self.widget_tree.get_widget('main_view') nb.goto_small() @@ -159,4 +162,3 @@ class FluentApp: logger.log('warning', e) else: logger.log('notice', 'Successfully reloaded workflow') - diff --git a/system/plots.py b/system/plots.py index bc5e887..53b41e2 100644 --- a/system/plots.py +++ b/system/plots.py @@ -51,6 +51,7 @@ class ViewFrame (gtk.Frame): self.focused = False self.view_frames = view_frames self.empty_view = EmptyView() + self._button_event = None view_frames.append(self) if len(view_frames) == 1: @@ -58,8 +59,11 @@ class ViewFrame (gtk.Frame): else: self.unfocus() + # Set view self._view = self.empty_view - self.set_view(self._view) + self._view.connect("button-press-event", self.on_button_press_event) + self.add(self._view) + self._view.show() self.show() def focus(self): @@ -88,14 +92,19 @@ class ViewFrame (gtk.Frame): if view == None: view = self.empty_view -# # do nothing if the view is already there -# if view == self._view: -# return + # do nothing if the view is already there + if view == self._view: + return + # detach view from current parent + view_parent = view.get_parent() + if view_parent: + view_parent.set_view(None) + # switch which widget we are listening to -# if self._view: -# self._view.disconnect(self.on_button_press_event) - view.connect("button-press-event", self.on_button_press_event) + if self._button_event: + self._view.disconnect(self._button_event) + self._button_event = view.connect("button-press-event", self.on_button_press_event) # remove old view, set new view self._view.hide() @@ -112,7 +121,6 @@ class ViewFrame (gtk.Frame): return self._view def on_button_press_event(self, widget, event): - print "foo" if not self.focused: self.focus() @@ -132,8 +140,8 @@ class MainView (gtk.Notebook): self.append_page(self._small_views) self.append_page(self._large_view) - self.set_current_page(0) self.show() + self.set_current_page(0) def __getitem__(self, x, y): return self._views[x, y] @@ -151,6 +159,9 @@ class MainView (gtk.Notebook): return None def goto_large(self): + if self.get_current_page() == 1: + return + vf = self.get_active_small_view() view = vf.get_view() vf.set_view(None) @@ -158,6 +169,9 @@ class MainView (gtk.Notebook): self.set_current_page(1) def goto_small(self): + if self.get_current_page() == 0: + return + vf = self.get_active_small_view() view = self._large_view.get_view() self._large_view.set_view(None) @@ -174,7 +188,6 @@ class MainView (gtk.Notebook): self._small_views.show() gtk.Notebook.show(self) -# def insert_view(self, view) class Plot (gtk.Frame):