Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Fixed plot things. A plot can only be attached to one view now.

This commit is contained in:
Einar Ryeng 2006-05-29 11:24:33 +00:00
parent 62c1d79dac
commit 581cef75ae
3 changed files with 31 additions and 16 deletions

View File

@ -8,7 +8,7 @@ from system import logger, project, workflow
import workflows import workflows
DATADIR = os.path.dirname(sys.modules['system'].__file__) 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): class CreateProjectDruid(gtk.Window):
"""A druid for creating a new project. """A druid for creating a new project.

View File

@ -18,7 +18,7 @@ from system import project, workflow, dataset, logger, plots, navigator, dialogs
PROGRAM_NAME = 'fluents' PROGRAM_NAME = 'fluents'
VERSION = '0.1.0' VERSION = '0.1.0'
DATADIR = os.path.dirname(sys.modules['system'].__file__) DATADIR = os.path.dirname(sys.modules['system'].__file__)
GLADEFILENAME = os.path.join(DATADIR, 'fluent.glade') GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade')
class FluentApp: class FluentApp:
@ -115,7 +115,10 @@ class FluentApp:
'on_workflow_refresh_clicked' : (self.on_workflow_refresh_clicked), 'on_workflow_refresh_clicked' : (self.on_workflow_refresh_clicked),
'on_index1_activate' : (self.on_help_index), 'on_index1_activate' : (self.on_help_index),
'on_about1_activate' : (self.on_help_about), '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) self.widget_tree.signal_autoconnect(signals)
# Log that we've set up the app now # Log that we've set up the app now
@ -125,11 +128,11 @@ class FluentApp:
pt = self.widget_tree.get_widget('main_view') pt = self.widget_tree.get_widget('main_view')
pt.insert_view(plot) 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 = self.widget_tree.get_widget('main_view')
nb.goto_large() nb.goto_large()
def on_multiple_view(self, button): def on_multiple_view(self, *ignored):
nb = self.widget_tree.get_widget('main_view') nb = self.widget_tree.get_widget('main_view')
nb.goto_small() nb.goto_small()
@ -159,4 +162,3 @@ class FluentApp:
logger.log('warning', e) logger.log('warning', e)
else: else:
logger.log('notice', 'Successfully reloaded workflow') logger.log('notice', 'Successfully reloaded workflow')

View File

@ -51,6 +51,7 @@ class ViewFrame (gtk.Frame):
self.focused = False self.focused = False
self.view_frames = view_frames self.view_frames = view_frames
self.empty_view = EmptyView() self.empty_view = EmptyView()
self._button_event = None
view_frames.append(self) view_frames.append(self)
if len(view_frames) == 1: if len(view_frames) == 1:
@ -58,8 +59,11 @@ class ViewFrame (gtk.Frame):
else: else:
self.unfocus() self.unfocus()
# Set view
self._view = self.empty_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() self.show()
def focus(self): def focus(self):
@ -88,14 +92,19 @@ class ViewFrame (gtk.Frame):
if view == None: if view == None:
view = self.empty_view view = self.empty_view
# # do nothing if the view is already there # do nothing if the view is already there
# if view == self._view: if view == self._view:
# return 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 # switch which widget we are listening to
# if self._view: if self._button_event:
# self._view.disconnect(self.on_button_press_event) self._view.disconnect(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()
@ -112,7 +121,6 @@ class ViewFrame (gtk.Frame):
return self._view return self._view
def on_button_press_event(self, widget, event): def on_button_press_event(self, widget, event):
print "foo"
if not self.focused: if not self.focused:
self.focus() self.focus()
@ -132,8 +140,8 @@ class MainView (gtk.Notebook):
self.append_page(self._small_views) self.append_page(self._small_views)
self.append_page(self._large_view) self.append_page(self._large_view)
self.set_current_page(0)
self.show() self.show()
self.set_current_page(0)
def __getitem__(self, x, y): def __getitem__(self, x, y):
return self._views[x, y] return self._views[x, y]
@ -151,6 +159,9 @@ class MainView (gtk.Notebook):
return None return None
def goto_large(self): def goto_large(self):
if self.get_current_page() == 1:
return
vf = self.get_active_small_view() vf = self.get_active_small_view()
view = vf.get_view() view = vf.get_view()
vf.set_view(None) vf.set_view(None)
@ -158,6 +169,9 @@ class MainView (gtk.Notebook):
self.set_current_page(1) self.set_current_page(1)
def goto_small(self): def goto_small(self):
if self.get_current_page() == 0:
return
vf = self.get_active_small_view() vf = self.get_active_small_view()
view = self._large_view.get_view() view = self._large_view.get_view()
self._large_view.set_view(None) self._large_view.set_view(None)
@ -174,7 +188,6 @@ class MainView (gtk.Notebook):
self._small_views.show() self._small_views.show()
gtk.Notebook.show(self) gtk.Notebook.show(self)
# def insert_view(self, view)
class Plot (gtk.Frame): class Plot (gtk.Frame):