mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Move more logic into ToolSectionElements, raising level abstraction in Toolbox.
This commit is contained in:
@@ -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 ):
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user