本文整理匯總了Python中AnyQt.QtGui.QFont.setFixedPitch方法的典型用法代碼示例。如果您正苦於以下問題:Python QFont.setFixedPitch方法的具體用法?Python QFont.setFixedPitch怎麽用?Python QFont.setFixedPitch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtGui.QFont
的用法示例。
在下文中一共展示了QFont.setFixedPitch方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setFixedPitch [as 別名]
def __init__(self, data):
icon = QApplication.style().standardIcon(QStyle.SP_MessageBoxWarning)
F = self.DataField
def _finished(*, key=(data.get(F.MODULE),
data.get(F.WIDGET_MODULE)),
filename=data.get(F.WIDGET_SCHEME)):
self._cache.add(key)
try:
os.remove(filename)
except Exception:
pass
super().__init__(None, Qt.Window, modal=True,
sizeGripEnabled=True, windowIcon=icon,
windowTitle='Unexpected Error',
finished=_finished)
self._data = data
layout = QVBoxLayout(self)
self.setLayout(layout)
labels = QWidget(self)
labels_layout = QHBoxLayout(self)
labels.setLayout(labels_layout)
labels_layout.addWidget(QLabel(pixmap=icon.pixmap(50, 50)))
labels_layout.addWidget(QLabel(
'The program encountered an unexpected error. Please<br>'
'report it anonymously to the developers.<br><br>'
'The following data will be reported:'))
labels_layout.addStretch(1)
layout.addWidget(labels)
font = QFont('Monospace', 10)
font.setStyleHint(QFont.Monospace)
font.setFixedPitch(True)
textbrowser = QTextBrowser(self,
font=font,
openLinks=False,
lineWrapMode=QTextBrowser.NoWrap,
anchorClicked=QDesktopServices.openUrl)
layout.addWidget(textbrowser)
def _reload_text():
add_scheme = cb.isChecked()
settings.setValue('error-reporting/add-scheme', add_scheme)
lines = ['<table>']
for k, v in data.items():
if k.startswith('_'):
continue
_v, v = v, escape(str(v))
if k == F.WIDGET_SCHEME:
if not add_scheme:
continue
v = '<a href="{}">{}</a>'.format(urljoin('file:', pathname2url(_v)), v)
if k in (F.STACK_TRACE, F.LOCALS):
v = v.replace('\n', '<br>').replace(' ', ' ')
lines.append('<tr><th align="left">{}:</th><td>{}</td></tr>'.format(k, v))
lines.append('</table>')
textbrowser.setHtml(''.join(lines))
settings = QSettings()
cb = QCheckBox(
'Include workflow (data will NOT be transmitted)', self,
checked=settings.value('error-reporting/add-scheme', True, type=bool))
cb.stateChanged.connect(_reload_text)
_reload_text()
layout.addWidget(cb)
buttons = QWidget(self)
buttons_layout = QHBoxLayout(self)
buttons.setLayout(buttons_layout)
buttons_layout.addWidget(
QPushButton('Send Report (Thanks!)', default=True, clicked=self.accept))
buttons_layout.addWidget(QPushButton("Don't Send", default=False, clicked=self.reject))
layout.addWidget(buttons)