Example #1
0
 def draw(self, context):
     cr = context.cairo
     if self.font:
         text_set_font(cr, self.font)
     if hasattr(self.subject, 'isStatic') and self.subject.isStatic:
         text_underline(cr, 0, 0, self.render() or '')
     else:
         text_align(cr, 0, 0, self.render(), align_x=1, align_y=1)
Example #2
0
    def draw(self, context):
        bounds = self.bounds
        x, y = bounds.x, bounds.y
        width, height = bounds.width, bounds.height

        cr = context.cairo
        text_set_font(cr, self._style.font)
        text_multiline(cr, x, y, self.text)
        cr.stroke()
        if self.editable and (context.hovered or context.focused):
            cr.save()
            cr.set_source_rgb(0.6, 0.6, 0.6)
            cr.set_line_width(0.5)
            cr.rectangle(x - 5, y - 1, width + 10, height + 2)
            cr.stroke()
            cr.restore()