def do_draw(self, contexto):
        """
        Dibuja el estado de la barra de progreso.
        """

        rect = self.get_allocation()
        w, h = (rect.width, rect.height)

        # Fondo
        Gdk.cairo_set_source_color(contexto, get_color("BLANCO"))
        contexto.paint()

        # Relleno de la barra
        ww = w - self.borde * 2
        hh = h / 5

        Gdk.cairo_set_source_color(contexto, get_color("NEGRO"))
        rect = Gdk.Rectangle()

        rect.x, rect.y, rect.width, rect.height = (self.borde, h / 5 * 2, ww,
                                                   hh)
        Gdk.cairo_rectangle(contexto, rect)
        contexto.fill()

        # Relleno de la barra segun progreso
        Gdk.cairo_set_source_color(contexto, get_color("NARANJA"))
        rect = Gdk.Rectangle()

        ximage = int(self.ajuste.get_value() * ww / 100)
        rect.x, rect.y, rect.width, rect.height = (self.borde, h / 5 * 2,
                                                   ximage, hh)
        Gdk.cairo_rectangle(contexto, rect)
        contexto.fill()

        # La Imagen
        imgw, imgh = (self.pixbuf.get_width(), self.pixbuf.get_height())
        imgx = (ximage - imgw / 2) + self.borde
        imgy = float(self.get_allocation().height / 2 - imgh / 2)
        Gdk.cairo_set_source_pixbuf(contexto, self.pixbuf, imgx, imgy)
        contexto.paint()

        return True
    def do_draw(self, contexto):
        """
        Dibuja el estado de la barra de progreso.
        """

        rect = self.get_allocation()
        w, h = (rect.width, rect.height)

        # Fondo
        Gdk.cairo_set_source_color(contexto, get_color("BLANCO"))
        contexto.paint()

        # Relleno de la barra
        ww = w - self.borde * 2
        hh = h / 5

        Gdk.cairo_set_source_color(contexto, get_color("NEGRO"))
        rect = Gdk.Rectangle()

        rect.x, rect.y, rect.width, rect.height = (
            self.borde, h / 5 * 2, ww, hh)
        Gdk.cairo_rectangle(contexto, rect)
        contexto.fill()

        # Relleno de la barra segun progreso
        Gdk.cairo_set_source_color(contexto, get_color("NARANJA"))
        rect = Gdk.Rectangle()

        ximage = int(self.ajuste.get_value() * ww / 100)
        rect.x, rect.y, rect.width, rect.height = (
            self.borde, h / 5 * 2, ximage, hh)
        Gdk.cairo_rectangle(contexto, rect)
        contexto.fill()

        # La Imagen
        imgw, imgh = (self.pixbuf.get_width(), self.pixbuf.get_height())
        imgx = (ximage - imgw / 2) + self.borde
        imgy = float(self.get_allocation().height / 2 - imgh / 2)
        Gdk.cairo_set_source_pixbuf(contexto, self.pixbuf, imgx, imgy)
        contexto.paint()

        return True
    def __get_widgets_colors(self):
        """
        Cuatro botones para seleccionar el color.
        """

        color_widgets = gtk.HBox()

        white = JAMediaButton()
        white.connect('clicked', self.__set_color, 3)
        white.set_colores(colornormal=get_color("BLANCO"))
        white.set_tooltip('Blanco')

        red = JAMediaButton()
        red.connect('clicked', self.__set_color, 0)
        red.set_colores(colornormal=get_color("ROJO"))
        red.set_tooltip('Rojo')

        green = JAMediaButton()
        green.connect('clicked', self.__set_color, 1)
        green.set_colores(colornormal=get_color("VERDE"))
        green.set_tooltip('Verde')

        blue = JAMediaButton()
        blue.connect('clicked', self.__set_color, 2)
        blue.set_colores(colornormal=get_color("AZUL"))
        blue.set_tooltip('Azul')

        self.botones_colores = [
            white,
            red,
            green,
            blue]

        for button in self.botones_colores:
            button.set_tamanio(24, 24)
            button.set_border_width(4)
            color_widgets.pack_start(button, True, True, 0)
            button.connect('clicked', self.__clicked_color)

        return color_widgets
    def __get_widgets_colors(self):
        """
        Cuatro botones para seleccionar el color.
        """

        color_widgets = Gtk.HBox()

        white = JAMediaButton()
        white.connect('clicked', self.__set_color, 3)
        white.set_colores(colornormal=get_color("BLANCO"))
        white.set_tooltip('Blanco')

        red = JAMediaButton()
        red.connect('clicked', self.__set_color, 0)
        red.set_colores(colornormal=get_color("ROJO"))
        red.set_tooltip('Rojo')

        green = JAMediaButton()
        green.connect('clicked', self.__set_color, 1)
        green.set_colores(colornormal=get_color("VERDE"))
        green.set_tooltip('Verde')

        blue = JAMediaButton()
        blue.connect('clicked', self.__set_color, 2)
        blue.set_colores(colornormal=get_color("AZUL"))
        blue.set_tooltip('Azul')

        self.botones_colores = [white, red, green, blue]

        for button in self.botones_colores:
            button.set_tamanio(24, 24)
            button.set_border_width(4)
            color_widgets.pack_start(button, True, True, 0)
            button.connect('clicked', self.__clicked_color)

        return color_widgets