I have created a python toolbox containing a number of classes which define the various tools within. As these classes are part of a workflow in which the tools are to be executed sequentially using outputs from the previous tools, it would be very handy if the tools were presented in this order within the box, reinforcing the workflow. However, they appear to be displayed alphabetically. Is there a way to define the order? The tools are entered into the class Toolbox attribute list, self.tools[tool1, tool2] in the proper order, but they are subsequently alphabetized before being displayed.
-
3As far as I know, this is unavoidable in both Python toolboxes and regular toolboxes. The workaround I've used is to add a number before the tool name, to correspond to the workflow: "1. First Step", "2a. Second Step, Part 1", "2b. Second Step, Part 2", etc.nmpeterson– nmpeterson2014年10月06日 20:44:27 +00:00Commented Oct 6, 2014 at 20:44
-
I had a feeling that was the case. Not a bad solution really, just wondering if it was necessary to get the desired results.lumbrjak– lumbrjak2014年10月06日 21:05:27 +00:00Commented Oct 6, 2014 at 21:05
1 Answer 1
As @nmpeterson stated, we also had to add a prefix to the tool name to get the desired sorting. However, if memory serves, we used alpha characters first
A- Tool number 1
B- Tool number 2
because if the number of tools creep in to the double digits, the tools will still be sorted alphabetically rather than numerically.
1 - Tool number 1
11 - Tool number 11
2 - Tool number 2
-
2Good point. If numbers are desired but 10+ tools are present, you can of course use '01', '02', etc.nmpeterson– nmpeterson2014年10月07日 03:48:14 +00:00Commented Oct 7, 2014 at 3:48
-
Ah true +1 for that.fluidmotion– fluidmotion2014年10月07日 04:03:05 +00:00Commented Oct 7, 2014 at 4:03