本文整理汇总了Python中PyQt5.QtGui.QFontDatabase.systemFont方法的典型用法代码示例。如果您正苦于以下问题:Python QFontDatabase.systemFont方法的具体用法?Python QFontDatabase.systemFont怎么用?Python QFontDatabase.systemFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase.systemFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_encrypt_tab
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def create_encrypt_tab(self):
w = QWidget()
layout = QGridLayout(w)
message_e = QTextEdit()
layout.addWidget(QLabel(_('Message')), 1, 0)
layout.addWidget(message_e, 1, 1)
layout.setRowStretch(2, 2)
recipient_e = QTextEdit()
recipient_e.setPlaceholderText('''-----BEGIN PGP PUBLIC KEY BLOCK-----''')
recipient_e.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
layout.addWidget(QLabel(_('Recipient key')), 2, 0)
layout.addWidget(recipient_e, 2, 1)
encrypted_e = QTextEdit()
encrypted_e.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
layout.addWidget(QLabel(_('Encrypted')), 3, 0)
layout.addWidget(encrypted_e, 3, 1)
layout.setRowStretch(3, 1)
hbox = QHBoxLayout()
b = QPushButton(_('Encrypt'))
b.clicked.connect(lambda: self.do_encrypt(message_e, recipient_e, encrypted_e))
hbox.addWidget(b)
b = QPushButton(_('Decrypt'))
b.clicked.connect(lambda: self.do_decrypt(encrypted_e, message_e))
hbox.addWidget(b)
layout.addLayout(hbox, 4, 1)
return w
示例2: drawWindow
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def drawWindow(self):
if self.layout() is not None:
tempWidget = QWidget()
tempWidget.setLayout(self.layout())
gridLayout = QGridLayout()
# add header
gridLayout.addWidget(QLabel('Libraries'), 0, 0)
gridLayout.addWidget(QLabel(''), 0, 1)
# add new library edit box
self.libraryNameEdit = QLineEdit()
fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.libraryNameEdit.setFont(fixedWidthFont)
gridLayout.addWidget(self.libraryNameEdit, 1, 0)
self.addButton = QPushButton('Add')
self.addButton.clicked.connect(self.addClicked)
gridLayout.addWidget(self.addButton, 1, 1)
self.buttons = {}
row = 2
for lib in self.libraries:
gridLayout.addWidget(QLabel(lib), row, 0)
deleteButton = QPushButton()
deleteButton.setObjectName(lib)
deleteButton.setText('Delete')
deleteButton.clicked.connect(self.deleteButtonClicked)
gridLayout.addWidget(deleteButton, row, 1)
row += 1
self.buttons[deleteButton] = lib
self.resize(300, 100)
self.setLayout(gridLayout)
示例3: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, parent):
super().__init__(parent)
font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
font.setPointSize(8)
self.setFont(font)
self.setPlainText("...")
示例4: create_signature_tab
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def create_signature_tab(self):
w = QWidget()
layout = QGridLayout(w)
message_e = QTextEdit()
layout.addWidget(QLabel(_('Message')), 1, 0)
layout.addWidget(message_e, 1, 1)
layout.setRowStretch(2, 2)
encrypted_e = QTextEdit()
encrypted_e.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
layout.addWidget(QLabel(_('Signed')), 2, 0)
layout.addWidget(encrypted_e, 2, 1)
layout.setRowStretch(2, 2)
hbox = QHBoxLayout()
b = QPushButton(_('Sign'))
b.clicked.connect(lambda: self.do_sign(message_e, encrypted_e))
hbox.addWidget(b)
b = QPushButton(_('Verify'))
b.clicked.connect(lambda: self.do_verify(encrypted_e, message_e))
hbox.addWidget(b)
layout.addLayout(hbox, 3, 1)
return w
示例5: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, name, timeValue):
super(QDialog, self).__init__()
self.resize(300, 150)
timeContainer = QGroupBox()
timeContainer.setTitle('Time (ms)')
self.lineEdit = QLineEdit()
fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.lineEdit.setFont(fixedWidthFont)
self.lineEdit.setText(str(timeValue))
vLayout = QVBoxLayout()
vLayout.addWidget(self.lineEdit)
self.cancelButton = QPushButton()
self.cancelButton.setText('Cancel')
self.cancelButton.clicked.connect(self.cancelClicked)
self.acceptButton = QPushButton()
self.acceptButton.setText('Accept')
self.acceptButton.clicked.connect(self.acceptClicked)
buttonContainer = QWidget()
hLayout = QHBoxLayout()
hLayout.addWidget(self.cancelButton)
hLayout.addWidget(self.acceptButton)
buttonContainer.setLayout(hLayout)
vLayout.addWidget(buttonContainer)
timeContainer.setLayout(vLayout)
vLayout2 = QVBoxLayout()
vLayout2.addWidget(timeContainer)
self.setLayout(vLayout2)
示例6: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, app, parent=None):
super().__init__(parent)
self._app = app
# self.setPlaceholderText('搜索歌曲、歌手、专辑、用户;执行 Python 代码等')
self.setPlaceholderText('Search library, exec code, or run command.')
self.setToolTip('直接输入文字可以进行过滤,按 Enter 可以搜索\n'
'输入 >>> 前缀之后,可以执行 Python 代码\n'
'输入 $ 前缀可以执行 fuo 命令(未实现,欢迎 PR)')
self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
# 模拟 QLineEdit
self.setTabChangesFocus(True)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setWordWrapMode(QTextOption.NoWrap)
self.setFixedHeight(self.sizeHint().height())
self.setMinimumHeight(25)
self._timer = QTimer(self)
self._cmd_text = None
self._mode = 'cmd' # 详见 _set_mode 函数
self._timer.timeout.connect(self.__on_timeout)
self.textChanged.connect(self.__on_text_edited)
self._highlighter = Highlighter(self.document())
# self.textEdited.connect(self.__on_text_edited)
self.returnPressed.connect(self.__on_return_pressed)
示例7: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, buf, parent=None):
super(HexViewWidget, self).__init__()
self.setupUi(self)
self._buf = buf
self._model = HexTableModel(self._buf)
self._colored_regions = intervaltree.IntervalTree()
self._origins = []
# ripped from pyuic5 ui/hexview.ui
# at commit 6c9edffd32706097d7eba8814d306ea1d997b25a
# so we can add our custom HexTableView instance
self.view = HexTableView(self)
sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.view.sizePolicy().hasHeightForWidth())
self.view.setSizePolicy(sizePolicy)
self.view.setMinimumSize(QSize(660, 0))
self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.view.setSelectionMode(QAbstractItemView.NoSelection)
self.view.setShowGrid(False)
self.view.setWordWrap(False)
self.view.setObjectName("view")
self.view.horizontalHeader().setDefaultSectionSize(25)
self.view.horizontalHeader().setMinimumSectionSize(25)
self.view.verticalHeader().setDefaultSectionSize(21)
self.mainLayout.insertWidget(0, self.view)
# end rip
# TODO: provide a HexViewWidget.setModel method, and don't build it ourselves
self.view.setModel(self._model)
for i in range(0x10):
self.view.setColumnWidth(i, 25)
self.view.setColumnWidth(0x10, 12)
for i in range(0x11, 0x22):
self.view.setColumnWidth(i, 11)
self._hsm = HexItemSelectionModel(self._model, self.view)
self.view.setSelectionModel(self._hsm)
self.view.setContextMenuPolicy(Qt.CustomContextMenu)
self.view.customContextMenuRequested.connect(self._handle_context_menu_requested)
self._hsm.selectionRangeChanged.connect(self._handle_selection_range_changed)
self.originsChanged.connect(self._handle_origins_changed)
self.view.moveKeyPressed.connect(self._hsm.handle_move_key)
self.view.selectKeyPressed.connect(self._hsm.handle_select_key)
f = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.view.setFont(f)
self.statusLabel.setFont(f)
self.view.setItemDelegate(HexItemDelegate(self._model, self))
self.statusLabel.setText("")
示例8: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, name, currentValue):
super(QDialog, self).__init__()
self.setWindowTitle(name)
self.resize(800, 600)
self.codeEdit = QsciScintilla()
self.codeEdit.setText(currentValue)
fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.codeEdit.setFont(fixedWidthFont)
fontmetrics = QFontMetrics(fixedWidthFont)
self.codeEdit.setMarginWidth(0, fontmetrics.width("000"))
self.codeEdit.setMarginLineNumbers(0, True)
self.codeEdit.setMarginsBackgroundColor(QColor("#cccccc"))
self.codeEdit.setBraceMatching(QsciScintilla.SloppyBraceMatch)
self.codeEdit.setCaretLineVisible(True)
self.codeEdit.setCaretLineBackgroundColor(QColor("#ffe4e4"))
lexer = QsciLexerPython()
lexer.setDefaultFont(fixedWidthFont)
self.codeEdit.setLexer(lexer)
self.codeEdit.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
self.codeEdit.setUtf8(True)
self.codeEdit.setTabWidth(4)
self.codeEdit.setIndentationsUseTabs(True)
self.codeEdit.setIndentationGuides(True)
self.codeEdit.setTabIndents(True)
self.codeEdit.setAutoIndent(True)
self.cancelButton = QPushButton('Cancel')
self.cancelButton.clicked.connect(self.cancel)
self.acceptButton = QPushButton('Accept')
self.acceptButton.clicked.connect(self.accept)
self.pythonButton = QRadioButton('Python')
self.pythonButton.setChecked(True)
self.pythonButton.clicked.connect(self.pythonClicked)
self.cppButton = QRadioButton('C++')
self.cppButton.clicked.connect(self.cppClicked)
hLayout0 = QHBoxLayout()
hLayout0.addWidget(self.pythonButton)
hLayout0.addWidget(self.cppButton)
container0 = QWidget()
container0.setLayout(hLayout0)
verticalLayout = QVBoxLayout()
verticalLayout.addWidget(container0)
verticalLayout.addWidget(self.codeEdit)
container = QWidget()
hLayout =QHBoxLayout()
hLayout.addWidget(self.cancelButton)
hLayout.addWidget(self.acceptButton)
container.setLayout(hLayout)
verticalLayout.addWidget(container)
self.setLayout(verticalLayout)
self.language = 'python'
示例9: family
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def family(self):
return idaapi.reg_read_string(
'Name',
self._key,
'Consolas'
if os.name == 'nt' else
QFontDatabase.systemFont(QFontDatabase.FixedFont).family().encode()
)
示例10: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, name):
super(QDialog, self).__init__()
self.setWindowTitle(name)
self.config = None
self.gridLayout = QGridLayout()
# add header
self.gridLayout.addWidget(QLabel('Server Type'), 0, 0)
self.gridLayout.addWidget(QLabel('Name'), 0, 1)
self.gridLayout.addWidget(QLabel('Topic'), 0, 2)
self.gridLayout.addWidget(QLabel('Proxy Name'), 0, 3)
self.gridLayout.addWidget(QLabel('IP'), 0, 4)
self.gridLayout.addWidget(QLabel('Port'), 0, 5)
self.gridLayout.addWidget(QLabel('Interface'), 0, 6)
self.gridLayout.addWidget(QLabel(''), 0, 7)
# add new config input fields
fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.serverTypeCombo = QComboBox()
self.serverTypeCombo.setFont(fixedWidthFont)
self.gridLayout.addWidget(self.serverTypeCombo, 1, 0)
self.nameEdit = QLineEdit()
self.nameEdit.setFont(fixedWidthFont)
self.gridLayout.addWidget(self.nameEdit, 1, 1)
self.topicEdit = QLineEdit()
self.topicEdit.setFont(fixedWidthFont)
self.topicEdit.setEnabled(False)
self.gridLayout.addWidget(self.topicEdit, 1, 2)
self.proxyNameEdit = QLineEdit()
self.proxyNameEdit.setFont(fixedWidthFont)
self.gridLayout.addWidget(self.proxyNameEdit, 1, 3)
self.ipEdit = QLineEdit()
self.ipEdit.setFont(fixedWidthFont)
self.gridLayout.addWidget(self.ipEdit, 1, 4)
self.portEdit = QLineEdit()
self.portEdit.setFont(fixedWidthFont)
self.gridLayout.addWidget(self.portEdit, 1, 5)
self.interfaceCombo = QComboBox()
self.gridLayout.addWidget(self.interfaceCombo, 1, 6)
self.addButton = QPushButton('Add')
self.gridLayout.addWidget(self.addButton, 1, 7)
self.addButton.clicked.connect(self.addClicked)
self.rowCount = 2
# add server types to the combobox
self.serverTypeCombo.addItem('ICE', 'ice')
self.serverTypeCombo.addItem('ROS', 'ros')
self.serverTypeCombo.currentIndexChanged.connect(self.serverTypeChanged)
# add interfaces to the combobox
interfaces = Interfaces.getInterfaces()
for interfaceName in interfaces:
self.interfaceCombo.addItem(interfaceName, interfaceName)
self.resize(700, 100)
self.setLayout(self.gridLayout)
示例11: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, title, config):
QDialog.__init__(self)
if config is not None:
self.type = config.type
else:
self.type = JDEROBOTCOMM
self.setWindowTitle(title)
commSelectionBox = QGroupBox('Select Communication Interface')
commSelectionBox.setObjectName('commInterface')
# add new config input fields
fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.commTypeCombo = QComboBox()
self.commTypeCombo.setFont(fixedWidthFont)
self.commTypeCombo.setMaximumWidth(220)
boxLayout = QVBoxLayout()
boxLayout.addWidget(self.commTypeCombo)
commSelectionBox.setLayout(boxLayout)
vLayout = QFormLayout()
vLayout.addWidget(commSelectionBox)
self.configsLayout = QVBoxLayout()
self.configsBox = QGroupBox('')
self.configsBox.setLayout(self.configsLayout)
vLayout.addWidget(self.configsBox)
self.setLayout(vLayout)
self.resize(700, 500)
#self.setStyleSheet('QGroupBox#commInterface { border: 1px solid black; border-radius: 4px; padding:15px;} QGroupBox::title#commInterface {background-color:transparent; padding-left:25px; padding-top:5px;} ')
self.rosConfigsUI = RosConfigDialog('ROS Communication')
self.rosConfigsUI.configChanged.connect(self.configChangedHandler)
self.configsLayout.addWidget(self.rosConfigsUI)
self.rosConfigsUI.setVisible(False)
self.jderobotCommConfigsUI = JdeRobotCommConfigDialog('JdeRobot Communication')
self.jderobotCommConfigsUI.configChanged.connect(self.configChangedHandler)
self.configsLayout.addWidget(self.jderobotCommConfigsUI)
self.jderobotCommConfigsUI.setVisible(True)
self.rosConfig = None
self.jdeRobotCommConfig = None
self.commTypeCombo.addItem('JdeRobot Communication', 'jderobotcomm')
self.commTypeCombo.addItem('ROS Node', 'ros')
self.commTypeCombo.currentIndexChanged.connect(self.commTypeComboChanged)
if config is not None:
if config.type == ROS:
self.rosConfig = config
self.commTypeCombo.setCurrentIndex(1)
self.loadRosConfigs()
elif config.type == JDEROBOTCOMM:
self.jdeRobotCommConfig = config
self.commTypeCombo.setCurrentIndex(0)
self.loadJdeRobotCommConfigs()
else:
self.loadJdeRobotCommConfigs()
示例12: create_key_info_tab
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def create_key_info_tab(self):
w = QWidget()
layout = QGridLayout(w)
layout.addWidget(QLabel(_('GPG public key')), 1, 1)
data_e = QTextEdit()
data_e.setReadOnly(True)
data_e.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
layout.addWidget(data_e, 2, 1)
data_e.setPlainText(self.gpgw.export_pubkey())
return w
示例13: __init__
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def __init__(self, parent):
super().__init__(parent)
self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
self.setAcceptRichText(False)
self.setTabChangesFocus(True)
self._highlighter = RulesEditorHighlighter(self.document())
self._quiescence_timer = QTimer(self)
self._quiescence_timer.setSingleShot(True)
self._quiescence_timer.setInterval(self.QUIESCENCE_TIME_MSEC)
self._quiescence_timer.timeout.connect(self._on_quiescence_timer_timeout)
self.document().contentsChanged.connect(self._on_contents_changed)
示例14: _initializeDefaults
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def _initializeDefaults(self) -> None:
self._fonts = {
"system": QCoreApplication.instance().font(),
"fixed": QFontDatabase.systemFont(QFontDatabase.FixedFont)
}
palette = QCoreApplication.instance().palette()
self._colors = {
"system_window": palette.window(),
"system_text": palette.text()
}
self._sizes = {
"line": QSizeF(self._em_width, self._em_height)
}
示例15: fixedFont
# 需要导入模块: from PyQt5.QtGui import QFontDatabase [as 别名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 别名]
def fixedFont():
"""
Returns a default fixed-pitch QFont_ for each supported platform.
Returns "Consolas" instead of the default "Courier New" on Windows.
TODO: test more
.. _QFont: http://doc.qt.io/qt-5/qfont.html
"""
font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
if sys.platform == "win32":
# pick Consolas instead of Courier New
font.setFamily("Consolas")
elif sys.platform == "darwin":
# pick Menlo instead of Monaco
font.setFamily("Menlo")
font.setPointSize(11)
return font