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


Python QTextCursor.End方法代码示例

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


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

示例1: content

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def content(self, data):
        assert isinstance(data, (bytearray, bytes))
        if isinstance(data, bytes):
            data = bytearray(data)
        self._content = data
        if self.previous.formatted_view:
            self.printable = True
            self.ui.toggle_formatted_view.click()
        elif not all(chr(c) in string.printable for c in self._content):
            # If there are non-printable characters,
            # switch to hex view.
            self.printable = False
            self.ui.toggle_hex_view.click()
        else:
            # Prevent the field from overwriting itself with invalid
            # characters.
            self.printable = True
            self.ui.toggle_text_view.setEnabled(True)
            self.ui.toggle_text_view.click()
            self.text_field.moveCursor(QTextCursor.End)
        self.update_length_field() 
开发者ID:takeshixx,项目名称:deen,代码行数:23,代码来源:encoder.py

示例2: UpdateOutputText

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def UpdateOutputText(self, text):
        """ write console output to text widget """
        cursor = self.process.textCursor()
        cursor.movePosition(QTextCursor.End)
        if isinstance(text, bytes):
            text = text.decode()
        cursor.insertText(text)
        self.process.setTextCursor(cursor)
        self.process.ensureCursorVisible() 
开发者ID:Macr0phag3,项目名称:email_hack,代码行数:11,代码来源:email_hacker-GUI.py

示例3: append_text

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def append_text(self, text):
        """Append new text and scroll output to bottom.

        We can't use Qt's way to append stuff because that inserts weird
        newlines.
        """
        self.moveCursor(QTextCursor.End)
        self.insertPlainText(text)
        scrollbar = self.verticalScrollBar()
        scrollbar.setValue(scrollbar.maximum()) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:12,代码来源:consolewidget.py

示例4: update_content

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def update_content(self):
        new_content = self.terminal.read()
        new_content = self.process_backspaces(new_content)
        if not new_content:
            return

        scrollbar = self.outputTextEdit.verticalScrollBar()
        assert isinstance(scrollbar, QScrollBar)
        # Preserve scroll while updating content
        current_scroll = scrollbar.value()

        prev_cursor = self.outputTextEdit.textCursor()
        self.outputTextEdit.moveCursor(QTextCursor.End)
        # Use any backspaces that were left in input to delete text
        cut = 0
        for x in new_content:
            if x != "\b":
                break
            self.outputTextEdit.textCursor().deletePreviousChar()
            cut += 1
        self.outputTextEdit.insertPlainText(new_content[cut:])
        self.outputTextEdit.setTextCursor(prev_cursor)

        if self._auto_scroll:
            scrollbar.setValue(scrollbar.maximum())
        else:
            scrollbar.setValue(current_scroll) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:29,代码来源:terminal_dialog.py

示例5: updateReceivedDataDisplay

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def updateReceivedDataDisplay(self,str):
        if str != "":
            curScrollValue = self.receiveArea.verticalScrollBar().value()
            self.receiveArea.moveCursor(QTextCursor.End)
            endScrollValue = self.receiveArea.verticalScrollBar().value()
            self.receiveArea.insertPlainText(str)
            if curScrollValue < endScrollValue:
                self.receiveArea.verticalScrollBar().setValue(curScrollValue)
            else:
                self.receiveArea.moveCursor(QTextCursor.End)
        self.statusBarSendCount.setText("%s(bytes):%d" %(parameters.strSend ,self.sendCount))
        self.statusBarReceiveCount.setText("%s(bytes):%d" %(parameters.strReceive ,self.receiveCount)) 
开发者ID:Neutree,项目名称:COMTool,代码行数:14,代码来源:Main.py

示例6: write

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def write(self, msg):
        self.insertPlainText('%s\n' % msg)
        self.moveCursor(QTextCursor.End)
        self._buffer.write(msg) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:6,代码来源:videoconsole.py

示例7: write

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def write(self, text: str, color: QColor) -> None:
        self._cursor.movePosition(QTextCursor.End)
        self._cursor.insertText(text, self._setupFormat(color)) 
开发者ID:thejoeejoee,项目名称:VUT-FIT-IFJ-2017-toolkit,代码行数:5,代码来源:formatted_text_writer.py

示例8: logOutput

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def logOutput(self, log):
        # 获取当前系统时间
        time = datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')
        log = time + ' ' + log + '\n'

        self.logTextEdit.moveCursor(QTextCursor.End)
        self.logTextEdit.insertPlainText(log)
        self.logTextEdit.ensureCursorVisible()  # 自动滚屏

    # 系统对话框 
开发者ID:winterssy,项目名称:face_recognition_py,代码行数:12,代码来源:dataRecord.py

示例9: logOutput

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def logOutput(self, log):
        time = datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')
        log = time + ' ' + log + '\n'

        self.logTextEdit.moveCursor(QTextCursor.End)
        self.logTextEdit.insertPlainText(log)
        self.logTextEdit.ensureCursorVisible()  # 自动滚屏

    # 系统对话框 
开发者ID:winterssy,项目名称:face_recognition_py,代码行数:11,代码来源:dataManage.py

示例10: appendText

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def appendText(self, text):
        # GUI CLEAR SIGNAL is a string that will be printed by RunMultiCMD to
        # indicate a clear screen to this widget
        if text == GUI_CLEAR_SIGNAL:
            self.ui.textEdit.clear()
            return

        self.ui.textEdit.moveCursor(QTextCursor.End)
        self.ui.textEdit.insertPlainText(text) 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:11,代码来源:AnalysisProgress.py

示例11: loadSigLogFile

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def loadSigLogFile(self):
        """读取本地信号日志并写入界面"""
        sigLogPath = r"./log/trade.dat"
        with open(sigLogPath, "r", encoding="utf-8") as f:
            data = f.read()
        self.signal_log_widget.setText(data)
        self.signal_log_widget.moveCursor(QTextCursor.End) 
开发者ID:epolestar,项目名称:equant,代码行数:9,代码来源:view.py

示例12: loadSysLogFile

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def loadSysLogFile(self):
        """读取本地系统日志"""
        sysLogPath = r"./log/equant.log"
        # with open(sysLogPath, "r", encoding="utf-8") as f:
        with open(sysLogPath, "r") as f:
            data = f.read()
        self.sys_log_widget.setText(data)
        self.sys_log_widget.moveCursor(QTextCursor.End) 
开发者ID:epolestar,项目名称:equant,代码行数:10,代码来源:view.py

示例13: append_to_console

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def append_to_console(self, text):
        self.consoleArea.moveCursor(QTextCursor.End)
        self.consoleArea.insertHtml(text) 
开发者ID:PIVX-Project,项目名称:PIVX-SPMT,代码行数:5,代码来源:mainWindow.py

示例14: append_data

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def append_data(self, msg):
        """
        Add data to the end of the text area.
        """
        cursor = self.text_area.textCursor()
        cursor.movePosition(QTextCursor.End)
        cursor.insertText(msg)
        cursor.movePosition(QTextCursor.End)
        self.text_area.setTextCursor(cursor) 
开发者ID:mu-editor,项目名称:mu,代码行数:11,代码来源:dialogs.py

示例15: test_MicroPythonREPLPane_process_bytes

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import End [as 别名]
def test_MicroPythonREPLPane_process_bytes(qtapp):
    """
    Ensure bytes coming from the device to the application are processed as
    expected. Backspace is enacted, carriage-return is ignored, newline moves
    the cursor position to the end of the line before enacted and all others
    are simply inserted.
    """
    mock_serial = mock.MagicMock()
    mock_tc = mock.MagicMock()
    mock_tc.movePosition = mock.MagicMock(
        side_effect=[True, False, True, True]
    )
    mock_tc.deleteChar = mock.MagicMock(return_value=None)
    rp = mu.interface.panes.MicroPythonREPLPane(mock_serial)
    rp.textCursor = mock.MagicMock(return_value=mock_tc)
    rp.setTextCursor = mock.MagicMock(return_value=None)
    rp.insertPlainText = mock.MagicMock(return_value=None)
    rp.ensureCursorVisible = mock.MagicMock(return_value=None)
    bs = bytes([8, 13, 10, 65])  # \b, \r, \n, 'A'
    rp.process_bytes(bs)
    rp.textCursor.assert_called_once_with()
    assert mock_tc.movePosition.call_count == 4
    assert mock_tc.movePosition.call_args_list[0][0][0] == QTextCursor.Down
    assert mock_tc.movePosition.call_args_list[1][0][0] == QTextCursor.Down
    assert mock_tc.movePosition.call_args_list[2][0][0] == QTextCursor.Left
    assert mock_tc.movePosition.call_args_list[3][0][0] == QTextCursor.End
    assert rp.setTextCursor.call_count == 3
    assert rp.setTextCursor.call_args_list[0][0][0] == mock_tc
    assert rp.setTextCursor.call_args_list[1][0][0] == mock_tc
    assert rp.setTextCursor.call_args_list[2][0][0] == mock_tc
    assert rp.insertPlainText.call_count == 2
    assert rp.insertPlainText.call_args_list[0][0][0] == chr(10)
    assert rp.insertPlainText.call_args_list[1][0][0] == chr(65)
    rp.ensureCursorVisible.assert_called_once_with() 
开发者ID:mu-editor,项目名称:mu,代码行数:36,代码来源:test_panes.py


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