def __call__(self, tokens): if not self.in_wf and match_values(tokens, "<", "workflow", ">"): self.in_wf = True elif self.in_wf and match_values(tokens, "</", "workflow", ">"): self.in_wf = False elif self.in_wf: print("task") element = build_element(tokens) _id = element.get('id',"n/a") name = "%s: %s" % (_id, element["_tag"],) position = element[':tag'][0] try: operator = msml_app.alphabet.operators[element["_tag"]] for o in operator.output_names(): self.overview.add_variable( "%s.%s" % (_id, o), position ) foreground = False except KeyError: foreground = Qt.darkRed self.overview.add_task(name, position, foreground = foreground)
def __call__(self, tokens): if not self.in_wf and match_values(tokens, "<", "workflow", ">"): self.in_wf = True elif self.in_wf and match_values(tokens, "</", "workflow", ">"): self.in_wf = False elif self.in_wf: print("task") element = build_element(tokens) _id = element.get('id', "n/a") name = "%s: %s" % ( _id, element["_tag"], ) position = element[':tag'][0] try: operator = msml_app.alphabet.operators[element["_tag"]] for o in operator.output_names(): self.overview.add_variable("%s.%s" % (_id, o), position) foreground = False except KeyError: foreground = Qt.darkRed self.overview.add_task(name, position, foreground=foreground)
def create_task(self, operator, **kwargs): if 'id' not in kwargs: kwargs["id"] = generate_name() if isinstance(operator, str): operator = ACTIVE_APP.alphabet.operators[operator] task = Task(operator.name, parse_attrib(kwargs)) for out in operator.output_names(): setattr(task, out, "${%s.%s}" % (id, out)) if operator.output_names(): setattr(task, 'output_default', "${%s.%s}" % (id, operator.output_names()[0])) self.workflow.add_task(task) return task