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