本文整理汇总了Python中gazpacho.gadget.Gadget.create_widget方法的典型用法代码示例。如果您正苦于以下问题:Python Gadget.create_widget方法的具体用法?Python Gadget.create_widget怎么用?Python Gadget.create_widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gazpacho.gadget.Gadget
的用法示例。
在下文中一共展示了Gadget.create_widget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_box
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import create_widget [as 别名]
def _create_box(self, gtk_source, gtk_target, location):
"""
Create a Box containing the widgets.
@param gtk_source: the gtk widget to add
@type gtk_source: gtk.Gadget
@param gtk_target: the gtk widget to replace
@type gtk_target: gtk.Gadget
@param location: Where to put the source in relation to the target
@type location: (constant value)
"""
from gazpacho.dndhandlers import DND_POS_TOP, DND_POS_BOTTOM, \
DND_POS_LEFT
# Create a Box with size 2
if location in [DND_POS_TOP, DND_POS_BOTTOM]:
box_type = 'GtkVBox'
else:
box_type = 'GtkHBox'
adaptor = widget_registry.get_by_name(box_type)
box_gadget = Gadget(adaptor, self._project)
box_gadget.create_widget(interactive=False)
box_gadget.get_prop('size').set(2)
# Add the source and target widgets
children = box_gadget.widget.get_children()
if location in [DND_POS_TOP, DND_POS_LEFT]:
source_placeholder, target_placeholder = children[0], children[1]
else:
source_placeholder, target_placeholder = children[1], children[0]
Gadget.replace(source_placeholder, gtk_source, box_gadget)
Gadget.replace(target_placeholder, gtk_target, box_gadget)
return box_gadget.widget
示例2: add_tree_view_column
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import create_widget [as 别名]
def add_tree_view_column(self, tree_view, interactive=True):
adaptor = widget_registry.get_by_type(gtk.TreeViewColumn)
project = tree_view.project
try:
column = Gadget(adaptor, project)
column.create_widget(interactive)
except CreationCancelled:
return
cmd = CommandAddRemoveTreeViewColumn(tree_view, column, project, True)
command_manager.execute(cmd, project)
return column
示例3: _execute_create
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import create_widget [as 别名]
def _execute_create(self, location, adaptor, target_gadget):
"""
Execute the create-append or create-extend command.
@param location: the drop location
@type location: dnd constant
@param adaptor: adaptor for creating the class
@type adaptor: L{gazpacho.widgetadaptor.WidgetAdaptor}
@param target_gadget: the gadget where the drop occurred
@type target_gadget: L{gazpacho.gadget.Gadget}
@return: True if the drop was successful
@rtype: bool
"""
project = target_gadget.project
success = False
if self._is_extend_action(location):
gadget = Gadget(adaptor, project)
gadget.create_widget(interactive=True)
cmd = CreateExtendCommand(gadget, target_gadget, location)
command_manager.execute(cmd, project)
success = True
elif self._is_append_action(location):
pos = self._get_append_position(target_gadget.widget, location)
parent = target_gadget.get_parent()
gadget = Gadget(adaptor, project)
gadget.create_widget(interactive=True)
cmd = CreateAppendCommand(gadget, parent, pos)
command_manager.execute(cmd, project)
success = True
if success:
from gazpacho.palette import palette
if not palette.persistent_mode:
palette.unselect_widget()
return success
示例4: _create_gadget
# 需要导入模块: from gazpacho.gadget import Gadget [as 别名]
# 或者: from gazpacho.gadget.Gadget import create_widget [as 别名]
def _create_gadget(project, adaptor, interactive):
from gazpacho.gadget import Gadget
gadget = Gadget(adaptor, project)
gadget.create_widget(interactive)
return gadget