def __init__(self, diagram, id=None): super().__init__(diagram, id) self.shape = Box( Text( text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), style={"min-width": 50, "min-height": 30, "padding": (5, 10, 5, 25)}, draw=self.draw_border, ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, diagram, id=None): super().__init__(diagram, id, width=30, height=30) for h in self.handles(): h.movable = False self.shape = IconBox( Box(draw=draw_final_state), Text(text=lambda: stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject and self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def update_shapes(self, event=None): compartment = Box( Text( text=lambda: self.subject.entry.name and f"entry / {self.subject.entry.name}" or "", style={ "text-align": TextAlign.LEFT, "min-height": 0 }, ), Text( text=lambda: self.subject.exit.name and f"exit / {self.subject.exit.name}" or "", style={ "text-align": TextAlign.LEFT, "min-height": 0 }, ), Text( text=lambda: self.subject.doActivity.name and f"do / {self.subject.doActivity.name}" or "", style={ "text-align": TextAlign.LEFT, "min-height": 0 }, ), style={ "padding": (4, 4, 4, 4), "vertical-align": VerticalAlign.TOP }, draw=draw_top_separator, ) if not any(t.text() for t in compartment.children): compartment = Box() self.shape = Box( Box( Text(text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), style={"padding": (4, 4, 4, 4)}, ), compartment, style={ "min-width": 50, "min-height": 30, "vertical-align": VerticalAlign.TOP, }, draw=draw_state, )
def __init__(self, id=None, model=None): super().__init__(id, model) # AssociationEnds are really inseparable from the AssociationItem. # We give them the same id as the association item. self._head_end = AssociationEnd(owner=self, end="head") self._tail_end = AssociationEnd(owner=self, end="tail") # Direction depends on the ends that hold the ownedEnd attributes. self._show_direction = False self._dir_angle = 0 self._dir_pos = 0, 0 self.shape_middle = Box( Text( text=lambda: stereotypes_str(self.subject), style={ "min-width": 0, "min-height": 0 }, ), EditableText(text=lambda: self.subject.name or ""), ) # For the association ends: base = "subject[Association].memberEnd[Property]" self.watch("subject[NamedElement].name").watch( "subject.appliedStereotype.classifier.name" ).watch(f"{base}.name", self.on_association_end_value).watch( f"{base}.aggregation", self.on_association_end_value).watch( f"{base}.appliedStereotype.slot.definingFeature.name", self.on_association_end_value, ).watch( f"{base}.appliedStereotype.slot.value", self.on_association_end_value ).watch(f"{base}.classifier", self.on_association_end_value).watch( f"{base}.visibility", self.on_association_end_value ).watch(f"{base}.lowerValue", self.on_association_end_value).watch( f"{base}.upperValue", self.on_association_end_value).watch( f"{base}.owningAssociation", self.on_association_end_value).watch( f"{base}.type[Class].ownedAttribute", self.on_association_end_value).watch( f"{base}.type[Interface].ownedAttribute", self.on_association_end_value).watch( f"{base}.appliedStereotype.classifier", self.on_association_end_value ).watch("subject[Association].ownedEnd").watch( "subject[Association].navigableOwnedEnd")
def __init__(self, diagram, id=None): super().__init__(diagram, id, width=30, height=30) no_movable_handles(self) self.shape = IconBox( Box(draw=draw_activity_final_node), # Text should be right-bottom Text( text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject and self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, id=None, model=None): super().__init__(id, model) no_movable_handles(self) self.shape = IconBox( Box(style={"min-width": 20, "min-height": 20}, draw=draw_initial_node), # Text should be left-top Text( text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject and self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, id=None, model=None): super().__init__(id, model) self.shape_tail = Box( Text( text=lambda: stereotypes_str(self.subject), style={ "min-width": 0, "min-height": 0 }, ), EditableText(text=lambda: self.subject.name or ""), ) self.watch("subject<NamedElement>.name") self.watch("subject.appliedStereotype.classifier.name") self.shape_middle = EditableText( text=lambda: self.subject and self.subject.guard or "") self.watch("subject<ControlFlow>.guard") self.watch("subject<ObjectFlow>.guard") self.draw_tail = draw_arrow_tail
def __init__(self, diagram, id=None): super().__init__(diagram, id, style={"dash-style": (7.0, 5.0)}) self.shape_middle = Box( Text( text=lambda: stereotypes_str(self.subject, (self.relation_type,)), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject.name or ""), ) self.draw_head = draw_arrow_head self.watch("subject[NamedElement].name").watch( "subject.appliedStereotype.classifier.name" )
def __init__(self, id=None, model=None): super().__init__(id, model) self.shape_tail = Box( Text( text=lambda: stereotypes_str(self.subject), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name") self.shape_middle = EditableText( text=lambda: self.subject and self.subject.guard and self.subject.guard.specification or "" ) self.watch("subject[Transition].guard[Constraint].specification") self.draw_tail = draw_arrow_tail
def __init__(self, id=None, model=None): super().__init__(id, model) for h in self.handles(): h.movable = False self.shape = IconBox( Box(draw=draw_history_pseudostate), Text( text=lambda: stereotypes_str(self.subject), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject and self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def update_shapes(self): self.shape_middle = Box( Text( text=lambda: stereotypes_str(self.subject), style={ "min-width": 0, "min-height": 0 }, ), EditableText(text=lambda: self.subject.name or ""), *(Text(text=lambda: message.name) for message in self._messages), *(Text(text=lambda: message.name) for message in self._inverted_messages), ) self.request_update()
def __init__(self, diagram, id=None): super().__init__(diagram, id, width=50, height=30) self.shape = Box( Text(text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), style={ "padding": (4, 12, 4, 12), "border-radius": 15, }, draw=draw_border, ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, id=None, model=None): super().__init__(id, model, style={"dash-style": (7.0, 5.0)}) self.shape_middle = Box( Text( text=lambda: stereotypes_str(self.subject), style={ "min-width": 0, "min-height": 0 }, ), EditableText(text=lambda: self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, diagram, id=None): super().__init__(diagram, id) self.shape = Box( Text( text=lambda: stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), style={"min-width": 50, "min-height": 30}, draw=draw_usecase, ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, diagram, id=None): super().__init__( diagram, id, shape_middle=Box( Text(text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), ), ) self._is_communication = False self._arrow_pos = 0, 0 self._arrow_angle = 0 self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def update_shapes(self, event=None): self.shape = Box( Box( Text( text=lambda: stereotypes_str(self.subject, ["requirement"] ), style={ "min-width": 0, "min-height": 0 }, ), EditableText( text=lambda: self.subject.name or "", width=lambda: self.width - 4, style={ "font-weight": FontWeight.BOLD, "font-style": FontStyle.ITALIC if self.subject and self.subject.isAbstract else FontStyle.NORMAL, }, ), Text( text=lambda: from_package_str(self), style={ "font-size": 10, "min-width": 0, "min-height": 0 }, ), style={"padding": (12, 4, 12, 4)}, ), *(self.show_attributes and self.subject and [attributes_compartment(self.subject)] or []), *(self.show_operations and self.subject and [operations_compartment(self.subject)] or []), *(self.show_stereotypes and stereotype_compartments(self.subject) or []), self.id_and_text_compartment(), style={ "min-width": 100, "min-height": 50, "vertical-align": VerticalAlign.TOP, }, draw=draw_border, )
def __init__(self, id=None, model=None): super().__init__(id, model) self.shape = Box( Text(text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), style={ "min-width": 50, "min-height": 30, "padding": (5, 10, 5, 10), "border-radius": 15, }, draw=draw_border, ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, id=None, model=None): super().__init__(id, model) self._show_ordering = False self.shape = IconBox( Box( Text( text=lambda: stereotypes_str(self.subject), style={ "min-width": 0, "min-height": 0 }, ), EditableText(text=lambda: self.subject.name or ""), style={ "min-width": 50, "min-height": 30, "padding": (5, 10, 5, 10) }, draw=draw_border, ), Text( text=lambda: self.subject.upperBound not in (None, DEFAULT_UPPER_BOUND ) and f"{{ upperBound = {self.subject.upperBound} }}", style={ "min-width": 0, "min-height": 0 }, ), Text( text=lambda: self._show_ordering and self.subject.ordering and f"{{ ordering = {self.subject.ordering} }}", style={ "min-width": 0, "min-height": 0 }, ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name") self.watch("subject[ObjectNode].upperBound") self.watch("subject[ObjectNode].ordering")
def __init__(self, diagram, id=None): super().__init__(diagram, id, width=ARM * 2, height=HEAD + NECK + BODY + ARM) self.shape = IconBox( Box( draw=draw_actor, ), Text( text=lambda: stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def update_shapes(self, event=None): self.shape = Box( Box( Text(text=lambda: UML.model.stereotypes_str(self.subject), ), EditableText( text=lambda: format_property( self.subject, type=True, multiplicity=True) or "", style={"font-weight": FontWeight.BOLD}, ), style={"padding": (12, 4, 12, 4)}, ), *(self.show_stereotypes and stereotype_compartments(self.subject) or []), style={ "vertical-align": self.alignment(), "dash-style": self.dash(), }, draw=draw_border)
def __init__(self, id=None, model=None): super().__init__(id, model) no_movable_handles(self) self.shape = IconBox( Box( style={"min-width": 30, "min-height": 30}, draw=draw_activity_final_node ), # Text should be right-bottom Text( text=lambda: stereotypes_str(self.subject), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject and self.subject.name or ""), ) self.watch("subject<NamedElement>.name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, id=None, model=None): """ Create action item. """ super().__init__(id, model) self.shape = Box( Text( text=lambda: stereotypes_str(self.subject), style={"min-width": 0, "min-height": 0}, ), EditableText(text=lambda: self.subject.name or ""), style={"min-width": 50, "min-height": 30, "padding": (5, 10, 5, 25)}, draw=self.draw_border, ) self.watch("subject<NamedElement>.name") self.watch("subject.appliedStereotype.classifier.name")
def update_shapes(self, event=None): self.shape = Box( Box( Text(text=lambda: UML.model.stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), style={"padding": (4, 32, 4, 4)}, draw=draw_component_icon, ), *(self.show_stereotypes and stereotype_compartments(self.subject) or []), style={ "vertical-align": VerticalAlign.TOP if self.diagram and self.children else VerticalAlign.MIDDLE, }, draw=draw_border)
def update_shapes(self, event=None): self.shape = Box( Box( Text(text=lambda: UML.model.stereotypes_str(self.subject),), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), style={"padding": (4, 34, 4, 4), "min-height": 44}, draw=draw_artifact_icon, ), *(self.show_stereotypes and stereotype_compartments(self.subject) or []), style={ "min-width": 100, "min-height": 50, "vertical-align": VerticalAlign.TOP, }, draw=draw_border )
def update_shapes(self, event=None): if self.subject and self.subject.kind == "shallowHistory": box = Box(style={ "min-height": 30, "min-width": 30 }, draw=draw_history_pseudostate) else: box = Box(style={ "min-height": 20, "min-width": 20 }, draw=draw_initial_pseudostate) self.shape = IconBox( box, Text(text=lambda: stereotypes_str(self.subject), ), EditableText(text=lambda: self.subject.name or ""), )
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") self.constraint(vertical=(h1.pos, h2.pos)) self.constraint(above=(h1.pos, h2.pos), delta=30)
def update_shapes(self, event=None): self.shape = Box( Box( Text( text=lambda: UML.model.stereotypes_str( self.subject, isinstance(self.subject, UML.Device) and ("device",) or (), ), style={"min-width": 0, "min-height": 0}, ), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), style={"padding": (4, 4, 4, 4)}, ), *(self.show_stereotypes and stereotype_compartments(self.subject) or []), style={"min-width": 100, "min-height": 50}, draw=draw_node )
def __init__(self, id=None, model=None): super().__init__(id, model) self.shape = IconBox( Box( style={ "min-width": ARM * 2, "min-height": HEAD + NECK + BODY + ARM }, draw=draw_actor, ), Text(text=lambda: stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject.name or "", style={"font-weight": FontWeight.BOLD}, ), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def __init__(self, diagram, id=None): super().__init__(diagram, id, style={"dash-style": (7.0, 5.0)}) self._dependency_type = UML.Dependency # auto_dependency is used by connection logic, not in this class itself self.auto_dependency = True additional_stereotype = { UML.Usage: ("use", ), UML.Realization: ("realize", ), UML.InterfaceRealization: ("implements", ), } self.shape_middle = Box( Text(text=lambda: stereotypes_str( self.subject, additional_stereotype.get(self._dependency_type, ())), ), EditableText(text=lambda: self.subject.name or ""), ) self.watch("subject[NamedElement].name") self.watch("subject.appliedStereotype.classifier.name")
def ball_and_socket_shape(self, connectors=None): if connectors is None: # distinguish between None and [] connected_items = [ c.item for c in self.diagram.connections.get_connections( connected=self) ] connectors = any( map(lambda i: isinstance(i.subject, UML.Connector), connected_items)) return IconBox( Box(draw=self.draw_interface_ball_and_socket, ), Text(text=lambda: UML.model.stereotypes_str(self.subject), ), EditableText( text=lambda: self.subject.name or "", style={ "font-weight": FontWeight.NORMAL if connectors else FontWeight.BOLD }, ), )