def build_toolbar(self): toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(False) toolbar_box.toolbar.insert(separator, -1) separator.show() button = ToolButton('speaker-muted-100') button.set_tooltip(_('Sound')) button.connect('clicked', self.sound_control) toolbar_box.toolbar.insert(button, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.show_all()
def make_toolbar(self): def make_separator(expand=False): separator = Gtk.SeparatorToolItem() if expand: separator.set_expand(True) separator.props.draw = False return separator toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar = toolbar_box.toolbar activity_button = ActivityToolbarButton(self) toolbar.insert(activity_button, -1) toolbar.insert(make_separator(), -1) button_add = ToolButton(Gtk.STOCK_ADD) button_add.set_tooltip(_("Add a channel")) button_add.connect("clicked", self._add_channel) toolbar.insert(button_add, -1) toolbar.insert(make_separator(True), -1) stop_button = ToolButton("activity-stop") stop_button.connect("clicked", self._exit) stop_button.props.accelerator = "<Ctrl>Q" toolbar.insert(stop_button, -1)
def add_button(icon_name, tooltip, func): def callback(source): func() button = ToolButton(icon_name) toolbar.add(button) button.connect('clicked', callback) button.set_tooltip(tooltip)
def __init__(self, **kwargs): GObject.GObject.__init__(self) help_button = ToolButton('toolbar-help') help_button.set_tooltip(_('Help')) self.add(help_button) self._palette = help_button.get_palette() sw = Gtk.ScrolledWindow() sw.set_size_request(int(Gdk.Screen.width() / 2.8), Gdk.Screen.height() - style.GRID_CELL_SIZE * 3) sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self._max_text_width = int(Gdk.Screen.width() / 3) - 600 self._vbox = Gtk.Box() self._vbox.set_orientation(Gtk.Orientation.VERTICAL) self._vbox.set_homogeneous(False) sw.add_with_viewport(self._vbox) self._palette.set_content(sw) sw.show_all() help_button.connect('clicked', self.__help_button_clicked_cb)
def __init__(self, **kwargs): Gtk.ToolItem.__init__(self) help_button = ToolButton("toolbar-help") help_button.set_tooltip(_("Help")) self.add(help_button) self._palette = help_button.get_palette() sw = Gtk.ScrolledWindow() sw.set_size_request(int(Gdk.Screen.width() / 2.8), 310) sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self._max_text_width = int(Gdk.Screen.width() / 3) - 600 self._vbox = Gtk.Box() self._vbox.set_orientation(Gtk.Orientation.VERTICAL) self._vbox.set_homogeneous(False) self._vbox.set_border_width(10) hbox = Gtk.Box() hbox.pack_start(self._vbox, False, True, 0) sw.add_with_viewport(hbox) self._palette.set_content(sw) sw.show_all() help_button.connect("clicked", self.__help_button_clicked_cb)
def __init__(self, activity, **kwargs): Gtk.ToolItem.__init__(self) description_button = ToolButton('edit-description') description_button.show() description_button.set_tooltip(_('Description')) description_button.palette_invoker.props.toggle_palette = True description_button.props.hide_tooltip_on_click = False self._palette = description_button.get_palette() description_box = PaletteMenuBox() sw = Gtk.ScrolledWindow() sw.set_size_request(int(Gdk.Screen.width() / 2), 2 * style.GRID_CELL_SIZE) sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self._text_view = Gtk.TextView() self._text_view.set_left_margin(style.DEFAULT_PADDING) self._text_view.set_right_margin(style.DEFAULT_PADDING) self._text_view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR) text_buffer = Gtk.TextBuffer() if 'description' in activity.metadata: text_buffer.set_text(activity.metadata['description']) self._text_view.set_buffer(text_buffer) self._text_view.connect('focus-out-event', self.__description_changed_cb, activity) sw.add(self._text_view) description_box.append_item(sw, vertical_padding=0) self._palette.set_content(description_box) description_box.show_all() self.add(description_button) activity.metadata.connect('updated', self.__jobject_updated_cb)
def __init__(self, path, add_back_button=False): ToolbarBox.__init__(self) self._path = path self.search_entry = iconentry.IconEntry() try: self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY, 'entry-search') except: pass text = _('Search') self.search_entry.set_placeholder_text(text) self.search_entry.connect('activate', self._search_entry_activated_cb) self.search_entry.connect('changed', self._search_entry_changed_cb) self.search_entry.add_clear_button() self._autosearch_timer = None self._add_widget(self.search_entry, expand=True) if add_back_button: back_button = ToolButton(icon_name='go-previous') back_button.set_tooltip(_('Back')) self._add_widget(back_button, expand=False) back_button.connect('clicked', self.__back_button_clicked_cb) back_button.show() self._query = self._build_query()
class ViewToolbar(Gtk.Toolbar): __gtype_name__ = 'ViewToolbar' __gsignals__ = { 'go-fullscreen': (GObject.SignalFlags.RUN_FIRST, None, ([])), 'toggle-playlist': (GObject.SignalFlags.RUN_FIRST, None, ([])) } def __init__(self): Gtk.Toolbar.__init__(self) self._show_playlist = ToggleToolButton('view-list') self._show_playlist.set_active(True) # due to Activity.show_all() self._show_playlist.set_tooltip(_('Playlist')) self._show_playlist.set_accelerator('<ctrl>l') self._show_playlist.connect('toggled', self._playlist_toggled_cb) self.insert(self._show_playlist, -1) self._show_playlist.show() self._fullscreen = ToolButton('view-fullscreen') self._fullscreen.set_tooltip(_('Fullscreen')) self._fullscreen.set_accelerator('<ctrl>f') self._fullscreen.connect('clicked', self._fullscreen_cb) self.insert(self._fullscreen, -1) self._fullscreen.show() def _fullscreen_cb(self, button): self.emit('go-fullscreen') def _playlist_toggled_cb(self, button): self.emit('toggle-playlist')
class BasicToolbar(Gtk.Toolbar): def __init__(self, icon_name, title=''): GObject.GObject.__init__(self) icon = ToolButton(icon_name) self.insert(icon, -1) label = Gtk.Label() label.set_markup('<b>%s</b>' % title) label.set_alignment(0, 0.5) tool_item = Gtk.ToolItem() tool_item.set_expand(True) tool_item.add(label) tool_item.show_all() self.insert(tool_item, -1) self.separator = Gtk.SeparatorToolItem() self.separator.props.draw = False self.separator.set_expand(True) self.insert(self.separator, -1) self.stop = ToolButton(icon_name='dialog-cancel') self.stop.set_tooltip(_('Cancel')) self.insert(self.stop, -1) self.stop.show() self.confirm = ToolButton(icon_name='dialog-ok') self.confirm.set_tooltip(_('Done')) self.insert(self.confirm, -1) self.confirm.show()
class TitleBox(Gtk.Toolbar): def __init__(self, title=None): Gtk.Toolbar.__init__(self) self.journal_button = ToolButton() icon = Icon(icon_name='activity-journal', xo_color=profile.get_color()) self.journal_button.set_icon_widget(icon) self.journal_button.set_tooltip(_('Select from the Journal')) self.insert(self.journal_button, -1) self.journal_button.show_all() label = Gtk.Label() if title is None: title = _('Choose an image') label.set_markup('<b>%s</b>' % title) label.set_alignment(0, 0.5) label.set_margin_left(10) self._add_widget(label, expand=True) self.close_button = ToolButton(icon_name='dialog-cancel') self.close_button.set_tooltip(_('Close')) self.insert(self.close_button, -1) self.close_button.show() def _add_widget(self, widget, expand=False): tool_item = Gtk.ToolItem() tool_item.set_expand(expand) tool_item.add(widget) widget.show() self.insert(tool_item, -1) tool_item.show()
class BasicToolbar(Gtk.Toolbar): def __init__(self, title): GObject.GObject.__init__(self) self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_BLACK.get_gdk_color()) label = Gtk.Label() label.set_markup('<b>%s</b>' % title) label.set_halign(Gtk.Align.START) tool_item = Gtk.ToolItem() tool_item.set_expand(True) tool_item.add(label) tool_item.show_all() tool_item.props.margin_left = style.GRID_CELL_SIZE / 2 self.insert(tool_item, -1) self.separator = Gtk.SeparatorToolItem() self.separator.props.draw = False self.separator.set_expand(True) self.insert(self.separator, -1) self.stop = ToolButton(icon_name='dialog-cancel') self.stop.set_tooltip(_('Cancel')) self.insert(self.stop, -1) self.stop.show()
def __init__(self, comicbox): BaseWindow.__init__(self) self.toolbar = BasicToolbar('contract-coordinates') self.toolbar.stop.connect('clicked', self.__stop_clicked_cb) self.toolbar.confirm.connect('clicked', self.__ok_clicked_cb) reset_size = ToolButton(icon_name='box-size') reset_size.set_tooltip(_('Reset to box size')) self.toolbar.insert(reset_size, 3) reset_size.show() reset_size.connect('clicked', self.__reset_size_cb) self.comicbox = comicbox self.canvas = CanvasEditor( self.comicbox, self.comicbox.width, self.comicbox.height, self) label = Gtk.Label('') title = _('Drag to move or resize using the marked corners') label.set_markup('<span size="x-large">%s</span>' % title) self.vbox = Gtk.VBox() self.vbox.pack_start(self.toolbar, False, False, 0) self.vbox.pack_start(label, False, False, style.DEFAULT_SPACING) self.vbox.pack_start(self.canvas, True, True, 0) self.add(self.vbox) self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
def build_toolbar(self): toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() # Pause/Play button: stop_play = ToolButton('media-playback-stop') stop_play.set_tooltip(_("Stop")) stop_play.set_accelerator(_('<ctrl>space')) stop_play.connect('clicked', self._stop_play_cb) stop_play.show() toolbar_box.toolbar.insert(stop_play, -1) # Blank space (separator) and Stop button at the end: separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show()
def build_toolbar(self): # Create the toolbar box toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() # Create the activity button activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() # Create the pause/play button stop_play = ToolButton('media-playback-stop') stop_play.set_tooltip(_("Stop")) stop_play.set_accelerator(_('<ctrl>space')) stop_play.connect('clicked', self.stop_play_cb) stop_play.show() toolbar_box.toolbar.insert(stop_play, -1) # Create a blank separator and a Stop button separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show()
class MainToolbar(Gtk.Toolbar): """ Main toolbar of the control panel """ __gtype_name__ = 'MainToolbar' __gsignals__ = { 'stop-clicked': (GObject.SignalFlags.RUN_FIRST, None, ([])), 'search-changed': (GObject.SignalFlags.RUN_FIRST, None, ([str])), } def __init__(self): Gtk.Toolbar.__init__(self) self._add_separator() tool_item = Gtk.ToolItem() self.insert(tool_item, -1) tool_item.show() self._search_entry = iconentry.IconEntry() self._search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY, 'entry-search') self._search_entry.add_clear_button() self._search_entry.set_width_chars(25) text = _('Search in %s') % _('Settings') self._search_entry.set_placeholder_text(text) self._search_entry.connect('changed', self.__search_entry_changed_cb) tool_item.add(self._search_entry) self._search_entry.show() self._add_separator(True) self.stop = ToolButton(icon_name='dialog-cancel') self.stop.set_tooltip(_('Done')) self.stop.connect('clicked', self.__stop_clicked_cb) self.stop.show() self.insert(self.stop, -1) self.stop.show() def get_entry(self): return self._search_entry def _add_separator(self, expand=False): separator = Gtk.SeparatorToolItem() separator.props.draw = False if expand: separator.set_expand(True) else: separator.set_size_request(style.DEFAULT_SPACING, -1) self.insert(separator, -1) separator.show() def __search_entry_changed_cb(self, search_entry): self.emit('search-changed', search_entry.props.text) def __stop_clicked_cb(self, button): self.emit('stop-clicked')
def __init__(self, comicbox): BaseWindow.__init__(self) self.toolbar = BasicToolbar('contract-coordinates') self.toolbar.stop.connect('clicked', self.__stop_clicked_cb) self.toolbar.confirm.connect('clicked', self.__ok_clicked_cb) reset_size = ToolButton(icon_name='box-size') reset_size.set_tooltip(_('Reset to box size')) self.toolbar.insert(reset_size, 3) reset_size.show() reset_size.connect('clicked', self.__reset_size_cb) self.comicbox = comicbox self.canvas = CanvasEditor(self.comicbox, self.comicbox.width, self.comicbox.height, self) label = Gtk.Label('') title = _('Drag to move or resize using the marked corners') label.set_markup('<span size="x-large">%s</span>' % title) self.vbox = Gtk.VBox() self.vbox.pack_start(self.toolbar, False, False, 0) self.vbox.pack_start(label, False, False, style.DEFAULT_SPACING) self.vbox.pack_start(self.canvas, True, True, 0) self.add(self.vbox) self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
def __init__(self, **kwargs): Gtk.ToolItem.__init__(self) help_button = ToolButton('toolbar-help') help_button.set_tooltip(_('Ayuda / ÑepYsyrõ')) self.add(help_button) self._palette = help_button.get_palette() sw = Gtk.ScrolledWindow() sw.set_size_request(int(Gdk.Screen.width() / 2.8), 100) sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self._max_text_width = int(Gdk.Screen.width() / 3) - 600 self._vbox = Gtk.Box() self._vbox.set_orientation(Gtk.Orientation.VERTICAL) self._vbox.set_homogeneous(False) self._vbox.set_border_width(10) hbox = Gtk.Box() hbox.pack_start(self._vbox, False, True, 0) sw.add_with_viewport(hbox) self._palette.set_content(sw) sw.show_all() help_button.connect('clicked', self.__help_button_clicked_cb)
class TitleBox(VolumesToolbar): __gtype_name__ = 'TitleBox' def __init__(self): VolumesToolbar.__init__(self) label = Gtk.Label() label.set_markup('<b>%s</b>' % _('Choose an object')) label.set_alignment(0, 0.5) self._add_widget(label, expand=True) self.close_button = ToolButton(icon_name='dialog-cancel') self.close_button.set_tooltip(_('Close')) self.insert(self.close_button, -1) self.close_button.show() def _add_widget(self, widget, expand=False): tool_item = Gtk.ToolItem() tool_item.set_expand(expand) tool_item.add(widget) widget.show() self.insert(tool_item, -1) tool_item.show()
class TitleBox(Gtk.Toolbar): __gtype_name__ = 'TitleBox' def __init__(self, title): Gtk.Toolbar.__init__(self) label = Gtk.Label() label.set_markup('<b>%s</b>' % title) label.set_alignment(0, 0.5) self._add_widget(label, expand=True) self.close_button = ToolButton(icon_name='dialog-cancel') self.close_button.set_tooltip(_('Close')) self.insert(self.close_button, -1) self.close_button.show() def _add_widget(self, widget, expand=False): tool_item = Gtk.ToolItem() tool_item.set_expand(expand) tool_item.add(widget) widget.show() self.insert(tool_item, -1) tool_item.show()
class WebToolbar(Gtk.Toolbar): def __init__(self,browser): self.logger = logging.getLogger("gvr.Widgets.WebToolbar") Gtk.Toolbar.__init__(self) self._browser = browser self._back = ToolButton('go-previous') self._back.set_tooltip(_('Go back one page')) self._back.connect('clicked', self._go_back_cb) self.insert(self._back, -1) self._back.show() self._forw = ToolButton('go-next') self._forw.set_tooltip(_('Go one page forward')) self._forw.connect('clicked', self._go_forward_cb) self.insert(self._forw, -1) self._forw.show() def _go_forward_cb(self, button): if self._browser.can_go_forward(): self._browser.go_forward() def _go_back_cb(self, button): if self._browser.can_go_back(): self._browser.go_back()
class TitleBox(VolumesToolbar): __gtype_name__ = 'TitleBox' def __init__(self, what_filter='', filter_type=None): VolumesToolbar.__init__(self) label = Gtk.Label() title = _('Choose an object') if filter_type == FILTER_TYPE_MIME_BY_ACTIVITY: registry = bundleregistry.get_registry() bundle = registry.get_bundle(what_filter) if bundle is not None: title = _('Choose an object to open with %s activity') % \ bundle.get_name() label.set_markup('<b>%s</b>' % title) label.set_alignment(0, 0.5) self._add_widget(label, expand=True) self.close_button = ToolButton(icon_name='dialog-cancel') self.close_button.set_tooltip(_('Close')) self.insert(self.close_button, -1) self.close_button.show() def _add_widget(self, widget, expand=False): tool_item = Gtk.ToolItem() tool_item.set_expand(expand) tool_item.add(widget) widget.show() self.insert(tool_item, -1) tool_item.show()
def makeToolbar(self, activity): self.activity = activity toolbar = ToolbarBox() activity_button = ActivityToolbarButton(activity) toolbar.toolbar.insert(activity_button, -1) activity_button.show() editmode = ToolButton('edit-description') editmode.set_tooltip(_("Enter Edit Mode")) editmode.set_accelerator(_('<ctrl>e')) editmode.connect('clicked', self.gotoCoding) toolbar.toolbar.insert(editmode, -1) editmode.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(activity) toolbar.toolbar.insert(stop_button, -1) stop_button.show() return toolbar
def __init__(self, parent, web_view): GObject.GObject.__init__(self) self._help = parent self._web_view = web_view self._back = ToolButton('go-previous-paired') self._back.set_tooltip(_('Back')) self._back.props.sensitive = False self._back.connect('clicked', self._go_back_cb) self.insert(self._back, -1) self._back.show() self._forward = ToolButton('go-next-paired') self._forward.set_tooltip(_('Forward')) self._forward.props.sensitive = False self._forward.connect('clicked', self._go_forward_cb) self.insert(self._forward, -1) self._forward.show() home = ToolButton('zoom-home') home.set_tooltip(_('Home')) home.connect('clicked', self._go_home_cb) self.insert(home, -1) home.show() separator = Gtk.SeparatorToolItem() separator.set_draw(False) separator.set_expand(True) self.insert(separator, -1) separator.show()
def __init__(self, calc): Gtk.Toolbar.__init__(self) copy_tool = ToolButton('edit-copy') copy_tool.set_tooltip(_('Copy')) copy_tool.set_accelerator(_('<ctrl>c')) copy_tool.connect('clicked', lambda x: calc.text_copy()) self.insert(copy_tool, -1) menu_item = MenuItem(_('Cut')) try: menu_item.set_accelerator(_('<ctrl>x')) except AttributeError: pass menu_item.connect('activate', lambda x: calc.text_cut()) menu_item.show() copy_tool.get_palette().menu.append(menu_item) self.insert(IconToolButton('edit-paste', _('Paste'), lambda x: calc.text_paste(), alt_html='Paste'), -1) self.show_all()
def __init__(self, activity_name, has_local_help): Gtk.Toolbar.__init__(self) self._add_separator(False) if has_local_help and get_social_help_server(): help_button = RadioToolButton() icon = Icon(icon_name='toolbar-help', pixel_size=style.STANDARD_ICON_SIZE, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) help_button.set_icon_widget(icon) icon.show() help_button.props.tooltip = _('Help Manual') help_button.connect('toggled', self.__button_toggled_cb, _MODE_HELP) self.insert(help_button, -1) help_button.show() self._add_separator(False) social_help_button = RadioToolButton() icon = Icon(icon_name='toolbar-social-help', pixel_size=style.STANDARD_ICON_SIZE, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) social_help_button.set_icon_widget(icon) icon.show() social_help_button.props.tooltip = _('Social Help') social_help_button.props.group = help_button social_help_button.connect('toggled', self.__button_toggled_cb, _MODE_SOCIAL_HELP) self.insert(social_help_button, -1) social_help_button.show() self._add_separator(False) self._back_button = ToolButton(icon_name='go-previous-paired') self._back_button.props.tooltip = _('Back') self._back_button.connect('clicked', self.__back_clicked_cb) self.insert(self._back_button, -1) self._back_button.show() self._forward_button = ToolButton(icon_name='go-next-paired') self._forward_button.props.tooltip = _('Forward') self._forward_button.connect('clicked', self.__forward_clicked_cb) self.insert(self._forward_button, -1) self._forward_button.show() title = _('Help: %s') % activity_name self._label = Gtk.Label() self._label.set_markup('<b>%s</b>' % title) self._label.set_alignment(0, 0.5) self._add_widget(self._label) self._add_separator(True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', self.__stop_clicked_cb) self.insert(stop, -1) stop.show()
def __init__(self, activity_name, has_local_help): Gtk.Toolbar.__init__(self) self._add_separator(False) if has_local_help and get_social_help_server(): help_button = RadioToolButton() icon = Icon(icon_name='toolbar-help', pixel_size=style.STANDARD_ICON_SIZE, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) help_button.set_icon_widget(icon) icon.show() help_button.props.tooltip = _('Help Manual') help_button.connect('toggled', self.__button_toggled_cb, _MODE_HELP) self.insert(help_button, -1) help_button.show() self._add_separator(False) social_help_button = RadioToolButton() icon = Icon(icon_name='toolbar-social-help', pixel_size=style.STANDARD_ICON_SIZE, fill_color=style.COLOR_TRANSPARENT.get_svg(), stroke_color=style.COLOR_WHITE.get_svg()) social_help_button.set_icon_widget(icon) icon.show() social_help_button.props.tooltip = _('Social Help') social_help_button.props.group = help_button social_help_button.connect( 'toggled', self.__button_toggled_cb, _MODE_SOCIAL_HELP) self.insert(social_help_button, -1) social_help_button.show() self._add_separator(False) self._back_button = ToolButton(icon_name='go-previous-paired') self._back_button.props.tooltip = _('Back') self._back_button.connect('clicked', self.__back_clicked_cb) self.insert(self._back_button, -1) self._back_button.show() self._forward_button = ToolButton(icon_name='go-next-paired') self._forward_button.props.tooltip = _('Forward') self._forward_button.connect('clicked', self.__forward_clicked_cb) self.insert(self._forward_button, -1) self._forward_button.show() title = _('Help: %s') % activity_name self._label = Gtk.Label() self._label.set_markup('<b>%s</b>' % title) self._label.set_alignment(0, 0.5) self._add_widget(self._label) self._add_separator(True) stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', self.__stop_clicked_cb) self.insert(stop, -1) stop.show()
class BooksToolbar(Gtk.Toolbar): __gtype_name__ = 'BooksToolbar' def __init__(self): Gtk.Toolbar.__init__(self) book_search_item = Gtk.ToolItem() self.search_entry = Gtk.Entry() self.search_entry.connect('activate', self.search_entry_activate_cb) self.search_entry.connect("key_press_event", self.keypress_cb) width = int(Gdk.Screen.width() / 2) self.search_entry.set_size_request(width, -1) book_search_item.add(self.search_entry) self.search_entry.show() self.search_entry.grab_focus() self.insert(book_search_item, -1) book_search_item.show() self.download = ToolButton('go-down') self.download.set_tooltip(_('Get Book')) self.download.props.sensitive = False self.download.connect('clicked', self.get_book_cb) self.insert(self.download, -1) self.download.show() self.hide_results = ToolButton('dialog-cancel') self.hide_results.set_tooltip(_('Remove Results List')) self.hide_results.props.sensitive = False self.hide_results.connect('clicked', self.hide_results_cb) self.insert(self.hide_results, -1) self.hide_results.show() def set_activity(self, activity): self.activity = activity def search_entry_activate_cb(self, entry): self.activity.find_books(entry.props.text) self.hide_results.props.sensitive = True def get_book_cb(self, button): self.activity.get_book() def enable_button(self, state): self.download.props.sensitive = state def hide_results_cb(self, button): self.activity.list_scroller.hide() self.hide_results.props.sensitive = False def keypress_cb(self, widget, event): keyname = Gdk.keyval_name(event.keyval) if keyname == 'Escape': self.activity.list_scroller.hide() self.hide_results.props.sensitive = False return True
def __init__(self, handle): activity.Activity.__init__(self, handle) self.props.max_participants = 1 self._web_view = WebKit.WebView() toolbox = ToolbarBox() self.set_toolbar_box(toolbox) toolbox.show() toolbar = toolbox.toolbar toolbar.show() activity_button = ActivityButton(self) toolbar.insert(activity_button, -1) viewtoolbar = ViewToolbar(self) viewtoolbar_button = ToolbarButton( page=viewtoolbar, icon_name='toolbar-view') toolbar.insert(viewtoolbar_button, -1) toolbar.show_all() self._back = ToolButton('go-previous-paired') self._back.set_tooltip(_('Back')) self._back.props.sensitive = False self._back.connect('clicked', self._go_back_cb) toolbar.insert(self._back, -1) self._back.show() self._forward = ToolButton('go-next-paired') self._forward.set_tooltip(_('Forward')) self._forward.props.sensitive = False self._forward.connect('clicked', self._go_forward_cb) toolbar.insert(self._forward, -1) self._forward.show() home = ToolButton('go-home') home.set_tooltip(_('Home')) home.connect('clicked', self._go_home_cb) toolbar.insert(home, -1) home.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) stopbtn = StopButton(self) toolbar.insert(stopbtn, -1) toolbar.show_all() self._web_view.connect('load-finished', self.update_navigation_buttons) self.set_canvas(self._web_view) self._web_view.show() self._web_view.load_uri(HOME)
class QrReader(activity.Activity): def __init__(self, handle): activity.Activity.__init__(self, handle) self.realize() self.qr_window = Gtk.DrawingArea() self.qr_window.set_double_buffered(False) self.qr_window.set_app_paintable(True) self.image = Gtk.Image() self.box = Gtk.VBox() self.box.pack_start(self.qr_window, True, True, 0) self.box.pack_end(self.image, True, True, 0) self.set_canvas(self.box) self.build_toolbar() self.show_all() self.image.hide() GObject.idle_add(self.setup_init) def build_toolbar(self): toolbox = ToolbarBox() toolbar = toolbox.toolbar activity_button = ActivityButton(self) toolbar.insert(activity_button, -1) toolbar.insert(Gtk.SeparatorToolItem(), -1) self.stop_play = ToogleButton('media-playback-start') self.stop_play.set_tooltip(_("Turn on/off the camera")) self.stop_play.props.active = True self.copylink = ToolButton('text-uri-list') self.copylink.set_tooltip(_("Copy link to clipboard")) self.copylink.set_sensitive(False) toolbar.insert(self.stop_play, -1) toolbar.insert(self.copylink, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar.insert(separator, -1) stopbtn = StopButton(self) toolbar.insert(stopbtn, -1) toolbar.show_all() self.set_toolbar_box(toolbox) def setup_init(self): xid = self.qr_window.get_property('window').get_xid() visor = QrVisor(xid, self.stop_play, self, self.qr_window, self.copylink, self.image) visor.play()
def make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() toolbarview = Gtk.Toolbar() langtoolbar_button = ToolbarButton( label=_('View'), page=toolbarview, icon_name='settings') langtoolbar_button.show() toolbar_box.toolbar.insert(langtoolbar_button, -1) tool = ToolButton('en') tool.set_tooltip(_('English')) tool.connect('clicked', self.language_en) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('es') tool.set_tooltip(_('Spanish')) tool.connect('clicked', self.language_es) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('fr') tool.set_tooltip(_('French')) tool.connect('clicked', self.language_fr) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('remote') tool.set_tooltip(_('Server settings')) tool.connect('clicked', self.settings) tool.show() toolbarview.insert(tool, -1) toolbarview.show() favorite_button = ToolButton(self.favorite_status) favorite_button.set_tooltip('Filter on favorite') favorite_button.connect('clicked', self.favorite) toolbar_box.toolbar.insert(favorite_button, -1) favorite_button.show() self.favorite_button = favorite_button separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
class BooksToolbar(Gtk.Toolbar): __gtype_name__ = 'BooksToolbar' def __init__(self): Gtk.Toolbar.__init__(self) book_search_item = Gtk.ToolItem() self.search_entry = Gtk.Entry() self.search_entry.connect('activate', self.search_entry_activate_cb) width = int(Gdk.Screen.width() / 2) self.search_entry.set_size_request(width, -1) book_search_item.add(self.search_entry) self.search_entry.show() self.insert(book_search_item, -1) book_search_item.show() self._download = ToolButton('go-down') self._download.set_tooltip(_('Get Book')) self._download.props.sensitive = False self._download.connect('clicked', self._get_book_cb) self.insert(self._download, -1) self._download.show() self.format_combo = ComboBox() self.format_combo.connect('changed', self.format_changed_cb) self.format_combo.append_item('.djvu', 'Deja Vu') self.format_combo.append_item('_bw.pdf', 'B/W PDF') self.format_combo.append_item('.pdf', 'Color PDF') self.format_combo.append_item('.epub', 'EPUB') self.format_combo.set_active(0) self.format_combo.props.sensitive = False combotool = ToolComboBox(self.format_combo) self.insert(combotool, -1) combotool.show() self.search_entry.grab_focus() def set_activity(self, activity): self.activity = activity def format_changed_cb(self, combo): if self.activity != None: self.activity.show_book_data() def search_entry_activate_cb(self, entry): self.activity.find_books(entry.props.text) def _get_book_cb(self, button): self.activity.get_book() def enable_button(self, state): self._download.props.sensitive = state self.format_combo.props.sensitive = state
class EditToolbar(SugarEditToolbar): def __init__(self, _parent): SugarEditToolbar.__init__(self) self._parent = _parent self.undo.connect('clicked', self.__undo_cb) self.redo.connect('clicked', self.__redo_cb) self.copy.connect('clicked', self.__copy_cb) self.paste.connect('clicked', self.__paste_cb) menu_item = MenuItem(_('Cut')) menu_item.connect('activate', self.__cut_cb) menu_item.show() self.copy.get_palette().menu.append(menu_item) self.insert(Gtk.SeparatorToolItem(), -1) self.erase_button = ToolButton('edit-delete') self.erase_button.set_tooltip(_('Erase selected thought(s)')) self.erase_button.connect('clicked', self.__delete_cb) self.insert(self.erase_button, -1) self.show_all() self.clipboard = Gtk.Clipboard() self.copy.set_sensitive(False) self.paste.set_sensitive(False) self.erase_button.set_sensitive(False) def __undo_cb(self, button): self._parent._undo.undo_action(None) def __redo_cb(self, button): self._parent._undo.redo_action(None) def __cut_cb(self, event): self._parent._main_area.cut_clipboard(self.clipboard) def __copy_cb(self, event): self._parent._main_area.copy_clipboard(self.clipboard) def __paste_cb(self, event): self._parent._main_area.paste_clipboard(self.clipboard) def __delete_cb(self, widget): self._stop_moving() self.stop_dragging() self._parent._main_area.delete_selected_elements() def stop_dragging(self): if self._parent._main_area.is_dragging(): self._parent._main_area.drag_menu_cb(self._sw, False) def _stop_moving(self): self._parent._main_area.move_mode = False
class BaseWindow(Gtk.Box): ''' A basic Sugar style popover window. Like view source mode. Use self to add content to a vbox. ''' __gtype_name__ = 'BibliographyBaseWindow' def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.props.halign = Gtk.Align.CENTER self.props.valign = Gtk.Align.CENTER self._tb = Gtk.Toolbar() self.pack_start(self._tb, True, True, 0) self._tb.show() sep = Gtk.SeparatorToolItem() sep.props.draw = False self._tb.insert(sep, -1) sep.show() label = Gtk.Label() label.set_markup('<b>{}</b>'.format(_('Edit Bibliography Entry'))) label.set_alignment(0, 0.5) self._add_widget(label) sep = Gtk.SeparatorToolItem() sep.props.draw = False sep.props.expand = True self._tb.insert(sep, -1) sep.show() self.add_ = ToolButton(icon_name='dialog-ok') self.add_.set_tooltip(_('Add Bibliography Item')) self._tb.insert(self.add_, -1) self.add_.show() stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Close')) stop.connect('clicked', lambda *args: self.destroy()) self._tb.insert(stop, -1) stop.show() self.show() def _add_widget(self, widget): t = Gtk.ToolItem() t.props.expand = True t.add(widget) widget.show() self._tb.insert(t, -1) t.show()
def Boton(tooltip=None, icon=None, connect=None): if icon != None: Boton = ToolButton(icon) else: Boton = ToolButton('gtk-missing-image') if tooltip != None: Boton.set_tooltip(tooltip) if connect != None: Boton.connect("clicked", connect) return Boton
def build_toolbar(self): self.max_participants = 1 toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() # toolbars self.build_size_toolbar(toolbar_box) self.build_colors_toolbar(toolbar_box) # new game button new_game = ToolButton('new-game') new_game.connect('clicked', self._new_game) new_game.set_tooltip(_('New game')) new_game.show() toolbar_box.toolbar.insert(new_game, -1) separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() # current item = Gtk.ToolItem() label = Gtk.Label() label.set_text(' %s ' % _('Current player:')) label.show() item.add(label) item.show() toolbar_box.toolbar.insert(item, -1) # player item = Gtk.ToolItem() self.current_label = Gtk.Label() self.current_label.set_text(' %s ' % _('Player 1')) item.add(self.current_label) self.current_label.show() item.show() toolbar_box.toolbar.insert(item, -1) # end separator separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show()
def make_toolbar(self): # toolbar with the new toolbar redesign toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() toolbarview = Gtk.Toolbar() langtoolbar_button = ToolbarButton(label=_('View'), page=toolbarview, icon_name='settings') langtoolbar_button.show() toolbar_box.toolbar.insert(langtoolbar_button, -1) tool = ToolButton('en') tool.set_tooltip(_('English')) tool.connect('clicked', self.language_en) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('es') tool.set_tooltip(_('Spanish')) tool.connect('clicked', self.language_es) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('fr') tool.set_tooltip(_('French')) tool.connect('clicked', self.language_fr) tool.show() toolbarview.insert(tool, -1) tool = ToolButton('remote') tool.set_tooltip(_('Server settings')) tool.connect('clicked', self.settings) tool.show() toolbarview.insert(tool, -1) toolbarview.show() favorite_button = ToolButton(self.favorite_status) favorite_button.set_tooltip('Filter on favorite') favorite_button.connect('clicked', self.favorite) toolbar_box.toolbar.insert(favorite_button, -1) favorite_button.show() self.favorite_button = favorite_button separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show()
def build_toolbar(self): """Build our Activity toolbar for the Sugar system.""" toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) activity_button.show() separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() easier_button = ToolButton('create-easier') easier_button.set_tooltip(_('Easier level')) easier_button.connect('clicked', self._easier_button_cb) toolbar_box.toolbar.insert(easier_button, -1) harder_button = ToolButton('create-harder') harder_button.set_tooltip(_('Harder level')) harder_button.connect('clicked', self._harder_button_cb) toolbar_box.toolbar.insert(harder_button, -1) self._risk_button = ToggleToolButton('make-risk') self._risk_button.set_tooltip(_('Make risk')) if self.state and 'risk' in self.state: self._risk_button.set_active(self.state['risk']) self._risk_button.connect('toggled', self._make_risk_button_cb) toolbar_box.toolbar.insert(self._risk_button, -1) separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() self.show_trail_button = ToggleToolButton('show-trail') self.show_trail_button.set_tooltip(_('Show trail')) self.show_trail_button.set_active(True) self.show_trail_button.connect('toggled', self._toggled_show_trail_cb) toolbar_box.toolbar.insert(self.show_trail_button, -1) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_size_request(0, -1) separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbar_box) toolbar_box.show_all() return toolbar_box
def build_toolbar(self): self.max_participants = 1 toolbox = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbox.toolbar.insert(activity_button, -1) activity_button.show() pano_toolbar = toolbox.toolbar new_button = ToolButton('stock_refresh') new_button.set_tooltip(_('New Panorama')) new_button.connect('clicked', self.new_event) pano_toolbar.insert(new_button, -1) new_button.show() capture_button = ToolButton('add_capture') capture_button.set_tooltip(_('Add a capture to the Panorama')) capture_button.connect('clicked', self.capture_event) pano_toolbar.insert(capture_button, -1) capture_button.show() stitch_button = ToolButton('format-columns-triple') stitch_button.set_tooltip(_('Stitch Panorama')) stitch_button.connect('clicked', self.stitch_event) pano_toolbar.insert(stitch_button, -1) stitch_button.show() stiching_auto = ToolButton('media-playback-start') stiching_auto.set_tooltip(_('Enable auto-stitch')) stiching_auto.connect('clicked', self.change_stich) pano_toolbar.insert(stiching_auto, -1) save_button = ToolButton('filesave') save_button.set_tooltip(_('Save Panorama')) save_button.connect('clicked', self.save_event) pano_toolbar.insert(save_button, -1) save_button.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) pano_toolbar.insert(separator, -1) stop_button = StopButton(self) stop_button.props.accelerator = '<Ctrl>q' pano_toolbar.insert(stop_button, -1) stop_button.show() self.set_toolbar_box(toolbox) toolbox.show_all()
def __init__(self, activity, abi): toolbar = activity.activity_button.props.page for i in self._EXPORT_FORMATS: if abi.get_version() == '3.0' and i['title'].find('PDF') > -1: # pdf export crashes on abiword 3.0 continue button = ToolButton(i['icon']) button.set_tooltip(i['title']) button.connect('clicked', self.__clicked_cb, activity, abi, i) toolbar.insert(button, -1) button.show()
def __init__(self, parent_xid, dialog_title): Gtk.Window.__init__(self) self.connect('realize', self.__realize_cb) self.set_decorated(False) self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.set_border_width(style.LINE_WIDTH) self.set_resizable(False) width = Gdk.Screen.width() - style.GRID_CELL_SIZE * 4 height = Gdk.Screen.height() - style.GRID_CELL_SIZE * 4 self.set_size_request(width, height) self._parent_window_xid = parent_xid _vbox = Gtk.VBox(spacing=2) self.add(_vbox) self.toolbar = Gtk.Toolbar() label = Gtk.Label() label.set_markup('<b><span foreground="#ffffff"> %s</span></b>' % dialog_title) label.set_alignment(0, 0.5) tool_item = Gtk.ToolItem() tool_item.add(label) label.show() self.toolbar.insert(tool_item, -1) tool_item.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) self.toolbar.insert(separator, -1) separator.show() stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Cancel')) stop.connect('clicked', self.cancel_clicked_cb) self.toolbar.insert(stop, -1) stop.show() accept = ToolButton(icon_name='dialog-ok') accept.set_tooltip(_('Ok')) accept.connect('clicked', self.accept_clicked_cb) accept.show() self.toolbar.insert(accept, -1) _vbox.pack_start(self.toolbar, False, True, 0) self.toolbar.show() self._event_box = Gtk.EventBox() _vbox.pack_start(self._event_box, True, True, 0) self._canvas = None
def __init__(self, parent_xid, dialog_title): Gtk.Window.__init__(self) self.connect('realize', self.__realize_cb) self.set_decorated(False) self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.set_border_width(style.LINE_WIDTH) self.set_resizable(False) width = Gdk.Screen.width() - style.GRID_CELL_SIZE * 4 height = Gdk.Screen.height() - style.GRID_CELL_SIZE * 4 self.set_size_request(width, height) self._parent_window_xid = parent_xid _vbox = Gtk.VBox(spacing=2) self.add(_vbox) self.toolbar = Gtk.Toolbar() label = Gtk.Label() label.set_markup('<b> %s</b>' % dialog_title) label.set_alignment(0, 0.5) tool_item = Gtk.ToolItem() tool_item.add(label) label.show() self.toolbar.insert(tool_item, -1) tool_item.show() separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) self.toolbar.insert(separator, -1) separator.show() stop = ToolButton(icon_name='dialog-cancel') stop.set_tooltip(_('Cancel')) stop.connect('clicked', self.cancel_clicked_cb) self.toolbar.insert(stop, -1) stop.show() accept = ToolButton(icon_name='dialog-ok') accept.set_tooltip(_('Ok')) accept.connect('clicked', self.accept_clicked_cb) accept.show() self.toolbar.insert(accept, -1) _vbox.pack_start(self.toolbar, False, True, 0) self.toolbar.show() self._event_box = Gtk.EventBox() _vbox.pack_start(self._event_box, True, True, 0) self._canvas = None
def __init__(self, abiword_canvas): Gtk.Toolbar.__init__(self) self._abiword_canvas = abiword_canvas self._table = abiword.TableCreator() self._table.set_labels(_('Table'), _('Cancel')) self._table_id = self._table.connect('selected', self._table_cb) image = Gtk.Image() image.set_from_icon_name('insert-table', -1) self._table.set_image(image) self._table.set_relief(Gtk.ReliefStyle.NONE) tool_item = Gtk.ToolItem() tool_item.add(self._table) self.insert(tool_item, -1) tool_item.show_all() self._table_rows_after = ToolButton('row-insert') self._table_rows_after.set_tooltip(_('Insert Row')) self._table_rows_after_id = self._table_rows_after.connect( \ 'clicked', self._table_rows_after_cb) self.insert(self._table_rows_after, -1) self._table_delete_rows = ToolButton('row-remove') self._table_delete_rows.set_tooltip(_('Delete Row')) self._table_delete_rows_id = self._table_delete_rows.connect( \ 'clicked', self._table_delete_rows_cb) self.insert(self._table_delete_rows, -1) self._table_cols_after = ToolButton('column-insert') self._table_cols_after.set_tooltip(_('Insert Column')) self._table_cols_after_id = self._table_cols_after.connect( \ 'clicked', self._table_cols_after_cb) self.insert(self._table_cols_after, -1) self._table_delete_cols = ToolButton('column-remove') self._table_delete_cols.set_tooltip(_('Delete Column')) self._table_delete_cols_id = self._table_delete_cols.connect( \ 'clicked', self._table_delete_cols_cb) self.insert(self._table_delete_cols, -1) separator = Gtk.SeparatorToolItem() self.insert(separator, -1) image = ToolButton('insert-picture') image.set_tooltip(_('Insert Image')) self._image_id = image.connect('clicked', self._image_cb) self.insert(image, -1) self.show_all() self._abiword_canvas.connect('table-state', self._isTable_cb)
def build_toolbar(self): self.max_participants = 1 toolbar_box = ToolbarBox() self.set_toolbar_box(toolbar_box) toolbar_box.show() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() # toolbars self.build_size_toolbar(toolbar_box) self.build_colors_toolbar(toolbar_box) # new game button new_game = ToolButton('new-game') new_game.connect('clicked', self._new_game) new_game.set_tooltip(_('New game')) toolbar_box.toolbar.insert(new_game, -1) separator = Gtk.SeparatorToolItem() toolbar_box.toolbar.insert(separator, -1) separator.show() #current item = Gtk.ToolItem() label = Gtk.Label() label.set_text(' %s ' % _('Current player:')) item.add(label) toolbar_box.toolbar.insert(item, -1) #player item = Gtk.ToolItem() self.current_label = Gtk.Label() self.current_label.set_text(' %s ' % _('Player 1')) item.add(self.current_label) toolbar_box.toolbar.insert(item, -1) # end separator separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) toolbar_box.toolbar.insert(separator, -1) separator.show() stop_button = StopButton(self) toolbar_box.toolbar.insert(stop_button, -1) stop_button.show() self.show_all()