本文整理汇总了Python中gi.repository.Gtk.UIManager方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.UIManager方法的具体用法?Python Gtk.UIManager怎么用?Python Gtk.UIManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.UIManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import UIManager [as 别名]
def __init__(self, uimanager, pageview):
'''Constructor
@param uimanager: a C{Gtk.UIManager}
@param pageview: either a L{PageView} or a L{StubPageView}
'''
# TODO check via abc base class ?
assert hasattr(pageview, 'notebook')
assert hasattr(pageview, 'page')
assert hasattr(pageview, 'get_selection')
assert hasattr(pageview, 'get_word')
assert hasattr(pageview, 'save_changes')
assert hasattr(pageview, 'replace_selection')
self.uimanager = uimanager
self.pageview = pageview
self._manager = CustomToolManager()
self._iconfactory = Gtk.IconFactory()
self._iconfactory.add_default()
self._ui_id = None
self._actiongroup = None
self.add_customtools()
self._manager.connect('changed', self.on_changed)
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import UIManager [as 别名]
def __init__(self):
GObject.GObject.__init__(self)
# XDotWidget
xdotwidget = self.xdotwidget = xdot.DotWidget()
# Toolbar
uimanager = Gtk.UIManager()
actiongroup = Gtk.ActionGroup('Actions')
actiongroup.add_actions((
('ZoomIn', Gtk.STOCK_ZOOM_IN, None, None, None, self.xdotwidget.on_zoom_in),
('ZoomOut', Gtk.STOCK_ZOOM_OUT, None, None, None, self.xdotwidget.on_zoom_out),
('ZoomFit', Gtk.STOCK_ZOOM_FIT, None, None, None, self.xdotwidget.on_zoom_fit),
('Zoom100', Gtk.STOCK_ZOOM_100, None, None, None, self.xdotwidget.on_zoom_100),
))
uimanager.insert_action_group(actiongroup, 0)
uimanager.add_ui_from_string(self.ui)
toolbar = uimanager.get_widget('/ToolBar')
toolbar.set_icon_size(Gtk.IconSize.SMALL_TOOLBAR)
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
toolbar.set_show_arrow(False)
label = self.label = Gtk.Label()
hbox = Gtk.HBox(False, 5)
hbox.pack_start(toolbar, False, True, 0)
hbox.pack_start(label, False, True, 0)
self.pack_start(hbox, False, True, 0)
self.pack_start(xdotwidget, True, True, 0)
示例3: populate_menu_with_actions
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import UIManager [as 别名]
def populate_menu_with_actions(self, scope, menu):
assert scope in (PAGE_EDIT_ACTIONS, PAGE_ROOT_ACTIONS, PAGE_ACCESS_ACTIONS)
uimanager = Gtk.UIManager()
group = get_gtk_actiongroup(self)
uimanager.insert_action_group(group, 0)
xml = _get_xml_for_menu(scope + '_popup')
uimanager.add_ui_from_string(xml)
tmp_menu = uimanager.get_widget('/' + scope + '_popup')
assert isinstance(tmp_menu, Gtk.Menu)
for item in tmp_menu.get_children():
item.reparent(menu)