本文整理汇总了Python中pyqode.core.api.TextHelper.selected_text方法的典型用法代码示例。如果您正苦于以下问题:Python TextHelper.selected_text方法的具体用法?Python TextHelper.selected_text怎么用?Python TextHelper.selected_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqode.core.api.TextHelper
的用法示例。
在下文中一共展示了TextHelper.selected_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _compute_offsets
# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import selected_text [as 别名]
def _compute_offsets(self):
original_tc = self.editor.textCursor()
tc = self.editor.textCursor()
start = tc.selectionStart()
end = tc.selectionEnd()
tc.setPosition(start)
start_line = tc.blockNumber()
tc.setPosition(end)
end_line = tc.blockNumber()
th = TextHelper(self.editor)
th.select_lines(start=start_line, end=end_line, apply_selection=True)
source = th.selected_text()
results = get_field_infos(source, self.editor.free_format)
self.editor.setTextCursor(original_tc)
self.pic_infos_available.emit(results)
示例2: _computeOffsets
# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import selected_text [as 别名]
def _computeOffsets(self):
original_tc = self.editor.textCursor()
tc = self.editor.textCursor()
assert isinstance(tc, QTextCursor)
start = tc.selectionStart()
end = tc.selectionEnd()
tc.setPosition(start)
start_line = tc.blockNumber() + 1
tc.setPosition(end)
end_line = tc.blockNumber() + 1
th = TextHelper(self.editor)
th.select_lines(start=start_line, end=end_line, apply_selection=True)
source = th.selected_text()
self.picInfosAvailable.emit(get_field_infos(source))
self.editor.setTextCursor(original_tc)