예제 #1
0
    def draw(self, context):
        """Draw name and multiplicity of the line end.
        """
        if not self.subject:
            return

        cr = context.cairo
        text_color = context.style.get("text-color")
        if text_color:
            cr.set_source_rgba(*text_color)

        text_draw(
            cr,
            self._name,
            self.font,
            lambda w, h: (self._name_bounds.x, self._name_bounds.y),
        )
        text_draw(
            cr,
            self._mult,
            self.font,
            lambda w, h: (self._mult_bounds.x, self._mult_bounds.y),
        )

        for b in (self._name_bounds, self._mult_bounds):
            text_draw_focus_box(context, b.x, b.y, b.width, b.height)
예제 #2
0
    def draw(self, context):
        """Draw name and multiplicity of the line end."""
        if not self.subject:
            return

        cr = context.cairo
        text_color = context.style.get("text-color")
        if text_color:
            cr.set_source_rgba(*text_color)

        cr.move_to(self._name_bounds.x, self._name_bounds.y)
        self._name_layout.show_layout(cr)
        cr.move_to(self._mult_bounds.x, self._mult_bounds.y)
        self._mult_layout.show_layout(cr)

        for b in (self._name_bounds, self._mult_bounds):
            text_draw_focus_box(context, b.x, b.y, b.width, b.height)