Python PyQt5.QtCore.Qt 模块,RichText() 实例源码

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

项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def dropEvent(self, event):
        mimeData = event.mimeData()
        if mimeData.hasImage():
            self.setPixmap(QPixmap(mimeData.imageData()))
        elif mimeData.hasHtml():
            self.setText(mimeData.html())
            self.setTextFormat(Qt.RichText)
        elif mimeData.hasText():
            self.setText(mimeData.text())
            self.setTextFormat(Qt.PlainText)
        elif mimeData.hasUrls():
            self.setText("\n".join([url.path() for url in mimeData.urls()]))
        else:
            self.setText("Cannot display data")

        self.setBackgroundRole(QPalette.Dark)
        event.acceptProposedAction()
项目:Gao-s-SB    作者:bioinformatist    | 项目源码 | 文件源码
def exception_message(log_lines, exc_info):
    stacktrace = traceback.format_exception(*exc_info) if exc_info else ""
    message = """
    {log_lines}

    ----
    {stacktrace}
    """.format(log_lines='\n'.join(log_lines), stacktrace='\n'.join(stacktrace))
    mb = QMessageBox()
    mb.setIcon(QMessageBox.Critical)
    mb.setWindowTitle("DUANG!!!")
    mb.setText('A critical error occurred. Select the details to display it.')
    mb.setInformativeText("Please report it to "
                          "<a href=https://github.com/bioinformatist/Gao-s-SB/issues/new>the owner's GitHub</a>")
    mb.setTextFormat(Qt.RichText)
    mb.setDetailedText(message)

    mb.setTextInteractionFlags(Qt.TextSelectableByMouse)
    mb.exec()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def dropEvent(self, event):
        mimeData = event.mimeData()
        if mimeData.hasImage():
            self.setPixmap(QPixmap(mimeData.imageData()))
        elif mimeData.hasHtml():
            self.setText(mimeData.html())
            self.setTextFormat(Qt.RichText)
        elif mimeData.hasText():
            self.setText(mimeData.text())
            self.setTextFormat(Qt.PlainText)
        elif mimeData.hasUrls():
            self.setText("\n".join([url.path() for url in mimeData.urls()]))
        else:
            self.setText("Cannot display data")

        self.setBackgroundRole(QPalette.Dark)
        event.acceptProposedAction()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def dropEvent(self, event):
        mimeData = event.mimeData()
        if mimeData.hasImage():
            self.setPixmap(QPixmap(mimeData.imageData()))
        elif mimeData.hasHtml():
            self.setText(mimeData.html())
            self.setTextFormat(Qt.RichText)
        elif mimeData.hasText():
            self.setText(mimeData.text())
            self.setTextFormat(Qt.PlainText)
        elif mimeData.hasUrls():
            self.setText("\n".join([url.path() for url in mimeData.urls()]))
        else:
            self.setText("Cannot display data")

        self.setBackgroundRole(QPalette.Dark)
        event.acceptProposedAction()
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def get_notes(self) -> QLabel:
        content = QLabel()
        content.setStyleSheet('margin:10px; border:1px solid #BABABA; padding:10px; color:#666;')
        content.setTextFormat(Qt.RichText)
        content.setWordWrap(True)
        content.setText('''Labels from this list will be used to filter links. Filtering is NOT case-sensitive.
                            <br/><br/>Example:<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;the simpsons<br/>
                            &nbsp;&nbsp;&nbsp;&nbsp;south park''')
        return content
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(LogsPage, self).__init__(parent)
        self.parent = parent
        self.setObjectName('settingslogspage')
        verboseCheckbox = QCheckBox('Enable verbose logging', self)
        verboseCheckbox.setToolTip('Detailed log ouput to log file and console')
        verboseCheckbox.setCursor(Qt.PointingHandCursor)
        verboseCheckbox.setChecked(self.parent.parent.verboseLogs)
        verboseCheckbox.stateChanged.connect(self.setVerboseLogs)
        verboseLabel = QLabel('''
            <b>ON:</b> includes detailed logs from video player (MPV) and backend services
            <br/>
            <b>OFF:</b> includes errors and important messages to log and console
        ''', self)
        verboseLabel.setObjectName('verboselogslabel')
        verboseLabel.setTextFormat(Qt.RichText)
        verboseLabel.setWordWrap(True)
        logsLayout = QVBoxLayout()
        logsLayout.addWidget(verboseCheckbox)
        logsLayout.addWidget(verboseLabel)
        logsGroup = QGroupBox('Logging')
        logsGroup.setLayout(logsLayout)
        mainLayout = QVBoxLayout()
        mainLayout.setSpacing(10)
        mainLayout.addWidget(logsGroup)
        mainLayout.addStretch(1)
        self.setLayout(mainLayout)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def switchTheme(self) -> None:
        if self.darkRadio.isChecked():
            newtheme = 'dark'
        else:
            newtheme = 'light'
        if newtheme != self.parent.theme:
            # noinspection PyArgumentList
            mbox = QMessageBox(icon=QMessageBox.NoIcon, windowTitle='Restart required', minimumWidth=500,
                               textFormat=Qt.RichText, objectName='genericdialog')
            mbox.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint)
            mbox.setText('''
                <style>
                    h1 {
                        color: %s;
                        font-family: "Futura-Light", sans-serif;
                        font-weight: 400;
                    }
                    p { font-size: 15px; }
                </style>
                <h1>Warning</h1>
                <p>The application needs to be restarted in order to switch themes. Attempts will be made to reopen
                media files and add back all clip times from your clip index.</p>
                <p>Would you like to restart and switch themes now?</p>'''
                         % ('#C681D5' if self.parent.theme == 'dark' else '#642C68'))
            mbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
            mbox.setDefaultButton(QMessageBox.Yes)
            response = mbox.exec_()
            if response == QMessageBox.Yes:
                self.parent.settings.setValue('theme', newtheme)
                self.parent.parent.theme = newtheme
                self.parent.parent.parent.reboot()
            else:
                self.darkRadio.setChecked(True) if newtheme == 'light' else self.lightRadio.setChecked(True)
项目:FIRST-plugin-ida    作者:vrtadmin    | 项目源码 | 文件源码
def view_about(self):
        self.thread_stop = True
        container = QtWidgets.QVBoxLayout()

        label = QtWidgets.QLabel('FIRST ')
        label.setStyleSheet('font: 24px;')
        container.addWidget(label)

        label = QtWidgets.QLabel('Function Identification and Recovery Signature Tool')
        label.setStyleSheet('font: 12px;')
        container.addWidget(label)

        grid_layout = QtWidgets.QGridLayout()
        grid_layout.addWidget(QtWidgets.QLabel('Version'), 0, 0)
        grid_layout.addWidget(QtWidgets.QLabel(str(FIRST.VERSION)), 0, 1)
        grid_layout.addWidget(QtWidgets.QLabel('Date'), 1, 0)
        grid_layout.addWidget(QtWidgets.QLabel(FIRST.DATE), 1, 1)

        grid_layout.addWidget(QtWidgets.QLabel('Report Issues'), 2, 0)
        label = QtWidgets.QLabel(('<a href="https://git.vrt.sourcefire.com/'
                                'demonduck/FIRST/issues/new">'
                                'git.vrt.sourcefire.com</a>'))
        label.setTextFormat(Qt.RichText)
        label.setTextInteractionFlags(Qt.TextBrowserInteraction)
        label.setOpenExternalLinks(True)
        grid_layout.addWidget(label, 2, 1)

        grid_layout.setColumnMinimumWidth(0, 100)
        grid_layout.setColumnStretch(1, 1)
        grid_layout.setContentsMargins(10, 0, 0, 0)

        container.addSpacing(10)
        container.addLayout(grid_layout)
        container.addStretch()

        copyright = '{}-{} Cisco Systems, Inc.'.format(FIRST.BEGIN, FIRST.END)
        label = QtWidgets.QLabel(copyright)
        label.setStyleSheet('font: 10px;')
        label.setAlignment(Qt.AlignCenter)

        container.addWidget(label)
        return container