Esempio n. 1
0
    def __init__(self, id=None):
        """
        Create named item.
        """
        ElementItem.__init__(self, id)

        # create (from ...) text to distinguish diagram items from
        # different namespace
        self._from = self.add_text('from',
                                   pattern='(from %s)',
                                   style={
                                       'text-align-group': 'stereotype',
                                       'font': self.style.from_font
                                   },
                                   visible=self.is_namespace_info_visible)

        self._name = self.add_text('name',
                                   style={
                                       'font': self.style.name_font,
                                       'text-align': self.style.name_align,
                                       'text-padding': self.style.name_padding,
                                       'text-outside': self.style.name_outside,
                                       'text-rotated': self.style.name_rotated,
                                       'text-align-str':
                                       self.style.name_align_str,
                                       'text-align-group': 'stereotype',
                                   },
                                   editable=True)

        # size of stereotype, namespace and name text
        self._header_size = 0, 0
        self.watch('subject<NamedElement>.name', self.on_named_element_name)\
            .watch('subject<Namespace>.namespace', self.on_named_element_namespace)
Esempio n. 2
0
    def __init__(self, id=None):
        """
        Create named item.
        """
        ElementItem.__init__(self, id)

        # create (from ...) text to distinguish diagram items from
        # different namespace
        self._from = self.add_text(
            "from",
            pattern="(from %s)",
            style={"text-align-group": "stereotype", "font": self.style.from_font},
            visible=self.is_namespace_info_visible,
        )

        self._name = self.add_text(
            "name",
            style={
                "font": self.style.name_font,
                "text-align": self.style.name_align,
                "text-padding": self.style.name_padding,
                "text-outside": self.style.name_outside,
                "text-rotated": self.style.name_rotated,
                "text-align-str": self.style.name_align_str,
                "text-align-group": "stereotype",
            },
            editable=True,
        )

        # size of stereotype, namespace and name text
        self._header_size = 0, 0
        self.watch("subject<NamedElement>.name", self.on_named_element_name).watch(
            "subject<Namespace>.namespace", self.on_named_element_namespace
        )
Esempio n. 3
0
 def pre_update(self, context):
     if not self.subject:
         return
     cr = context.cairo
     e = self.EAR
     o = self.OFFSET
     w, h = text_extents(
         cr, self.subject.body, self.style.font, width=self.width - e
     )
     self.min_width = w + e + o * 2
     self.min_height = h + o * 2
     ElementItem.pre_update(self, context)
Esempio n. 4
0
    def __init__(self, id=None, model=None):
        """
        Create named item.
        """
        ElementItem.__init__(self, id, model)

        # create (from ...) text to distinguish diagram items from
        # different namespace
        self._from = self.add_text(
            "from",
            pattern="(from %s)",
            style={
                "text-align-group": "stereotype",
                "font": self.style.from_font
            },
            visible=self.is_namespace_info_visible,
        )

        self._name = self.add_text(
            "name",
            style={
                "font": self.style.name_font,
                "text-align": self.style.name_align,
                "text-padding": self.style.name_padding,
                "text-outside": self.style.name_outside,
                "text-rotated": self.style.name_rotated,
                "text-align-str": self.style.name_align_str,
                "text-align-group": "stereotype",
            },
            editable=True,
        )

        # size of stereotype, namespace and name text
        self._header_size = 0, 0
        self.watch("subject<NamedElement>.name",
                   self.on_named_element_name).watch(
                       "subject<Namespace>.namespace",
                       self.on_named_element_namespace)
Esempio n. 5
0
 def __init__(self, id=None):
     ElementItem.__init__(self, id)
     self.min_width = CommentItem.EAR + 2 * CommentItem.OFFSET
     self.height = 50
     self.width = 100
     self.watch('subject<Comment>.body')
Esempio n. 6
0
 def __init__(self, id=None):
     ElementItem.__init__(self, id)
     self.min_width = CommentItem.EAR + 2 * CommentItem.OFFSET
     self.height = 50
     self.width = 100
     self.watch("subject<Comment>.body")