Philipp Hörist pushed to branch master at gajim / gajim
Commits: 4ad5fd9c by Philipp Hörist at 2017-08-15T19:23:23+02:00 Add method for creating image buttons
- - - - -
2 changed files:
- gajim/dialogs.py - gajim/gtkgui_helpers.py
Changes:
===================================== gajim/dialogs.py ===================================== --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -3399,41 +3399,23 @@ class XMLConsoleWindow(Gtk.Window):
self.actionbar = Gtk.ActionBar()
- icon = gtkgui_helpers.get_icon_pixmap('edit-clear-all-symbolic') - image = Gtk.Image() - image.set_from_pixbuf(icon) - button = Gtk.Button() - button.set_tooltip_text(_('Clear')) + button = gtkgui_helpers.get_image_button( + 'edit-clear-all-symbolic', 'Clear') button.connect('clicked', self.on_clear) - button.set_image(image) self.actionbar.pack_start(button)
- icon = gtkgui_helpers.get_icon_pixmap('applications-system-symbolic') - image = Gtk.Image() - image.set_from_pixbuf(icon) - button = Gtk.Button() - button.set_tooltip_text(_('Filter')) + button = gtkgui_helpers.get_image_button( + 'applications-system-symbolic', 'Filter') button.connect('clicked', self.on_filter_options) - button.set_image(image) self.actionbar.pack_start(button)
- icon = gtkgui_helpers.get_icon_pixmap('document-edit-symbolic') - image = Gtk.Image() - image.set_from_pixbuf(icon) - button = Gtk.ToggleButton() - button.set_tooltip_text(_('XML Input')) - button.set_active(False) + button = gtkgui_helpers.get_image_button( + 'document-edit-symbolic', 'XML Input', toggle=True) button.connect('toggled', self.on_input) - button.set_image(image) self.actionbar.pack_start(button)
- icon = gtkgui_helpers.get_icon_pixmap('emblem-ok-symbolic') - image = Gtk.Image() - image.set_from_pixbuf(icon) - button = Gtk.Button() - button.set_tooltip_text(_('Send')) + button = gtkgui_helpers.get_image_button('emblem-ok-symbolic', 'Send') button.connect('clicked', self.on_send) - button.set_image(image) self.actionbar.pack_end(button)
listbox = Gtk.ListBox()
===================================== gajim/gtkgui_helpers.py ===================================== --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -106,6 +106,18 @@ def add_image_to_button(button, icon_name): img.set_from_file(path_img) button.set_image(img)
+def get_image_button(icon_name, tooltip, toggle=False): + icon = get_icon_pixmap(icon_name) + image = Gtk.Image() + image.set_from_pixbuf(icon) + if toggle: + button = Gtk.ToggleButton() + else: + button = Gtk.Button() + button.set_tooltip_text(_(tooltip)) + button.set_image(image) + return button + GUI_DIR = os.path.join(gajim.DATA_DIR, 'gui') def get_gtk_builder(file_name, widget=None): file_path = os.path.join(GUI_DIR, file_name)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/4ad5fd9cdc2382f7a1c420cb65520967d75...
--- View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/4ad5fd9cdc2382f7a1c420cb65520967d75... You're receiving this email because of your account on dev.gajim.org.