本文整理汇总了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)