Sort workflow steps based on the layout in the workflow editor.

Prior to the topological sort, steps are arranged based on distance from top left corner.
This commit is contained in:
Dannon Baker
2011-01-18 11:22:43 -05:00
parent c76b83ff84
commit 01d15a1e6f
+2 -1
View File
@@ -5,7 +5,7 @@ pkg_resources.require( "simplejson" )
pkg_resources.require( "SVGFig" )
import simplejson
import base64, httplib, urllib2, sgmllib, svgfig
import math
from galaxy.web.framework.helpers import time_ago, grids
from galaxy.tools.parameters import *
from galaxy.tools import DefaultToolState
@@ -1670,6 +1670,7 @@ def order_workflow_steps( steps ):
"""
Perform topological sort of the steps, return ordered or None
"""
steps.sort(cmp=lambda s1,s2: cmp( math.sqrt(s1.position['left']**2 + s1.position['top']**2), math.sqrt(s2.position['left']**2 + s2.position['top']**2)))
try:
edges = edgelist_for_workflow_steps( steps )
node_order = topsort( edges )