Python PyQt5.QtWidgets.QTextEdit() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QTextEdit(). 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: qutebrowser   Author: qutebrowser   File: test_completiondelegate.py    License: 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 2
Project: networkzero   Author: tjguk   File: chatter.py    License: 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 3
Project: Cura   Author: Ultimaker   File: CrashHandler.py    License: GNU Lesser General Public License v3.0 6 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 4
Project: Writer-Tutorial   Author: goldsborough   File: part-3.py    License: 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 5
Project: kawaii-player   Author: kanishka-linux   File: settings_widget.py    License: 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 6
Project: kawaii-player   Author: kanishka-linux   File: settings_widget.py    License: 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 7
Project: GROOT   Author: ugroot   File: notesWindow.py    License: 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 8
Project: heap-viewer   Author: danigargu   File: bins.py    License: 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 9
Project: heap-viewer   Author: danigargu   File: magic.py    License: 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 10
Project: heap-viewer   Author: danigargu   File: magic.py    License: 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 11
Project: heap-viewer   Author: danigargu   File: magic.py    License: 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 12
Project: linux-show-player   Author: FrancescoCeruti   File: info_panel.py    License: 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 13
Project: handyscripts   Author: Tecplot   File: pyqt5_execute_macro_command.py    License: 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 14
Project: python   Author: Yeah-Kun   File: Putting_it_together.py    License: 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 15
Project: tierpsy-tracker   Author: ver228   File: AnalysisProgress_ui.py    License: 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 16
Project: Pythonic   Author: hANSIc99   File: exceptwindow.py    License: 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 17
Project: pkmeter   Author: pkkid   File: pkwidgets.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, etree, control, parent=None):
        QtWidgets.QTextEdit.__init__(self)
        self._changed = False
        self.setTabChangesFocus(True)
        self.textChanged.connect(self._handle_text_changed)
        pkmixins.LayoutMixin._init(self, etree, control, parent) 
Example 18
Project: pkmeter   Author: pkkid   File: pkwidgets.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setHtml(self, html):
        QtWidgets.QTextEdit.setHtml(self, html)
        self._changed = False 
Example 19
Project: pkmeter   Author: pkkid   File: pkwidgets.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setText(self, text):
        QtWidgets.QTextEdit.setText(self, text)
        self._changed = False 
Example 20
Project: simnibs   Author: simnibs   File: simulation_menu.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super(SimProgressScreen, self).__init__()

        self.text = ''
        self.simFinished = False

        self.textBox = QtWidgets.QTextEdit()
        self.textBox.setReadOnly(True)
        self.textBox.setAcceptRichText(True)


        self.terminate_btn = QtWidgets.QPushButton('Terminate')
        self.terminate_btn.clicked.connect(self.close)

        mainLayout = QtWidgets.QGridLayout()

        mainLayout.addWidget(self.textBox)
        mainLayout.addWidget(self.terminate_btn)

        self.central_widget = QtWidgets.QWidget()
        self.central_widget.setLayout(mainLayout)


        self.setCentralWidget(self.central_widget)


        self.resize(800,500)

        self.setWindowTitle('Simulation Progress')
        try:
            gui_icon = os.path.join(SIMNIBSDIR,'resources', 'gui_icon.gif')
            self.setWindowIcon(QtGui.QIcon(gui_icon))
        except:
            pass 
Example 21
Project: idasec   Author: RobinDavid   File: default_analysis.py    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent, config, is_stream=False, trace=None):
        self.parent = parent
        self.configuration = config
        self.broker = Broker()
        self.result_widget = QtWidgets.QTextEdit()
        self.is_stream = is_stream
        self.trace_input_generator = None
        self.analyse_finished = False
        self.trace_finished = False
        if not is_stream and trace is not None:
            self.trace_input_generator = raw_parse_trace(trace.filename) 
Example 22
Project: easygui_qt   Author: aroberge   File: show_text_window.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, file_name=None, title="Title", text_type='text',
                 text='Default text'):
        """Simple text window whose input comes from a file, if a file_name 
           is specified, or from a supplied string.

           text_type can be one of  4 values: 'text', 'code', 'html', 'python'.
           If 'python' is specified, some basic syntax highlighting is added.
        """
        super(TextWindow, self).__init__(None)

        self.setWindowTitle(title)
        self.resize(900, 600)
        self.editor = qt_widgets.QTextEdit(self)
        self.setCentralWidget(self.editor)
        self.editor.setFocus()

        if file_name is not None:
            text = self.load(file_name)

        if text_type == 'text' or text_type == 'html':
            self.set_text_font()
        elif text_type == 'code':
            self.set_monospace_font()
        elif text_type == 'python':
            self.set_monospace_font()
            self.highlighter = Highlighter(self.editor.document())
        else:
            self.set_text_font()
            text = "Unknown text_type: {}".format(text_type)

        if text_type == 'html':
            self.editor.setHtml(text)
        else:
            self.editor.setPlainText(text) 
Example 23
Project: screenshot   Author: SeptemberHX   File: textinput.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(TextInput, self).__init__(parent)

        self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)

        self.mainLayout = QVBoxLayout()
        self.textArea = QTextEdit(self)

        self.buttonArea = QWidget(self)
        self.buttonLayout = QHBoxLayout()
        self.cancelButton = QPushButton('Cancel', self)
        self.okButton = QPushButton('Ok', self)
        self.buttonLayout.addWidget(self.cancelButton)
        self.buttonLayout.addWidget(self.okButton)
        self.buttonArea.setLayout(self.buttonLayout)

        self.mainLayout.addWidget(self.textArea)
        self.mainLayout.addWidget(self.buttonArea)
        self.setLayout(self.mainLayout)

        self.textArea.textChanged.connect(self.textChanged_)
        self.okButton.clicked.connect(self.okButtonClicked)
        self.cancelButton.clicked.connect(self.cancelPressed) 
Example 24
Project: tf-pose   Author: SrikanthVelpuri   File: FlowchartTemplate_pyqt5.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 25
Project: Lector   Author: BasioMeusPuga   File: dockwidgets.py    License: GNU General Public License v3.0 5 votes vote down vote up
def hideEvent(self, event=None):
        if self.notes_only:
            annotationNoteEdit = self.findChild(QtWidgets.QTextEdit)
            if self.current_annotation:
                self.current_annotation['note'] = annotationNoteEdit.toPlainText()

        try:
            self.main_window.active_docks.remove(self)
        except ValueError:
            pass 
Example 26
Project: visma   Author: aerospaceresearch   File: logger.py    License: GNU General Public License v3.0 5 votes vote down vote up
def logTextBox(workspace):
    workspace.logBox = QTextEdit()
    workspace.logBox.setReadOnly(True)
    textLayout = QVBoxLayout()
    textLayout.addWidget(workspace.logBox)
    return textLayout 
Example 27
Project: persepolis   Author: persepolisdm   File: error_window.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, text):
        super().__init__()
# finding windows_size
        self.setMinimumSize(QSize(363, 300))
        self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle('Persepolis Download Manager')

        verticalLayout = QVBoxLayout(self)
        horizontalLayout = QHBoxLayout()
        horizontalLayout.addStretch(1)

        self.text_edit = QTextEdit(self)
        self.text_edit.setReadOnly(True)
        self.text_edit.insertPlainText(text)

        verticalLayout.addWidget(self.text_edit)

        self.label2 = QLabel(self)
        self.label2.setText('Reseting persepolis may solving problem.\nDo not panic!If you add your download links again,\npersepolis will resume your downloads\nPlease copy this error message and press "Report Issue" button\nand open a new issue in Github for it.\nWe answer you as soon as possible. \nreporting this issue help us to improve persepolis.\nThank you!')
        verticalLayout.addWidget(self.label2)

        self.report_pushButton = QPushButton(self)
        self.report_pushButton.setText("Report Issue")
        horizontalLayout.addWidget(self.report_pushButton)

        self.reset_persepolis_pushButton = QPushButton(self)
        self.reset_persepolis_pushButton.clicked.connect(
            self.resetPushButtonPressed)
        self.reset_persepolis_pushButton.setText('Reset Persepolis')
        horizontalLayout.addWidget(self.reset_persepolis_pushButton)

        self.close_pushButton = QPushButton(self)
        self.close_pushButton.setText('close')
        horizontalLayout.addWidget(self.close_pushButton)

        verticalLayout.addLayout(horizontalLayout)

        self.report_pushButton.clicked.connect(self.reportPushButtonPressed)
        self.close_pushButton.clicked.connect(self.closePushButtonPressed) 
Example 28
Project: CHATIMUSMAXIMUS   Author: benhoff   File: message_area.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, text_color=Qt.white, font=QtGui.QFont.DemiBold):
        super(_StandardTextFormat, self).__init__()
        self.setFontWeight(font)
        self.setForeground(text_color)
        self.setFontPointSize(13)
        self.setVerticalAlignment(QtGui.QTextCharFormat.AlignMiddle)


# TODO: see `QTextEdit.setAlignment` for setting the time to the right 
Example 29
Project: networkzero   Author: tjguk   File: adventure.py    License: MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(Adventure, self).__init__(parent)

        #
        # Top-half of the
        #
        self.image_panel = QtWidgets.QLabel()
        self.image_panel.setAlignment(QtCore.Qt.AlignCenter)
        self.image = QtGui.QPixmap("image.jpg")
        self.image_panel.setPixmap(self.image)

        self.text_panel = QtWidgets.QTextEdit()
        self.text_panel.setReadOnly(True)
        self.text_panel.setTextBackgroundColor(QtGui.QColor("blue"))
        self.text_panel.setHtml("""<h1>Hello, World!</h1>

        <p>You are in a spacious ballroom with the sound of music playing all around you.</p>
        """)

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

        self.input = QtWidgets.QLineEdit()

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.image_panel, 1)
        hlayout = QtWidgets.QHBoxLayout()
        hlayout.addWidget(self.text_panel, 3)
        hlayout.addWidget(self.data_panel, 1)
        layout.addLayout(hlayout, 1)
        layout.addWidget(self.input)

        self.setLayout(layout)
        self.setWindowTitle("Westpark Adventure") 
Example 30
Project: DevilYuan   Author: moyuanz   File: DyStockTableColumnOperateDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self, colNames):
        self.setWindowTitle('列运算')
 
        # 控件
        table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
        table.setColNames(['列名', '表达式'])
        rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
        table.fastAppendRows(rows)

        descriptionLabel = QLabel('列运算表达式(Pandas语法)')
        self._expressionTextEdit = QTextEdit()

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(table, 0, 0, 22, 1)

        grid.addWidget(descriptionLabel, 0, 1)

        grid.addWidget(self._expressionTextEdit, 1, 1, 20, 20)
 
        grid.addWidget(okPushButton, 0, 21)
        grid.addWidget(cancelPushButton, 1, 21)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3)