Python PyQt5.QtWidgets.QTextEdit() Examples

The following are 30 code examples of PyQt5.QtWidgets.QTextEdit(). 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 also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: CrashHandler.py    From Cura with GNU Lesser General Public License v3.0 9 votes vote down vote up
def _logInfoWidget(self):
        group = QGroupBox()
        group.setTitle(catalog.i18nc("@title:groupbox", "Logs"))
        layout = QVBoxLayout()

        text_area = QTextEdit()
        tmp_file_fd, tmp_file_path = tempfile.mkstemp(prefix = "cura-crash", text = True)
        os.close(tmp_file_fd)
        with open(tmp_file_path, "w", encoding = "utf-8") as f:
            faulthandler.dump_traceback(f, all_threads=True)
        with open(tmp_file_path, "r", encoding = "utf-8") as f:
            logdata = f.read()

        text_area.setText(logdata)
        text_area.setReadOnly(True)

        layout.addWidget(text_area)
        group.setLayout(layout)

        self.data["log"] = logdata

        return group 
Example #2
Source File: demoFontComboBox.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 6 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(560, 228)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 231, 41))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.labelTextLine = QtWidgets.QLabel(Dialog)
        self.labelTextLine.setGeometry(QtCore.QRect(20, 60, 161, 41))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.labelTextLine.setFont(font)
        self.labelTextLine.setObjectName("labelTextLine")
        self.fontComboBox = QtWidgets.QFontComboBox(Dialog)
        self.fontComboBox.setGeometry(QtCore.QRect(200, 20, 321, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.fontComboBox.setFont(font)
        self.fontComboBox.setObjectName("fontComboBox")
        self.textEdit = QtWidgets.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(200, 70, 321, 121))
        self.textEdit.setObjectName("textEdit")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #3
Source File: test_completiondelegate.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def test_highlighted(qtbot):
    """Make sure highlighting works.

    Note that with Qt 5.11.3 and > 5.12.1 we need to call setPlainText *after*
    creating the highlighter for highlighting to work. Ideally, we'd test
    whether CompletionItemDelegate._get_textdoc() works properly, but testing
    that is kind of hard, so we just test it in isolation here.
    """
    doc = QTextDocument()
    completiondelegate._Highlighter(doc, 'Hello', Qt.red)
    doc.setPlainText('Hello World')

    # Needed so the highlighting actually works.
    edit = QTextEdit()
    qtbot.addWidget(edit)
    edit.setDocument(doc)

    colors = [f.foreground().color() for f in doc.allFormats()]
    assert QColor('red') in colors 
Example #4
Source File: exceptwindow.py    From Pythonic with GNU General Public License v3.0 6 votes vote down vote up
def initUI(self):

        self.confirm_button = QPushButton()

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)

        self.exceptionMessage = QTextEdit()
        self.exceptionMessage.setReadOnly(True)

        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)

        self.exceptWindowLayout = QVBoxLayout()
        self.exceptWindowLayout.addWidget(self.elementInfo)
        self.exceptWindowLayout.addWidget(self.exceptionMessage)
        self.exceptWindowLayout.addStretch(1)
        self.exceptWindowLayout.addWidget(self.confirm_button)

        self.confirm_button.clicked.connect(self.close)

        self.setLayout(self.exceptWindowLayout) 
Example #5
Source File: Putting_it_together.py    From python with Apache License 2.0 6 votes vote down vote up
def initUI(self):               

        textEdit = QTextEdit()
        self.setCentralWidget(textEdit)

        exitAct = QAction(QIcon('exit24.png'), 'Exit', self)
        exitAct.setShortcut('Ctrl+Q')
        exitAct.setStatusTip('Exit application')
        exitAct.triggered.connect(self.close)

        self.statusBar()

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAct)

        toolbar = self.addToolBar('Exit')
        toolbar.addAction(exitAct)

        self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle('Main window')    
        self.show() 
Example #6
Source File: chatter.py    From networkzero with MIT License 6 votes vote down vote up
def __init__(self, name, parent=None):
        super(Chatter, self).__init__(parent)
        self.name = name

        self.text_panel = QtWidgets.QTextEdit()
        self.text_panel.setReadOnly(True)
        self.input = QtWidgets.QLineEdit()

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.text_panel, 3)
        layout.addWidget(self.input, 1)

        self.setLayout(layout)
        self.setWindowTitle("Chatter")

        self.input.editingFinished.connect(self.input_changed)
        self.input.setFocus()

        self.chattery = nw0.discover("chattery/news")
        self.responder = FeedbackReader(self.chattery)
        self.responder.message_received.connect(self.handle_response)
        self.responder.start() 
Example #7
Source File: AnalysisProgress_ui.py    From tierpsy-tracker with MIT License 6 votes vote down vote up
def setupUi(self, AnalysisProgress):
        AnalysisProgress.setObjectName("AnalysisProgress")
        AnalysisProgress.resize(594, 465)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(AnalysisProgress)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.progressBar = QtWidgets.QProgressBar(AnalysisProgress)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setInvertedAppearance(False)
        self.progressBar.setObjectName("progressBar")
        self.verticalLayout.addWidget(self.progressBar)
        self.textEdit = QtWidgets.QTextEdit(AnalysisProgress)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName("textEdit")
        self.verticalLayout.addWidget(self.textEdit)
        self.verticalLayout_2.addLayout(self.verticalLayout)

        self.retranslateUi(AnalysisProgress)
        QtCore.QMetaObject.connectSlotsByName(AnalysisProgress) 
Example #8
Source File: part-3.py    From Writer-Tutorial with MIT License 6 votes vote down vote up
def initUI(self):

        self.text = QtWidgets.QTextEdit(self)

        # Set the tab stop width to around 33 pixels which is
        # more or less 8 spaces
        self.text.setTabStopWidth(33)

        self.initToolbar()
        self.initFormatbar()
        self.initMenubar()

        self.setCentralWidget(self.text)

        # Initialize a statusbar for the window
        self.statusbar = self.statusBar()

        # If the cursor position changes, call the function that displays
        # the line and column number
        self.text.cursorPositionChanged.connect(self.cursorPosition)

        self.setGeometry(100,100,1030,800)
        self.setWindowTitle("Writer")
        self.setWindowIcon(QtGui.QIcon("icons/icon.png")) 
Example #9
Source File: pyqt5_execute_macro_command.py    From handyscripts with MIT License 6 votes vote down vote up
def initUI(self):
        self.macro_command_textEdit = QtWidgets.QTextEdit()
        self.macro_command_textEdit.setPlainText("#!MC 1410")

        addExecuteMacroCommand_Button = QtWidgets.QPushButton("Execute")
        addExecuteMacroCommand_Button.clicked.connect(self.execute_macro_command_CB)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.macro_command_textEdit)
        vbox.addWidget(addExecuteMacroCommand_Button)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 800, 600)
        self.setWindowTitle('Macro Command Runner')
        self.show() 
Example #10
Source File: settings_widget.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def configsettings(self):
        self.line501 = QtWidgets.QTextEdit()
        self.gl7.addWidget(self.line501, 0, 0, 1, 3)
        msg = '<html>Use this config file, otherwise global config file will be used</html>'
        self.checkbox = QtWidgets.QCheckBox("Use This Config File")
        self.checkbox.setMinimumHeight(30)
        self.checkbox.stateChanged.connect(self.use_config_file)
        self.checkbox.setToolTip(msg)
        self.gl7.addWidget(self.checkbox, 1, 0, 1, 1)
        if ui.use_custom_config_file:
            self.checkbox.setChecked(True)
        mpvlist = self.basic_params(player='mpv')
        mpvstr = '\n'.join(mpvlist)
        self.line501.setText(mpvstr) 
        
        self.btn_default_settings = QPushButtonExtra('Default Settings')
        self.gl7.addWidget(self.btn_default_settings, 1, 1, 1, 1)
        self.btn_default_settings.clicked_connect(self.get_default_config_settings)
        self.btn_default_settings.setMinimumHeight(30)
        
        self.btn_confirm = QPushButtonExtra('Save Changes')
        self.gl7.addWidget(self.btn_confirm, 1, 2, 1, 1)
        self.btn_confirm.clicked_connect(self.save_config_settings)
        self.btn_confirm.setMinimumHeight(30) 
Example #11
Source File: settings_widget.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def apply_tab_shortcuts(self):
        self.line601 = QtWidgets.QTextEdit()
        self.gl8.addWidget(self.line601, 0, 0, 1, 2)
        
        if os.path.isfile(ui.custom_key_file) and os.stat(ui.custom_key_file).st_size:
            lines = open_files(ui.mpv_input_conf, True)
            lines = [i.strip() for i in lines if i.strip()]
            text = self.get_default_shortcuts_in_text(ui.tab_5.mpv_default, lines)
            self.line601.setText(text) 
        else:
            self.get_default_shortcuts_settings()
        
        self.btn_shortcut_default = QPushButtonExtra('Default Settings')
        self.gl8.addWidget(self.btn_shortcut_default, 1, 0, 1, 1)
        self.btn_shortcut_default.clicked_connect(self.get_default_shortcuts_settings)
        self.btn_shortcut_default.setMinimumHeight(30)
        
        self.btn_shortcut_confirm = QPushButtonExtra('Save Changes')
        self.gl8.addWidget(self.btn_shortcut_confirm, 1, 1, 1, 1)
        self.btn_shortcut_confirm.clicked_connect(self.save_shortcut_settings)
        self.btn_shortcut_confirm.setMinimumHeight(30) 
Example #12
Source File: notesWindow.py    From GROOT with Mozilla Public License 2.0 6 votes vote down vote up
def __init__(self,parent=None):
        super(noteCreationWidgetLayout,self).__init__()
        
        #Elements Present on Note Creation GUI
        self.title = QLabel('Title')
        self.titleEdit = QLineEdit()
        self.summary = QLabel('Summary')
        self.summaryEdit = QTextEdit()
        self.saveButton = QPushButton("Save")
        self.saveButton.clicked.connect(self.createNewFile)
        self.notesList = QPushButton("Notes")
        self.notesList.clicked.connect(self.createNotesList)

        #Main Layout
        self.noteLayout = QGridLayout()

        #Position of Widgets/Elements on Main Layout
        self.noteLayout.addWidget(self.title, 1, 0)
        self.noteLayout.addWidget(self.titleEdit, 1, 1)

        self.noteLayout.addWidget(self.summary, 2, 0)
        self.noteLayout.addWidget(self.summaryEdit, 2, 1, 10, 1)
        
        self.noteLayout.addWidget(self.saveButton,12,0)
        self.noteLayout.addWidget(self.notesList,13,0) 
Example #13
Source File: info_panel.py    From linux-show-player with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.__cue = None

        # cue name
        self.cueName = QLineEdit(self)
        self.cueName.setFocusPolicy(Qt.NoFocus)
        self.cueName.setReadOnly(True)
        self.layout().addWidget(self.cueName)

        # cue description
        self.cueDescription = QTextEdit(self)
        self.cueDescription.setObjectName('InfoPanelDescription')
        self.cueDescription.setFocusPolicy(Qt.NoFocus)
        self.cueDescription.setReadOnly(True)
        self.layout().addWidget(self.cueDescription)

        self.retranslateUi() 
Example #14
Source File: magic.py    From heap-viewer with GNU General Public License v3.0 6 votes vote down vote up
def _create_gui(self):
        self.t_chunk_addr = QtWidgets.QLineEdit()
        self.t_chunk_addr.setFixedWidth(150)

        self.t_freeable_info = QtWidgets.QTextEdit()
        self.t_freeable_info.setFixedHeight(400)
        self.t_freeable_info.setReadOnly(True)

        self.btn_freeable = QtWidgets.QPushButton("Check")
        self.btn_freeable.clicked.connect(self.check_freeable)

        hbox_freeable = QtWidgets.QHBoxLayout()
        hbox_freeable.addWidget(QtWidgets.QLabel("Chunk address"))
        hbox_freeable.addWidget(self.t_chunk_addr)
        hbox_freeable.addWidget(self.btn_freeable)
        hbox_freeable.addStretch(1)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox_freeable)
        vbox.addWidget(self.t_freeable_info)
        vbox.addStretch(1)
        vbox.setContentsMargins(0, 0, 0, 0)

        self.setLayout(vbox) 
Example #15
Source File: magic.py    From heap-viewer with GNU General Public License v3.0 6 votes vote down vote up
def _create_gui(self):
        self.t_req2size = QtWidgets.QLineEdit()
        self.t_req2size.setFixedWidth(150)

        self.t_req2size_info = QtWidgets.QTextEdit()
        self.t_req2size_info.setReadOnly(True)

        self.btn_req2size = QtWidgets.QPushButton("Calc chunk size")
        self.btn_req2size.clicked.connect(self.btn_req2size_on_click)

        hbox_req2size = QtWidgets.QHBoxLayout()
        hbox_req2size.addWidget(QtWidgets.QLabel("Request size"))
        hbox_req2size.addWidget(self.t_req2size)
        hbox_req2size.addWidget(self.btn_req2size)
        hbox_req2size.addStretch(1)

        vbox_req2size = QtWidgets.QVBoxLayout()
        vbox_req2size.addLayout(hbox_req2size)
        vbox_req2size.addWidget(self.t_req2size_info)
        vbox_req2size.addStretch(1)

        vbox_req2size.setContentsMargins(0, 0, 0, 0)
        self.setLayout(vbox_req2size) 
Example #16
Source File: bins.py    From heap-viewer with GNU General Public License v3.0 6 votes vote down vote up
def _create_gui(self):
        self._create_table()   
      
        self.te_tcache_chain = QtWidgets.QTextEdit()
        self.te_tcache_chain.setFixedHeight(100)
        self.te_tcache_chain.setReadOnly(True)
        
        vbox_tcache_chain = QtWidgets.QVBoxLayout()
        vbox_tcache_chain.addWidget(QtWidgets.QLabel('Chain info'))
        vbox_tcache_chain.addWidget(self.te_tcache_chain)

        vbox_tcache = QtWidgets.QVBoxLayout()
        vbox_tcache.addWidget(QtWidgets.QLabel('Tcache entries'))
        vbox_tcache.addWidget(self.tbl_tcache)
        vbox_tcache.addLayout(vbox_tcache_chain)
        vbox_tcache.addStretch(1)

        self.setLayout(vbox_tcache) 
Example #17
Source File: magic.py    From heap-viewer with GNU General Public License v3.0 6 votes vote down vote up
def _create_gui(self):
        self.t_unlink_addr = QtWidgets.QLineEdit()
        self.t_unlink_addr.setFixedWidth(150)
        self.t_unlink_info = QtWidgets.QTextEdit()
        self.t_unlink_info.setFixedHeight(400)
        self.t_unlink_info.setReadOnly(True)

        self.btn_check_unlink = QtWidgets.QPushButton("Check")
        self.btn_check_unlink.clicked.connect(self.check_unlink_on_click)

        hbox_unlink = QtWidgets.QHBoxLayout()
        hbox_unlink.addWidget(QtWidgets.QLabel('Chunk ptr unlink'))
        hbox_unlink.addWidget(self.t_unlink_addr)
        hbox_unlink.addWidget(self.btn_check_unlink)
        hbox_unlink.addStretch(1)

        vbox_unlink = QtWidgets.QVBoxLayout()
        vbox_unlink.addLayout(hbox_unlink)
        vbox_unlink.addWidget(self.t_unlink_info)
        vbox_unlink.addStretch(1)
        vbox_unlink.setContentsMargins(0, 0, 0, 0)
        self.setLayout(vbox_unlink) 
Example #18
Source File: Q_console_edit.py    From pyNMS with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        style = '''QTextEdit { background-color: rgb(0, 0, 0); 
                                color: rgb(255, 255, 255); 
                                font: 10pt "Courier New";
                              }'''
        self.setStyleSheet(style) 
Example #19
Source File: pyqt5_execute_pytecplot.py    From handyscripts with MIT License 5 votes vote down vote up
def initUI(self):
        self.python_command_textEdit = QtWidgets.QTextEdit()

        boilerPlate = """import tecplot as tp
from tecplot.constant import *
tp.session.connect()
frame = tp.active_frame()
plot = frame.plot()
dataset = frame.dataset
"""

        self.python_command_textEdit.setPlainText(boilerPlate)

        addExecutePyTecplot_Button = QtWidgets.QPushButton("Execute")
        addExecutePyTecplot_Button.clicked.connect(self.execute_python_command_CB)

        self.result_textEdit = QtWidgets.QTextEdit()

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.python_command_textEdit)
        vbox.addWidget(addExecutePyTecplot_Button)
        vbox.addWidget(self.result_textEdit)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 1600, 1200)
        self.setWindowTitle('PyTecplot Runner')
        self.show() 
Example #20
Source File: debugwindow.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def raiseWindow(self):

        logging.debug('raiseWindow() called')
        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(QC.translate('', 'Debug'))
        self.setWindowModality(Qt.WindowModal)

        self.confirm_button = QPushButton()
        self.confirm_button.setText(QC.translate('', 'Ok'))
        self.confirm_button.clicked.connect(self.close)

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.info_string = QC.translate('', 'Debug info of element:')
        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)
        self.elementInfo.setText(self.info_string + '{} {}'.format(self.source[0],
            alphabet[self.source[1]]))

        self.debugMessage = QTextEdit()
        self.debugMessage.setReadOnly(True)
        self.debugMessage.setText(self.message)



        self.debugWindowLayout = QVBoxLayout()
        self.debugWindowLayout.addWidget(self.elementInfo)
        self.debugWindowLayout.addWidget(self.debugMessage)
        self.debugWindowLayout.addStretch(1)
        self.debugWindowLayout.addWidget(self.confirm_button)

        self.setLayout(self.debugWindowLayout)   
        
        self.show() 
Example #21
Source File: videoconsole.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(VideoConsole, self).__init__(parent)
        self._buffer = StringIO()
        self.setReadOnly(True)
        self.setWordWrapMode(QTextOption.WordWrap)
        self.setStyleSheet('QTextEdit { font-family:monospace; font-size:%s; }'
                           % ('10pt' if sys.platform == 'darwin' else '8pt'))
        if sys.platform in {'win32', 'darwin'}:
            self.setStyle(QStyleFactory.create('Fusion')) 
Example #22
Source File: misc.py    From argos with GNU General Public License v3.0 5 votes vote down vote up
def resizeEvent(self, event):
        """ Resizes the details box if present (i.e. when 'Show Details' button was clicked)
        """
        result = super(ResizeDetailsMessageBox, self).resizeEvent(event)

        details_box = self.findChild(QtWidgets.QTextEdit)
        if details_box is not None:
            #details_box.setFixedSize(details_box.sizeHint())
            details_box.setFixedSize(QtCore.QSize(self.detailsBoxWidth, self.detailBoxHeight))

        return result 
Example #23
Source File: CallVirtualKeyboard.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)
        self.resultEdit = QTextEdit(self)
        self.resultEdit.setReadOnly(True)
        layout.addWidget(self.resultEdit)
        layout.addWidget(QPushButton(
            '打开虚拟键盘', self, clicked=self._onOpenKeyboard)) 
Example #24
Source File: progressScreen.py    From pip-gui with GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(582, 317)
        self.verticalLayoutWidget = QtWidgets.QWidget(Form)
        self.verticalLayoutWidget.setGeometry(
            QtCore.QRect(10, 10, 561, 261))
        self.verticalLayoutWidget.setObjectName(
            _fromUtf8("verticalLayoutWidget"))
        self.verticalLayout = QtWidgets.QVBoxLayout(
            self.verticalLayoutWidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.labelProgress = QtWidgets.QLabel(self.verticalLayoutWidget)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.labelProgress.setFont(font)
        self.labelProgress.setObjectName(_fromUtf8("labelProgress"))
        self.verticalLayout.addWidget(self.labelProgress)
        self.textEdit = QtWidgets.QTextEdit(self.verticalLayoutWidget)
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.verticalLayout.addWidget(self.textEdit)
        self.progressBar = QtWidgets.QProgressBar(self)
        self.progressBar.setRange(0,1)
        self.progressBar.setGeometry(QtCore.QRect(30, 30, 1050, 35))
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.verticalLayout.addWidget(self.progressBar)
        self.btnContinue = QtWidgets.QPushButton(Form)
        self.btnContinue.setGeometry(QtCore.QRect(450, 280, 90, 28))
        self.btnContinue.setObjectName(_fromUtf8("btnContinue"))

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example #25
Source File: generator.py    From awesometts-anki-addon with GNU General Public License v3.0 5 votes vote down vote up
def _ui_control(self):
        """
        Replaces the superclass's version of this with a version that
        returns a "Preview and Record" header, larger text input area,
        and preview button on its own line.
        """

        header = Label("Preview and Record")
        header.setFont(self._FONT_HEADER)

        text = QtWidgets.QTextEdit()
        text.setAcceptRichText(False)
        text.setObjectName('text')
        text.setTabChangesFocus(True)
        text.keyPressEvent = lambda key_event: \
            self.accept() if (
                key_event.modifiers() & QtCore.Qt.ControlModifier and
                key_event.key() in [QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter]
            ) \
            else QtWidgets.QTextEdit.keyPressEvent(text, key_event)

        button = QtWidgets.QPushButton("&Preview")
        button.setObjectName('preview')
        button.clicked.connect(self._on_preview)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(header)
        layout.addWidget(Note("This will be inserted as a [sound] tag and "
                              "synchronized with your collection."))
        layout.addWidget(text)
        layout.addWidget(button)
        layout.addWidget(self._ui_buttons())

        return layout 
Example #26
Source File: FramelessWindow.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self, spacing=0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(QPushButton('按钮', self))
        layout.addWidget(QTextEdit(self))


# 样式 
Example #27
Source File: GetCookie.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(WebEngineView, self).__init__(*args, **kwargs)
        self.cookieView = QTextEdit()
        self.cookieView.resize(800, 400)
        self.cookieView.move(400, 400)
        self.cookieView.setWindowTitle('Cookies')
        self.cookieView.show()
        # 绑定cookie被添加的信号槽
        QWebEngineProfile.defaultProfile().cookieStore(
        ).cookieAdded.connect(self.onCookieAdd)
        self.loadFinished.connect(self.onLoadFinished) 
Example #28
Source File: GetCookie.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(WebView, self).__init__(*args, **kwargs)
        self.cookieView = QTextEdit()
        self.cookieView.resize(800, 400)
        self.cookieView.move(400, 400)
        self.cookieView.setWindowTitle('Cookies')
        self.cookieView.show()
        self.loadFinished.connect(self.onLoadFinished) 
Example #29
Source File: platform.py    From artisan with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent = None, aw = None):
        super(platformDlg,self).__init__(parent, aw)
        self.setModal(True)
        self.setWindowTitle(QApplication.translate("Form Caption","Artisan Platform", None))
        platformdic = {}
        platformdic["Architecture"] = str(platform.architecture())
        platformdic["Machine"] = str(platform.machine())
        platformdic["Platform name"] =  str(platform.platform())
        platformdic["Processor"] = str(platform.processor())
        platformdic["Python Build"] = str(platform.python_build())
        platformdic["Python Compiler"] = str(platform.python_compiler())
        platformdic["Python Branch"] = str(platform.python_branch())
        platformdic["Python Implementation"] = str(platform.python_implementation())
        platformdic["Python Revision"] = str(platform.python_revision())
        platformdic["Release"] = str(platform.release())
        platformdic["System"] = str(platform.system())
        platformdic["Version"] = str(platform.version())
        platformdic["Python version"] = str(platform.python_version())
        system = str(platform.system())
        if system == "Windows":
            platformdic["Win32"] = str(platform.win32_ver())
        elif system == "Darwin":
            platformdic["Mac"] = str(platform.mac_ver())
        elif system == "Linux":
            platformdic["Linux"] = str(platform.linux_distribution())
            platformdic["Libc"] = str(platform.libc_ver())
        htmlplatform = "<b>version =</b> " + __version__ + " (" + __revision__ + ")<br>"
        for key in sorted(platformdic):
            htmlplatform += "<b>" + key + " = </b> <i>" + platformdic[key] + "</i><br>"
        platformEdit = QTextEdit()
        platformEdit.setHtml(htmlplatform)
        platformEdit.setReadOnly(True)
        layout = QVBoxLayout()
        layout.addWidget(platformEdit)
        self.setLayout(layout) 
Example #30
Source File: model-view_code.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QVBoxLayout())
        self.filename = qtw.QLineEdit()
        self.filecontent = qtw.QTextEdit()
        self.savebutton = qtw.QPushButton(
            'Save',
            clicked=self.submit
        )
        self.layout().addWidget(self.filename)
        self.layout().addWidget(self.filecontent)
        self.layout().addWidget(self.savebutton)