def __init__(self, parent=None): super(InteractiveConsole, self).__init__(parent) self.panels = PanelsManager(self) self.decorations = TextDecorationsManager(self) from pyqode.core.panels import SearchAndReplacePanel self.panels.append(SearchAndReplacePanel(), SearchAndReplacePanel.Position.TOP) self._stdout_col = QColor("#404040") self._app_msg_col = QColor("#4040FF") self._stdin_col = QColor("#22AA22") self._stderr_col = QColor("#FF0000") self._write_app_messages = True self._process_name = '' self.process = None self._args = None self._usr_buffer = "" self._clear_on_start = True self._merge_outputs = False self._running = False self._writer = self.write self._user_stop = False font = "monospace" if sys.platform == "win32": font = "Consolas" elif sys.platform == "darwin": font = 'Monaco' self._font_family = font self.setFont(QFont(font, 10)) self.setReadOnly(True) self._mask_user_input = False action = QAction('Copy', self) action.setShortcut(QKeySequence.Copy) action.triggered.connect(self.copy) self.add_action(action) action = QAction('Paste', self) action.setShortcut(QKeySequence.Paste) action.triggered.connect(self.paste) self.add_action(action)
""" Minimal example showing the use of the SearchAndReplacePanel. """ import logging logging.basicConfig(level=logging.DEBUG) import sys from pyqode.qt import QtWidgets from pyqode.core.api import CodeEdit from pyqode.core.backend import server from pyqode.core.panels import SearchAndReplacePanel if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) editor = CodeEdit() editor.backend.start(server.__file__) editor.resize(800, 600) editor.panels.append(SearchAndReplacePanel(), SearchAndReplacePanel.Position.TOP) editor.setPlainText('Pres Ctrl+F to search text in the document', '', '') editor.show() app.exec_() editor.close() del editor del app