本文整理汇总了Python中PyQt5.QtCore.Qt.RichText方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.RichText方法的具体用法?Python Qt.RichText怎么用?Python Qt.RichText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.RichText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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()
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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()
示例4: setup
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例5: _die
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例6: msgbox
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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
示例7: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例9: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例10: switchTheme
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例11: handle_about_action
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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()
示例12: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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)
示例13: setupUi
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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
#-------------------------------------------------------------------------------
示例14: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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))
示例15: view_about
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import RichText [as 别名]
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