diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index d9d95205de6..111f2b9d81b 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -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 ): """ diff --git a/lib/galaxy/tools/toolbox/panel.py b/lib/galaxy/tools/toolbox/panel.py index 6324b67abb3..6d952d79433 100644 --- a/lib/galaxy/tools/toolbox/panel.py +++ b/lib/galaxy/tools/toolbox/panel.py @@ -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