6

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.

  • 3
    As 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 Oct 6 '14 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 Oct 6 '14 at 21:05
2

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
  • 2
    Good point. If numbers are desired but 10+ tools are present, you can of course use '01', '02', etc. – nmpeterson Oct 7 '14 at 3:48
  • Ah true +1 for that. – fluidmotion Oct 7 '14 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.