def label_expose_event(self, widget, event, width):
        color = self.btn_text_color
        if widget == self.ok_btn and self.ok_key_check:
            color = "#FFFFFF"
        elif widget == self.cancel_btn and self.cancel_key_check:
            color = "#FFFFFF"

        if widget.state == gtk.STATE_PRELIGHT:
            color = "#FFFFFF"
        
        cr = widget.window.cairo_create()
        rect = widget.allocation
        
        size = get_text_size(widget.get_label(), 
                             self.btn_text_size, 
                             DEFAULT_FONT)
        draw_text(cr, 
                  widget.get_label(),
                  rect.x, 
                  rect.y + rect.height/2 - size[1]/2, 
                  text_size=self.btn_text_size, 
                  text_color=color, 
                  text_font=DEFAULT_FONT)  
        widget.set_size_request(size[0] + width, size[1] + 10)
        
        return True
Example #2
0
    def label_expose_event(self, widget, event, width):
        color = self.btn_text_color
        if widget == self.ok_btn and self.ok_key_check:
            color = "#FFFFFF"
        elif widget == self.cancel_btn and self.cancel_key_check:
            color = "#FFFFFF"

        if widget.state == gtk.STATE_PRELIGHT:
            color = "#FFFFFF"

        cr = widget.window.cairo_create()
        rect = widget.allocation

        size = get_text_size(widget.get_label(), self.btn_text_size,
                             DEFAULT_FONT)
        draw_text(cr,
                  widget.get_label(),
                  rect.x,
                  rect.y + rect.height / 2 - size[1] / 2,
                  text_size=self.btn_text_size,
                  text_color=color,
                  text_font=DEFAULT_FONT)
        widget.set_size_request(size[0] + width, size[1] + 10)

        return True
Example #3
0
 def label_expose_event(self, widget, event):
     cr = widget.window.cairo_create()
     rect = widget.allocation
     #
     draw_text(cr, widget.get_label(), rect.x + 5, rect.y, text_color="#000000")      
     #
     return True
    def expose(self, widget, event):
        if self.check:
            color = "#FFFFFF"
        else:
            color = self.btn_text_color

        if widget.state == gtk.STATE_PRELIGHT:
            color = "#FFFFFF"
        
        cr = widget.window.cairo_create()
        rect = widget.allocation
        
        draw_text(cr, 
                  widget.get_label(),
                  rect.x, 
                  rect.y, 
                  text_size=self.btn_text_size, 
                  text_color=color, 
                  text_font=DEFAULT_FONT)  
        return True
Example #5
0
    def expose(self, widget, event):
        if self.check:
            color = "#FFFFFF"
        else:
            color = self.btn_text_color

        if widget.state == gtk.STATE_PRELIGHT:
            color = "#FFFFFF"

        cr = widget.window.cairo_create()
        rect = widget.allocation

        draw_text(cr,
                  widget.get_label(),
                  rect.x,
                  rect.y,
                  text_size=self.btn_text_size,
                  text_color=color,
                  text_font=DEFAULT_FONT)
        return True
 def open_btn_expose_event(self, widget, event):
     cr = widget.window.cairo_create()
     rect = widget.allocation
     text = widget.get_label().decode("utf-8")
     text_width = get_text_size("ABCDEFABCDEFH", text_size=9)[0]
     ch_width = get_text_size("a", text_size=9)[0]
     dec_width = get_text_size(text, text_size=9)[0] - text_width
     if dec_width > 0:
         index = (dec_width/ch_width) + 2
         text = text[0:len(text)-index] + "..."
     if self.eject_check:
         text_color_value = "#000000"
     else:
         text_color_value = "#9d9d9d"
     draw_text(cr, 
               text, 
               rect.x, 
               rect.y + rect.height/2 - get_text_size(text)[1]/2, 
               text_color=text_color_value,
               text_size=9)
     return True
 def open_btn_expose_event(self, widget, event):
     cr = widget.window.cairo_create()
     rect = widget.allocation
     text = widget.get_label().decode("utf-8")
     text_width = get_text_size("ABCDEFABCDEFH", text_size=9)[0]
     ch_width = get_text_size("a", text_size=9)[0]
     dec_width = get_text_size(text, text_size=9)[0] - text_width
     if dec_width > 0:
         index = (dec_width / ch_width) + 2
         text = text[0 : len(text) - index] + "..."
     if self.eject_check:
         text_color_value = "#000000"
     else:
         text_color_value = "#9d9d9d"
     draw_text(
         cr,
         text,
         rect.x,
         rect.y + rect.height / 2 - get_text_size(text)[1] / 2,
         text_color=text_color_value,
         text_size=9,
     )
     return True