當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。