当前位置: 首页>>代码示例>>Python>>正文


Python TextHelper.current_line_nbr方法代码示例

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


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

示例1: _in_method_call

# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import current_line_nbr [as 别名]
 def _in_method_call(self):
     helper = TextHelper(self.editor)
     line_nbr = helper.current_line_nbr() - 1
     expected_indent = helper.line_indent() - 4
     while line_nbr >= 0:
         text = helper.line_text(line_nbr)
         indent = len(text) - len(text.lstrip())
         if indent == expected_indent and 'class' in text:
             return True
         line_nbr -= 1
     return False
开发者ID:PierreBizouard,项目名称:pyqode.python,代码行数:13,代码来源:autocomplete.py

示例2: _on_item_clicked

# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import current_line_nbr [as 别名]
 def _on_item_clicked(self, item):
     """
     Go to the item position in the editor.
     """
     if item:
         name = item.data(0, QtCore.Qt.UserRole)
         if name:
             go = name.block.blockNumber()
             helper = TextHelper(self._editor)
             if helper.current_line_nbr() != go:
                 helper.goto_line(go, column=name.column)
             self._editor.setFocus()
开发者ID:sopak,项目名称:cadquery-freecad-module,代码行数:14,代码来源:outline.py

示例3: _on_post_key_pressed

# 需要导入模块: from pyqode.core.api import TextHelper [as 别名]
# 或者: from pyqode.core.api.TextHelper import current_line_nbr [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)
开发者ID:PierreBizouard,项目名称:pyqode.python,代码行数:24,代码来源:autocomplete.py


注:本文中的pyqode.core.api.TextHelper.current_line_nbr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。