本文整理汇总了Python中gazpacho.gadget.Gadget.load方法的典型用法代码示例。如果您正苦于以下问题:Python Gadget.load方法的具体用法?Python Gadget.load怎么用?Python Gadget.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gazpacho.gadget.Gadget
的用法示例。
在下文中一共展示了Gadget.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import load [as 别名]
def load(self, context, widget):
"""This loader is special because of these features:
- It does not load the children of the menubar/toolbar
- Load the uimanager and put its content (action groups) into the
project
"""
# # we need to save the properties of this widget because otherwise
# # when we got it from the uimanager it's gonna be another widget with
# # different properties
# props = {}
# for prop in gobject.list_properties(widget):
# if 1 or prop.flags != gobject.PARAM_READWRITE:
# continue
# if propertyclass.get_type_from_spec(prop) is gobject.TYPE_OBJECT:
# continue
# # FIXME: This need to use the values from the catalog.
# # But it doesn't work right now, the property in
# # klass.properties is always set to False.
# if prop.name == 'parent' or prop.name == 'child':
# continue
# props[prop.name] = widget.get_property(prop.name)
project = context.get_project()
old_name = widget.name
gadget = Gadget.load(widget, project)
gadget._name = gadget.widget.name
# change the widget for the one we get from the uimanager
project.uim.load_widget(gadget, old_name)
return gadget
示例2: load
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import load [as 别名]
def load(self, context, column):
# column is a gtk.TreeViewColumn and we transform it into a
# GazpachoTreeViewColumn
gazpacho_column = GazpachoTreeViewColumn()
gazpacho_column.copy(column)
# copy the renderers also
func = renderer_expert.get_type_based_on_renderer
renderers = column.get_cell_renderers()
cells = [(func(gobject.type_name(r)), r) for r in renderers]
self.create_layout(gazpacho_column, cells)
# now we replace the pure column with the gazpacho column
# the old column is not useful anymore so we can set a custom widget
# just to get its parent. see GTK+ bug #342471
column.set_widget(gtk.Label())
tree_view = get_column_parent(column)
# when pasting a column from the clipboard, it is not attached to a
# tree view yet
if tree_view:
tree_view.remove_column(column)
tree_view.append_column(gazpacho_column)
gazpacho_column.update_widget()
project = context.get_project()
return Gadget.load(gazpacho_column, project)