def _updated(self):
     self._icon = ProgressIcon(self._icon_name, style.STANDARD_ICON_SIZE,
                               self._xo_color.get_stroke_color(),
                               self._xo_color.get_fill_color(),
                               self._direction)
     self._icon.update(self._progress)
     self.set_icon_widget(self._icon)
     self._icon.show()
Exemplo n.º 2
0
    def __init__(self, message, button_callback):
        Gtk.EventBox.__init__(self)

        self.modify_bg(Gtk.StateType.NORMAL,
                       style.COLOR_WHITE.get_gdk_color())

        alignment = Gtk.Alignment.new(0.5, 0.5, 0.1, 0.1)
        self.add(alignment)
        alignment.show()

        box = Gtk.VBox()
        alignment.add(box)
        box.show()

        icon = ProgressIcon(icon_name='book',
                            pixel_size=style.LARGE_ICON_SIZE,
                            stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                            fill_color=style.COLOR_SELECTION_GREY.get_svg())
        self.progress_icon = icon

        box.pack_start(icon, expand=True, fill=False, padding=0)
        icon.show()

        label = Gtk.Label()
        color = style.COLOR_BUTTON_GREY.get_html()
        label.set_markup('<span weight="bold" color="%s">%s</span>' % (
            color, GLib.markup_escape_text(message)))
        box.pack_start(label, expand=True, fill=False, padding=0)
        label.show()

        button_box = Gtk.HButtonBox()
        button_box.set_layout(Gtk.ButtonBoxStyle.CENTER)
        box.pack_start(button_box, False, True, 0)
        button_box.show()

        button = Gtk.Button(label=_('Cancel'))
        button.connect('clicked', button_callback)
        button.props.image = Icon(icon_name='dialog-cancel',
                                  pixel_size=style.SMALL_ICON_SIZE)
        button_box.pack_start(button, expand=True, fill=False, padding=0)
        button.show()
import common

test = common.Test()

box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
test.pack_start(box, True, True, 0)

toolbar_box = ToolbarBox()
box.pack_start(toolbar_box, False, False, 0)

separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)

icon = ProgressIcon(pixel_size=style.LARGE_ICON_SIZE,
                    icon_name='computer-xo',
                    stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                    fill_color=style.COLOR_WHITE.get_svg())
test.pack_start(icon, True, True, 0)
icon.show()

icon2 = ProgressIcon(pixel_size=style.LARGE_ICON_SIZE,
                     icon_name='computer-xo',
                     stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                     fill_color=style.COLOR_WHITE.get_svg(),
                     direction='horizontal')
test.pack_start(icon2, True, True, 0)
icon2.show()

test.show_all()

progress = 0