示例#1
0
 def OnPipelineShowVisualizerMenu(self, event):
     """Called on 'Pipeline'->'Show visualizer...' menu.
     """
     # TBD: this is almost same with OnPipelineShowInspectorMenu.
     # If current pipeline node is set to None, do nothing and return.
     selected_tree_id, selected_node = self.check_pipeline_node_selected()
     if selected_node is None:
         return
     # else --
     debug('current_pipeline_node is %s' % selected_node)
     # If there are already corresponding visualizer, just focus it.
     visualizer_page_index, visualizer_page_instance = self.visualizer_notebook.find_page_for_target(
         selected_node)
     if visualizer_page_index is None:
         debug('No page exists, trying')
         # find PipelineNode class and (try to) load new visualizer page.
         pipeline_node_type_name = selected_node.__class__.__name__
         debug('\n'.join(
             str((k, v)) for k, v in VISUALIZER_PAGE_REGISTRY.items()))
         visualizer_page_class = VISUALIZER_PAGE_REGISTRY.get(
             pipeline_node_type_name, None)
         if visualizer_page_class is None:
             wx.MessageBox(
                 'Node type %s does not have inspector.' %
                 (pipeline_node_type_name), 'Invalid operation.')
             return
         debug('inspector page class: %s' % (visualizer_page_class))
         # else
         visualizer_page_index, visualizer_page_instance = self.visualizer_notebook.create_page(
             visualizer_page_class,
             selected_node.name,
             target=selected_node)
         # force update
         visualizer_page_instance.update()
     self.visualizer_notebook.SetSelection(visualizer_page_index)
示例#2
0
文件: app.py 项目: ecell/ecell4-vis
 def OnPipelineShowVisualizerMenu(self, event):
     """Called on 'Pipeline'->'Show visualizer...' menu.
     """
     # TBD: this is almost same with OnPipelineShowInspectorMenu.
     # If current pipeline node is set to None, do nothing and return.
     selected_tree_id, selected_node = self.check_pipeline_node_selected()
     if selected_node is None:
         return
     # else -- 
     debug('current_pipeline_node is %s' %selected_node)
     # If there are already corresponding visualizer, just focus it.
     visualizer_page_index, visualizer_page_instance = self.visualizer_notebook.find_page_for_target(selected_node)
     if visualizer_page_index is None:
         debug('No page exists, trying')
         # find PipelineNode class and (try to) load new visualizer page.
         pipeline_node_type_name = selected_node.__class__.__name__
         debug('\n'.join(str((k, v)) for k, v in VISUALIZER_PAGE_REGISTRY.items()))
         visualizer_page_class = VISUALIZER_PAGE_REGISTRY.get(pipeline_node_type_name, None)
         if visualizer_page_class is None:
             wx.MessageBox('Node type %s does not have inspector.' %(pipeline_node_type_name),
                           'Invalid operation.')
             return
         debug('inspector page class: %s' %(visualizer_page_class))
         # else
         visualizer_page_index, visualizer_page_instance = self.visualizer_notebook.create_page(
             visualizer_page_class, selected_node.name, target=selected_node)
         # force update
         visualizer_page_instance.update()
     self.visualizer_notebook.SetSelection(visualizer_page_index)
示例#3
0
文件: app.py 项目: ecell/ecell4-vis
 def OnPipelineTreeSelChanged(self, event):
     """Called on selection change on pipeline tree item.
     """
     # If current pipeline node is set to None, do nothing and return.
     selected_tree_item_id, selected_node = self.check_pipeline_node_selected()
     if selected_node is None:
         return
     node_type_name = selected_node.__class__.__name__
     self.pipeline_tree_ctrl.tree_menu.enable_show_inspector(
         node_type_name in INSPECTOR_PAGE_REGISTRY.keys())
     self.pipeline_tree_ctrl.tree_menu.enable_show_visualizer(
         node_type_name in VISUALIZER_PAGE_REGISTRY.keys())
示例#4
0
 def OnPipelineTreeSelChanged(self, event):
     """Called on selection change on pipeline tree item.
     """
     # If current pipeline node is set to None, do nothing and return.
     selected_tree_item_id, selected_node = self.check_pipeline_node_selected(
     )
     if selected_node is None:
         return
     node_type_name = selected_node.__class__.__name__
     self.pipeline_tree_ctrl.tree_menu.enable_show_inspector(
         node_type_name in INSPECTOR_PAGE_REGISTRY.keys())
     self.pipeline_tree_ctrl.tree_menu.enable_show_visualizer(
         node_type_name in VISUALIZER_PAGE_REGISTRY.keys())
示例#5
0
文件: app.py 项目: ecell/ecell4-vis
 def OnPipelineShowObserversMenu(self, event):
     selected_tree_id, selected_node = self.check_pipeline_node_selected()
     if selected_node is None:
         return
     # If there are already corresponding inspector, just focus it.
     inspector_page_index, inspector_page_instance = self.inspector_notebook.find_page_for_target(selected_node)
     if inspector_page_index is None:
         pipeline_node_type_name = selected_node.__class__.__name__
         inspector_page_class = INSPECTOR_PAGE_REGISTRY.get(pipeline_node_type_name, None)
         if inspector_page_class is not None:
             self.OnPipelineShowInspectorMenu(event)
         visualizer_page_class = VISUALIZER_PAGE_REGISTRY.get(pipeline_node_type_name, None)
         if visualizer_page_class is not None:
             self.OnPipelineShowVisualizerMenu(event)
示例#6
0
 def OnPipelineShowObserversMenu(self, event):
     selected_tree_id, selected_node = self.check_pipeline_node_selected()
     if selected_node is None:
         return
     # If there are already corresponding inspector, just focus it.
     inspector_page_index, inspector_page_instance = self.inspector_notebook.find_page_for_target(
         selected_node)
     if inspector_page_index is None:
         pipeline_node_type_name = selected_node.__class__.__name__
         inspector_page_class = INSPECTOR_PAGE_REGISTRY.get(
             pipeline_node_type_name, None)
         if inspector_page_class is not None:
             self.OnPipelineShowInspectorMenu(event)
         visualizer_page_class = VISUALIZER_PAGE_REGISTRY.get(
             pipeline_node_type_name, None)
         if visualizer_page_class is not None:
             self.OnPipelineShowVisualizerMenu(event)