当前位置: 首页>>代码示例>>Python>>正文


Python QFontDatabase.systemFont方法代码示例

本文整理汇总了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() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:24,代码来源:code_edit_dialog.py

示例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') 
开发者ID:nccgroup,项目名称:binja_dynamics,代码行数:24,代码来源:__init__.py

示例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 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:41,代码来源:terminal_dialog.py

示例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()    
        ) 
开发者ID:zyantific,项目名称:IDASkins,代码行数:10,代码来源:idafontconfig.py

示例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)
        } 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:17,代码来源:Theme.py

示例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
        ) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:31,代码来源:magicbox.py

示例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 
开发者ID:jopohl,项目名称:urh,代码行数:6,代码来源:util.py

示例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("...") 
开发者ID:jopohl,项目名称:urh,代码行数:9,代码来源:UnlabeledRangeItem.py

示例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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:55,代码来源:configtypes.py

示例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) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:63,代码来源:editor.py


注:本文中的PyQt5.QtGui.QFontDatabase.systemFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。