本文整理汇总了Python中gi.repository.Gtk.STOCK_PREFERENCES属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STOCK_PREFERENCES属性的具体用法?Python Gtk.STOCK_PREFERENCES怎么用?Python Gtk.STOCK_PREFERENCES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.STOCK_PREFERENCES属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_PREFERENCES [as 别名]
def __init__(self, core, tviews):
super(Statusbar,self).__init__()
self.uicore = core
self.tviews = tviews
self.icons = {
'Arch':datafile_path('processor_small.png'),
'Name':Gtk.STOCK_FILE,
'Format':Gtk.STOCK_EXECUTE,
'Size':Gtk.STOCK_PREFERENCES,
'OS':Gtk.STOCK_INFO,
'Type':Gtk.STOCK_INFO,
'va':Gtk.STOCK_UNINDENT,
'ep': Gtk.STOCK_INDENT,
}
示例2: create_toolbar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_PREFERENCES [as 别名]
def create_toolbar(self):
'''This function creates a toolbar which is displayed next to the table'''
toolbar = Gtk.Toolbar()
toolbar.set_orientation(Gtk.Orientation.HORIZONTAL)
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
toolbar.set_border_width(1)
for pos, stock, handler, data, tooltip in (
(0, Gtk.STOCK_ADD, self.on_add_row, None, _('Add row')), # T: tooltip on mouse hover
(1, Gtk.STOCK_DELETE, self.on_delete_row, None, _('Remove row')), # T: tooltip on mouse hover
(2, Gtk.STOCK_COPY, self.on_clone_row, None, _('Clone row')), # T: tooltip on mouse hover
(3, None, None, None, None),
(4, Gtk.STOCK_GO_UP, self.on_move_row, -1, _('Row up')), # T: tooltip on mouse hover
(5, Gtk.STOCK_GO_DOWN, self.on_move_row, 1, _('Row down')), # T: tooltip on mouse hover
(6, None, None, None, None),
(7, Gtk.STOCK_PREFERENCES, self.on_change_columns, None, _('Change columns')), # T: tooltip on mouse hover
(8, None, None, None, None),
(9, Gtk.STOCK_HELP, self.on_open_help, None, _('Open help')), # T: tooltip on mouse hover
):
if stock is None:
toolbar.insert(Gtk.SeparatorToolItem(), pos)
else:
button = Gtk.ToolButton(stock)
if data:
button.connect('clicked', handler, data)
else:
button.connect('clicked', handler)
button.set_tooltip_text(tooltip)
toolbar.insert(button, pos)
toolbar.set_size_request(300, -1)
toolbar.set_icon_size(Gtk.IconSize.MENU)
return toolbar
示例3: rebuild_menu
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_PREFERENCES [as 别名]
def rebuild_menu(self):
# Main Menu items
self.errorItem = Gtk.MenuItem(_("View script error"))
enableMenuItem = Gtk.CheckMenuItem(_("Enable Expansions"))
enableMenuItem.set_active(self.app.service.is_running())
enableMenuItem.set_sensitive(not self.app.serviceDisabled)
configureMenuItem = Gtk.ImageMenuItem(_("Show Main Window"))
configureMenuItem.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU))
removeMenuItem = Gtk.ImageMenuItem(_("Remove icon"))
removeMenuItem.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU))
quitMenuItem = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
# Menu signals
enableMenuItem.connect("toggled", self.on_enable_toggled)
configureMenuItem.connect("activate", self.on_show_configure)
removeMenuItem.connect("activate", self.on_remove_icon)
quitMenuItem.connect("activate", self.on_destroy_and_exit)
self.errorItem.connect("activate", self.on_show_error)
# Get phrase folders to add to main menu
folders = []
items = []
for folder in self.configManager.allFolders:
if folder.show_in_tray_menu:
folders.append(folder)
for item in self.configManager.allItems:
if item.show_in_tray_menu:
items.append(item)
# Construct main menu
self.menu = popupmenu.PopupMenu(self.app.service, folders, items, False)
if len(items) > 0:
self.menu.append(Gtk.SeparatorMenuItem())
self.menu.append(self.errorItem)
self.menu.append(enableMenuItem)
self.menu.append(configureMenuItem)
self.menu.append(removeMenuItem)
self.menu.append(quitMenuItem)
self.menu.show_all()
self.errorItem.hide()
self.indicator.set_menu(self.menu)
示例4: on_button_press_event
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_PREFERENCES [as 别名]
def on_button_press_event(self, treeview, event):
'''
Displays a context-menu on right button click
Opens the link of a tablecell on CTRL pressed and left button click
'''
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 1 and event.get_state() & Gdk.ModifierType.CONTROL_MASK:
# With CTRL + LEFT-Mouse-Click link of cell is opened
cellvalue = self.fetch_cell_by_event(event, treeview)
linkvalue = self.get_linkurl(cellvalue)
if linkvalue:
self.emit('link-clicked', {'href': str(linkvalue)})
return
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
# Right button opens context menu
self._keep_toolbar_open = True
cellvalue = self.fetch_cell_by_event(event, treeview)
linkvalue = self.get_linkurl(cellvalue)
linkitem_is_activated = (linkvalue is not None)
menu = Gtk.Menu()
for stock, handler, data, tooltip in (
(Gtk.STOCK_ADD, self.on_add_row, None, _('Add row')), # T: menu item
(Gtk.STOCK_DELETE, self.on_delete_row, None, _('Delete row')), # T: menu item
(Gtk.STOCK_COPY, self.on_clone_row, None, _('Clone row')), # T: menu item
(None, None, None, None), # T: menu item
(Gtk.STOCK_JUMP_TO, self.on_open_link, linkvalue, _('Open cell content link')), # T: menu item
(None, None, None, None),
(Gtk.STOCK_GO_UP, self.on_move_row, -1, _('Row up')), # T: menu item
(Gtk.STOCK_GO_DOWN, self.on_move_row, 1, _('Row down')), # T: menu item
(None, None, None, None),
(Gtk.STOCK_PREFERENCES, self.on_change_columns, None, _('Change columns')) # T: menu item
):
if stock is None:
menu.append(Gtk.SeparatorMenuItem())
else:
item = Gtk.ImageMenuItem(stock)
item.set_always_show_image(True)
item.set_label(_(tooltip))
if data:
item.connect_after('activate', handler, data)
else:
item.connect_after('activate', handler)
if handler == self.on_open_link:
item.set_sensitive(linkitem_is_activated)
menu.append(item)
menu.show_all()
gtk_popup_at_pointer(menu, event)