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


Python TextHelper.cursor_position方法代码示例

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


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

示例1: _update

# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import cursor_position [as 别名]
 def _update(self, rect, delta_y, force_update_margins=False):
     """ Updates panels """
     helper = TextHelper(self.editor)
     if not self:
         return
     for zones_id, zone in self._panels.items():
         if zones_id == Panel.Position.TOP or \
            zones_id == Panel.Position.BOTTOM:
             continue
         panels = list(zone.values())
         for panel in panels:
             if panel.scrollable and delta_y:
                 panel.scroll(0, delta_y)
             line, col = helper.cursor_position()
             oline, ocol = self._cached_cursor_pos
             if line != oline or col != ocol or panel.scrollable:
                 panel.update(0, rect.y(), panel.width(), rect.height())
             self._cached_cursor_pos = helper.cursor_position()
     if (rect.contains(self.editor.viewport().rect()) or
             force_update_margins):
         self._update_viewport_margins()
开发者ID:AlexLee,项目名称:cadquery-freecad-module,代码行数:23,代码来源:panels.py

示例2: test_matched_selection

# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import cursor_position [as 别名]
def test_matched_selection(editor):
    line, column, text = 233, 14, '''        editor.textCursor(), 'import', QtGui.QTextDocument.FindCaseSensitively'''
    cursor = editor.textCursor()
    assert not cursor.hasSelection()
    helper = TextHelper(editor)
    helper.goto_line(line, column)
    assert helper.cursor_position()[0] == line
    assert helper.cursor_position()[1] == column
    cursor = editor.textCursor()
    helper.match_select()
    cursor = editor.textCursor()
    assert cursor.hasSelection()
    assert text in cursor.selectedText()
开发者ID:dtonal,项目名称:pyqode.core,代码行数:15,代码来源:test_text.py

示例3: test_matched_selection

# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import cursor_position [as 别名]
def test_matched_selection(editor):
    line, column, text = 297, 14, '''__file__'''
    cursor = editor.textCursor()
    assert not cursor.hasSelection()
    helper = TextHelper(editor)
    helper.goto_line(line, column)
    assert helper.cursor_position()[0] == line
    assert helper.cursor_position()[1] == column
    cursor = editor.textCursor()
    helper.match_select()
    cursor = editor.textCursor()
    assert cursor.hasSelection()
    assert text in cursor.selectedText()
开发者ID:SirmoGames,项目名称:pyqode.core,代码行数:15,代码来源:test_text.py

示例4: test_extended_selection

# 需要导入模块: from pyqode.core.api.utils import TextHelper [as 别名]
# 或者: from pyqode.core.api.utils.TextHelper import cursor_position [as 别名]
def test_extended_selection(editor):
    for line, column, text in [(8, 15, 'pyqode.core.api.utils'),
                               (8, 1, 'from')]:
        editor.file.open(__file__)
        QTest.qWait(1000)
        cursor = editor.textCursor()
        assert not cursor.hasSelection()
        helper = TextHelper(editor)
        helper.goto_line(line, column)
        assert helper.cursor_position()[0] == line
        assert helper.cursor_position()[1] == column
        cursor = editor.textCursor()
        assert text in cursor.block().text()
        helper.select_extended_word()
        cursor = editor.textCursor()
        assert cursor.hasSelection()
        assert cursor.selectedText() == text
开发者ID:dtonal,项目名称:pyqode.core,代码行数:19,代码来源:test_text.py


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