本文整理汇总了Python中sugar.graphics.menuitem.MenuItem.show方法的典型用法代码示例。如果您正苦于以下问题:Python MenuItem.show方法的具体用法?Python MenuItem.show怎么用?Python MenuItem.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.menuitem.MenuItem
的用法示例。
在下文中一共展示了MenuItem.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def setup_palette(self):
title = self._home_activity.get_title()
self.set_primary_text(glib.markup_escape_text(title))
vbox = gtk.VBox()
self.set_content(vbox)
vbox.show()
self._progress_bar = gtk.ProgressBar()
vbox.add(self._progress_bar)
self._progress_bar.show()
self._free_space_label = gtk.Label()
self._free_space_label.set_alignment(0.5, 0.5)
vbox.add(self._free_space_label)
self._free_space_label.show()
self.connect('popup', self.__popup_cb)
menu_item = MenuItem(_('Show contents'))
icon = Icon(file=self._home_activity.get_icon_path(),
icon_size=gtk.ICON_SIZE_MENU,
xo_color=self._home_activity.get_icon_color())
menu_item.set_image(icon)
icon.show()
menu_item.connect('activate', self.__open_activate_cb)
self.menu.append(menu_item)
menu_item.show()
示例2: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, mount):
Palette.__init__(self, label=mount.get_name())
self._mount = mount
path = mount.get_root().get_path()
self.props.secondary_text = glib.markup_escape_text(path)
vbox = gtk.VBox()
self.set_content(vbox)
vbox.show()
self._progress_bar = gtk.ProgressBar()
vbox.add(self._progress_bar)
self._progress_bar.show()
self._free_space_label = gtk.Label()
self._free_space_label.set_alignment(0.5, 0.5)
vbox.add(self._free_space_label)
self._free_space_label.show()
self.connect('popup', self.__popup_cb)
menu_item = MenuItem(pgettext('Volume', 'Remove'))
icon = Icon(icon_name='media-eject', icon_size=gtk.ICON_SIZE_MENU)
menu_item.set_image(icon)
icon.show()
menu_item.connect('activate', self.__unmount_activate_cb)
self.menu.append(menu_item)
menu_item.show()
示例3: create_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def create_palette(self):
primary_text = glib.markup_escape_text(self._model.bundle.get_name())
secondary_text = glib.markup_escape_text(self._model.get_name())
p_icon = Icon(file=self._model.bundle.get_icon(),
xo_color=self._model.get_color())
p_icon.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
p = palette.Palette(None,
primary_text=primary_text,
secondary_text=secondary_text,
icon=p_icon)
private = self._model.props.private
joined = get_owner_instance() in self._model.props.buddies
if joined:
item = MenuItem(_('Resume'), 'activity-start')
item.connect('activate', self._clicked_cb)
item.show()
p.menu.append(item)
elif not private:
item = MenuItem(_('Join'), 'activity-start')
item.connect('activate', self._clicked_cb)
item.show()
p.menu.append(item)
return p
示例4: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, activity_info, journal_entries):
ActivityPalette.__init__(self, activity_info)
if not journal_entries:
xo_color = XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TRANSPARENT.get_svg()))
else:
xo_color = misc.get_icon_color(journal_entries[0])
self.props.icon = Icon(file=activity_info.get_icon(),
xo_color=xo_color,
icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
if journal_entries:
self.props.secondary_text = journal_entries[0]['title']
menu_items = []
for entry in journal_entries:
icon_file_name = misc.get_icon_name(entry)
color = misc.get_icon_color(entry)
menu_item = MenuItem(text_label=entry['title'],
file_name=icon_file_name,
xo_color=color)
menu_item.connect('activate', self.__resume_entry_cb, entry)
menu_items.append(menu_item)
menu_item.show()
if journal_entries:
separator = gtk.SeparatorMenuItem()
menu_items.append(separator)
separator.show()
for i in range(0, len(menu_items)):
self.menu.insert(menu_items[i], i)
示例5: _reload_session_history
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _reload_session_history(self, current_page_index=None):
session_history = self._browser.web_navigation.sessionHistory
if current_page_index is None:
current_page_index = session_history.index
for palette in (self._back.get_palette(), self._forward.get_palette()):
for menu_item in palette.menu.get_children():
palette.menu.remove(menu_item)
if current_page_index > _MAX_HISTORY_ENTRIES:
bottom = current_page_index - _MAX_HISTORY_ENTRIES
else:
bottom = 0
if (session_history.count - current_page_index) > \
_MAX_HISTORY_ENTRIES:
top = current_page_index + _MAX_HISTORY_ENTRIES + 1
else:
top = session_history.count
for i in range(bottom, top):
if i == current_page_index:
continue
entry = session_history.getEntryAtIndex(i, False)
menu_item = MenuItem(entry.title, text_maxlen=60)
menu_item.connect('activate', self._history_item_activated_cb, i)
if i < current_page_index:
palette = self._back.get_palette()
palette.menu.prepend(menu_item)
elif i > current_page_index:
palette = self._forward.get_palette()
palette.menu.append(menu_item)
menu_item.show()
示例6: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, _parent):
activity.EditToolbar.__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.child.set_sensitive(False)
self.paste.child.set_sensitive(False)
self.erase_button.set_sensitive(False)
示例7: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, file_name, document_path, title):
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.ICON_SIZE_LARGE_TOOLBAR,
xo_color=XoColor(self._color))
self.set_icon_widget(icon)
icon.show()
menu_item = MenuItem(_('Keep'))
icon = Icon(icon_name='document-save', icon_size=gtk.ICON_SIZE_MENU,
xo_color=XoColor(self._color))
menu_item.set_image(icon)
menu_item.connect('activate', self.__keep_in_journal_cb)
self.props.palette.menu.append(menu_item)
menu_item.show()
示例8: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, invite):
Palette.__init__(self, '')
self._invite = invite
menu_item = MenuItem(_('Join'), icon_name='dialog-ok')
menu_item.connect('activate', self.__join_activate_cb)
self.menu.append(menu_item)
menu_item.show()
menu_item = MenuItem(_('Decline'), icon_name='dialog-cancel')
menu_item.connect('activate', self.__decline_activate_cb)
self.menu.append(menu_item)
menu_item.show()
bundle_id = invite.get_bundle_id()
registry = bundleregistry.get_registry()
self._bundle = registry.get_bundle(bundle_id)
if self._bundle:
name = self._bundle.get_name()
else:
name = bundle_id
self.set_primary_text(glib.markup_escape_text(name))
示例9: _setup_quality_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _setup_quality_palette(self):
self._quality_palette = self._quality_button.get_palette()
for quality in QUALITY_VALUES:
text = _("%s quality") % (quality)
menu_item = MenuItem(icon_name=quality + "-quality", text_label=text)
menu_item.connect("activate", self._quality_selected_cb, quality)
self._quality_palette.menu.append(menu_item)
menu_item.show()
示例10: _add_erase_option
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _add_erase_option(self, registry, activity_info):
menu_item = MenuItem(_('Erase'), 'list-remove')
menu_item.connect('activate', self.__erase_activate_cb)
self.menu.append(menu_item)
menu_item.show()
if not os.access(activity_info.get_path(), os.W_OK) or \
registry.is_activity_protected(self._bundle_id):
menu_item.props.sensitive = False
示例11: _setup_log_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _setup_log_palette(self):
self._log_palette = self._log_button.get_palette()
for tenth_seconds in LOG_TIMER_VALUES:
text = self._log_to_string(tenth_seconds)
menu_item = MenuItem(icon_name="timer-%d" % (tenth_seconds), text_label=self._log_to_string(tenth_seconds))
menu_item.connect("activate", self._log_selected_cb, tenth_seconds)
self._log_palette.menu.append(menu_item)
menu_item.show()
示例12: _setup_notes_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _setup_notes_palette(self):
self._notes_palette = self._notes_button.get_palette()
for note in NOTES:
menu_item = MenuItem(icon_name='',
text_label=note)
menu_item.connect('activate', self._note_selected_cb, note)
self._notes_palette.menu.append(menu_item)
menu_item.show()
示例13: _setup_octaves_palette
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def _setup_octaves_palette(self):
self._octaves_palette = self._octaves_button.get_palette()
for octave in range(9):
menu_item = MenuItem(icon_name='',
text_label=str(octave))
menu_item.connect('activate', self._octave_selected_cb, octave)
self._octaves_palette.menu.append(menu_item)
menu_item.show()
示例14: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, url):
Palette.__init__(self, url)
self.owns_clipboard = False
self.url = _url_check_protocol(url)
menu_item = MenuItem(_('Copy to Clipboard'), 'edit-copy')
menu_item.connect('activate', self._copy_to_clipboard_cb)
self.menu.append(menu_item)
menu_item.show()
示例15: __init__
# 需要导入模块: from sugar.graphics.menuitem import MenuItem [as 别名]
# 或者: from sugar.graphics.menuitem.MenuItem import show [as 别名]
def __init__(self, activity, abi):
ToolButton.__init__(self, "document-save")
self.props.tooltip = _("Export")
self.props.label = _("Export")
for i in self._EXPORT_FORMATS:
menu_item = MenuItem(i["title"])
menu_item.connect("activate", self.__activate_cb, activity, abi, i)
self.props.palette.menu.append(menu_item)
menu_item.show()