Added function menu. Clicking the items still does not work, though.

This commit is contained in:
Einar Ryeng 2007-01-05 14:42:22 +00:00
parent f7fe171896
commit 1371bc1b1a
2 changed files with 37 additions and 4 deletions

View File

@ -160,9 +160,17 @@ class FluentApp:
self['appwindow'].set_size_request(800, 600)
# Set up workflow
self.wf_menu = workflow.WorkflowView(self.workflow)
self.wf_menu.show()
self['workflow_vbox'].pack_end(self.wf_menu)
self.wf_view = workflow.WorkflowView(self.workflow)
self.wf_view.show()
self['workflow_vbox'].pack_end(self.wf_view)
self._wf_menu = workflow.WorkflowMenu(self.workflow)
self._wf_menu.show()
wf_menuitem = gtk.MenuItem('Fu_nctions')
wf_menuitem.set_submenu(self._wf_menu)
wf_menuitem.show()
self['menubar1'].insert(wf_menuitem, 3)
# Connect signals
signals = {'on_quit1_activate' : (gtk.main_quit),
@ -198,7 +206,7 @@ class FluentApp:
def set_workflow(self, workflow):
self.workflow = workflow
self.wf_menu.set_workflow(self.workflow)
self.wf_view.set_workflow(self.workflow)
def show(self):
self.init_gui()

View File

@ -377,3 +377,28 @@ def toggled(renderer, path, store):
it = store.get_iter(path)
old_value = store.get_value(it, 1)
store.set_value(it, 1, not old_value)
class WorkflowMenu (gtk.Menu):
def __init__(self, workflow):
gtk.Menu.__init__(self)
self._workflow = workflow
for stage in workflow.stages:
self.append(self._create_stage_item(stage))
def _create_stage_item(self, stage):
stage_menu_item = gtk.MenuItem(stage.name)
stage_menu_item.show()
stage_menu = gtk.Menu()
stage_menu_item.set_submenu(stage_menu)
for fun in stage.functions:
stage_menu.append(self._create_function_item(fun))
return stage_menu_item
def _create_function_item(self, function):
menuitem = gtk.MenuItem(function.name)
menuitem.show()
return menuitem