Ejemplo n.º 1
0
 def update_shapes(self, event=None):
     self.shape = Box(
         Box(
             Text(text=lambda: UML.model.stereotypes_str(
                 self.subject, self.additional_stereotypes()), ),
             EditableText(
                 text=lambda: self.subject.name or "",
                 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": "x-small"},
             ),
             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 []),
         style={
             "vertical-align": VerticalAlign.TOP,
         },
         draw=draw_border,
     )
Ejemplo n.º 2
0
 def class_shape(self):
     return Box(
         Box(
             Text(text=lambda: UML.model.stereotypes_str(
                 self.subject, ("interface", )), ),
             EditableText(
                 text=lambda: self.subject.name or "",
                 style={"font-weight": FontWeight.BOLD},
             ),
             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 []),
         style={
             "min-width": 100,
             "min-height": 50,
             "vertical-align": VerticalAlign.TOP,
         },
         draw=draw_border,
     )
Ejemplo n.º 3
0
 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_component_icon,
         ),
         *(self.show_stereotypes and stereotype_compartments(self.subject)
           or []),
         style={
             "min-width":
             100,
             "min-height":
             50,
             "vertical-align":
             VerticalAlign.TOP if self.canvas
             and self.canvas.get_children(self) else VerticalAlign.MIDDLE,
         },
         draw=draw_border)
Ejemplo n.º 4
0
 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
                 (),
             ), ),
             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,
             "vertical-align":
             VerticalAlign.TOP
             if self.diagram and self.children else VerticalAlign.MIDDLE,
         },
         draw=draw_node)
Ejemplo n.º 5
0
    def update_shapes(self, event=None):
        def additional_stereotypes():
            if isinstance(self.subject, UML.Stereotype):
                return ["stereotype"]
            elif UML.model.is_metaclass(self.subject):
                return ["metaclass"]
            else:
                return ()

        self.shape = Box(
            Box(
                Text(
                    text=lambda: UML.model.stereotypes_str(
                        self.subject, additional_stereotypes()
                    ),
                    style={"min-width": 0, "min-height": 0},
                ),
                EditableText(
                    text=lambda: self.subject.name or "",
                    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": "sans 8", "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 []),
            style={
                "min-width": 100,
                "min-height": 50,
                "vertical-align": VerticalAlign.TOP,
            },
            draw=draw_border,
        )
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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_artifact_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
     )