本文整理汇总了Python中sugar3.graphics.icon.Icon类的典型用法代码示例。如果您正苦于以下问题:Python Icon类的具体用法?Python Icon怎么用?Python Icon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Icon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
ToolButton.__init__(self)
self._property = 'timestamp'
self._order = Gtk.SortType.ASCENDING
self.props.tooltip = _('Sort view')
self.props.icon_name = 'view-lastedit'
self.props.hide_tooltip_on_click = False
self.palette_invoker.props.toggle_palette = True
menu_box = PaletteMenuBox()
self.props.palette.set_content(menu_box)
menu_box.show()
sort_options = [
('timestamp', 'view-lastedit', _('Sort by date modified')),
('creation_time', 'view-created', _('Sort by date created')),
('filesize', 'view-size', _('Sort by size')),
]
for property_, icon, label in sort_options:
button = PaletteMenuItem(label)
button_icon = Icon(pixel_size=style.SMALL_ICON_SIZE,
icon_name=icon)
button.set_image(button_icon)
button_icon.show()
button.connect('activate',
self.__sort_type_changed_cb,
property_,
icon)
button.show()
menu_box.append_item(button)
开发者ID:AbrahmAB,项目名称:sugar,代码行数:34,代码来源:journaltoolbox.py
示例2: __init__
def __init__(self, icon_name):
Gtk.Button.__init__(self)
self.modify_bg(
Gtk.StateType.NORMAL,
style.COLOR_TOOLBAR_GREY.get_gdk_color())
self.modify_bg(
Gtk.StateType.ACTIVE,
style.COLOR_BUTTON_GREY.get_gdk_color())
self.set_relief(Gtk.ReliefStyle.NONE)
self.set_size_request(
style.GRID_CELL_SIZE,
style.GRID_CELL_SIZE)
icon = Icon(
icon_name = icon_name,
icon_size = Gtk.IconSize.SMALL_TOOLBAR)
self.set_image(icon)
icon.show()
self.show_all()
#self.connect('clicked', self._clicked_cb)
开发者ID:i5o,项目名称:record-gtk3,代码行数:29,代码来源:Widgets.py
示例3: add_radio_buttons
def add_radio_buttons(self, button_icons, colors=None):
# Psuedo-radio buttons
alignment = Gtk.Alignment.new(0.5, 0.5, 0, 0)
grid = Gtk.Grid()
grid.set_row_spacing(style.DEFAULT_SPACING)
grid.set_column_spacing(style.DEFAULT_SPACING)
grid.set_border_width(style.DEFAULT_SPACING * 2)
buttons = []
for i, button_icon in enumerate(button_icons):
if colors is not None:
icon = Icon(pixel_size=style.STANDARD_ICON_SIZE,
icon_name=button_icon,
stroke_color=colors.get_stroke_color(),
fill_color=colors.get_fill_color())
else:
icon = Icon(pixel_size=style.STANDARD_ICON_SIZE,
icon_name=button_icon)
buttons.append(Gtk.Button())
buttons[i].set_image(icon)
icon.show()
grid.attach(buttons[i], i, 0, 1, 1)
buttons[i].show()
alignment.add(grid)
grid.show()
self._attach(alignment)
alignment.show()
return buttons
开发者ID:walterbender,项目名称:OneSupport,代码行数:30,代码来源:graphics.py
示例4: __init__
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)
开发者ID:rbuj,项目名称:implode-activity,代码行数:28,代码来源:implodeactivity.py
示例5: __init__
def __init__(self, child, label=""):
GObject.GObject.__init__(self)
self._child = child
self._label = Gtk.Label(label=label)
self._label.set_alignment(0, 0.5)
self.pack_start(self._label, True, True, 0)
self._label.show()
#self.modify_base(Gtk.StateType.NORMAL, Gdk.Color(0, 0, 0, 1))
close_tab_icon = Icon(icon_name='close-tab')
button = Gtk.Button()
button.props.relief = Gtk.ReliefStyle.NONE
button.props.focus_on_click = False
icon_box = Gtk.HBox()
icon_box.pack_start(close_tab_icon, True, False, 0)
button.add(icon_box)
button.connect('clicked', self.__button_clicked_cb)
button.set_name('browse-tab-close')
self.pack_start(button, False, True, 0)
close_tab_icon.show()
icon_box.show()
button.show()
self._close_button = button
开发者ID:samdroid-apps,项目名称:develop-activity,代码行数:25,代码来源:widgets.py
示例6: _IconWidget
class _IconWidget(Gtk.EventBox):
__gtype_name__ = 'SugarTrayIconWidget'
def __init__(self, icon_name=None, xo_color=None):
GObject.GObject.__init__(self)
self.set_app_paintable(True)
self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.TOUCH_MASK |
Gdk.EventMask.BUTTON_RELEASE_MASK)
self._icon = Icon(icon_name=icon_name, xo_color=xo_color,
icon_size=Gtk.IconSize.LARGE_TOOLBAR)
self.add(self._icon)
self._icon.show()
def do_draw(self, cr):
palette = self.get_parent().palette
if palette and palette.is_up():
invoker = palette.props.invoker
invoker.draw_rectangle(cr, palette)
Gtk.EventBox.do_draw(self, cr)
def get_icon(self):
return self._icon
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:27,代码来源:tray.py
示例7: __init__
def __init__(self, activity):
Gtk.EventBox.__init__(self)
self._area = Gtk.DrawingArea()
self._area.connect('draw', self._area_draw_cb)
self._boxes = []
self._current_box = None
prev_btn = Gtk.EventBox()
prev_btn.connect('button-press-event', self._prev_slide)
self._prev_icon = Icon(pixel_size=100)
self._prev_icon.props.icon_name = 'go-previous'
prev_btn.add(self._prev_icon)
next_btn = Gtk.EventBox()
next_btn.connect('button-press-event', self._next_slide)
self._next_icon = Icon(pixel_size=100)
self._next_icon.props.icon_name = 'go-next'
next_btn.add(self._next_icon)
hbox = Gtk.Box()
hbox.set_border_width(10)
hbox.pack_start(prev_btn, True, False, 0)
hbox.pack_start(self._area, False, False, 0)
hbox.pack_end(next_btn, True, False, 0)
self.add(hbox)
self.show_all()
开发者ID:i5o,项目名称:fototoon-activity,代码行数:30,代码来源:slideview.py
示例8: _update_invite_menu
def _update_invite_menu(self, activity):
buddy_activity = self._buddy.props.current_activity
if buddy_activity is not None:
buddy_activity_id = buddy_activity.activity_id
else:
buddy_activity_id = None
self._invite_menu.hide()
if activity is None or \
activity.is_journal() or \
activity.get_activity_id() == buddy_activity_id:
return
bundle_activity = ActivityBundle(activity.get_bundle_path())
if bundle_activity.get_max_participants() > 1:
title = activity.get_title()
self._invite_menu.set_label(_('Invite to %s') % title)
icon = Icon(file=activity.get_icon_path(),
pixel_size=style.SMALL_ICON_SIZE)
icon.props.xo_color = activity.get_icon_color()
self._invite_menu.set_image(icon)
icon.show()
self._invite_menu.show()
开发者ID:sugarlabs,项目名称:sugar,代码行数:25,代码来源:buddymenu.py
示例9: add_text_icon_and_button
def add_text_icon_and_button(self, text, icon_name,
button_icon=None,
button_label=None,
size='large', bold=False,
color=style.COLOR_BLACK.get_html(),
justify=Gtk.Justification.LEFT,
stroke=style.COLOR_BUTTON_GREY.get_svg(),
fill=style.COLOR_TRANSPARENT.get_svg(),
icon_size=style.XLARGE_ICON_SIZE):
label = Gtk.Label()
label.set_use_markup(True)
label.set_justify(justify)
if bold:
text = '<b>' + text + '</b>'
span = '<span foreground="%s" size="%s">' % (color, size)
label.set_markup(span + text + '</span>')
icon = Icon(pixel_size=icon_size, icon_name=icon_name,
stroke_color=stroke, fill_color=fill)
if button_icon is not None:
button = ToolButton(button_icon)
else:
button = Gtk.Button()
button.set_label(button_label)
self._attach_three(label, icon, button)
label.show()
icon.show()
button.show()
return button
开发者ID:walterbender,项目名称:OneSupport,代码行数:30,代码来源:graphics.py
示例10: can_close
def can_close(self):
if self._force_close:
return True
elif downloadmanager.can_quit():
return True
else:
alert = Alert()
alert.props.title = ngettext('Download in progress',
'Downloads in progress',
downloadmanager.num_downloads())
message = ngettext('Stopping now will erase your download',
'Stopping now will erase your downloads',
downloadmanager.num_downloads())
alert.props.msg = message
cancel_icon = Icon(icon_name='dialog-cancel')
cancel_label = ngettext('Continue download', 'Continue downloads',
downloadmanager.num_downloads())
alert.add_button(Gtk.ResponseType.CANCEL, cancel_label,
cancel_icon)
stop_icon = Icon(icon_name='dialog-ok')
alert.add_button(Gtk.ResponseType.OK, _('Stop'), stop_icon)
stop_icon.show()
self.add_alert(alert)
alert.connect('response', self.__inprogress_response_cb)
alert.show()
self.present()
return False
开发者ID:City-busz,项目名称:browse-activity,代码行数:27,代码来源:webactivity.py
示例11: __init__
def __init__(self, file_name, document_path, activity_name, title,
bundle=False):
RadioToolButton.__init__(self)
self._document_path = document_path
self._title = title
self._jobject = None
self._activity_name = activity_name
self.props.tooltip = _('Instance Source')
settings = Gio.Settings('org.sugarlabs.user')
self._color = settings.get_string('color')
icon = Icon(file=file_name,
pixel_size=style.STANDARD_ICON_SIZE,
xo_color=XoColor(self._color))
self.set_icon_widget(icon)
icon.show()
box = PaletteMenuBox()
self.props.palette.set_content(box)
box.show()
if bundle:
menu_item = PaletteMenuItem(_('Duplicate'), 'edit-duplicate',
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__show_duplicate_alert)
else:
menu_item = PaletteMenuItem(_('Keep'), 'document-save',
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__keep_in_journal_cb)
box.append_item(menu_item)
menu_item.show()
开发者ID:sugarlabs,项目名称:sugar,代码行数:34,代码来源:viewsource.py
示例12: _object_chooser
def _object_chooser(self, mime_type, type_name):
chooser = ObjectChooser()
matches_mime_type = False
response = chooser.run()
if response == Gtk.ResponseType.ACCEPT:
jobject = chooser.get_selected_object()
metadata = jobject.metadata
file_path = jobject.file_path
if metadata['mime_type'] == mime_type:
matches_mime_type = True
else:
alert = Alert()
alert.props.title = _('Invalid object')
alert.props.msg = \
_('The selected object must be a %s file' % (type_name))
ok_icon = Icon(icon_name='dialog-ok')
alert.add_button(Gtk.ResponseType.OK, _('Ok'), ok_icon)
ok_icon.show()
alert.connect('response', lambda a, r: self.remove_alert(a))
self.add_alert(alert)
alert.show()
return matches_mime_type, file_path, metadata['title']
开发者ID:sugarlabs,项目名称:AnalyzeJournal,代码行数:31,代码来源:activity.py
示例13: __init__
def __init__(self, browser):
GObject.GObject.__init__(self)
browser.connect('notify::title', self.__title_changed_cb)
browser.connect('notify::load-status', self.__load_status_changed_cb)
self._title = _('Untitled')
self._label = Gtk.Label(label=self._title)
self._label.set_ellipsize(Pango.EllipsizeMode.END)
self._label.set_alignment(0, 0.5)
self.pack_start(self._label, True, True, 0)
self._label.show()
close_tab_icon = Icon(icon_name='browse-close-tab')
button = Gtk.Button()
button.props.relief = Gtk.ReliefStyle.NONE
button.props.focus_on_click = False
icon_box = Gtk.HBox()
icon_box.pack_start(close_tab_icon, True, False, 0)
button.add(icon_box)
button.connect('clicked', self.__button_clicked_cb)
button.set_name('browse-tab-close')
self.pack_start(button, False, True, 0)
close_tab_icon.show()
icon_box.show()
button.show()
self._close_button = button
开发者ID:georgejhunt,项目名称:HaitiDictionary.activity,代码行数:27,代码来源:browser.py
示例14: __init__
def __init__(self, file_name, document_path, title, bundle=False):
RadioToolButton.__init__(self)
self._document_path = document_path
self._title = title
self._jobject = None
self.props.tooltip = _('Instance Source')
settings = Gio.Settings('org.sugarlabs.user')
self._color = settings.get_string('color')
icon = Icon(file=file_name,
pixel_size=style.STANDARD_ICON_SIZE,
xo_color=XoColor(self._color))
self.set_icon_widget(icon)
icon.show()
if bundle:
menu_item = MenuItem(_('Duplicate'))
icon = Icon(icon_name='edit-duplicate',
pixel_size=style.SMALL_ICON_SIZE,
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__copy_to_home_cb)
else:
menu_item = MenuItem(_('Keep'))
icon = Icon(icon_name='document-save',
pixel_size=style.SMALL_ICON_SIZE,
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__keep_in_journal_cb)
menu_item.set_image(icon)
self.props.palette.menu.append(menu_item)
menu_item.show()
开发者ID:AxEofBone7,项目名称:sugar,代码行数:34,代码来源:viewsource.py
示例15: __init__
def __init__(self, file_name, document_path, title, bundle=False):
RadioToolButton.__init__(self)
self._document_path = document_path
self._title = title
self._jobject = None
self.props.tooltip = _("Instance Source")
settings = Gio.Settings("org.sugarlabs.user")
self._color = settings.get_string("color")
icon = Icon(file=file_name, icon_size=Gtk.IconSize.LARGE_TOOLBAR, xo_color=XoColor(self._color))
self.set_icon_widget(icon)
icon.show()
if bundle:
menu_item = MenuItem(_("Duplicate"))
icon = Icon(icon_name="edit-duplicate", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
menu_item.connect("activate", self.__copy_to_home_cb)
else:
menu_item = MenuItem(_("Keep"))
icon = Icon(icon_name="document-save", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
menu_item.connect("activate", self.__keep_in_journal_cb)
menu_item.set_image(icon)
self.props.palette.menu.append(menu_item)
menu_item.show()
开发者ID:svineet,项目名称:sugar,代码行数:28,代码来源:viewsource.py
示例16: __init__
def __init__(self):
ToolButton.__init__(self)
self._property = 'timestamp'
self._order = Gtk.SortType.ASCENDING
self.props.tooltip = _('Sort view')
self.props.icon_name = 'view-lastedit'
self.props.hide_tooltip_on_click = False
self.palette_invoker.props.toggle_palette = True
menu_box = PaletteMenuBox()
self.props.palette.set_content(menu_box)
menu_box.show()
for property_, icon, label in self._SORT_OPTIONS:
button = PaletteMenuItem(label)
button_icon = Icon(icon_size=Gtk.IconSize.MENU, icon_name=icon)
button.set_image(button_icon)
button_icon.show()
button.connect('activate',
self.__sort_type_changed_cb,
property_,
icon)
button.show()
menu_box.append_item(button)
开发者ID:hgarrereyn,项目名称:sugar,代码行数:27,代码来源:journaltoolbox.py
示例17: _value_changed
def _value_changed(self, cell, path, new_text, model, activity):
_logger.info("Change '%s' to '%s'" % (model[path][1], new_text))
is_number = True
number = new_text.replace(",", ".")
try:
float(number)
except ValueError:
is_number = False
if is_number:
decimals = utils.get_decimals(str(float(number)))
new_text = locale.format('%.' + decimals + 'f', float(number))
model[path][1] = str(new_text)
self.emit("value-changed", str(path), number)
elif not is_number:
alert = Alert()
alert.props.title = _('Invalid Value')
alert.props.msg = \
_('The value must be a number (integer or decimal)')
ok_icon = Icon(icon_name='dialog-ok')
alert.add_button(Gtk.ResponseType.OK, _('Ok'), ok_icon)
ok_icon.show()
alert.connect('response', lambda a, r: activity.remove_alert(a))
activity.add_alert(alert)
alert.show()
开发者ID:sugarlabs,项目名称:AnalyzeJournal,代码行数:32,代码来源:activity.py
示例18: add_icon
def add_icon(self, icon_name, stroke=style.COLOR_BUTTON_GREY.get_svg(),
fill=style.COLOR_TRANSPARENT.get_svg(),
icon_size=style.XLARGE_ICON_SIZE):
icon = Icon(pixel_size=icon_size, icon_name=icon_name,
stroke_color=stroke, fill_color=fill)
self._attach(icon)
icon.show()
开发者ID:walterbender,项目名称:OneSupport,代码行数:7,代码来源:graphics.py
示例19: __init__
def __init__(self, file_name, document_path, title, bundle=False):
RadioToolButton.__init__(self)
self._document_path = document_path
self._title = title
self._jobject = None
self.props.tooltip = _('Instance Source')
client = GConf.Client.get_default()
self._color = client.get_string('/desktop/sugar/user/color')
icon = Icon(file=file_name,
icon_size=Gtk.IconSize.LARGE_TOOLBAR,
xo_color=XoColor(self._color))
self.set_icon_widget(icon)
icon.show()
if bundle:
menu_item = MenuItem(_('Duplicate'))
icon = Icon(icon_name='edit-duplicate',
icon_size=Gtk.IconSize.MENU,
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__copy_to_home_cb)
else:
menu_item = MenuItem(_('Keep'))
icon = Icon(icon_name='document-save',
icon_size=Gtk.IconSize.MENU,
xo_color=XoColor(self._color))
menu_item.connect('activate', self.__keep_in_journal_cb)
menu_item.set_image(icon)
self.props.palette.menu.append(menu_item)
menu_item.show()
开发者ID:axitkhurana,项目名称:sugar,代码行数:34,代码来源:viewsource.py
示例20: InlineAlert
class InlineAlert(Gtk.HBox):
"""UI interface for Inline alerts
Inline alerts are different from the other alerts beause they are
no dialogs, they only inform about a current event.
Properties:
'msg': the message of the alert,
'icon': the icon that appears at the far left
See __gproperties__
"""
__gtype_name__ = 'SugarInlineAlert'
__gproperties__ = {
'msg': (str, None, None, None, GObject.ParamFlags.READWRITE),
'icon': (object, None, None, GObject.ParamFlags.WRITABLE),
}
def __init__(self, **kwargs):
self._msg = None
self._msg_color = None
self._icon = Icon(icon_name='emblem-warning',
fill_color=style.COLOR_SELECTION_GREY.get_svg(),
stroke_color=style.COLOR_WHITE.get_svg())
self._msg_label = Gtk.Label()
self._msg_label.set_max_width_chars(150)
self._msg_label.set_ellipsize(style.ELLIPSIZE_MODE_DEFAULT)
self._msg_label.set_alignment(0, 0.5)
self._msg_label.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
Gtk.HBox.__init__(self, **kwargs)
self.set_spacing(style.DEFAULT_SPACING)
self.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_WHITE.get_gdk_color())
self.pack_start(self._icon, False, False, 0)
self.pack_start(self._msg_label, False, False, 0)
self._msg_label.show()
self._icon.show()
def do_set_property(self, pspec, value):
if pspec.name == 'msg':
if self._msg != value:
self._msg = value
self._msg_label.set_markup(self._msg)
elif pspec.name == 'icon':
if self._icon != value:
self._icon = value
def do_get_property(self, pspec):
if pspec.name == 'msg':
return self._msg
开发者ID:sugarlabs,项目名称:sugar,代码行数:57,代码来源:inlinealert.py
注:本文中的sugar3.graphics.icon.Icon类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论