def __init__(self, id=None, model=None): super().__init__(id, model) h1, h2 = Handle(), Handle() self._handles.append(h1) self._handles.append(h2) self._ports.append(LinePort(h1.pos, h2.pos)) self._combined = None self.shape = IconBox( Box(style={"min-width": 0, "min-height": 45}, draw=self.draw_fork_node), Text( text=lambda: stereotypes_str(self.subject), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject and self.subject.name or ""), Text( text=lambda: isinstance(self.subject, UML.JoinNode) and self.subject.joinSpec not in (None, DEFAULT_JOIN_SPEC) and f"{{ joinSpec = {self.subject.joinSpec} }}" or "", style={"min-width": 0, "min-height": 0}, ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name") self.watch("subject[JoinNode].joinSpec")
def __init__(self, diagram, id=None): super().__init__(diagram, id=id) h1, h2 = Handle(), Handle() self._handles = [h1, h2] self._ports = [LinePort(h1.pos, h2.pos)] self.watch_handle(h1) self.watch_handle(h2) self.shape = IconBox( Box(draw=self.draw_fork_node), Text( text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject and self.subject.name or ""), Text( text=lambda: isinstance(self.subject, UML.JoinNode) and self.subject.joinSpec not in (None, DEFAULT_JOIN_SPEC) and f"{{ joinSpec = {self.subject.joinSpec} }}" or "", ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name") self.watch("subject[JoinNode].joinSpec") diagram.connections.add_constraint(self, constraint(vertical=(h1.pos, h2.pos))) diagram.connections.add_constraint( self, constraint(above=(h1.pos, h2.pos), delta=30) )
def __init__(self, id=None): Item.__init__(self) DiagramItem.__init__(self, id) h1, h2 = Handle(), Handle() self._handles.append(h1) self._handles.append(h2) self._ports.append(LinePort(h1.pos, h2.pos)) self._combined = None self._join_spec = self.add_text('joinSpec', pattern='{ joinSpec = %s }', style=self.STYLE_TOP, visible=self.is_join_spec_visible) self._name = self.add_text('name', style={ 'text-align': self.style.name_align, 'text-padding': self.style.name_padding, 'text-outside': self.style.name_outside, 'text-align-str': self.style.name_align_str, 'text-align-group': 'stereotype', }, editable=True) self.watch('subject<NamedElement>.name', self.on_named_element_name)\ .watch('subject<JoinNode>.joinSpec', self.on_join_node_join_spec)
def __init__(self, connections, id=None, model=None): super().__init__(id=id, model=model) self._matrix = Matrix() self._matrix_i2c = Matrix() self._connections = connections h1, h2 = Handle(), Handle() self._handles = [h1, h2] self._ports = [LinePort(h1.pos, h2.pos)] self._combined = None self.shape = IconBox( Box(style={"min-width": 0, "min-height": 45}, draw=self.draw_fork_node), Text( text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject and self.subject.name or ""), Text( text=lambda: isinstance(self.subject, UML.JoinNode) and self.subject.joinSpec not in (None, DEFAULT_JOIN_SPEC) and f"{{ joinSpec = {self.subject.joinSpec} }}" or "", ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name") self.watch("subject[JoinNode].joinSpec") connections.add_constraint(self, constraint(vertical=(h1.pos, h2.pos))) connections.add_constraint(self, constraint(above=(h1.pos, h2.pos), delta=30))
def __init__(self, id=None, model=None): Item.__init__(self) DiagramItem.__init__(self, id, model) h1, h2 = Handle(), Handle() self._handles.append(h1) self._handles.append(h2) self._ports.append(LinePort(h1.pos, h2.pos)) self._combined = None self._join_spec = self.add_text( "joinSpec", pattern="{ joinSpec = %s }", style=self.STYLE_TOP, visible=self.is_join_spec_visible, ) self._name = self.add_text( "name", style={ "text-align": self.style.name_align, "text-padding": self.style.name_padding, "text-outside": self.style.name_outside, "text-align-str": self.style.name_align_str, "text-align-group": "stereotype", }, editable=True, ) self.watch("subject<NamedElement>.name", self.on_named_element_name).watch( "subject<JoinNode>.joinSpec", self.on_join_node_join_spec)