def _render_progress(self, context, cr, progress, cell_area, ypad, is_rtl):
        percent = progress * 0.01
        # per the spec, the progressbar should be the width of the action button
        action_btn = self.get_button_by_name(CellButtonIDs.ACTION)

        x, _, w, h = action_btn.allocation
        # shift the bar to the top edge
        y = cell_area.y + ypad

        context.save()
        context.add_class("trough")

        Gtk.render_background(context, cr, x, y, w, h)
        Gtk.render_frame(context, cr, x, y, w, h)

        context.restore ()

        bar_size = w * percent

        context.save ()
        context.add_class ("progressbar")

        if (bar_size > 0):
            if is_rtl:
                x += (w - bar_size)
            Gtk.render_activity(context, cr, x, y, bar_size, h)

        context.restore ()
        return
Beispiel #2
0
    def _render_progress(self, context, cr, progress, cell_area, ypad, is_rtl):
        percent = progress * 0.01
        # per the spec, the progressbar should be the width of the action
        # button
        action_btn = self.get_button_by_name(CellButtonIDs.ACTION)

        x, _, w, h = action_btn.allocation
        # shift the bar to the top edge
        y = cell_area.y + ypad

        context.save()
        context.add_class("trough")

        Gtk.render_background(context, cr, x, y, w, h)
        Gtk.render_frame(context, cr, x, y, w, h)

        context.restore()

        bar_size = w * percent

        context.save()
        context.add_class("progressbar")

        if (bar_size > 0):
            if is_rtl:
                x += (w - bar_size)
            Gtk.render_activity(context, cr, x, y, bar_size, h)

        context.restore()
Beispiel #3
0
    def do_draw(self, cairo_context):
        """Draw some magic."""
        sc = self.get_style_context()
        state = self.get_state_flags()
        width = self.get_allocated_width()
        height = self.get_allocated_height()

        sc.save()
        sc.set_state(state)

        y = 0
        x = width / 2
        while y < height:
            Gtk.render_activity(sc, cairo_context, float(x), float(y), 1, 1)
            y += 3

        sc.restore()
        return True