TclCommandPlotAll.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from tclCommands.TclCommand import TclCommandSignaled
  2. import collections
  3. class TclCommandPlotAll(TclCommandSignaled):
  4. """
  5. Tcl shell command to update the plot on the user interface.
  6. example:
  7. plot
  8. """
  9. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  10. aliases = ['plot_all']
  11. description = '%s %s' % ("--", "Plots all objects on GUI.")
  12. # Dictionary of types from Tcl command, needs to be ordered
  13. arg_names = collections.OrderedDict([
  14. ])
  15. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  16. option_types = collections.OrderedDict([
  17. ('use_thread', str)
  18. ])
  19. # array of mandatory options for current Tcl command: required = {'name','outname'}
  20. required = []
  21. # structured help for current command, args needs to be ordered
  22. help = {
  23. 'main': "Plots all objects on GUI.",
  24. 'args': collections.OrderedDict([
  25. ('use_thread', 'If to use multithreading: True (1) or False (0).')
  26. ]),
  27. 'examples': ['plot_all']
  28. }
  29. def execute(self, args, unnamed_args):
  30. """
  31. :param args:
  32. :param unnamed_args:
  33. :return:
  34. """
  35. if 'use_thread' in args:
  36. threaded = bool(eval(args['use_thread']))
  37. else:
  38. threaded = False
  39. if self.app.cmd_line_headless != 1:
  40. self.app.plot_all(use_thread=threaded)