Python PyQt5.QtCore.Qt.RichText() Examples

The following are 17 code examples of PyQt5.QtCore.Qt.RichText(). 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.QtCore.Qt , or try the search function .
Example #1
Source File: meta.py    From FeelUOwn with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.cover_label = CoverLabel(self)
        # these three widgets are in right layout
        self.title_label = QLabel(self)
        self.meta_label = QLabel(self)
        # this spacer item is used as a stretch in right layout,
        # it's  width and height is not so important, we set them to 0
        self.text_spacer = QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)

        self.title_label.setTextFormat(Qt.RichText)
        self.meta_label.setTextFormat(Qt.RichText)

        self._setup_ui()
        self._refresh() 
Example #2
Source File: welcome_window.py    From Dwarf with GNU General Public License v3.0 6 votes vote down vote up
def setup(self):
        """ Setup ui
        """
        h_box = QHBoxLayout()
        h_box.setContentsMargins(0, 0, 0, 0)
        update_label = QLabel(
            'A newer Version of Dwarf is available. Checkout <a style="color:white;" '
            'href="https://github.com/iGio90/Dwarf">Dwarf on GitHub</a> for more informations'
        )
        update_label.setOpenExternalLinks(True)
        update_label.setTextFormat(Qt.RichText)
        update_label.setTextInteractionFlags(Qt.TextBrowserInteraction)

        self.update_button = QPushButton('Update now!', update_label)
        self.update_button.setStyleSheet('padding: 0; border-color: white;')
        self.update_button.setGeometry(
            self.parent().width() - 10 - update_label.width() * .2, 5,
            update_label.width() * .2, 25)
        self.update_button.clicked.connect(self.update_now_clicked)
        #self.setMaximumHeight(35)
        h_box.addWidget(update_label)
        self.setLayout(h_box) 
Example #3
Source File: Browser.py    From Hydra with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, url):
            super().__init__()

            self.layout = QHBoxLayout()
            self.editor = QLabel()

            self.layout.addWidget(self.editor)
            self.editor.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
            self.editor.setText(
                """
                <h2> Sorry, support for Windows systems will come soon! </h2>
                <h2> Here are some links related to the issue:
            <a href=\"https://github.com/pyqt/python-qt5/issues/21\">https://github.com/pyqt/python-qt5/issues/21</a>
            </h2>
            """
            )
            self.editor.setTextFormat(Qt.RichText)
            self.editor.setTextInteractionFlags(Qt.TextBrowserInteraction)
            self.editor.setOpenExternalLinks(True)
            self.setLayout(self.layout)
            self.show() 
Example #4
Source File: meta.py    From FeelUOwn with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.toolbar = CollectionToolbar(self)

        self._title_label = QLabel(self)
        self._cover_label = QLabel(self)
        self._meta_label = QLabel(self)

        self._title_label.setTextFormat(Qt.RichText)
        self._meta_label.setTextFormat(Qt.RichText)
        self._top_mid_spacer = QSpacerItem(25, 0)

        self._layout = QVBoxLayout(self)
        self._top_layout = QHBoxLayout()
        self._top_right_layout = QVBoxLayout()
        self._bottom_layout = QHBoxLayout()

        self._setup_ui() 
Example #5
Source File: about.py    From vidcutter with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(BaseTab, self).__init__(parent)
        self.setTextFormat(Qt.RichText)
        self.setWordWrap(True)
        self.setAlignment(Qt.AlignLeft | Qt.AlignTop)
        self.setOpenExternalLinks(True)
        if parent.theme == 'dark':
            bgcolor = 'rgba(12, 15, 16, 210)'
            pencolor = '#FFF'
        else:
            bgcolor = 'rgba(255, 255, 255, 200)'    
            pencolor = '#000'
        self.setStyleSheet('''
            QLabel {{
                background-color: {bgcolor};
                color: {pencolor};
                padding: 8px;
            }}'''.format(**locals()))


# noinspection PyBroadException 
Example #6
Source File: suite.py    From mhw_armor_edit with The Unlicense 5 votes vote down vote up
def handle_about_action(self):
        dialog = QDialog(self)
        dialog.setWindowTitle("About MHW Editor Suite")
        layout = QVBoxLayout()
        dialog.setLayout(layout)
        about_text = QLabel(ABOUT_TEXT)
        about_text.setTextFormat(Qt.RichText)
        about_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        about_text.setOpenExternalLinks(True)
        layout.addWidget(about_text)
        dialog.exec() 
Example #7
Source File: __init__.py    From tdm with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(HTMLLabel, self).__init__(*args, **kwargs)
        self.setTextFormat(Qt.RichText)
        self.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.setOpenExternalLinks(True)
        self.setWordWrap(True) 
Example #8
Source File: __init__.py    From tdm with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cmd, title="", *args, **kwargs):
        super(CmdWikiUrl, self).__init__(*args, **kwargs)
        self.setTextFormat(Qt.RichText)
        self.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.setOpenExternalLinks(True)
        self.setText("<a href=https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#{}>{}</a>".format(cmd, title if title else cmd)) 
Example #9
Source File: casc_plugin.py    From CASC with 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 #10
Source File: table.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.setContentsMargins(30, 15, 30, 10)
        self.setWordWrap(True)
        self.setTextFormat(Qt.RichText)
        self.setTextInteractionFlags(Qt.TextSelectableByMouse) 
Example #11
Source File: earlyinit.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def _die(message, exception=None):
    """Display an error message using Qt and quit.

    We import the imports here as we want to do other stuff before the imports.

    Args:
        message: The message to display.
        exception: The exception object if we're handling an exception.
    """
    from PyQt5.QtWidgets import QApplication, QMessageBox
    from PyQt5.QtCore import Qt
    if (('--debug' in sys.argv or '--no-err-windows' in sys.argv) and
            exception is not None):
        print(file=sys.stderr)
        traceback.print_exc()
    app = QApplication(sys.argv)
    if '--no-err-windows' in sys.argv:
        print(message, file=sys.stderr)
        print("Exiting because of --no-err-windows.", file=sys.stderr)
    else:
        if exception is not None:
            message = message.replace('%ERROR%', str(exception))
        msgbox = QMessageBox(QMessageBox.Critical, "qutebrowser: Fatal error!",
                             message)
        msgbox.setTextFormat(Qt.RichText)
        msgbox.resize(msgbox.sizeHint())
        msgbox.exec_()
    app.quit()
    sys.exit(1) 
Example #12
Source File: settings.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
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 LT", sans-serif;
                        font-weight: normal;
                    }
                </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) 
Example #13
Source File: settings.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
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.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(15)
        mainLayout.addWidget(logsGroup)
        mainLayout.addStretch(1)
        self.setLayout(mainLayout) 
Example #14
Source File: keyhintwidget.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, win_id, parent=None):
        super().__init__(parent)
        self.setTextFormat(Qt.RichText)
        self._win_id = win_id
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.hide()
        self._show_timer = usertypes.Timer(self, 'keyhint_show')
        self._show_timer.timeout.connect(self.show)
        self._show_timer.setSingleShot(True)
        stylesheet.set_register(self) 
Example #15
Source File: backendproblem.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *, because: str,
                 text: str,
                 backend: usertypes.Backend,
                 buttons: typing.Sequence[_Button] = None,
                 parent: QWidget = None) -> None:
        super().__init__(parent)
        vbox = QVBoxLayout(self)

        other_backend, other_setting = _other_backend(backend)
        text = _error_text(because, text, backend)

        label = QLabel(text)
        label.setWordWrap(True)
        label.setTextFormat(Qt.RichText)
        vbox.addWidget(label)

        hbox = QHBoxLayout()
        buttons = [] if buttons is None else buttons

        quit_button = QPushButton("Quit")
        quit_button.clicked.connect(lambda: self.done(_Result.quit))
        hbox.addWidget(quit_button)

        backend_text = "Force {} backend".format(other_backend.name)
        if other_backend == usertypes.Backend.QtWebKit:
            backend_text += ' (not recommended)'
        backend_button = QPushButton(backend_text)
        backend_button.clicked.connect(functools.partial(
            self._change_setting, 'backend', other_setting))
        hbox.addWidget(backend_button)

        for button in buttons:
            btn = QPushButton(button.text)
            btn.setDefault(button.default)
            btn.clicked.connect(functools.partial(
                self._change_setting, button.setting, button.value))
            hbox.addWidget(btn)

        vbox.addLayout(hbox) 
Example #16
Source File: msgbox.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def msgbox(parent, title, text, *, icon, buttons=QMessageBox.Ok,
           on_finished=None, plain_text=None):
    """Display a QMessageBox with the given icon.

    Args:
        parent: The parent to set for the message box.
        title: The title to set.
        text: The text to set.
        buttons: The buttons to set (QMessageBox::StandardButtons)
        on_finished: A slot to connect to the 'finished' signal.
        plain_text: Whether to force plain text (True) or rich text (False).
                    None (the default) uses Qt's auto detection.

    Return:
        A new QMessageBox.
    """
    if objects.args.no_err_windows:
        print('Message box: {}; {}'.format(title, text), file=sys.stderr)
        return DummyBox()

    box = QMessageBox(parent)
    box.setAttribute(Qt.WA_DeleteOnClose)
    box.setIcon(icon)
    box.setStandardButtons(buttons)
    if on_finished is not None:
        box.finished.connect(on_finished)
    if plain_text:
        box.setTextFormat(Qt.PlainText)
    elif plain_text is not None:
        box.setTextFormat(Qt.RichText)
    box.setWindowTitle(title)
    box.setText(text)
    box.show()
    return box 
Example #17
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 4 votes vote down vote up
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://github.com/'
                                'vrtadmin/FIRST-plugin-ida/issues">'
                                'github.com/vrtadmin/FIRST-plugin-ida</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