Python gi.repository.Gtk.Image() Examples
The following are 30
code examples of gi.repository.Gtk.Image().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: custom.py From Dindo-Bot with MIT License | 6 votes |
def __init__(self, text=None, color='black', enable_buttons=False): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=5) self.enable_buttons = enable_buttons # label self.label = Gtk.Label(text) self.label.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse(color)) self.add(self.label) # question buttons if enable_buttons: self.button_box = ButtonBox(linked=True) self.pack_end(self.button_box, False, False, 0) # yes self.yes_button = Gtk.Button() self.yes_button.set_tooltip_text('Yes') self.yes_button.set_image(Gtk.Image(icon_name='emblem-ok-symbolic')) self.button_box.add(self.yes_button) # no self.no_button = Gtk.Button() self.no_button.set_tooltip_text('No') self.no_button.set_image(Gtk.Image(icon_name='window-close-symbolic')) self.button_box.add(self.no_button)
Example #2
Source File: asktext.py From textext with BSD 3-Clause "New" or "Revised" License | 6 votes |
def window_deleted_cb(self, widget, event, view): if (self._gui_config.get("confirm_close", self.DEFAULT_CONFIRM_CLOSE) and self._source_buffer.get_text(self._source_buffer.get_start_iter(), self._source_buffer.get_end_iter(), True) != self.text): dlg = Gtk.MessageDialog(self._window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE) dlg.set_markup( "<b>Do you want to close TexText without save?</b>\n\n" "Your changes will be lost if you don't save them." ) dlg.add_button("Continue editing", Gtk.ResponseType.CLOSE) \ .set_image(Gtk.Image.new_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.BUTTON)) dlg.add_button("Close without save", Gtk.ResponseType.YES) \ .set_image(Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON)) dlg.set_title("Close without save?") res = dlg.run() dlg.destroy() if res in (Gtk.ResponseType.CLOSE, Gtk.ResponseType.DELETE_EVENT): return True Gtk.main_quit() return False
Example #3
Source File: kano_combobox.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def __init__(self, image_path): Gtk.ImageMenuItem.__init__(self) self.get_style_context().add_class("KanoComboBox") self.set_use_underline(False) self.set_always_show_image(True) # set the given image pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_path) image = Gtk.Image.new_from_pixbuf(pixbuf) # put the image inside an alignment container for centering self.box = Gtk.Alignment() self.box.set_padding(0, 0, 0, pixbuf.get_width()) self.box.add(image) # by default, a MenuItem has an AccelLabel widget as it's one and only child self.remove(self.get_child()) self.add(self.box) # By overriding this signal we can stop the Menu # containing this item from being popped down self.connect("button-release-event", self.do_not_popdown_menu)
Example #4
Source File: tab.py From ImEditor with GNU General Public License v3.0 | 6 votes |
def __init__(self, win, tab, title, img): Gtk.Box.__init__(self) self.set_spacing(5) self.win = win self.tab = tab # Preview of image self.icon = Gtk.Image() # Title self.label = Gtk.Label() self.set_title(title) # Close button button = Gtk.Button() button.set_relief(Gtk.ReliefStyle.NONE) button.add(Gtk.Image.new_from_icon_name('window-close', Gtk.IconSize.MENU)) button.connect('clicked', self.on_close_button_clicked) self.add(self.icon) self.add(self.label) self.add(button) self.show_all()
Example #5
Source File: list.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self): """ Build EmptyAccountList widget. """ self.set_border_width(36) self.set_valign(Gtk.Align.CENTER) self.set_halign(Gtk.Align.CENTER) # Image g_icon = Gio.ThemedIcon(name="dialog-information-symbolic.symbolic") img = Gtk.Image.new_from_gicon(g_icon, Gtk.IconSize.DIALOG) # Label label = Gtk.Label(label=_("There are no accounts yet…")) self.pack_start(img, False, False, 6) self.pack_start(label, False, False, 6)
Example #6
Source File: backend_gtk3.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def add_toolitem(self, name, group, position, image_file, description, toggle): if toggle: tbutton = Gtk.ToggleToolButton() else: tbutton = Gtk.ToolButton() tbutton.set_label(name) if image_file is not None: image = Gtk.Image() image.set_from_file(image_file) tbutton.set_icon_widget(image) if position is None: position = -1 self._add_button(tbutton, group, position) signal = tbutton.connect('clicked', self._call_tool, name) tbutton.set_tooltip_text(description) tbutton.show_all() self._toolitems.setdefault(name, []) self._toolitems[name].append((tbutton, signal))
Example #7
Source File: icons.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def set_from_name(name): icon_number = 0 if name == "green_arrow": icon_number = 0 elif name == "pale_right_arrow": icon_number = 1 elif name == "dark_left_arrow": icon_number = 2 elif name == "dark_right_arrow": icon_number = 3 elif name == "pale_left_arrow": icon_number = 4 elif name == "tick": icon_number = 5 elif name == "cross": icon_number = 6 elif name == "dropdown_arrow": icon_number = 7 # Create main window filename = os.path.join(common_images_dir, "icons.png") pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 192, 24) subpixbuf = pixbuf.new_subpixbuf(24 * icon_number, 0, 24, 24).add_alpha(True, 255, 255, 255) image = Gtk.Image() image.set_from_pixbuf(subpixbuf) return image
Example #8
Source File: add.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def __init__(self, **kwargs): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) GObject.GObject.__init__(self) self.is_edit = kwargs.get("edit", False) self._account = kwargs.get("account", None) self._providers_store = Gtk.ListStore(str, str) self.logo_img = Gtk.Image() self.username_entry = Gtk.Entry() self.provider_combo = Gtk.ComboBox.new_with_model_and_entry( self._providers_store) self.token_entry = Gtk.Entry() self._build_widgets() self._fill_data()
Example #9
Source File: misc.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def tick_icon(): '''This should return a tick image. We use this to show which WiFi network is already selected ''' width = 24 height = 24 icons_path = os.path.join(common_images_dir, 'icons.png') tick_pixbuf = GdkPixbuf.Pixbuf.new_from_file(icons_path) tick_pixbuf = tick_pixbuf.new_subpixbuf(5 * 24, 0, width, height) tick_image = Gtk.Image() tick_image.set_from_pixbuf(tick_pixbuf) return tick_image
Example #10
Source File: set_wallpaper.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def format_image(self, name): '''In the wallpaper, we get a 4 by 3 ratio, so need to change the size to 120 by 90 and then crop it ''' width = self.icon_width height = self.icon_height # Create the wallpaper thumbnail try: # The original picture is not square, so resize the picture to # scale and then crop the picture wallpaper_name = name + name_pattern wallpaper_path = os.path.join(self.get_path(name), wallpaper_name) wallpaper_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( wallpaper_path, 120, 90 ) cropped_wallpaper = wallpaper_pixbuf.new_subpixbuf(15, 0, width, height) image = Gtk.Image() image.set_from_pixbuf(cropped_wallpaper) return image except: return None
Example #11
Source File: combinedview.py From addons-source with GNU General Public License v2.0 | 6 votes |
def build_menu_item(self, obj_type, handle): if obj_type == 'Person': person = self.dbstate.db.get_person_from_handle(handle) name = name_displayer.display(person) elif obj_type == 'Event': event = self.dbstate.db.get_event_from_handle(handle) name = str(event.get_type()) item = Gtk.ImageMenuItem(None) image = Gtk.Image.new_from_icon_name('gtk-edit', Gtk.IconSize.MENU) image.show() label = Gtk.Label(label=_("Edit %s") % name) label.show() label.set_halign(Gtk.Align.START) item.set_image(image) item.add(label) item.connect('activate', self.edit_menu, handle, obj_type) item.show() return item
Example #12
Source File: editexifmetadata.py From addons-source with GNU General Public License v2.0 | 6 votes |
def build_thumbnail_gui(self, pbloader, width, height): """ builds the thumbnail viewing area. """ main_vbox = Gtk.VBox() main_vbox.set_size_request((width - 30), (height - 30)) hbox = Gtk.HBox(homogeneous=False, spacing=0) main_vbox.pack_start(hbox, expand=False, fill=False, padding=5) hbox.show() # Get the resulting pixbuf and build an image to be displayed pixbuf = pbloader.get_pixbuf() pbloader.close() imgwidget = Gtk.Image() imgwidget.set_from_pixbuf(pixbuf) hbox.pack_start(imgwidget, expand=False, fill=True, padding=0) imgwidget.show() main_vbox.show_all() return main_vbox
Example #13
Source File: tomboy.py From gtg with GNU General Public License v3.0 | 6 votes |
def addButtonToToolbar(self, plugin_api): if not self.checkTomboyPresent(): return tb_Taskbutton_image = Gtk.Image() tb_Taskbutton_image_path = self.tomboy_icon_path tb_Taskbutton_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( tb_Taskbutton_image_path, 16, 16) tb_Taskbutton_image.set_from_pixbuf(tb_Taskbutton_pixbuf) self.tb_Taskbutton = Gtk.ToolButton(tb_Taskbutton_image) self.tb_Taskbutton.set_label(_("Add Tomboy note")) self.tb_Taskbutton.connect('clicked', self.onTbTaskButton, self.plugin_api) self.tb_Taskbutton.show_all() self.plugin_api.add_toolbar_item(self.tb_Taskbutton) # Converts all the textual tokens in tomboy note widgets
Example #14
Source File: list.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self, accounts_list, provider): provider_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) provider_lbl = Gtk.Label() provider_lbl.set_text(provider) provider_lbl.set_halign(Gtk.Align.START) provider_lbl.get_style_context().add_class("provider-lbl") provider_img = Gtk.Image() pixbuf = load_pixbuf_from_provider(provider) provider_img.set_from_pixbuf(pixbuf) provider_container.pack_start(provider_img, False, False, 3) provider_container.pack_start(provider_lbl, False, False, 3) self.pack_start(provider_container, False, False, 3) self.pack_start(accounts_list, False, False, 3)
Example #15
Source File: screenshot.py From badKarma with GNU General Public License v3.0 | 6 votes |
def get_log(self,out): base64image = out try: raw_data = base64.b64decode(base64image) input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None) pixbuf = Pixbuf.new_from_stream(input_stream, None) except: # error image raw_data = base64.b64decode("""iVBORw0KGgoAAAANSUhEUgAAAZAAAAFACAYAAACSgSrjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoWAAsIwyEjnAAAEPhJREFUeNrt3b9uW+cZwOFXhhFAHjPGgzIFCQu4BbQF6SBfgZyhRW7Bvox2ypwhvgR3SZasydAiG4EmQJUgQwEO7ujRKoIg7uDDhpYoiufwO+d8f54HKES0saNSlF6+H3n0iwC2ujg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GWzgdA9Xp1Q27dQHQ+AJrRqxuy1wai8wHQlL26IUd7bB86HwBt2asbcmfX8ND5AGjSXt2Q2zYQnQ+Adu3shhzdtH3ofAA0b2c3ZOsRls4HAHFLN+SmDUTnA4C1rd2QNzYQnQ8AttjaDTna2Dp0PgC4ybVuyLUjLJ0PALa41g25s94+uo86HwBsc60bsnmEpfMBwC5vdEM2X0TX+QBglze6IesjLJ0PAPbx/27Ikc4HAD29iIgHdyLiU8MDgB7ejohP/wdfG3IxFRM1PgAAAABJRU5ErkJggg==""") input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None) pixbuf = Pixbuf.new_from_stream(input_stream, None) self.image = Gtk.Image() self.image.set_from_pixbuf(pixbuf) self.image.show() scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_hexpand(True) scrolledwindow.set_vexpand(True) scrolledwindow.add(self.image) scrolledwindow.show() return scrolledwindow
Example #16
Source File: run.py From twitch-indicator with zlib License | 6 votes |
def push_notifications(self, streams): """Pushes notifications of every stream, passed as a list of dictionaries.""" try: for stream in streams: self.image = gtk.Image() # Show default if channel owner has not set his avatar if (stream["image"] == None): self.response = urllib.urlopen("http://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_150x150.png") else: self.response = urllib.urlopen(stream["image"]) self.loader = GdkPixbuf.PixbufLoader.new() self.loader.write(self.response.read()) self.loader.close() Notify.init("image") self.n = Notify.Notification.new("%s just went LIVE!" % stream["name"], stream["status"], "", ) self.n.set_icon_from_pixbuf(self.loader.get_pixbuf()) self.n.show() except IOError: return
Example #17
Source File: infobox.py From syncthing-gtk with GNU General Public License v2.0 | 6 votes |
def _prepare_icon(self, icon): if icon.endswith(".svg"): # Icon is svg file key = icon if self.dark_color is None else icon + "-dark" if not key in svg_cache: if not self.dark_color is None: # Recolor svg for dark theme with open(os.path.join(self.app.iconpath, icon), "r") as f: svg_source = f.read() svg_source = svg_source.replace('fill:rgb(0%,0%,0%)', 'fill:rgb(100%,100%,100%)') svg = Rsvg.Handle.new_from_data(svg_source.encode("utf-8")) else: # Load svg directly svg = Rsvg.Handle.new_from_file(os.path.join(self.app.iconpath, icon)) pixbuf = svg.get_pixbuf() svg_cache[key] = pixbuf return Gtk.Image.new_from_pixbuf(svg_cache[key]) elif "." in icon: # Icon is other image file (png) return Gtk.Image.new_from_file(os.path.join(self.app.iconpath, icon)) else: # Icon is theme icon name return Gtk.Image.new_from_icon_name(icon, 1)
Example #18
Source File: __init__.py From pychess with GNU General Public License v3.0 | 6 votes |
def get_infobarmessage_content2(player, heading_text, message_text, gametype=None): hbox = Gtk.HBox() image = Gtk.Image() image.set_from_pixbuf(player.getIcon(size=24, gametype=gametype)) hbox.pack_start(image, False, False, 0) label = Gtk.Label() markup = player.getMarkup(gametype=gametype, long_titles=False) label.set_markup(markup + heading_text) hbox.pack_start(label, False, False, 0) vbox = Gtk.VBox() vbox.pack_start(hbox, False, False, 0) label = Gtk.Label() label.props.xalign = 0 label.props.xpad = 4 label.props.justify = Gtk.Justification.LEFT label.props.wrap = True label.set_width_chars(70) label.set_text(message_text) vbox.pack_start(label, False, False, 5) return vbox
Example #19
Source File: ChainVBox.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self): GObject.GObject.__init__(self) chainline = ChainLine(CHAIN_TOP) self.pack_start(chainline, True, True, 0) self.button = Gtk.Button() self.pack_start(self.button, False, True, 0) chainline = ChainLine(CHAIN_BOTTOM) self.pack_start(chainline, True, True, 0) self.image = Gtk.Image() self.image.set_from_file(addDataPrefix("glade/stock-vchain-24.png")) self.button.set_image(self.image) self.button.set_relief(Gtk.ReliefStyle.NONE) self.button.set_property("yalign", 0) self._active = True self.button.connect("clicked", self.onClicked)
Example #20
Source File: main_window.py From vimiv with MIT License | 6 votes |
def __init__(self, app): """Initialize image and thumbnail attributes and configure self.""" super(MainWindow, self).__init__() self._app = app self.image = Image(app) self.thumbnail = Thumbnail(app) self.set_hexpand(True) self.set_vexpand(True) # Image is default self.add(self.image) self.connect("key_press_event", self._app["eventhandler"].on_key_press, "IMAGE") # Connect signals self._app.connect("widget-layout-changed", self._on_widgets_changed) self._app.connect("paths-changed", self._on_paths_changed)
Example #21
Source File: image.py From vimiv with MIT License | 6 votes |
def __init__(self, app): """Set default values for attributes.""" super(Image, self).__init__() self._app = app # Settings and defaults self.fit_image = "overzoom" self._pixbuf_iter = GdkPixbuf.PixbufAnimationIter() self._pixbuf_original = GdkPixbuf.Pixbuf() self.zoom_percent = 1 self._identifier = 0 self._size = (1, 1) self._timer_id = 0 self._faulty_image = False # Connect signals self._app["transform"].connect("changed", self._on_image_changed) self._app["commandline"].search.connect("search-completed", self._on_search_completed) settings.connect("changed", self._on_settings_changed)
Example #22
Source File: slider_win.py From volctl with GNU General Public License v2.0 | 6 votes |
def _add_scale(self, sink): # scale scale = Gtk.Scale().new(Gtk.Orientation.VERTICAL) scale.set_draw_value(False) scale.set_value_pos(Gtk.PositionType.BOTTOM) scale.set_range(PA_VOLUME_MUTED, PA_VOLUME_NORM) scale.set_inverted(True) scale.set_size_request(24, 128) scale.set_tooltip_text(sink.name) self._set_increments_on_scale(scale) # icon icon = Gtk.Image() icon.set_tooltip_text(sink.name) icon.set_from_icon_name(sink.icon_name, Gtk.IconSize.SMALL_TOOLBAR) return scale, icon
Example #23
Source File: utils.py From nautilus-folder-icons with GNU General Public License v3.0 | 6 votes |
def set_icon(self, icon_name): icon_name = uriparse(icon_name) theme = Gtk.IconTheme.get_default() # Make sure the icon name doesn't contain any special char # Be sure that the icon still exists on the system if (is_path(icon_name) and path.exists(icon_name) and get_ext(icon_name) in SUPPORTED_EXTS): pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(icon_name, Image.SIZE, Image.SIZE, True) elif theme.has_icon(icon_name): pixbuf = theme.load_icon_for_scale(icon_name, Image.SIZE, 1, 0) else: pixbuf = theme.load_icon_for_scale("image-missing", Image.SIZE, 1, 0) self.set_from_pixbuf(pixbuf)
Example #24
Source File: editexifmetadata.py From addons-source with GNU General Public License v2.0 | 6 votes |
def __convert_dialog(self, _object): """ Handles the Convert question Dialog """ # Convert and delete original file or just convert parent = self.gui.get_container_widget().get_toplevel() res = QuestionDialog3( _("Edit Image Exif Metadata"), _("WARNING: You are about to convert this image into a " ".jpeg image. Are you sure that you want to do this?"), _("Convert and Delete"), _("Convert"), parent=parent).run() if res == -1: return if res: self.__convert_delete() else: self.__convert_only() self.update() return
Example #25
Source File: splash_screen.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
def __init__(self, width=530, height=350, contains_image=False): # init Gtk.Window with type popup super(SplashScreen, self).__init__(type=Gtk.WindowType.POPUP) # index for the image rotator self.image_index = 0 # Set the title to rafcon so it is detectable in taskbars # set width and height to parameter values and position the window in the center self.set_title('RAFCON') self.set_default_size(width, height) self.set_position(Gtk.WindowPosition.CENTER) main_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) self.add(main_vbox) self.image = Gtk.Image() # If an img path was defined, create a gtk img and fill it from a pixelbuffer which is created from the # set file path if contains_image: main_vbox.pack_start(self.image, True, True, 0) # add label to display text, the text can be changed by the text() method. # Align it in the middle of the gtk window self.label = Gtk.Label(label="") self.label.set_xalign(0.5) self.label.set_yalign(0.5) main_vbox.pack_start(self.label, False, True, 10) main_vbox.set_spacing(0) if not os.getenv("RAFCON_START_MINIMIZED", False): self.show_all()
Example #26
Source File: theme_picker.py From wpgtk with GNU General Public License v2.0 | 5 votes |
def on_add_clicked(self, widget): filechooser = Gtk.FileChooserDialog( 'Select an Image', self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) filechooser.set_select_multiple(True) filefilter = Gtk.FileFilter() filefilter.set_name("Images") filefilter.add_mime_type("image/png") filefilter.add_mime_type("image/jpg") filefilter.add_mime_type("image/jpeg") filechooser.add_filter(filefilter) response = filechooser.run() if response == Gtk.ResponseType.OK: for f in filechooser.get_filenames(): themer.create_theme(f) option_list = Gtk.ListStore(str) for elem in list(files.get_file_list()): option_list.append([elem]) self.option_combo.set_model(option_list) self.option_combo.set_entry_text_column(0) self.colorscheme.set_model(option_list) self.colorscheme.set_entry_text_column(0) self.cpage.update_combo(option_list) filechooser.destroy()
Example #27
Source File: utils.py From nautilus-folder-icons with GNU General Public License v3.0 | 5 votes |
def __init__(self): Gtk.Image.__init__(self) self.props.icon_size = Image.SIZE
Example #28
Source File: infobox.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def set_dark_color(self, r, g, b, a): """ Overrides background color, inverts icon colors and darkens some borders """ # Override background self.background = self.dark_color = (r, g, b, a) self.set_bg_color(*self.background) # Recolor existing widgets self.text_color = (1, 1, 1, 1) col = Gdk.RGBA(*self.text_color) for key in self.value_widgets: for w in self.value_widgets[key]: if isinstance(w, Gtk.Image): if (Gtk.get_major_version(), Gtk.get_minor_version()) <= (3, 10): # Mint.... v1 = GObject.Value(int, 0) v2 = GObject.Value(int, 0) self.grid.child_get_property(w, "left-attach", v1) self.grid.child_get_property(w, "top-attach", v2) la, ta = v1.get_int(), v2.get_int() else: la = self.grid.child_get_property(w, "left-attach") ta = self.grid.child_get_property(w, "top-attach") vis = not w.get_no_show_all() wIcon = self._prepare_icon(self.icons[key]) w.get_parent().remove(w) self.grid.attach(wIcon, la, ta, 1, 1) if not vis: wIcon.set_no_show_all(True) wIcon.set_visible(False) wValue, trash, wTitle = self.value_widgets[key] self.value_widgets[key] = (wValue, wIcon, wTitle) else: w.override_color(Gtk.StateFlags.NORMAL, col) # Recolor borders self.recolor() # Recolor header self.set_title(self.str_title)
Example #29
Source File: newGameDialog.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self, image_paths): GObject.GObject.__init__(self) self.surfaces = [Gtk.Image().new_from_file(path) for path in image_paths] self.current = 0 self.image = self.surfaces[self.current] self.image.show() self.add(self.image) self.connect("clicked", self.on_clicked)
Example #30
Source File: __init__.py From pychess with GNU General Public License v3.0 | 5 votes |
def dock_panel_tab(title, desc, icon, button=None): box = Gtk.Box() pixbuf = get_pixbuf(icon, 16) image = Gtk.Image.new_from_pixbuf(pixbuf) label = Gtk.Label(label=title) box.set_tooltip_text(desc) box.pack_start(image, False, True, 0) box.pack_start(label, False, True, 0) if button is not None: box.pack_start(button, False, True, 0) box.set_spacing(2) box.show_all() return box