本文整理匯總了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)