本文整理汇总了Python中pyqode.core.api.TextHelper.current_line_text方法的典型用法代码示例。如果您正苦于以下问题:Python TextHelper.current_line_text方法的具体用法?Python TextHelper.current_line_text怎么用?Python TextHelper.current_line_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqode.core.api.TextHelper
的用法示例。
在下文中一共展示了TextHelper.current_line_text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _on_post_key_pressed
# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import current_line_text [as 别名]
def _on_post_key_pressed(self, event):
# if we are in disabled cc, use the parent implementation
helper = TextHelper(self.editor)
column = helper.current_column_nbr()
usd = self.editor.textCursor().block().userData()
if usd:
for start, end in usd.cc_disabled_zones:
if (start <= column < end - 1 and
not helper.current_line_text(
).lstrip().startswith('"""')):
return
prev_line = helper.line_text(helper.current_line_nbr() - 1)
is_below_fct_or_class = "def" in prev_line or "class" in prev_line
if (event.text() == '"' and
'""' == helper.current_line_text().strip() and
(is_below_fct_or_class or column == 2)):
self._insert_docstring(prev_line, is_below_fct_or_class)
elif (event.text() == "(" and
helper.current_line_text().lstrip().startswith("def ")):
self._handle_fct_def()
else:
super(PyAutoCompleteMode, self)._on_post_key_pressed(event)