def get_popup_menu(self, velem, elem): popup_menu = BPMN_Draw.get_popup_menu(self, velem, elem) if velem is None: popup_menu.add_command(label="New activity", command=self._new_activity()) popup_menu.add_command(label="New event", command=self._new_event()) popup_menu.add_command(label="New gateway", command=self._new_gateway()) popup_menu.add_command(label="New pool", command=self._new_pool()) return popup_menu if velem.type == "shape": popup_menu.add_separator() popup_menu.add_command(label="Change name", command=self._change_element_name(elem)) if isinstance(elem, mbpmn.BPMN_Element): popup_menu.add_command(label="Add connection", command=self._add_edge(velem)) if isinstance(elem, mbpmn.Gateway): subtype_menu = Menu(popup_menu.menu, tearoff=0) if elem.subtype != "exclusive": subtype_menu.add_command(label="Exclusive gateway", command=self._change_element_subtype(elem, "exclusive")) if elem.subtype != "inclusive": subtype_menu.add_command(label="Inclusive gateway", command=self._change_element_subtype(elem, "inclusive")) if elem.subtype != "parallel": subtype_menu.add_command(label="Parallel gateway", command=self._change_element_subtype(elem, "parallel")) popup_menu.add_cascade(label="Change subtype to", menu=subtype_menu) if isinstance(elem, mbpmn.Event): subtype_menu = Menu(popup_menu.menu, tearoff=0) if elem.subtype != "intermediate": subtype_menu.add_command(label="Intermediate event", command=self._change_element_subtype(elem, "intermediate")) if elem.subtype != "start": subtype_menu.add_command(label="Start event", command=self._change_element_subtype(elem, "start")) if elem.subtype != "end": subtype_menu.add_command(label="End event", command=self._change_element_subtype(elem, "end")) popup_menu.add_cascade(label="Change subtype to", menu=subtype_menu) popup_menu.add_command(label="Delete "+elem.type, command=self._del_elem(elem)) if isinstance(elem, mbpmn.Pool): popup_menu.add_command(label="New lane", command=self._new_lane(elem)) popup_menu.add_command(label="Delete pool", command=self._del_pool(elem)) if isinstance(elem, mbpmn.Lane): popup_menu.add_command(label="New activity", command=self._new_activity(elem)) popup_menu.add_command(label="New event", command=self._new_event(elem)) popup_menu.add_command(label="New gateway", command=self._new_gateway(elem)) popup_menu.add_command(label="Delete lane", command=self._del_lane(elem)) if velem.type == "edge": popup_menu.add_command(label="Delete edge", command=self._del_edge(velem)) return popup_menu
def get_popup_menu(self, velem, elem): popup_menu = BPMN_Draw.get_popup_menu(self, velem, elem) if velem is None: popup_menu.add_command(label="New activity", command=self._new_activity()) popup_menu.add_command(label="New event", command=self._new_event()) popup_menu.add_command(label="New gateway", command=self._new_gateway()) popup_menu.add_command(label="New pool", command=self._new_pool()) return popup_menu if velem.type == "shape": popup_menu.add_separator() popup_menu.add_command(label="Change name", command=self._change_element_name(elem)) if isinstance(elem, mbpmn.BPMN_Element): popup_menu.add_command(label="Add connection", command=self._add_edge(velem)) if isinstance(elem, mbpmn.Gateway): subtype_menu = Menu(popup_menu.menu, tearoff=0) if elem.subtype != "exclusive": subtype_menu.add_command( label="Exclusive gateway", command=self._change_element_subtype( elem, "exclusive")) if elem.subtype != "inclusive": subtype_menu.add_command( label="Inclusive gateway", command=self._change_element_subtype( elem, "inclusive")) if elem.subtype != "parallel": subtype_menu.add_command( label="Parallel gateway", command=self._change_element_subtype( elem, "parallel")) popup_menu.add_cascade(label="Change subtype to", menu=subtype_menu) if isinstance(elem, mbpmn.Event): subtype_menu = Menu(popup_menu.menu, tearoff=0) if elem.subtype != "intermediate": subtype_menu.add_command( label="Intermediate event", command=self._change_element_subtype( elem, "intermediate")) if elem.subtype != "start": subtype_menu.add_command( label="Start event", command=self._change_element_subtype( elem, "start")) if elem.subtype != "end": subtype_menu.add_command( label="End event", command=self._change_element_subtype(elem, "end")) popup_menu.add_cascade(label="Change subtype to", menu=subtype_menu) popup_menu.add_command(label="Delete " + elem.type, command=self._del_elem(elem)) if isinstance(elem, mbpmn.Pool): popup_menu.add_command(label="New lane", command=self._new_lane(elem)) popup_menu.add_command(label="Delete pool", command=self._del_pool(elem)) if isinstance(elem, mbpmn.Lane): popup_menu.add_command(label="New activity", command=self._new_activity(elem)) popup_menu.add_command(label="New event", command=self._new_event(elem)) popup_menu.add_command(label="New gateway", command=self._new_gateway(elem)) popup_menu.add_command(label="Delete lane", command=self._del_lane(elem)) if velem.type == "edge": popup_menu.add_command(label="Delete edge", command=self._del_edge(velem)) return popup_menu