本文整理汇总了Python中pyqode.core.api.utils.TextHelper.line_pos_from_number方法的典型用法代码示例。如果您正苦于以下问题:Python TextHelper.line_pos_from_number方法的具体用法?Python TextHelper.line_pos_from_number怎么用?Python TextHelper.line_pos_from_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqode.core.api.utils.TextHelper
的用法示例。
在下文中一共展示了TextHelper.line_pos_from_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _draw_fold_region_background
# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import line_pos_from_number [as 别名]
def _draw_fold_region_background(self, block, painter):
"""
Draw the fold region when the mouse is over and non collapsed
indicator.
:param top: Top position
:param block: Current block.
:param painter: QPainter
"""
r = folding.FoldScope(block)
th = TextHelper(self.editor)
start, end = r.get_range(ignore_blank_lines=True)
if start > 0:
top = th.line_pos_from_number(start)
else:
top = 0
bottom = th.line_pos_from_number(end + 1)
h = bottom - top
if h == 0:
h = self.sizeHint().height()
w = self.sizeHint().width()
self._draw_rect(QtCore.QRectF(0, top, w, h), painter)