Beispiel #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,
     )
Beispiel #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,
     )
Beispiel #3
0
    def __init__(self, connections, id=None, model=None):
        super().__init__(connections, id, model)

        self.shape = Box(
            Text(text=lambda: stereotypes_str(
                self.subject,
                isinstance(self.subject, UML.Profile) and ("profile", ) or (),
            ), ),
            EditableText(
                text=lambda: self.subject and 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={
                "min-width": 50,
                "min-height": 70,
                "padding": (25, 10, 5, 10)
            },
            draw=draw_package,
        )

        self.watch("subject[NamedElement].name")
        self.watch("subject[NamedElement].namespace.name")
        self.watch("subject.appliedStereotype.classifier.name")
Beispiel #4
0
    def __init__(self, diagram, id=None):
        super().__init__(diagram, id, width=70, height=70)

        self.shape = Box(
            Text(
                text=lambda: stereotypes_str(
                    self.subject,
                    isinstance(self.subject, UML.Profile) and ("profile",) or (),
                ),
            ),
            EditableText(
                text=lambda: self.subject and self.subject.name or "",
                style={"font-weight": FontWeight.BOLD},
            ),
            Text(
                text=lambda: from_package_str(self),
                style={"font-size": "x-small"},
            ),
            style={"padding": (24, 12, 4, 12)},
            draw=draw_package,
        )

        self.watch("subject[NamedElement].name")
        self.watch("subject[NamedElement].namespace.name")
        self.watch("subject.appliedStereotype.classifier.name")
Beispiel #5
0
 def update_shapes(self, event=None):
     if self._folded == Folded.NONE:
         self.shape = Box(
             Box(
                 Text(
                     text=lambda: UML.model.stereotypes_str(
                         self.subject, ("interface", )),
                     style={
                         "min-width": 0,
                         "min-height": 0
                     },
                 ),
                 EditableText(
                     text=lambda: self.subject.name or "",
                     style={"font-weight": FontWeight.BOLD},
                 ),
                 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_attrs
               and stereotype_compartments(self.subject) or []),
             style={
                 "min-width": 100,
                 "min-height": 50,
                 "vertical-align": VerticalAlign.TOP,
             },
             draw=draw_border,
         )
     else:
         self.shape = IconBox(
             Box(
                 style={
                     "min-width": self.min_width,
                     "min-height": self.min_height
                 },
                 draw=self.draw_interface_ball_and_socket,
             ),
             Text(
                 text=lambda: UML.model.stereotypes_str(self.subject),
                 style={
                     "min-width": 0,
                     "min-height": 0
                 },
             ),
             EditableText(
                 text=lambda: self.subject.name or "",
                 style={"font-weight": FontWeight.BOLD},
             ),
         )
Beispiel #6
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,
        )
Beispiel #7
0
 def update_shapes(self, event=None):
     self.shape = Box(
         Box(
             Text(
                 text=lambda: stereotypes_str(self.subject, ["block"]),
                 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_parts and self.subject and [
             self.block_compartment(
                 gettext("parts"),
                 lambda a: a.aggregation == "composite",
             )
         ] or []),
         *(self.show_references and self.subject and [
             self.block_compartment(
                 gettext("references"),
                 lambda a: a.aggregation != "composite",
             )
         ] or []),
         *(self.show_stereotypes and stereotype_compartments(self.subject)
           or []),
         style={
             "min-width": 100,
             "min-height": 50,
             "vertical-align": VerticalAlign.TOP,
         },
         draw=draw_border,
     )
Beispiel #8
0
 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,
     )