Python TextHelper.line_nbr_from_position方法代码示例

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


Python TextHelper.line_nbr_from_position方法代码示例

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

示例1: mouseMoveEvent

# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import line_nbr_from_position [as 别名]
    def mouseMoveEvent(self, event):
        """
        Detect mouser over indicator and highlight the current scope in the
        editor (up and down decoration arround the foldable text when the mouse
        is over an indicator).

        :param event: event
        """
        super(FoldingPanel, self).mouseMoveEvent(event)
        th = TextHelper(self.editor)
        line = th.line_nbr_from_position(event.pos().y())
        if line >= 0:
            block = FoldScope.find_parent_scope(
                self.editor.document().findBlockByNumber(line))
            if TextBlockHelper.is_fold_trigger(block):
                if self._mouse_over_line is None:
                    # mouse enter fold scope
                    QtWidgets.QApplication.setOverrideCursor(
                        QtGui.QCursor(QtCore.Qt.PointingHandCursor))
                if self._mouse_over_line != block.blockNumber() and \
                        self._mouse_over_line is not None:
                    # fold scope changed, a previous block was highlighter so
                    # we quickly update our highlighting
                    self._mouse_over_line = block.blockNumber()
                    self._highlight_surrounding_scopes(block)
                else:
                    # same fold scope, request highlight
                    self._mouse_over_line = block.blockNumber()
                    self._highlight_runner.request_job(
                        self._highlight_surrounding_scopes, block)
                self._highight_block = block
            else:
                # no fold scope to highlight, cancel any pending requests
                self._highlight_runner.cancel_requests()
                self._mouse_over_line = None
                QtWidgets.QApplication.restoreOverrideCursor()
            self.repaint()
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:39,代码来源:folding.py

本文标签属性:

示例:示例志愿表

代码:代码生成器

Python:python什么意思

上一篇:Java Style.setBackgroundColor方法代码示例
下一篇:Python scipy.arcsin函数代码示例

为您推荐