示例#1
0
    def _draw_mainlayer(self, gc, view_bounds=None, mode="default"):
        with gc:
            if self.color_is_set:
                fill_color = self.color
            else:
                fill_color = self.color_normal
            gc.set_fill_color(fill_color)
            dx, dy = self.width, self.height
            x, y = self.position
            gc.rect(x, y, dx, dy)
            gc.fill_path()

            gc.set_font(str_to_font("arial 10"))
            ytext = (self.y + self.y2) / 2
            gc.set_text_position(self.x, ytext)
            gc.set_fill_color((0, 0, 0, 1))
            gc.show_text(self.element.__str__())
        return
示例#2
0
    def _draw_mainlayer(self, gc, view_bounds=None, mode="default"):

        gc.save_state()

        font = str_to_font( str(self.font) )
        gc.set_font(font)

        gc.set_fill_color(self.font_color_)
#        gc.set_fill_color(self.font_color)

        x = gc.width() * 0.3
        y = gc.height() * 0.6

        gc.show_text_at_point(self.text, x, y)

        self.position = [x, y]
#            self.bounds = [w, h]

        gc.restore_state()