Move more logic into ToolSectionElements, raising level abstraction in Toolbox.

This commit is contained in:
John Chilton
2014-12-31 18:21:10 -05:00
parent 482e0ce0fa
commit a998453883
2 changed files with 24 additions and 14 deletions
+9 -14
View File
@@ -435,29 +435,24 @@ class ToolBox( object, Dictifiable ):
tree = parse_xml( self._integrated_tool_panel_config )
root = tree.getroot()
for elem in root:
key = elem.get( 'id' )
if elem.tag == 'tool':
key = 'tool_%s' % elem.get( 'id' )
self._integrated_tool_panel[ key ] = None
self._integrated_tool_panel.stub_tool( key )
elif elem.tag == 'workflow':
key = 'workflow_%s' % elem.get( 'id' )
self._integrated_tool_panel[ key ] = None
self._integrated_tool_panel.stub_workflow( key )
elif elem.tag == 'section':
section = ToolSection( elem )
for section_elem in elem:
section_id = section_elem.get( 'id' )
if section_elem.tag == 'tool':
key = 'tool_%s' % section_elem.get( 'id' )
section.elems[ key ] = None
section.elems.stub_tool( section_id )
elif section_elem.tag == 'workflow':
key = 'workflow_%s' % section_elem.get( 'id' )
section.elems[ key ] = None
section.elems.stub_workflow( section_id )
elif section_elem.tag == 'label':
key = 'label_%s' % section_elem.get( 'id' )
section.elems[ key ] = None
key = elem.get( 'id' )
self._integrated_tool_panel[ key ] = section
section.elems.stub_label( section_id )
self._integrated_tool_panel.append_section( key, section )
elif elem.tag == 'label':
key = 'label_%s' % elem.get( 'id' )
self._integrated_tool_panel[ key ] = None
section.stub_label( key )
def _write_integrated_tool_panel_config_file( self ):
"""
+15
View File
@@ -35,3 +35,18 @@ class ToolPanelElements( odict ):
def append_tool( self, tool ):
key = "tool_%s" % tool.id
self[ key ] = tool
def stub_tool( self, key ):
key = "tool_%s" % key
self[ key ] = None
def stub_workflow( self, key ):
key = 'workflow_%s' % key
self[ key ] = None
def stub_label( self, key ):
key = 'label_%s' % key
self[ key ] = None
def append_section( self, key, section_elems ):
self[ key ] = section_elems