本文整理汇总了Python中gtk.SeparatorMenuItem方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.SeparatorMenuItem方法的具体用法?Python gtk.SeparatorMenuItem怎么用?Python gtk.SeparatorMenuItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.SeparatorMenuItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_tags_menu
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SeparatorMenuItem [as 别名]
def _init_tags_menu(self):
self._tags_menu_items = {}
self._tags_remove_submenu_items = {}
self._tags_menu_relative_position = None
self._tags_menu = gtk.Menu()
self._tags_remove_submenu = gtk.Menu()
self._tags_menu.append(gtk.SeparatorMenuItem())
self._menu_item_add_tag = gtk.MenuItem(_("Add New Tag..."))
self._menu_item_add_tag.connect("activate", self._on_menu_item_add_tag_activate)
self._tags_menu.append(self._menu_item_add_tag)
self._menu_item_remove_tag = gtk.MenuItem(_("Remove Tag"))
self._menu_item_remove_tag.set_submenu(self._tags_remove_submenu)
self._tags_menu.append(self._menu_item_remove_tag)
for tag, tag_display_name in self._available_tags_setting.default_value.items():
self._add_tag_menu_item(tag, tag_display_name)
self._tags_menu.show_all()
示例2: _add_menu_item
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SeparatorMenuItem [as 别名]
def _add_menu_item(self, id=None, label='Menu item',
sensitive=False,
separator=False,
op=None, args=None,
**ignored_kwarg):
if separator:
menu_item = gtk.SeparatorMenuItem()
else:
menu_item = gtk.MenuItem(label)
menu_item.set_sensitive(sensitive)
if op:
def activate(o, a):
return lambda d: self._do(o, a)
menu_item.connect("activate", activate(op, args or []))
menu_item.show()
self.menu.append(menu_item)
if id:
self.items[id] = menu_item
示例3: callback
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SeparatorMenuItem [as 别名]
def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu"""
item = gtk.MenuItem(_('Custom Commands'))
menuitems.append(item)
submenu = gtk.Menu()
item.set_submenu(submenu)
menuitem = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
menuitem.connect("activate", self.configure)
submenu.append(menuitem)
menuitem = gtk.SeparatorMenuItem()
submenu.append(menuitem)
theme = gtk.IconTheme()
for command in self.cmd_list:
if not command['enabled']:
continue
exe = command['command'].split(' ')[0]
iconinfo = theme.choose_icon([exe], gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_USE_BUILTIN)
if iconinfo:
image = gtk.Image()
image.set_from_icon_name(exe, gtk.ICON_SIZE_MENU)
menuitem = gtk.ImageMenuItem(command['name'])
menuitem.set_image(image)
else:
menuitem = gtk.MenuItem(command["name"])
menuitem.connect("activate", self._execute, {'terminal' : terminal, 'command' : command['command'] })
submenu.append(menuitem)
示例4: _init_operations_menu_popup
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SeparatorMenuItem [as 别名]
def _init_operations_menu_popup(self):
for operation_dict in self._builtin_operations.values():
self._add_operation_to_menu_popup(operation_dict)
if self._allow_custom_operations:
self._operations_menu.append(gtk.SeparatorMenuItem())
self._add_add_custom_operation_to_menu_popup()
self._operations_menu.show_all()
示例5: menu
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SeparatorMenuItem [as 别名]
def menu(self, event_button, event_time, data=None):
"""Create popup menu
"""
self.sub_menu()
menu = gtk.Menu()
menu.append(self.daemon)
separator = gtk.SeparatorMenuItem()
menu_Check = gtk.ImageMenuItem("Check updates")
img_Check = gtk.image_new_from_stock(gtk.STOCK_OK,
gtk.ICON_SIZE_MENU)
img_Check.show()
menu_Info = gtk.ImageMenuItem("OS Info")
img_Info = gtk.image_new_from_stock(gtk.STOCK_INFO,
gtk.ICON_SIZE_MENU)
img_Info.show()
menu_About = gtk.ImageMenuItem("About")
img_About = gtk.image_new_from_stock(gtk.STOCK_ABOUT,
gtk.ICON_SIZE_MENU)
img_About.show()
self.daemon.set_image(self.img_daemon)
menu.append(self.daemon)
self.daemon.show()
menu_Quit = gtk.ImageMenuItem("Quit")
img_Quit = gtk.image_new_from_stock(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
img_Quit.show()
menu_Check.set_image(img_Check)
menu_Info.set_image(img_Info)
menu_About.set_image(img_About)
menu_Quit.set_image(img_Quit)
menu.append(menu_Check)
menu.append(menu_Info)
menu.append(separator)
menu.append(menu_About)
menu.append(menu_Quit)
separator.show()
menu_Check.show()
menu_Info.show()
menu_About.show()
menu_Quit.show()
menu_Check.connect_object("activate", self._Check, " ")
menu_Info.connect_object("activate", self._Info, "OS Info")
menu_About.connect_object("activate", self._About, "SUN")
self.start.connect_object("activate", self._start, "Start daemon ")
self.stop.connect_object("activate", self._stop, "Stop daemon ")
self.restart.connect_object("activate", self._restart,
"Restart daemon ")
self.status.connect_object("activate", self._status, daemon_status())
menu_Quit.connect_object("activate", self._Quit, "stop")
menu.popup(None, None, None, event_button, event_time, data)