Python PyQt5.QtWidgets.QPlainTextEdit() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QPlainTextEdit(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: universal_tool_template.py   Author: shiningdesign   File: LNTextEdit.py    License: MIT License 6 votes vote down vote up
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) 
Example 2
Project: universal_tool_template.py   Author: shiningdesign   File: LNTextEdit.py    License: MIT License 6 votes vote down vote up
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) 
Example 3
Project: Dwarf   Author: iGio90   File: error_dlg.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None, label_txt="", text_txt=""):
        super().__init__(parent=parent)

        h_box = QHBoxLayout(self)

        v_box = QVBoxLayout()
        icon = QLabel()
        icon.setPixmap(QIcon('assets/icons/issue.svg').pixmap(QSize(75, 75)))
        icon.setAlignment(Qt.AlignTop)
        h_box.addWidget(icon)

        label = QLabel(label_txt)
        v_box.addWidget(label)

        text = QPlainTextEdit(text_txt)
        text.setReadOnly(True)
        text.setMinimumWidth(550)
        text.setMinimumHeight(300)
        v_box.addWidget(text)
        h_box.addLayout(v_box)

        self.title = "Error" 
Example 4
Project: legion   Author: GoVanguard   File: dialogs.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setupLayout(self):
        ###
        self.labelPath = QtWidgets.QLineEdit() # this is the extra input field to insert the path to brute force
        self.labelPath.setFixedWidth(800)
        self.labelPath.setText('-m "/login/login.html:username=^USER^&password=^PASS^&Login=Login:failed"')
        ###

        self.layoutAddOptions = QtWidgets.QHBoxLayout()
        self.layoutAddOptions.addWidget(self.labelPath)
        self.labelPath.hide()
        self.layoutAddOptions.addStretch()
        
        self.display = QtWidgets.QPlainTextEdit()
        self.display.setReadOnly(True)
        if self.settings.general_tool_output_black_background == 'True':
            self.__drawPalette()

        self.vlayout = QtWidgets.QVBoxLayout()
        self.vlayout.addLayout(self.setupLayoutHlayout())
        self.vlayout.addLayout(self.setupLayoutHlayout4())
        self.vlayout.addLayout(self.layoutAddOptions)
        self.vlayout.addLayout(self.setupLayoutHlayout2())
        self.vlayout.addLayout(self.setupLayoutHlayout3())
        self.vlayout.addWidget(self.display)
        self.setLayout(self.vlayout) 
Example 5
Project: legion   Author: GoVanguard   File: gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setupBottom2Panel(self):
        # Log Tab
        self.LogTab = QtWidgets.QWidget()
        self.LogTab.setObjectName(_fromUtf8("LogTab"))
        self.LogTabLayout = QtWidgets.QHBoxLayout(self.LogTab)
        self.LogTabLayout.setObjectName(_fromUtf8("LogTabLayout"))
        self.LogOutputTextView = QPlainTextEditLogger(self.LogTab)
        self.LogOutputTextView.widget.setObjectName(_fromUtf8("LogOutputTextView"))
        self.LogOutputTextView.widget.setReadOnly(True)
        self.LogTabLayout.addWidget(self.LogOutputTextView.widget)
        self.BottomTabWidget.addTab(self.LogTab, _fromUtf8(""))
        log.addHandler(self.LogOutputTextView)

        # Python Tab - Disabled until next release
        #self.PythonTab = QtWidgets.QWidget()
        #self.PythonTab.setObjectName(_fromUtf8("PythonTab"))
        #self.PythonOutputTextView = QtWidgets.QPlainTextEdit(self.PythonTab)
        #self.PythonOutputTextView.setReadOnly(False)
        #self.PythonTabLayout = QtWidgets.QHBoxLayout(self.PythonTab)
        #self.PythonTabLayout.addWidget(self.PythonOutputTextView)
        #self.BottomTabWidget.addTab(self.PythonTab, _fromUtf8("")) 
Example 6
Project: PyQt   Author: PyQt5   File: SignalsExample.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)

        btn1 = QPushButton('按钮点击信号', self)
        btn1.setObjectName('ClickBtn')
        btn1.clicked.connect(self.onClicked)

        layout.addWidget(btn1)
        layout.addWidget(QPushButton(
            '按钮按下信号', self, objectName='PressBtn', pressed=self.onPressed))
        layout.addWidget(QPushButton(
            '按钮释放信号', self, objectName='ReleaseBtn', released=self.onReleased))
        layout.addWidget(QPushButton(
            '按钮选中信号', self, checkable=True, objectName='ToggleBtn', toggled=self.onToggled))

        self.resultView = QPlainTextEdit(self)
        self.resultView.setReadOnly(True)
        layout.addWidget(self.resultView) 
Example 7
Project: stonix   Author: CSD-Public   File: gui_pyqt5.py    License: GNU General Public License v2.0 6 votes vote down vote up
def setenableci(self, enabled):
        """This function will either enable or disable the editable QtWidgets in
        this ci frame.

        :param enabled: boolean to enable or disable
        @author: Brandon Gonzales

        """
        for opt in self.rule_config_opts:
            datatype = opt.getdatatype()
            name = opt.getkey()
            myuc = self.findChild(QtWidgets.QPlainTextEdit, 'ucvalue' + name)
            if datatype == 'string':
                mydata = self.findChild(QtWidgets.QLineEdit, 'value' + name)
                mydata.setEnabled(enabled)
            elif datatype == 'bool':
                mydata = self.findChild(QtWidgets.QCheckBox, 'value' + name)
                mydata.setEnabled(enabled)
            elif datatype == 'list':
                mydata = self.findChild(QtWidgets.QLineEdit, 'value' + name)
                mydata.setEnabled(enabled)
        return 
Example 8
Project: pyweed   Author: iris-edu   File: LoggingDialog.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, LoggingDialog):
        LoggingDialog.setObjectName("LoggingDialog")
        LoggingDialog.resize(697, 474)
        self.verticalLayout = QtWidgets.QVBoxLayout(LoggingDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.loggingPlainTextEdit = QtWidgets.QPlainTextEdit(LoggingDialog)
        self.loggingPlainTextEdit.setObjectName("loggingPlainTextEdit")
        self.verticalLayout.addWidget(self.loggingPlainTextEdit)

        self.retranslateUi(LoggingDialog)
        QtCore.QMetaObject.connectSlotsByName(LoggingDialog) 
Example 9
Project: IDAngr   Author: andreafioraldi   File: constraints.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setupUi(self, IDAngrConstraintsDialog):
        IDAngrConstraintsDialog.setObjectName("IDAngrConstraintsDialog")
        IDAngrConstraintsDialog.resize(811, 599)
        self.gridLayout_2 = QtWidgets.QGridLayout(IDAngrConstraintsDialog)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.constrEdit = QtWidgets.QPlainTextEdit(IDAngrConstraintsDialog)
        self.constrEdit.setEnabled(True)
        self.constrEdit.setObjectName("constrEdit")
        self.gridLayout_2.addWidget(self.constrEdit, 0, 0, 1, 1)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.savedsBtn = QtWidgets.QPushButton(IDAngrConstraintsDialog)
        self.savedsBtn.setEnabled(True)
        self.savedsBtn.setObjectName("savedsBtn")
        self.gridLayout.addWidget(self.savedsBtn, 0, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(IDAngrConstraintsDialog)
        self.buttonBox.setMinimumSize(QtCore.QSize(0, 48))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 0, 1, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1)

        self.retranslateUi(IDAngrConstraintsDialog)
        self.buttonBox.accepted.connect(IDAngrConstraintsDialog.accept)
        self.buttonBox.rejected.connect(IDAngrConstraintsDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(IDAngrConstraintsDialog) 
Example 10
Project: IDAngr   Author: andreafioraldi   File: saveds.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setupUi(self, IDAngrSavedsDialog):
        IDAngrSavedsDialog.setObjectName("IDAngrSavedsDialog")
        IDAngrSavedsDialog.resize(941, 569)
        self.gridLayout = QtWidgets.QGridLayout(IDAngrSavedsDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.splitter = QtWidgets.QSplitter(IDAngrSavedsDialog)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.selectorList = QtWidgets.QListView(self.splitter)
        self.selectorList.setMaximumSize(QtCore.QSize(270, 16777215))
        self.selectorList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.selectorList.setObjectName("selectorList")
        self.codeView = QtWidgets.QPlainTextEdit(self.splitter)
        self.codeView.setReadOnly(True)
        self.codeView.setObjectName("codeView")
        self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(IDAngrSavedsDialog)
        self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 48))
        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.retranslateUi(IDAngrSavedsDialog)
        self.buttonBox.accepted.connect(IDAngrSavedsDialog.accept)
        self.buttonBox.rejected.connect(IDAngrSavedsDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(IDAngrSavedsDialog) 
Example 11
Project: IDAngr   Author: andreafioraldi   File: viewer.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setupUi(self, IDAngrTextViewer):
        IDAngrTextViewer.setObjectName("IDAngrTextViewer")
        IDAngrTextViewer.resize(812, 612)
        self.gridLayout = QtWidgets.QGridLayout(IDAngrTextViewer)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.plainBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.plainBox.setChecked(True)
        self.plainBox.setObjectName("plainBox")
        self.horizontalLayout.addWidget(self.plainBox)
        self.hexBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.hexBox.setObjectName("hexBox")
        self.horizontalLayout.addWidget(self.hexBox)
        self.pyBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.pyBox.setObjectName("pyBox")
        self.horizontalLayout.addWidget(self.pyBox)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
        self.plainTextEdit = QtWidgets.QPlainTextEdit(IDAngrTextViewer)
        self.plainTextEdit.setReadOnly(True)
        self.plainTextEdit.setPlainText("")
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.gridLayout.addWidget(self.plainTextEdit, 1, 0, 1, 1)

        self.retranslateUi(IDAngrTextViewer)
        QtCore.QMetaObject.connectSlotsByName(IDAngrTextViewer) 
Example 12
Project: BAG_framework   Author: ucb-art   File: gui.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example 13
Project: linux-show-player   Author: FrancescoCeruti   File: user_element.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.groupBox = QGroupBox(self)
        self.groupBox.setGeometry(self.geometry())
        self.groupBox.setLayout(QVBoxLayout())
        self.layout().addWidget(self.groupBox)

        self.textEdit = QPlainTextEdit(self.groupBox)
        self.groupBox.layout().addWidget(self.textEdit)

        self.warning = QLabel(self.groupBox)
        self.warning.setAlignment(QtCore.Qt.AlignCenter)
        self.warning.setStyleSheet('color: #FF2222; font-weight: bold')
        self.groupBox.layout().addWidget(self.warning)

        self.retranslateUi() 
Example 14
Project: Miyamoto   Author: aboood40091   File: items.py    License: GNU General Public License v3.0 5 votes vote down vote up
def CreateTextEdit(self):
        """
        Make the text edit
        """
        self.TextEdit = QtWidgets.QPlainTextEdit()
        self.TextEditProxy = globals.mainWindow.scene.addWidget(self.TextEdit)
        self.TextEditProxy.setZValue(self.zval)
        self.TextEditProxy.setCursor(Qt.IBeamCursor)
        self.TextEditProxy.boundingRect = lambda self: QtCore.QRectF(0, 0, 4000, 4000)
        self.TextEdit.setVisible(False)
        self.TextEdit.setMinimumWidth(8 * globals.TileWidth)
        self.TextEdit.setMinimumHeight(16 * globals.TileWidth / 3)
        self.TextEdit.setMaximumWidth(8 * globals.TileWidth)
        self.TextEdit.setMaximumHeight(16 * globals.TileWidth / 3)
        self.TextEdit.setPlainText(self.text)
        self.TextEdit.textChanged.connect(self.handleTextChanged)
        self.TextEdit.zoomIn(13)
        self.reposTextEdit() 
Example 15
Project: universal_tool_template.py   Author: shiningdesign   File: LNTextEdit.py    License: MIT License 5 votes vote down vote up
def setWrap(self, state):
        if state == 0:
            self.edit.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        else:
            self.edit.setLineWrapMode(QtWidgets.QPlainTextEdit.WidgetWidth) 
Example 16
Project: universal_tool_template.py   Author: shiningdesign   File: LNTextEdit.py    License: MIT License 5 votes vote down vote up
def setReadOnlyStyle(self, state):
        if state == 1:
            mainWindowBgColor = QtGui.QPalette().color(QtGui.QPalette.Window)
            self.setStyleSheet('QPlainTextEdit[readOnly="true"] { background-color: %s;} QFrame {border: 0px}' % mainWindowBgColor.name() )
            self.setHighlight(0)
        else:
            self.setStyleSheet('')
            self.setHighlight(1) 
Example 17
Project: universal_tool_template.py   Author: shiningdesign   File: LNTextEdit.py    License: MIT License 5 votes vote down vote up
def monoFont(self, state):
        if state == 1:
            self.edit.setStyleSheet('QPlainTextEdit {font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;}')
        else:
            self.edit.setStyleSheet('') 
Example 18
Project: guppy-proxy   Author: roglew   File: macros.py    License: MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QObject.__init__(self, *args, **kwargs)
        self.msg = ""
        self.setLayout(QVBoxLayout())
        self.msgwidg = QPlainTextEdit()
        self.layout().addWidget(self.msgwidg) 
Example 19
Project: CvStudio   Author: haruiz   File: base_dataset_form.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Base_DatasetDialog):
        Base_DatasetDialog.setObjectName("Base_DatasetDialog")
        Base_DatasetDialog.resize(341, 146)
        self.verticalLayout = QtWidgets.QVBoxLayout(Base_DatasetDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.nameLabel = QtWidgets.QLabel(Base_DatasetDialog)
        self.nameLabel.setObjectName("nameLabel")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.nameLabel)
        self.nameLineEdit = QtWidgets.QLineEdit(Base_DatasetDialog)
        self.nameLineEdit.setObjectName("nameLineEdit")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.nameLineEdit)
        self.label = QtWidgets.QLabel(Base_DatasetDialog)
        self.label.setObjectName("label")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label)
        self.descriptionEditText = QtWidgets.QPlainTextEdit(Base_DatasetDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.descriptionEditText.sizePolicy().hasHeightForWidth())
        self.descriptionEditText.setSizePolicy(sizePolicy)
        self.descriptionEditText.setMinimumSize(QtCore.QSize(0, 60))
        self.descriptionEditText.setMaximumSize(QtCore.QSize(16777215, 50))
        self.descriptionEditText.setObjectName("descriptionEditText")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.descriptionEditText)
        self.verticalLayout.addLayout(self.formLayout)
        self.buttonsbox = QtWidgets.QDialogButtonBox(Base_DatasetDialog)
        self.buttonsbox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonsbox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.buttonsbox.setObjectName("buttonsbox")
        self.verticalLayout.addWidget(self.buttonsbox)

        self.retranslateUi(Base_DatasetDialog)
        self.buttonsbox.accepted.connect(Base_DatasetDialog.accept)
        self.buttonsbox.rejected.connect(Base_DatasetDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Base_DatasetDialog) 
Example 20
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName('Dialog')
        Dialog.setWindowIcon(get_clamav_icon())
        Dialog.setWindowTitle('Submit Your ClamAV Signature')
        Dialog.resize(430, 300)

        #   Email Body Area
        self.link = QtWidgets.QLabel('')
        self.link.setTextFormat(Qt.RichText)
        self.link.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.link.setOpenExternalLinks(True)
        self.email_body = QtWidgets.QPlainTextEdit()
        self.email_body.setReadOnly(True)

        #   Ok Button Area
        self.button_box = QtWidgets.QDialogButtonBox()
        self.button_box.setOrientation(Qt.Horizontal)
        self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
        self.button_box.setObjectName('button_box')
        self.hbox_bottom = QtWidgets.QHBoxLayout()
        self.hbox_bottom.addWidget(self.button_box)

        #   Vertical Layout
        self.vbox_outer = QtWidgets.QVBoxLayout(Dialog)
        self.vbox_outer.setObjectName('vbox_outer')
        self.vbox_outer.addWidget(self.link)
        self.vbox_outer.addWidget(self.email_body)
        self.vbox_outer.addLayout(self.hbox_bottom)

        #   Signal Handling
        self.button_box.accepted.connect(Dialog.accept)


#   Class to interface with Dialog GUIs and the back end data
#------------------------------------------------------------------------------- 
Example 21
Project: Dwarf   Author: iGio90   File: panel_data.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, app):
        super(DataPanel, self).__init__(app)

        self.app = app
        self.data = {}

        self.setOrientation(Qt.Horizontal)

        self._key_list_model = QStandardItemModel(0, 1)
        self.key_lists = DwarfListView(parent=self.app)
        self.key_lists.setHeaderHidden(True)
        self.key_lists.setModel(self._key_list_model)
        self.key_lists.selectionModel().selectionChanged.connect(self.item_selected)
        self.key_lists.setContextMenuPolicy(Qt.CustomContextMenu)
        self.key_lists.customContextMenuRequested.connect(self._on_context_menu)
        self.addWidget(self.key_lists)

        self.editor = QPlainTextEdit()
        self.addWidget(self.editor)

        self.hex_view = HexEditor(self.app)
        self.hex_view.have_context_menu = False
        self.hex_view.setVisible(False)
        self.addWidget(self.hex_view)
        #self.setStretchFactor(0, 8)
        self.setStretchFactor(1, 4)
        self.setStretchFactor(2, 4) 
Example 22
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: question_4_example_code.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())

        # Image
        self.image_source = ImageFileButton(changed=self.on_change)
        self.layout().addRow('Image file', self.image_source)

        # Text entries
        self.top_text = qtw.QPlainTextEdit(textChanged=self.on_change)
        self.bottom_text = qtw.QPlainTextEdit(textChanged=self.on_change)
        self.layout().addRow("Top Text", self.top_text)
        self.layout().addRow("Bottom Text", self.bottom_text)

        # Text color and font
        self.text_color = ColorButton('white', changed=self.on_change)
        self.layout().addRow("Text Color", self.text_color)
        self.text_font = FontButton('Impact', 32, changed=self.on_change)
        self.layout().addRow("Text Font", self.text_font)

        # Background Boxes
        self.text_bg_color = ColorButton('black', changed=self.on_change)
        self.layout().addRow('Text Background', self.text_bg_color)
        self.top_bg_height = qtw.QSpinBox(
            minimum=0, maximum=32,
            valueChanged=self.on_change, suffix=' line(s)')
        self.layout().addRow('Top BG height', self.top_bg_height)
        self.bottom_bg_height = qtw.QSpinBox(
            minimum=0, maximum=32,
            valueChanged=self.on_change, suffix=' line(s)')
        self.layout().addRow('Bottom BG height', self.bottom_bg_height)
        self.bg_padding = qtw.QSpinBox(
            minimum=0, maximum=100, value=10,
            valueChanged=self.on_change, suffix=' px')
        self.layout().addRow('BG Padding', self.bg_padding)

        # Deep Fryer
        self.deep_fry = qtw.QCheckBox('Deep Fry', stateChanged=self.on_change)
        self.layout().addRow(self.deep_fry) 
Example 23
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: meme_gen.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())

        # Image
        self.image_source = ImageFileButton(changed=self.on_change)
        self.layout().addRow('Image file', self.image_source)

        # Text entries
        self.top_text = qtw.QPlainTextEdit(textChanged=self.on_change)
        self.bottom_text = qtw.QPlainTextEdit(textChanged=self.on_change)
        self.layout().addRow("Top Text", self.top_text)
        self.layout().addRow("Bottom Text", self.bottom_text)

        # Text color and font
        self.text_color = ColorButton('white', changed=self.on_change)
        self.layout().addRow("Text Color", self.text_color)
        self.text_font = FontButton('Impact', 32, changed=self.on_change)
        self.layout().addRow("Text Font", self.text_font)

        # Background Boxes
        self.text_bg_color = ColorButton('black', changed=self.on_change)
        self.layout().addRow('Text Background', self.text_bg_color)
        self.top_bg_height = qtw.QSpinBox(
            minimum=0, maximum=32,
            valueChanged=self.on_change, suffix=' line(s)')
        self.layout().addRow('Top BG height', self.top_bg_height)
        self.bottom_bg_height = qtw.QSpinBox(
            minimum=0, maximum=32,
            valueChanged=self.on_change, suffix=' line(s)')
        self.layout().addRow('Bottom BG height', self.bottom_bg_height)
        self.bg_padding = qtw.QSpinBox(
            minimum=0, maximum=100, value=10,
            valueChanged=self.on_change, suffix=' px')
        self.layout().addRow('BG Padding', self.bg_padding) 
Example 24
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: invoice_maker.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())
        self.inputs = {}
        self.inputs['Customer Name'] = qtw.QLineEdit()
        self.inputs['Customer Address'] = qtw.QPlainTextEdit()
        self.inputs['Invoice Date'] = qtw.QDateEdit(
            date=qtc.QDate.currentDate(), calendarPopup=True)
        self.inputs['Days until Due'] = qtw.QSpinBox(
            minimum=0, maximum=60, value=30)
        for label, widget in self.inputs.items():
            self.layout().addRow(label, widget)

        self.line_items = qtw.QTableWidget(
            rowCount=10, columnCount=3)
        self.line_items.setHorizontalHeaderLabels(
            ['Job', 'Rate', 'Hours'])
        self.line_items.horizontalHeader().setSectionResizeMode(
            qtw.QHeaderView.Stretch)
        self.layout().addRow(self.line_items)
        for row in range(self.line_items.rowCount()):
            for col in range(self.line_items.columnCount()):
                if col > 0:
                    w = qtw.QSpinBox(minimum=0, maximum=300)
                    self.line_items.setCellWidget(row, col, w)
        submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
        self.layout().addRow(submit) 
Example 25
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: invoice_maker_printable.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QFormLayout())
        self.inputs = dict()
        self.inputs['Customer Name'] = qtw.QLineEdit()
        self.inputs['Customer Address'] = qtw.QPlainTextEdit()
        self.inputs['Invoice Date'] = qtw.QDateEdit(
            date=qtc.QDate.currentDate(), calendarPopup=True)
        self.inputs['Days until Due'] = qtw.QSpinBox(
            minimum=0, maximum=60, value=30)
        for label, widget in self.inputs.items():
            self.layout().addRow(label, widget)

        self.line_items = qtw.QTableWidget(
            rowCount=10, columnCount=3)
        self.line_items.setHorizontalHeaderLabels(
            ['Job', 'Rate', 'Hours'])
        self.line_items.horizontalHeader().setSectionResizeMode(
            qtw.QHeaderView.Stretch)
        self.layout().addRow(self.line_items)
        for row in range(self.line_items.rowCount()):
            for col in range(self.line_items.columnCount()):
                if col > 0:
                    w = qtw.QSpinBox(minimum=0, maximum=300)
                    self.line_items.setCellWidget(row, col, w)
        submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
        self.layout().addRow(submit)

        self.on_submit() 
Example 26
Project: legion   Author: GoVanguard   File: dialogs.py    License: GNU General Public License v3.0 5 votes vote down vote up
def resetDisplay(self):
        self.display.setParent(None)
        self.display = QtWidgets.QPlainTextEdit()
        self.display.setReadOnly(True)
        if self.settings.general_tool_output_black_background == 'True':
            self.__drawPalette()

        self.vlayout.addWidget(self.display)

# dialog displayed when the user clicks on the advanced filters button 
Example 27
Project: legion   Author: GoVanguard   File: qtLogging.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):
        super().__init__()
        self.widget = QtWidgets.QPlainTextEdit(parent)
        #self.widget.setReadOnly(True)
        #self.sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        #self.sizePolicy.setHorizontalStretch(1)
        #self.sizePolicy.setVerticalStretch(1)
        #self.widget.setSizePolicy(self.sizePolicy)
        #self.widget.setGeometry(0, 0, 200, 400) 
Example 28
Project: urh   Author: jopohl   File: util.py    License: GNU General Public License v3.0 5 votes vote down vote up
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 
Example 29
Project: stonix   Author: CSD-Public   File: gui_pyqt5.py    License: GNU General Public License v2.0 5 votes vote down vote up
def clearchanges(self):
        """This method will undo any changes that the user has made to any of the
        ci feilds in the gui.
        @author: David Kennel


        """
        for opt in self.rule_config_opts:
            datatype = opt.getdatatype()
            name = opt.getkey()
            myuc = self.findChild(QtWidgets.QPlainTextEdit, 'ucvalue' + name)
            if datatype == 'string':
                mydata = self.findChild(QtWidgets.QLineEdit, 'value' + name)
                mydata.setText(opt.getcurrvalue())
            elif datatype == 'bool':
                mydata = self.findChild(QtWidgets.QCheckBox, 'value' + name)
                mydata.setChecked(opt.getcurrvalue())
            elif datatype == 'list':
                mydata = self.findChild(QtWidgets.QLineEdit, 'value' + name)
                rawlist = opt.getcurrvalue()
                strlist = ''
                for item in rawlist:
                    if type(item) is bytes:
                        strlist += item.decode('utf-8') + ' '
                    else:
                        strlist += item + ' '
                mydata.setText(strlist)
            myuc.setPlainText(opt.getusercomment()) 
Example 30
Project: qhangups   Author: xmikos   File: ui_qhangupsconversationwidget.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, QHangupsConversationWidget):
        QHangupsConversationWidget.setObjectName("QHangupsConversationWidget")
        QHangupsConversationWidget.resize(600, 400)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(QHangupsConversationWidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.splitter = QtWidgets.QSplitter(QHangupsConversationWidget)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.setObjectName("splitter")
        self.messagesFrame = QtWidgets.QFrame(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(250)
        sizePolicy.setHeightForWidth(self.messagesFrame.sizePolicy().hasHeightForWidth())
        self.messagesFrame.setSizePolicy(sizePolicy)
        self.messagesFrame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.messagesFrame.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.messagesFrame.setObjectName("messagesFrame")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.messagesFrame)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.messagesWebView = QtWebKitWidgets.QWebView(self.messagesFrame)
        self.messagesWebView.setUrl(QtCore.QUrl("about:blank"))
        self.messagesWebView.setObjectName("messagesWebView")
        self.verticalLayout.addWidget(self.messagesWebView)
        self.frame = QtWidgets.QFrame(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
        self.frame.setSizePolicy(sizePolicy)
        self.frame.setMinimumSize(QtCore.QSize(0, 60))
        self.frame.setObjectName("frame")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
        self.horizontalLayout.setContentsMargins(0, -1, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.messageTextEdit = QtWidgets.QPlainTextEdit(self.frame)
        self.messageTextEdit.setObjectName("messageTextEdit")
        self.horizontalLayout.addWidget(self.messageTextEdit)
        self.sendButton = QtWidgets.QPushButton(self.frame)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sendButton.sizePolicy().hasHeightForWidth())
        self.sendButton.setSizePolicy(sizePolicy)
        self.sendButton.setObjectName("sendButton")
        self.horizontalLayout.addWidget(self.sendButton)
        self.verticalLayout_2.addWidget(self.splitter)

        self.retranslateUi(QHangupsConversationWidget)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversationWidget)
        QHangupsConversationWidget.setTabOrder(self.messageTextEdit, self.sendButton)
        QHangupsConversationWidget.setTabOrder(self.sendButton, self.messagesWebView)