本文整理汇总了Python中gi.repository.Gio.ThemedIcon方法的典型用法代码示例。如果您正苦于以下问题:Python Gio.ThemedIcon方法的具体用法?Python Gio.ThemedIcon怎么用?Python Gio.ThemedIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio
的用法示例。
在下文中一共展示了Gio.ThemedIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_widgets
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
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)
示例2: _setup_widgets
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _setup_widgets(self):
"""Setup main headerbar widgets."""
# Open button
self._open_btn.set_label(_("Open"))
self._open_btn.connect("clicked", self._open_file)
self.pack_start(self._open_btn)
menu_icn = Gio.ThemedIcon(name="open-menu-symbolic")
menu_img = Gtk.Image.new_from_gicon(menu_icn, Gtk.IconSize.BUTTON)
self.menu_btn.set_image(menu_img)
self.pack_end(self.menu_btn)
# Play Button
self.set_is_playing(False)
self.play_btn.set_sensitive(False)
self.pack_start(self.play_btn)
示例3: _setup_widgets
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _setup_widgets(self):
"""Create the Time Button widgets."""
# Time entry
self._entry.set_max_length(8)
self._entry.set_width_chars(8)
self._entry.connect("changed", self._on_type)
self._entry.set_max_width_chars(8)
# Up btn
up_icn = Gio.ThemedIcon(name="list-add-symbolic")
up_img = Gtk.Image.new_from_gicon(up_icn, Gtk.IconSize.BUTTON)
self._up_btn.set_image(up_img)
self._up_btn.connect("clicked", self.step_up)
self._up_btn.get_style_context().add_class("flat")
# Lower btn
lower_icn = Gio.ThemedIcon(name="list-remove-symbolic")
lower_img = Gtk.Image.new_from_gicon(lower_icn, Gtk.IconSize.BUTTON)
self._lower_btn.set_image(lower_img)
self._lower_btn.connect("clicked", self.step_down)
self._lower_btn.get_style_context().add_class("flat")
self.pack_start(self._entry, False, False, 0)
self.pack_start(self._lower_btn, False, False, 0)
self.pack_start(self._up_btn, False, False, 0)
示例4: get_from_app
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def get_from_app(app, size=DEFAULT_SIZE):
try:
gicon = app.get_icon()
pixbuf = None
if gicon:
if isinstance(gicon, Gio.ThemedIcon):
return get_from_list(gicon.get_names(), size=size)
elif isinstance(gicon, Gio.FileIcon):
file = app.get_icon().get_file().get_path()
return get_from_file(file, size)
if not pixbuf:
return get_from_name('application-x-executable', size=size)
except Exception as e:
log.error('get_from_app failed: %s' % e)
return get_from_name(size=size)
示例5: _build
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _build(self, icon_name, tooltip):
"""
:param icon_name:
:param tooltip:
"""
icon = Gio.ThemedIcon(name=icon_name)
image = Gtk.Image.new_from_gicon(icon,
Gtk.IconSize.BUTTON)
self.set_tooltip_text(tooltip)
self.set_image(image)
示例6: _build_widget
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _build_widget(self, icon_name, tooltip):
icon = Gio.ThemedIcon(name=icon_name)
image = Gtk.Image.new_from_gicon(icon,
Gtk.IconSize.BUTTON)
self.set_tooltip_text(tooltip)
self.set_image(image)
示例7: update_position
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def update_position(self):
if self.active_row is not None:
position = self.player.get_position() / float(
self.active_row.audio['length'])
if position >= 0:
self.active_row.set_position(position)
self.control['position'].handler_block_by_func(
self.on_position_button_changed)
self.control['position'].set_value(int(position * 100))
self.control['label-position'].set_text(
_('Position') + ': {0}%'.format(int(position * 100)))
self.control['position'].handler_unblock_by_func(
self.on_position_button_changed)
if position >= 0.999:
pass
'''
self.active_row.set_listened(True)
self.active_row.set_position(0)
if self.is_playing is True:
self.player.pause()
self.control['play-pause'].get_child().set_from_gicon(
Gio.ThemedIcon(
name='media-playback-start-symbolic'),
Gtk.IconSize.BUTTON)
self.control['play-pause'].set_tooltip_text(_('Play'))
self.is_playing = False
if self.configuration.get('play_continuously') is True:
self._sound_menu_next()
'''
self.update_audio_in_configuration(self.active_row.audio)
if self.player.status != Status.PLAYING:
self.updater = 0
return self.player.status == Status.PLAYING
self.updater = 0
return False
示例8: on_track_end
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def on_track_end(self, widget):
self.active_row.set_listened(True)
self.active_row.set_position(0)
if self.is_playing is True:
self.player.pause()
self.control['play-pause'].get_child().set_from_gicon(
Gio.ThemedIcon(
name='media-playback-start-symbolic'),
Gtk.IconSize.BUTTON)
self.control['play-pause'].set_tooltip_text(_('Play'))
self.is_playing = False
if self.configuration.get('play_continuously') is True:
self._sound_menu_next()
self.update_audio_in_configuration(self.active_row.audio)
示例9: _build_header_bar
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _build_header_bar(self):
"""Setup window headerbar."""
# Header bar
headerbar = Gtk.HeaderBar()
headerbar_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
spacing=3)
title = Gtk.Label()
title.set_text(_("Icon Chooser"))
title.get_style_context().add_class("title")
headerbar_container.pack_start(title, False, False, 0)
subtitle = Gtk.Label()
subtitle.get_style_context().add_class("subtitle")
subtitle_text = ", ".join(self._folders)
subtitle.set_text(subtitle_text)
subtitle.set_ellipsize(Pango.EllipsizeMode.END)
subtitle.set_tooltip_text(subtitle_text)
subtitle.props.max_width_chars = 30
headerbar_container.pack_start(subtitle, False, False, 0)
headerbar.set_custom_title(headerbar_container)
headerbar.set_show_close_button(False)
# Search Button
self._search_btn = Gtk.ToggleButton()
search_icn = Gio.ThemedIcon(name="system-search-symbolic")
search_img = Gtk.Image.new_from_gicon(search_icn, Gtk.IconSize.BUTTON)
self._search_btn.set_image(search_img)
# Cancel Button
close_button = Gtk.Button()
close_button.set_label(_("Close"))
close_button.connect("clicked", self._close_window)
headerbar.pack_start(close_button)
headerbar.pack_end(self._search_btn)
self.set_titlebar(headerbar)
示例10: get_attribute_value
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def get_attribute_value(ginfo, attribute):
if ginfo.has_attribute(attribute):
attribute_type = ginfo.get_attribute_type(attribute)
if attribute_type == Gio.FileAttributeType.STRING:
value = ginfo.get_attribute_string(attribute)
if value is not None:
return uriparse(value)
elif attribute_type == Gio.FileAttributeType.OBJECT:
# This return a Gio.ThemedIcon object
value = ginfo.get_attribute_object(attribute)
icon_names = value.props.names
if icon_names:
return icon_names[0]
return None
示例11: set_is_playing
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def set_is_playing(self, is_playing):
"""Set the play button info depending on the player status."""
if not is_playing:
tooltip = _("Play")
icon_name = "media-playback-start-symbolic"
else:
tooltip = _("Pause")
icon_name = "media-playback-pause-symbolic"
icon = Gio.ThemedIcon(name=icon_name)
image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
self.play_btn.set_image(image)
self.play_btn.set_tooltip_text(tooltip)
示例12: _build_widgets
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def _build_widgets(self):
up_icn = Gio.ThemedIcon(name="list-add-symbolic")
up_img = Gtk.Image.new_from_gicon(up_icn, Gtk.IconSize.BUTTON)
self.zoom_up.set_image(up_img)
self.zoom_up.get_style_context().add_class("flat")
# Lower btn
lower_icn = Gio.ThemedIcon(name="list-remove-symbolic")
lower_img = Gtk.Image.new_from_gicon(lower_icn, Gtk.IconSize.BUTTON)
self.zoom_down.set_image(lower_img)
self.zoom_down.get_style_context().add_class("flat")
self.pack_start(self.zoom_up, False, False, 0)
self.pack_start(self.zoom_down, False, False, 0)
self.show_all()
示例13: add_error
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def add_error(self):
icon = Gio.ThemedIcon(name="dialog-error-symbolic")
error_image = Gtk.Image()
error_image.props.margin = 5
error_image.set_from_gicon(icon, Gtk.IconSize.BUTTON)
error_image.show_all()
error_image.set_has_tooltip(True)
error_image.set_tooltip_text(_('The plugin cannot be enabled'))
self.outerbox.pack_end(error_image, False, False, 4)
self.set_sensitive(False)
示例14: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def __init__(self, header):
"""
Initialises the object.
"""
super(AltQueueController, self).__init__(header)
self._gicon = Gio.ThemedIcon(name='audio-x-queue-symbolic')
示例15: __init__
# 需要导入模块: from gi.repository import Gio [as 别名]
# 或者: from gi.repository.Gio import ThemedIcon [as 别名]
def __init__(self, icon_name, tooltip_text=None, label=None):
super().__init__()
self.box = Gtk.Box()
self.icon = Gio.ThemedIcon(name=icon_name)
self.image = Gtk.Image.new_from_gicon(self.icon, Gtk.IconSize.BUTTON)
self.get_style_context().add_class('image-button')
if label:
self.label = Gtk.Label(label)
self.box.pack_start(self.label, True, True, 3)
self.get_style_context().add_class('text-button')
self.box.pack_start(self.image, True, True, 3 if self.label else 0)
self.add(self.box)
if tooltip_text:
self.set_tooltip_text(tooltip_text)