def __init__(self, *args, **kwargs): super(_StuckStrip, self).__init__(*args, **kwargs) self.orientation = Gtk.Orientation.HORIZONTAL spacer1 = Gtk.Label(label='') self.pack_start(spacer1, True, True, 0) spacer2 = Gtk.Label(label='') self.pack_end(spacer2, expand=True, fill=False, padding=0) self.set_spacing(10) self.set_border_width(10) label = Gtk.Label(label=_("Stuck? You can still solve the puzzle.")) self.pack_start(label, False, True, 0) icon = Icon() icon.set_from_icon_name('edit-undo', Gtk.IconSize.LARGE_TOOLBAR) self.button = Gtk.Button(stock=Gtk.STOCK_UNDO) self.button.set_image(icon) self.button.set_label(_("Undo some moves")) self.pack_end(self.button, expand=False, fill=False, padding=0) def callback(source): self.emit('undo-clicked') self.button.connect('clicked', callback)
def __init__(self, *args, **kwargs): super(_StuckStrip, self).__init__(*args, **kwargs) self.orientation = Gtk.Orientation.HORIZONTAL spacer1 = Gtk.Label(label='') self.pack_start(spacer1, True, True, 0) spacer2 = Gtk.Label(label='') self.pack_end(spacer2, expand=True, fill=False, padding=0) self.set_spacing(10) self.set_border_width(10) label = Gtk.Label(label=_("Stuck? You can still solve the puzzle.")) self.pack_start(label, False, True, 0) icon = Icon() icon.set_from_icon_name('edit-undo', Gtk.IconSize.LARGE_TOOLBAR) self.button = Gtk.Button(stock=Gtk.STOCK_UNDO) self.button.set_image(icon) self.button.set_label(_("Undo some moves")) self.pack_end(self.button, expand=False, fill=False, padding=0) def callback(source): self.emit('undo-clicked') self.button.connect('clicked', callback)
def add_button(icon_name, tooltip, signal_name): icon = Icon() icon.set_from_icon_name(icon_name, Gtk.IconSize.LARGE_TOOLBAR) button = Gtk.Button() button.set_image(icon) button.set_tooltip_text(tooltip) self.add(button) def callback(source): self.emit(signal_name) button.connect('clicked', callback) return button
def add_button(icon_name, tooltip, signal_name): icon = Icon() icon.set_from_icon_name(icon_name, Gtk.IconSize.LARGE_TOOLBAR) button = Gtk.Button() button.set_image(icon) button.set_tooltip_text(tooltip) self.add(button) def callback(source): self.emit(signal_name) button.connect('clicked', callback) return button
def __init__(self, icon_name, title): super(_DialogToolbar, self).__init__() icon = Icon() icon.set_from_icon_name(icon_name, Gtk.IconSize.LARGE_TOOLBAR) self._add_widget(icon) self._add_separator() label = Gtk.Label(label=title) self._add_widget(label) self._add_separator(expand=True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Done')) stop.connect('clicked', self._stop_clicked_cb) self.add(stop)
def __init__(self, icon_name, title): super(_DialogToolbar, self).__init__() icon = Icon() icon.set_from_icon_name(icon_name, Gtk.IconSize.LARGE_TOOLBAR) self._add_widget(icon) self._add_separator() label = Gtk.Label(label=title) self._add_widget(label) self._add_separator(expand=True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Done')) stop.connect('clicked', self._stop_clicked_cb) self.add(stop)