Python PyQt5.QtWidgets 模块,QPlainTextEdit() 实例源码

我们从Python开源项目中,提取了以下35个代码示例,用于说明如何使用PyQt5.QtWidgets.QPlainTextEdit()

项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, parent ):
        self.app = app

        super().__init__( parent )

        self.setWindowTitle( T_('Lock files') )

        self.details = QtWidgets.QPlainTextEdit( '' )
        self.message = QtWidgets.QPlainTextEdit( '' )

        self.force = QtWidgets.QCheckBox( T_('force files to be locked') )
        self.force.setCheckState( QtCore.Qt.Unchecked )

        em = self.fontMetrics().width( 'M' )

        self.addNamedDivider( 'Files to Lock' )
        self.addRow( None, self.details, min_width=60*em )
        self.addNamedDivider( 'Lock Message' )
        self.addRow( None, self.message )
        self.addRow( T_('Force'), self.force )
        self.addButtons()
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, parent ):
        self.app = app

        super().__init__( parent )

        self.setWindowTitle( T_('UnLock files') )

        self.details = QtWidgets.QPlainTextEdit( '' )
        self.force = QtWidgets.QCheckBox( T_('force files to be unlocked') )
        self.force.setCheckState( QtCore.Qt.Unchecked )

        em = self.fontMetrics().width( 'M' )

        self.addNamedDivider( 'Files to Unlock' )
        self.addRow( None, self.details, min_width=60*em )
        self.addRow( T_('Force'), self.force )
        self.addButtons()
项目:FuME    作者:fupadev    | 项目源码 | 文件源码
def setupUi(self, Log):
        Log.setObjectName("Log")
        Log.resize(631, 264)
        self.gridLayout = QtWidgets.QGridLayout(Log)
        self.gridLayout.setObjectName("gridLayout")
        self.buttonBox = QtWidgets.QDialogButtonBox(Log)
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 0, 1, 1, 1)
        self.plainTextEdit = QtWidgets.QPlainTextEdit(Log)
        self.plainTextEdit.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.gridLayout.addWidget(self.plainTextEdit, 0, 0, 1, 1)

        self.retranslateUi(Log)
        self.buttonBox.accepted.connect(Log.accept)
        self.buttonBox.rejected.connect(Log.reject)
        QtCore.QMetaObject.connectSlotsByName(Log)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, extraData, sheetview, sheethandler):
            super().__init__()

            self.data = extraData

            self.sheetview = sheetview
            self.sheethandler = sheethandler

            self.containerWidgetLayout = QFormLayout(self)
            self.containerWidgetLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
            self.containerWidgetLayout.setContentsMargins(6, 6, 6, 6)

            self.containerWidgetLayout.addRow("Enter contents of your string below", None)

            self.plainTextEdit = QPlainTextEdit()
            if "string" in self.data:
                self.plainTextEdit.setPlainText(self.data["string"])
            self.plainTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.containerWidgetLayout.addRow(self.plainTextEdit)

            self.okButton = QPushButton()
            self.okButton.setText("Ok")
            self.okButton.clicked.connect(self.okclicked)
            self.containerWidgetLayout.addRow(self.okButton)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, extraData, sheetview, sheethandler):
            super().__init__()

            self.data = extraData

            self.sheetview = sheetview
            self.sheethandler = sheethandler

            self.containerWidgetLayout = QFormLayout(self)
            self.containerWidgetLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
            self.containerWidgetLayout.setContentsMargins(6, 6, 6, 6)

            self.containerWidgetLayout.addRow("Enter the names of sheets that are in the mix (one sheet per line):", None)

            self.plainTextEdit = QPlainTextEdit()
            if "string" in self.data:
                self.plainTextEdit.setPlainText(self.data["string"])
            self.plainTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.containerWidgetLayout.addRow(self.plainTextEdit)

            self.okButton = QPushButton()
            self.okButton.setText("Ok")
            self.okButton.clicked.connect(self.okclicked)
            self.containerWidgetLayout.addRow(self.okButton)
项目:Crawler_UI_New    作者:crystalhsj    | 项目源码 | 文件源码
def setupUi(self, Help):
        Help.setObjectName("Help")
        Help.resize(300, 400)
        Help.setMinimumSize(QtCore.QSize(300, 400))
        Help.setMaximumSize(QtCore.QSize(300, 400))
        self.plainTextEdit = QtWidgets.QPlainTextEdit(Help)
        self.plainTextEdit.setGeometry(QtCore.QRect(0, 0, 301, 341))
        self.plainTextEdit.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.pushButton = QtWidgets.QPushButton(Help)
        self.pushButton.setGeometry(QtCore.QRect(100, 360, 99, 27))
        self.pushButton.setObjectName("pushButton")

        self.retranslateUi(Help)
        self.pushButton.clicked.connect(Help.close)
        QtCore.QMetaObject.connectSlotsByName(Help)
项目:BAG_framework    作者:ucb-art    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtWidgets.QFrame.__init__(self, parent=parent)

        self.logger = QtWidgets.QPlainTextEdit(parent=self)
        self.logger.setReadOnly(True)
        self.logger.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        self.logger.setMinimumWidth(1100)
        self.buffer = ''

        self.clear_button = QtWidgets.QPushButton('Clear Log', parent=self)
        self.clear_button.clicked.connect(self.clear_log)
        self.save_button = QtWidgets.QPushButton('Save Log As...', parent=self)
        self.save_button.clicked.connect(self.save_log)

        self.lay = QtWidgets.QVBoxLayout(self)
        self.lay.addWidget(self.logger)
        self.lay.addWidget(self.clear_button)
        self.lay.addWidget(self.save_button)
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def _select_text_on_widget(widget, selection_start, selection_end):
    if isinstance(widget, QtWidgets.QPlainTextEdit):
        cursor = widget.textCursor()
        cursor.setPosition(selection_start)
        cursor.setPosition(selection_end, QtGui.QTextCursor.KeepAnchor)
        widget.setTextCursor(cursor)
    elif isinstance(widget, QtWidgets.QLineEdit):
        widget.setSelection(selection_start, selection_end - selection_start)
    else:
        assert False, 'Unknown widget type'
    widget.setFocus()
项目:notepad    作者:lfsando    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.text_editor = QPlainTextEdit()
        self.syntax = PythonHighlighter(self.text_editor.document())

        self.init_ui()
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, title ):
        self.app = app

        super().__init__()

        self.setWindowTitle( title )
        self.setWindowIcon( self.app.getAppQIcon() )

        self.label_outgoing = QtWidgets.QLabel( T_('Outgoing commits') )
        self.outgoing = QtWidgets.QPlainTextEdit( '' )
        self.outgoing.setReadOnly( True )

        self.label_incoming = QtWidgets.QLabel( T_('Incoming commits') )
        self.incoming = QtWidgets.QPlainTextEdit( '' )
        self.incoming.setReadOnly( True )

        self.label_modified = QtWidgets.QLabel( T_('Modified Files') )
        self.modified = QtWidgets.QPlainTextEdit( '' )
        self.modified.setReadOnly( True )

        self.label_untracked = QtWidgets.QLabel( T_('Untracked Files') )
        self.untracked = QtWidgets.QPlainTextEdit( '' )
        self.untracked.setReadOnly( True )

        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget( self.label_outgoing )
        self.layout.addWidget( self.outgoing )
        self.layout.addWidget( self.label_incoming )
        self.layout.addWidget( self.incoming )
        self.layout.addWidget( self.label_modified )
        self.layout.addWidget( self.modified )
        self.layout.addWidget( self.label_untracked )
        self.layout.addWidget( self.untracked )

        self.setLayout( self.layout )

        em = self.app.fontMetrics().width( 'm' )
        ex = self.app.fontMetrics().lineSpacing()
        self.resize( 100*em, 50*ex )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, parent, title, all_rebase_commands, commit_message=None ):
        self.app = app

        super().__init__( parent )

        self.setWindowTitle( title )

        em = self.fontMetrics().width( 'M' )

        self.rebase_details = QtWidgets.QPlainTextEdit()
        self.rebase_details.setReadOnly( True )
        self.rebase_details.setFont( app.getCodeFont() )

        self.addNamedDivider( T_('Rebase Details') )
        self.addRow( None, self.rebase_details, min_width=em*80 )

        if commit_message is not None:
            self.commit_message = QtWidgets.QPlainTextEdit()
            self.commit_message.setFont( app.getCodeFont() )
            self.commit_message.textChanged.connect( self.commitMessageChanged )

            self.addNamedDivider( T_('New Commit Message') )
            self.addRow( None, self.commit_message, min_width=em*80 )

        else:
            self.commit_message = None

        self.addButtons()

        # turn rebase details into a block of text
        all_details_text = []
        for detail_row in all_rebase_commands:
            all_details_text.append( ' '.join( detail_row ) )

        self.rebase_details.setPlainText( '\n'.join( all_details_text ) )

        if commit_message is not None:
            self.commit_message.setPlainText( commit_message )
            self.commitMessageChanged()
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, title ):
        self.app = app

        super().__init__()

        self.setWindowTitle( title )
        self.setWindowIcon( self.app.getAppQIcon() )

        self.label_unpushed = QtWidgets.QLabel( T_('Unpushed commits') )
        self.unpushed = QtWidgets.QPlainTextEdit( '' )
        self.unpushed.setReadOnly( True )

        self.label_staged = QtWidgets.QLabel( T_('Staged Files') )
        self.staged = QtWidgets.QPlainTextEdit( '' )
        self.staged.setReadOnly( True )

        self.label_untracked = QtWidgets.QLabel( T_('Untracked Files') )
        self.untracked = QtWidgets.QPlainTextEdit( '' )
        self.untracked.setReadOnly( True )

        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget( self.label_unpushed )
        self.layout.addWidget( self.unpushed )
        self.layout.addWidget( self.label_staged )
        self.layout.addWidget( self.staged )
        self.layout.addWidget( self.label_untracked )
        self.layout.addWidget( self.untracked )

        self.setLayout( self.layout )

        em = self.app.fontMetrics().width( 'm' )
        ex = self.app.fontMetrics().lineSpacing()
        self.resize( 100*em, 50*ex )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, parent, title, error_message ):
        self.app = app

        super().__init__( parent, cancel=False )

        self.setWindowTitle( title )

        self.error_message = QtWidgets.QPlainTextEdit( self )
        self.error_message.setReadOnly( True )
        self.error_message.insertPlainText( error_message )
        self.setFont( self.app.getCodeFont() )

        em = self.fontMetrics().width( 'M' )
        self.addRow( None, self.error_message, min_width=em*60 )
        self.addButtons()
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def addWidget(self, widget):
        super().addWidget(widget)
        if isinstance(widget, QtWidgets.QPlainTextEdit):
            self.text_preview = widget
        if isinstance(widget, QtWidgets.QGraphicsView):
            self.graphics_preview = widget
项目:sequana    作者:sequana    | 项目源码 | 文件源码
def __init__(self, parent):
        super().__init__()
        self.widget = QW.QPlainTextEdit(parent)
        self.widget.setReadOnly(True)
        self.bgcolor = "#aabbcc"
        self.widget.setStyleSheet("background-color: %s" % self.bgcolor)

        self.widget.setStyleSheet("""* {
            selection-background-color: #5964FF;
            background-color: %s
            }""" % self.bgcolor);
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def __init__(self, mem, syms=None, parent=None):
        e_memcanvas.MemoryCanvas.__init__(self, mem, syms=syms)
        QtWidgets.QPlainTextEdit.__init__(self, parent=parent)

        self.setReadOnly(True)
        self.cursorPositionChanged.connect(self._cursorChanged)

        self._highlighter = VivCanvasColors()
        self.setCurrentCharFormat(self._highlighter.getFormat(ContentTagsEnum.DEFAULT))
        self._cur_line_bg_color = self._highlighter.getColors(ContentTagsEnum.CURRENT_LINE)[1]

        self._canv_cache = None
        self._canv_curva = None
        self._canv_rend_middle = False
        self._do_heavy_highlight = False

        # keep track of highlighted blocks
        self._high_blocks = dict()
        self._high_bg_color = self._highlighter.getColors(ContentTagsEnum.HIGHLIGHT)[1]
        self._high_bg = QtGui.QBrush(self._high_bg_color)

        # Allow our parent to handle these...
        self.setAcceptDrops(False)

        # in case we want this canvas to display only a fixed amount of data at any time
        # useful for the function graph where one canvas renders one basic block of code etc.
        self._fixed_location = False
        # also in such cases we would like to know when the rendering of the given fixed region is done
        # because this rendering is done asynchronously in another thread
        self._render_counter = 0
        self._render_counter_lock = threading.Lock()

        self._max_text_width = 0
        self._cur_line_width = 0
        self._lines_height = 0
项目:CRIkit2    作者:CoherentRamanNIST    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(389, 239)
        Dialog.setStyleSheet("font: 10pt \"Arial\";")
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(10)
        font.setItalic(False)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignTop)
        self.comboBox = QtWidgets.QComboBox(Dialog)
        self.comboBox.setObjectName("comboBox")
        self.verticalLayout.addWidget(self.comboBox)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.plainTextEditDescription = QtWidgets.QPlainTextEdit(Dialog)
        self.plainTextEditDescription.setReadOnly(True)
        self.plainTextEditDescription.setObjectName("plainTextEditDescription")
        self.verticalLayout.addWidget(self.plainTextEditDescription)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(911, 688)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(Form)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.splitter = QtWidgets.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.editorBox = QtWidgets.QGroupBox(self.splitter)
        self.editorBox.setObjectName("editorBox")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.editorBox)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.plainTextEdit = QtWidgets.QPlainTextEdit(self.editorBox)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.verticalLayout_2.addWidget(self.plainTextEdit)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.clearButton = QtWidgets.QPushButton(self.editorBox)
        self.clearButton.setObjectName("clearButton")
        self.horizontalLayout.addWidget(self.clearButton)
        self.previewButton = QtWidgets.QPushButton(self.editorBox)
        self.previewButton.setObjectName("previewButton")
        self.horizontalLayout.addWidget(self.previewButton)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.horizontalLayout_2.addLayout(self.verticalLayout_2)
        self.previewerBox = QtWidgets.QGroupBox(self.splitter)
        self.previewerBox.setObjectName("previewerBox")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.previewerBox)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.webView = QtWebKitWidgets.QWebView(self.previewerBox)
        self.webView.setUrl(QtCore.QUrl("about:blank"))
        self.webView.setObjectName("webView")
        self.horizontalLayout_3.addWidget(self.webView)
        self.horizontalLayout_4.addWidget(self.splitter)

        self.retranslateUi(Form)
        self.clearButton.clicked.connect(self.plainTextEdit.clear)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:kalbur    作者:ahmetax    | 项目源码 | 文件源码
def setupUi(self, dlgDerlem):
        dlgDerlem.setObjectName("dlgDerlem")
        dlgDerlem.resize(656, 460)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(dlgDerlem)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.editGirdi = QtWidgets.QPlainTextEdit(dlgDerlem)
        self.editGirdi.setObjectName("editGirdi")
        self.verticalLayout.addWidget(self.editGirdi)
        self.editCikti = QtWidgets.QPlainTextEdit(dlgDerlem)
        self.editCikti.setObjectName("editCikti")
        self.verticalLayout.addWidget(self.editCikti)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.btnSecenekler = QtWidgets.QPushButton(dlgDerlem)
        self.btnSecenekler.setObjectName("btnSecenekler")
        self.horizontalLayout.addWidget(self.btnSecenekler)
        self.btnGirdiDosyasiSec = QtWidgets.QPushButton(dlgDerlem)
        self.btnGirdiDosyasiSec.setObjectName("btnGirdiDosyasiSec")
        self.horizontalLayout.addWidget(self.btnGirdiDosyasiSec)
        self.btnDonustur = QtWidgets.QPushButton(dlgDerlem)
        self.btnDonustur.setObjectName("btnDonustur")
        self.horizontalLayout.addWidget(self.btnDonustur)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.btnKaydet = QtWidgets.QPushButton(dlgDerlem)
        self.btnKaydet.setObjectName("btnKaydet")
        self.horizontalLayout.addWidget(self.btnKaydet)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2.addLayout(self.verticalLayout)

        self.retranslateUi(dlgDerlem)
        self.btnSecenekler.clicked.connect(dlgDerlem.secenekler)
        self.btnGirdiDosyasiSec.clicked.connect(dlgDerlem.dosyasec)
        self.btnDonustur.clicked.connect(dlgDerlem.donustur)
        self.btnKaydet.clicked.connect(dlgDerlem.kaydet)
        QtCore.QMetaObject.connectSlotsByName(dlgDerlem)
项目:mlox    作者:mlox    | 项目源码 | 文件源码
def __init__(self):
        QDialog.__init__(self)
        self.setModal(False)

        self.inner_text = QPlainTextEdit(self)
        self.inner_text.setReadOnly(True)

        self.setFixedSize(400, 600)
        self.inner_text.setFixedSize(400, 600)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(911, 688)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(Form)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.splitter = QtWidgets.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.editorBox = QtWidgets.QGroupBox(self.splitter)
        self.editorBox.setObjectName("editorBox")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.editorBox)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.plainTextEdit = QtWidgets.QPlainTextEdit(self.editorBox)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.verticalLayout_2.addWidget(self.plainTextEdit)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.clearButton = QtWidgets.QPushButton(self.editorBox)
        self.clearButton.setObjectName("clearButton")
        self.horizontalLayout.addWidget(self.clearButton)
        self.previewButton = QtWidgets.QPushButton(self.editorBox)
        self.previewButton.setObjectName("previewButton")
        self.horizontalLayout.addWidget(self.previewButton)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.horizontalLayout_2.addLayout(self.verticalLayout_2)
        self.previewerBox = QtWidgets.QGroupBox(self.splitter)
        self.previewerBox.setObjectName("previewerBox")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.previewerBox)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.webView = QtWebKitWidgets.QWebView(self.previewerBox)
        self.webView.setUrl(QtCore.QUrl("about:blank"))
        self.webView.setObjectName("webView")
        self.horizontalLayout_3.addWidget(self.webView)
        self.horizontalLayout_4.addWidget(self.splitter)

        self.retranslateUi(Form)
        self.clearButton.clicked.connect(self.plainTextEdit.clear)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, *args):
            QtWidgets.QPlainTextEdit.__init__(self, *args)
            self.setFrameStyle(QtWidgets.QFrame.NoFrame)
            self.zoomWheelEnabled = 0
            self.highlight()
            #self.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
            self.cursorPositionChanged.connect(self.highlight)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def wheelEvent(self, event, forward=True):
            if event.modifiers() == QtCore.Qt.ControlModifier:
                if self.zoomWheelEnabled == 1:
                    if event.delta() == 120:
                        self.zoom_in()
                    elif event.delta() == -120:
                        self.zoom_out()
                event.ignore()
            QtWidgets.QPlainTextEdit.wheelEvent(self, event)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setWrap(self, state):
        if state == 0:
            self.edit.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        else:
            self.edit.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setReadOnlyStyle(self, state):
        if state == 1:
            mainWindowBgColor = QtWidgets.QPalette().color(QtWidgets.QPalette.Window)
            self.setStyleSheet('QPlainTextEdit[readOnly="true"] { background-color: %s;} QFrame {border: 0px}' % mainWindowBgColor.name() )
            self.setHighlight(0)
        else:
            self.setStyleSheet('')
            self.setHighlight(1)
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def _get_selection_from_widget(widget):
    if isinstance(widget, QtWidgets.QPlainTextEdit):
        cursor = widget.textCursor()
        return (cursor.selectionStart(), cursor.selectionEnd())
    elif isinstance(widget, QtWidgets.QLineEdit):
        return (
            widget.selectionStart(),
            widget.selectionStart() + len(widget.selectedText()))
    else:
        assert False, 'Unknown widget type'
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def _get_widget_text(widget):
    if isinstance(widget, QtWidgets.QPlainTextEdit):
        return widget.toPlainText()
    elif isinstance(widget, QtWidgets.QLineEdit):
        return widget.text()
    else:
        assert False, 'Unknown widget type'
项目:bubblesub    作者:rr-    | 项目源码 | 文件源码
def _set_widget_text(widget, text):
    if isinstance(widget, QtWidgets.QPlainTextEdit):
        widget.document().setPlainText(text)
    elif isinstance(widget, QtWidgets.QLineEdit):
        widget.setText(text)
    else:
        assert False, 'Unknown widget type'
项目:solar-sails    作者:metrasynth    | 项目源码 | 文件源码
def setUp(self, ui):
        super().setUp(ui)
        self.textedit = QPlainTextEdit(self)
        items = self.value.items() if hasattr(self.value, 'items') else self.value
        self.textedit.setPlainText('\n'.join('='.join(item) for item in items))
        self.textedit.textChanged.connect(self.on_textedit_textChanged)
        self.textedit.setTabChangesFocus(True)
        self.layout.addWidget(self.textedit)
项目:solar-sails    作者:metrasynth    | 项目源码 | 文件源码
def setUp(self, ui):
        super().setUp(ui)
        self.textedit = QPlainTextEdit(self)
        self.textedit.setPlainText('\n'.join(self.value))
        self.textedit.textChanged.connect(self.on_textedit_textChanged)
        self.textedit.setTabChangesFocus(True)
        self.layout.addWidget(self.textedit)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def create_textbox_dialog(content: str, title: str, parent) -> QDialog:
    d = QDialog(parent)
    d.resize(800, 600)
    d.setWindowTitle(title)
    layout = QVBoxLayout(d)
    text_edit = QPlainTextEdit(content)
    text_edit.setReadOnly(True)
    layout.addWidget(text_edit)
    d.setLayout(layout)
    return d
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(911, 688)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(Form)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.splitter = QtWidgets.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.editorBox = QtWidgets.QGroupBox(self.splitter)
        self.editorBox.setObjectName("editorBox")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.editorBox)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.plainTextEdit = QtWidgets.QPlainTextEdit(self.editorBox)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.verticalLayout_2.addWidget(self.plainTextEdit)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.clearButton = QtWidgets.QPushButton(self.editorBox)
        self.clearButton.setObjectName("clearButton")
        self.horizontalLayout.addWidget(self.clearButton)
        self.previewButton = QtWidgets.QPushButton(self.editorBox)
        self.previewButton.setObjectName("previewButton")
        self.horizontalLayout.addWidget(self.previewButton)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.horizontalLayout_2.addLayout(self.verticalLayout_2)
        self.previewerBox = QtWidgets.QGroupBox(self.splitter)
        self.previewerBox.setObjectName("previewerBox")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.previewerBox)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.webView = QtWebKitWidgets.QWebView(self.previewerBox)
        self.webView.setUrl(QtCore.QUrl("about:blank"))
        self.webView.setObjectName("webView")
        self.horizontalLayout_3.addWidget(self.webView)
        self.horizontalLayout_4.addWidget(self.splitter)

        self.retranslateUi(Form)
        self.clearButton.clicked.connect(self.plainTextEdit.clear)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(LogDialog, self).__init__()
        self.parent = parent
        self.logwindow = QPlainTextEdit(parent=self.parent)
        self.logwindow.setReadOnly(True)
        self.logwindow.setStyleSheet("QPlainTextEdit {background-color:gray}")
        layout = QVBoxLayout(self)
        layout.addWidget(self.logwindow)
        self.setWindowIcon(get_icon("log_file.png"))
        self.setWindowTitle("Log record")
项目:notepad    作者:lfsando    | 项目源码 | 文件源码
def __init__(self, window_width=1000, window_height=950):
        super().__init__()

        # Initialize Plain Text Widget

        self.text_widget = QtWidgets.QPlainTextEdit()

        # Default Mode to Insertion

        self.insert = True

        # EventFilter FocusOut

        self._filter = Filter()

        # Setup Shortcuts

        self.shift_tab = QtWidgets.QShortcut(QtGui.QKeySequence('Shift+Tab'), self)
        #self.shift_tab.activated.setFocus()

        # Default start up File

        self.file_name = 'Untitled.txt'
        self.file_path = ['/', '']
        self.file_type = self.file_name.split('.')[-1]
        self.syntax = highlighter.PythonHighlighter(self.text_widget.document())
        self.assign_syntax_def()

        # Initialize Menus

        self.menu_bar = self.menuBar()
        self.file_menu()
        self.edit_menu()
        self.format_menu()
        self.preferences_menu()
        self.finder_toolbar()

        # Set Default Pallete

        self.default_visual()

        # Initialize UI Related Properties

        self.notepad_ui()

        self.setCentralWidget(self.text_widget)
        self.setWindowIcon(QtGui.QIcon('assets/icons/notepad.png'))
        self.resize(window_width, window_height)

        # Center the main window to the screen
        self.center()
        self.show()
项目:well-being-diary    作者:SunyataZero    | 项目源码 | 文件源码
def keyPressEvent(self, iQKeyEvent):
        if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
            if iQKeyEvent.key() == QtCore.Qt.Key_Enter or iQKeyEvent.key() == QtCore.Qt.Key_Return:
                logging.debug("CtrlModifier + Enter/Return")
                self.ref_central.add_text_to_diary()
                self.key_press_down_for_question_list_signal.emit()
                # -TODO: Change name of signals to focus on goal rather than origin
                return
        elif QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.AltModifier:
            if iQKeyEvent.key() == QtCore.Qt.Key_Down:
                logging.debug("AltModifier + Key_Down")
                self.key_press_down_for_question_list_signal.emit()
                return
            elif iQKeyEvent.key() == QtCore.Qt.Key_Up:
                logging.debug("AltModifier + Key_Up")
                self.key_press_up_for_question_list_signal.emit()
                return
            elif iQKeyEvent.key() >= QtCore.Qt.Key_1 or iQKeyEvent.key() >= QtCore.Qt.Key_9:
                logging.debug("AltModifier + Key_0-9")
                new_row_int = 0
                if iQKeyEvent.key() == QtCore.Qt.Key_1:
                    new_row_int = 0
                elif iQKeyEvent.key() == QtCore.Qt.Key_2:
                    new_row_int = 1
                elif iQKeyEvent.key() == QtCore.Qt.Key_3:
                    new_row_int = 2
                elif iQKeyEvent.key() == QtCore.Qt.Key_4:
                    new_row_int = 3
                elif iQKeyEvent.key() == QtCore.Qt.Key_5:
                    new_row_int = 4
                elif iQKeyEvent.key() == QtCore.Qt.Key_6:
                    new_row_int = 5
                elif iQKeyEvent.key() == QtCore.Qt.Key_7:
                    new_row_int = 6
                elif iQKeyEvent.key() == QtCore.Qt.Key_8:
                    new_row_int = 7
                elif iQKeyEvent.key() == QtCore.Qt.Key_9:
                    new_row_int = 8
                ### self.questions_composite_w3.list_widget.setCurrentRow(new_row_int)
                self.key_press_0_9_for_question_list_signal.emit(new_row_int)
                return
        elif QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
            pass
        else: # -no keyboard modifier
            if iQKeyEvent.key() == QtCore.Qt.Key_Enter or iQKeyEvent.key() == QtCore.Qt.Key_Return:
                # -http://doc.qt.io/qt-5/qguiapplication.html#keyboardModifiers
                # -Please note that the modifiers are placed directly in the QtCore.Qt namespace
                # Alternatively:
                # if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
                # -using bitwise and to find out if the shift key is pressed
                logging.debug("enter or return key pressed in textedit area")
                self.ref_central.add_text_to_diary()
                return

        QtWidgets.QPlainTextEdit.keyPressEvent(self, iQKeyEvent)
        # -if we get here it means that the key has not been captured elsewhere (or possibly
        # (that the key has been captured but that we want "double handling" of the key event)