def render_background(self,  cr, rect):
     if self.is_select:
         background_color = app_theme.get_color("globalItemSelect")
         cr.set_source_rgb(*color_hex_to_cairo(background_color.get_color()))
     else:
         if  self.is_hover:
             background_color = app_theme.get_color("globalItemHover")
             cr.set_source_rgb(*color_hex_to_cairo(background_color.get_color()))
         else:
             background_color = "#ffffff"
             cr.set_source_rgb(*color_hex_to_cairo(background_color))
     cr.rectangle(rect.x, rect.y, rect.width, rect.height)
     cr.fill()
    def __init__(self,
                 name,
                 text_size = TITLE_FONT_SIZE,
                 always_show = False,
                 toggle_callback=None,
                 label_right=False):
        gtk.HBox.__init__(self)
        self.set_size_request(-1, 30)
        
        self.label = Label(name,
                      text_size=text_size,
                      text_color=app_theme.get_color("globalTitleForeground"), 
                      enable_select=False,
                      enable_double_click=False)
        if label_right:
            self.label_box = style.wrap_with_align(self.label, width=210)
        else:
            self.label_box = style.wrap_with_align(self.label, align="left", width=210)
        self.label_box.set_size_request(210, 30)
        self.pack_start(self.label_box, False, False)

        if not always_show:
            self.switch = SwitchButton(
                                        False,
                                        inactive_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/inactive_normal.png"), 
                                        active_disable_dpixbuf = app_theme.get_pixbuf("toggle_button/active_disable.png"))
            align = style.wrap_with_align(self.switch, align="left")
            self.pack_start(align, False, False)
            self.switch.connect("toggled", toggle_callback)
            align.set_padding(0, 0, 15, 0)
    def __init__(self,
                 pixbuf,
                 title,
                 has_separator=True,
                 text_size=TITLE_FONT_SIZE,
                 text_color=app_theme.get_color("globalTitleForeground"),
                 width=222,
                 left_padding=0,
                 spacing=10):
        gtk.VBox.__init__(self)
        self.set_size_request(width, -1)

        hbox = gtk.HBox(spacing=spacing)
        label = Label(title,
                      text_color,
                      text_size,
                      enable_select=False,
                      enable_double_click=False)

        if pixbuf == None:
            self.__box_pack_start(hbox, [label])
        else:
            image_box = ImageBox(pixbuf)
            self.__box_pack_start(hbox, [image_box, label])

        align = style.wrap_with_align(hbox, align="left")

        self.__box_pack_start(self, [align])
        if has_separator:
            separator = HSeparator(
                app_theme.get_shadow_color("hSeparator").get_color_info(), 0,
                0)
            separator.set_size_request(-1, 10)
            self.__box_pack_start(self, [separator])
    def __init__(self, 
                 pixbuf, 
                 title,
                 has_separator=True,
                 text_size=TITLE_FONT_SIZE,
                 text_color=app_theme.get_color("globalTitleForeground"), 
                 width=222,
                 left_padding = 0,
                 spacing=10):
        gtk.VBox.__init__(self)
        self.set_size_request(width, -1)
        
        hbox = gtk.HBox(spacing=spacing)
        label = Label(title, 
                      text_color,
                      text_size,
                      enable_select=False,
                      enable_double_click=False)

        if pixbuf == None:
            self.__box_pack_start(hbox, [label])
        else:
            image_box = ImageBox(pixbuf)
            self.__box_pack_start(hbox, [image_box,label])

        align = style.wrap_with_align(hbox, align="left")

        self.__box_pack_start(self, [align])
        if has_separator:
            separator = HSeparator(app_theme.get_shadow_color("hSeparator").get_color_info(), 0, 0)
            separator.set_size_request(-1, 10)
            self.__box_pack_start(self, [separator])
    def __init__(self,
                 name,
                 text_size=TITLE_FONT_SIZE,
                 always_show=False,
                 toggle_callback=None,
                 label_right=False):
        gtk.HBox.__init__(self)
        self.set_size_request(-1, 30)

        self.label = Label(
            name,
            text_size=text_size,
            text_color=app_theme.get_color("globalTitleForeground"),
            enable_select=False,
            enable_double_click=False)
        if label_right:
            self.label_box = style.wrap_with_align(self.label, width=210)
        else:
            self.label_box = style.wrap_with_align(self.label,
                                                   align="left",
                                                   width=210)
        self.label_box.set_size_request(210, 30)
        self.pack_start(self.label_box, False, False)

        if not always_show:
            self.switch = SwitchButton(
                False,
                inactive_disable_dpixbuf=app_theme.get_pixbuf(
                    "toggle_button/inactive_normal.png"),
                active_disable_dpixbuf=app_theme.get_pixbuf(
                    "toggle_button/active_disable.png"))
            align = style.wrap_with_align(self.switch, align="left")
            self.pack_start(align, False, False)
            self.switch.connect("toggled", toggle_callback)
            align.set_padding(0, 0, 15, 0)