def reports_callback(line): root = xml.fromstring(line) net_id = utils.xml_int(root, "net-id") runinstance = RunInstance(self.project, self.process_count) for process_id, e in enumerate(root.findall("process")): runinstance.event_spawn(process_id, 0, net_id) for pe in e.findall("place"): place_id = utils.xml_int(pe, "id") for te in pe.findall("token"): name = te.get("value") source = te.get("source") if source is not None: name = "{{{0}}} {1}".format(source, name) runinstance.add_token(place_id, 0, name) runinstance.clear_removed_and_new_tokens() for tre in e.findall("enabled"): runinstance.add_enabled_transition(utils.xml_int(tre, "id")) for e in root.findall("activation"): process_id = utils.xml_int(e, "process-id") transition_id = utils.xml_int(e, "transition-id") runinstance.transition_fired(process_id, 0, transition_id, []) if utils.xml_bool(e, "blocked", False): runinstance.transition_blocked(process_id) for e in root.findall("packet"): origin_id = utils.xml_int(e, "origin-id") target_id = utils.xml_int(e, "target-id") size = utils.xml_int(e, "size") edge_id = utils.xml_int(e, "edge-id") runinstance.event_send(origin_id, 0, target_id, size, edge_id) runinstance.reset_last_event_info() self.runinstance = runinstance self.history_instances.append(runinstance) if self.state != "finished" and utils.xml_bool(root, "quit"): self.state = "finished" self.emit_event("error", "Program finished\n") if callback: callback() self.emit_event("changed", True)