當前位置: 首頁>>代碼示例>>Python>>正文


Python Gadget.create_widget方法代碼示例

本文整理匯總了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
開發者ID:dsaran,項目名稱:packagehelper,代碼行數:37,代碼來源:box.py

示例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
開發者ID:dsaran,項目名稱:packagehelper,代碼行數:14,代碼來源:treeview.py

示例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
開發者ID:dsaran,項目名稱:packagehelper,代碼行數:43,代碼來源:dndhandlers.py

示例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
開發者ID:dsaran,項目名稱:packagehelper,代碼行數:7,代碼來源:gapi.py


注:本文中的gazpacho.gadget.Gadget.create_widget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。