本文整理匯總了Python中PyQt5.QtGui.QFontDatabase.systemFont方法的典型用法代碼示例。如果您正苦於以下問題:Python QFontDatabase.systemFont方法的具體用法?Python QFontDatabase.systemFont怎麽用?Python QFontDatabase.systemFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtGui.QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase.systemFont方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def __init__(self, parent, connection):
super(CodeEditDialog, self).__init__(None, Qt.WindowCloseButtonHint)
self.setupUi(self)
geometry = Settings().retrieve_geometry("editor")
if geometry:
self.restoreGeometry(geometry)
self._connection = connection
self.saveLocalButton.clicked.connect(self._save_local)
self.saveMcuButton.clicked.connect(self._save_to_mcu)
#self.runButton.clicked.connect(self._run_file)
self.runButton.hide()
fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.codeEdit.setFont(fixed_font)
if connection and connection.is_connected():
self.connected(connection)
else:
self.disconnected()
示例2: __init__
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def __init__(self):
super(TracebackWindow, self).__init__()
self.framelist = []
self.ret_add = 0x0
self.setWindowTitle("Traceback")
self.setLayout(QtWidgets.QVBoxLayout())
self._layout = self.layout()
# Creates the rich text viewer that displays the traceback
self._textBrowser = QtWidgets.QTextBrowser()
self._textBrowser.setOpenLinks(False)
self._textBrowser.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
self._layout.addWidget(self._textBrowser)
# Creates the button that displays the return address
self._ret = QtWidgets.QPushButton()
self._ret.setFlat(True)
self._layout.addWidget(self._ret)
self.resize(self.width(), int(self.height() * 0.5))
self.setObjectName('Traceback_Window')
示例3: __init__
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def __init__(self, parent, connection, terminal):
super(TerminalDialog, self).__init__(None, Qt.WindowCloseButtonHint)
self.setupUi(self)
self.setWindowFlags(Qt.Window)
geometry = Settings().retrieve_geometry("terminal")
if geometry:
self.restoreGeometry(geometry)
self.connection = connection
self.terminal = terminal
self._auto_scroll = True # TODO: Settings?
self.terminal_listener = Listener(self.emit_update_content)
self._update_content_signal.connect(self.update_content)
self.terminal.add_event.connect(self.terminal_listener)
self.outputTextEdit.installEventFilter(self)
self.outputTextEdit.verticalScrollBar().sliderPressed.connect(self._stop_scrolling)
self.outputTextEdit.verticalScrollBar().sliderReleased.connect(self._scroll_released)
self.outputTextEdit.verticalScrollBar().installEventFilter(self)
self.inputTextBox.installEventFilter(self)
self.clearButton.clicked.connect(self.clear_content)
self.sendButton.clicked.connect(self.send_input)
self.ctrlaButton.clicked.connect(lambda: self.send_control("a"))
self.ctrlbButton.clicked.connect(lambda: self.send_control("b"))
self.ctrlcButton.clicked.connect(lambda: self.send_control("c"))
self.ctrldButton.clicked.connect(lambda: self.send_control("d"))
self.ctrleButton.clicked.connect(lambda: self.send_control("e"))
fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
self.outputTextEdit.setFont(fixed_font)
self.inputTextBox.setFont(fixed_font)
self.autoscrollCheckBox.setChecked(self._auto_scroll)
self.autoscrollCheckBox.stateChanged.connect(self._auto_scroll_changed)
self.terminal.read()
self.outputTextEdit.setText(TerminalDialog.process_backspaces(self.terminal.history))
self._input_history_index = 0
示例4: 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()
)
示例5: _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)
}
示例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('搜索歌曲、歌手、專輯、用戶')
self.setToolTip('直接輸入文字可以進行過濾,按 Enter 可以搜索\n'
'輸入 >>> 前綴之後,可以執行 Python 代碼\n'
'輸入 # 前綴之後,可以過濾表格內容\n'
'輸入 > 前綴可以執行 fuo 命令(未實現,歡迎 PR)')
self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.setFixedHeight(32)
self.setFrame(False)
self.setAttribute(Qt.WA_MacShowFocusRect, 0)
self.setTextMargins(5, 0, 0, 0)
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.textEdited.connect(self.__on_text_edited)
self.returnPressed.connect(self.__on_return_pressed)
self._app.hotkey_mgr.register(
[QKeySequence('Ctrl+F'), QKeySequence(':'), QKeySequence('Alt+x')],
self.setFocus
)
示例7: get_monospace_font
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def get_monospace_font() -> QFont:
fixed_font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
fixed_font.setPointSize(QApplication.instance().font().pointSize())
return fixed_font
示例8: __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("...")
示例9: set_defaults
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def set_defaults(cls, default_family: typing.List[str],
default_size: str) -> None:
"""Make sure default_family/default_size are available.
If the given family value (fonts.default_family in the config) is
unset, a system-specific default monospace font is used.
Note that (at least) three ways of getting the default monospace font
exist:
1) f = QFont()
f.setStyleHint(QFont.Monospace)
print(f.defaultFamily())
2) f = QFont()
f.setStyleHint(QFont.TypeWriter)
print(f.defaultFamily())
3) f = QFontDatabase.systemFont(QFontDatabase.FixedFont)
print(f.family())
They yield different results depending on the OS:
QFont.Monospace | QFont.TypeWriter | QFontDatabase
------------------------------------------------------
Windows: Courier New | Courier New | Courier New
Linux: DejaVu Sans Mono | DejaVu Sans Mono | monospace
macOS: Menlo | American Typewriter | Monaco
Test script: https://p.cmpl.cc/d4dfe573
On Linux, it seems like both actually resolve to the same font.
On macOS, "American Typewriter" looks like it indeed tries to imitate a
typewriter, so it's not really a suitable UI font.
Looking at those Wikipedia articles:
https://en.wikipedia.org/wiki/Monaco_(typeface)
https://en.wikipedia.org/wiki/Menlo_(typeface)
the "right" choice isn't really obvious. Thus, let's go for the
QFontDatabase approach here, since it's by far the simplest one.
"""
if default_family:
families = configutils.FontFamilies(default_family)
else:
assert QApplication.instance() is not None
font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
families = configutils.FontFamilies([font.family()])
cls.default_family = families.to_str(quote=True)
cls.default_size = default_size
示例10: __init__
# 需要導入模塊: from PyQt5.QtGui import QFontDatabase [as 別名]
# 或者: from PyQt5.QtGui.QFontDatabase import systemFont [as 別名]
def __init__(self,parent=None):
super(Editor,self).__init__(parent)
ComponentMixin.__init__(self)
self._filename = ''
self.setup_editor(linenumbers=True,
markers=True,
edge_line=False,
tab_mode=False,
show_blanks=True,
font=QFontDatabase.systemFont(QFontDatabase.FixedFont),
language='Python')
self._actions = \
{'File' : [QAction(icon('new'),
'New',
self,
shortcut='ctrl+N',
triggered=self.new),
QAction(icon('open'),
'Open',
self,
shortcut='ctrl+O',
triggered=self.open),
QAction(icon('save'),
'Save',
self,
shortcut='ctrl+S',
triggered=self.save),
QAction(icon('save_as'),
'Save as',
self,
shortcut='ctrl+shift+S',
triggered=self.save_as),
QAction(icon('autoreload'),
'Automatic reload and preview',
self,triggered=self.autoreload,
checkable=True,
checked=False,
objectName='autoreload'),
]}
for a in self._actions.values():
self.addActions(a)
self._fixContextMenu()
self.updatePreferences()
# autoreload support
self._file_watcher = QFileSystemWatcher(self)
self._watched_file = None
# we wait for 50ms after a file change for the file to be written completely
self._file_watch_timer = QTimer(self)
self._file_watch_timer.setInterval(50)
self._file_watch_timer.setSingleShot(True)
self._file_watcher.fileChanged.connect(
lambda val: self._file_watch_timer.start())
self._file_watch_timer.timeout.connect(self._file_changed)