当前位置: 首页>>代码示例>>Python>>正文


Python TextBlockHelper.get_fold_trigger_state方法代码示例

本文整理汇总了Python中pyqode.core.api.TextBlockHelper.get_fold_trigger_state方法的典型用法代码示例。如果您正苦于以下问题:Python TextBlockHelper.get_fold_trigger_state方法的具体用法?Python TextBlockHelper.get_fold_trigger_state怎么用?Python TextBlockHelper.get_fold_trigger_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqode.core.api.TextBlockHelper的用法示例。


在下文中一共展示了TextBlockHelper.get_fold_trigger_state方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_item_state_changed

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
 def _on_item_state_changed(self, item):
     if self._updating:
         return
     block = item.data(0, QtCore.Qt.UserRole).block
     assert isinstance(item, QtWidgets.QTreeWidgetItem)
     item_state = not item.isExpanded()
     block_state = TextBlockHelper.get_fold_trigger_state(block)
     if item_state != block_state:
         self._updating = True
         self._folding_panel.toggle_fold_trigger(block)
         self._updating = False
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:13,代码来源:outline.py

示例2: _highlight_surrounding_scopes

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
    def _highlight_surrounding_scopes(self, block):
        """
        Highlights the scopes surrounding the current fold scope.

        :param block: Block that starts the current fold scope.
        """
        scope = FoldScope(block)
        if (self._current_scope is None or
                self._current_scope.get_range() != scope.get_range()):
            self._current_scope = scope
            self._clear_scope_decos()
            # highlight surrounding parent scopes with a darker color
            start, end = scope.get_range()
            if not TextBlockHelper.get_fold_trigger_state(block):
                self._add_scope_decorations(block, start, end)
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:17,代码来源:folding.py

示例3: _on_item_state_changed

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
 def _on_item_state_changed(self, item):
     if self._updating:
         return
     if item == self._root_item:
         item_state = not item.isExpanded()
         if item_state:
             QtCore.QTimer.singleShot(
                 1, self._editor.folding_panel.collapse_all)
         else:
             QtCore.QTimer.singleShot(
                 1, self._editor.folding_panel.expand_all)
     else:
         block = item.data(0, QtCore.Qt.UserRole).block
         assert isinstance(item, QtWidgets.QTreeWidgetItem)
         item_state = not item.isExpanded()
         block_state = TextBlockHelper.get_fold_trigger_state(block)
         if item_state != block_state:
             self._editor.folding_panel.toggle_fold_trigger(block)
开发者ID:dtonal,项目名称:pyqode.cobol,代码行数:20,代码来源:outline.py

示例4: paintEvent

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
 def paintEvent(self, event):
     # Paints the fold indicators and the possible fold region background
     # on the folding panel.
     super(FoldingPanel, self).paintEvent(event)
     painter = QtGui.QPainter(self)
     # Draw background over the selected non collapsed fold region
     if self._mouse_over_line is not None:
         block = self.editor.document().findBlockByNumber(
             self._mouse_over_line)
         try:
             self._draw_fold_region_background(block, painter)
         except ValueError:
             pass
     # Draw fold triggers
     for top_position, line_number, block in self.editor.visible_blocks:
         if TextBlockHelper.is_fold_trigger(block):
             collapsed = TextBlockHelper.get_fold_trigger_state(block)
             mouse_over = self._mouse_over_line == line_number
             self._draw_fold_indicator(
                 top_position, mouse_over, collapsed, painter)
             if collapsed:
                 # check if the block already has a decoration, it might
                 # have been folded by the parent editor/document in the
                 # case of cloned editor
                 for deco in self._block_decos:
                     if deco.block == block:
                         # no need to add a deco, just go to the next block
                         break
                 else:
                     self._add_fold_decoration(block, FoldScope(block))
             else:
                 for deco in self._block_decos:
                     # check if the block decoration has been removed, it
                     # might have been unfolded by the parent
                     # editor/document in the case of cloned editor
                     if deco.block == block:
                         # remove it and
                         self._block_decos.remove(deco)
                         self.editor.decorations.remove(deco)
                         del deco
                         break
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:43,代码来源:folding.py

示例5: convert

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
        def convert(name, editor, to_collapse):
            ti = QtWidgets.QTreeWidgetItem()
            ti.setText(0, name.name)
            ti.setIcon(0, QtGui.QIcon(name.icon))
            name.block = editor.document().findBlockByNumber(name.line)
            ti.setData(0, QtCore.Qt.UserRole, name)
            block_data = name.block.userData()
            if block_data is None:
                block_data = TextBlockUserData()
                name.block.setUserData(block_data)
            block_data.tree_item = ti

            if to_collapse is not None and \
                    TextBlockHelper.get_fold_trigger_state(name.block):
                to_collapse.append(ti)

            for ch in name.children:
                ti_ch, to_collapse = convert(ch, editor, to_collapse)
                if ti_ch:
                    ti.addChild(ti_ch)
            return ti, to_collapse
开发者ID:AlexLee,项目名称:cadquery-freecad-module,代码行数:23,代码来源:document_analyser.py

示例6: _convert_name

# 需要导入模块: from pyqode.core.api import TextBlockHelper [as 别名]
# 或者: from pyqode.core.api.TextBlockHelper import get_fold_trigger_state [as 别名]
    def _convert_name(self, name, editor):
        ti = QtWidgets.QTreeWidgetItem()
        ti.setText(0, name.name)
        ti.setIcon(0, QtGui.QIcon(ICONS[name.node_type]))
        ti.setToolTip(0, name.description)
        name.block = editor.document().findBlockByNumber(name.line)
        ti.setData(0, QtCore.Qt.UserRole, name)

        block_data = name.block.userData()
        if block_data is None:
            block_data = TextBlockUserData()
            name.block.setUserData(block_data)
        block_data.tree_item = ti

        if TextBlockHelper.get_fold_trigger_state(name.block):
            self._to_collapse.append(ti)

        for child in name.children:
            ti_ch = self._convert_name(child, editor)
            ti.addChild(ti_ch)

        return ti
开发者ID:dtonal,项目名称:pyqode.cobol,代码行数:24,代码来源:outline.py


注:本文中的pyqode.core.api.TextBlockHelper.get_fold_trigger_state方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。