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


Python QtWidgets.QFontDialog类代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QFontDialog的典型用法代码示例。如果您正苦于以下问题:Python QFontDialog类的具体用法?Python QFontDialog怎么用?Python QFontDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QFontDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_font

 def get_font(self):
     try:
         conf = self.get_console_config()
         return QFontDialog.getFont(conf)
         #return pango.FontDescription(conf['font.type'])
     except KeyError:
         return QFontDialog.setFont(QFont="Liberation Sans")
开发者ID:khrysro,项目名称:monocute,代码行数:7,代码来源:configurations.py

示例2: on_bTest_clicked

 def on_bTest_clicked(self):
     """
     Private method to test the selected options.
     """
     if self.font is None:
         QFontDialog.getFont()
     else:
         QFontDialog.getFont(self.font)
开发者ID:Darriall,项目名称:eric,代码行数:8,代码来源:FontDialogWizardDialog.py

示例3: on_fontButton_clicked

 def on_fontButton_clicked(self):
     """
     Private slot to handle the button press to select a font via a
     font selection dialog.
     """
     if self.font is None:
         font, ok = QFontDialog.getFont()
     else:
         font, ok = QFontDialog.getFont(self.font)
     if ok:
         self.font = font
     else:
         self.font = None
开发者ID:Darriall,项目名称:eric,代码行数:13,代码来源:FontDialogWizardDialog.py

示例4: on_rtfFontButton_clicked

 def on_rtfFontButton_clicked(self):
     """
     Private method used to select the font for the RTF export.
     """
     font, ok = QFontDialog.getFont(self.rtfFont)
     if ok:
         self.rtfFontSample.setFont(font)
         self.rtfFont = font
开发者ID:testmana2,项目名称:test,代码行数:8,代码来源:EditorExportersPage.py

示例5: selectFont

 def selectFont(self):
     selected = self.table.selectedItems()
     if not selected:
         return
     font, ok = QFontDialog.getFont(self.font(), self)
     if not ok:
         return
     for i in selected:
         i and i.setFont(font)
开发者ID:death-finger,项目名称:Scripts,代码行数:9,代码来源:spreadsheet.py

示例6: msg

   def msg(self):  
       color = QColorDialog.getColor(Qt.blue, self, "Select Color")  
       if color.isValid():  
           print(color.name(),color)  
           self.myButton.setPalette(QPalette(color))#给按钮填充背景色  
           self.myButton.setAutoFillBackground(True)  
 
       font, ok = QFontDialog.getFont()  
       if ok:  
           print(font.key)  
           self.myButton.setFont(font)  
开发者ID:weather319,项目名称:gdals,代码行数:11,代码来源:setbackground.py

示例7: changeFont

	def changeFont(self):
		if not self.font:
			self.font = QFont()
		fd = QFontDialog.getFont(self.font, self)
		if fd[1]:
			self.font = QFont()
			self.font.setFamily(fd[0].family())
			settings.setValue('font', fd[0].family())
			self.font.setPointSize(fd[0].pointSize())
			settings.setValue('fontSize', fd[0].pointSize())
			self.updatePreviewBox()
开发者ID:frostasm,项目名称:retext,代码行数:11,代码来源:window.py

示例8: _load_editor_font

 def _load_editor_font(self):
     try:
         font, ok = QFontDialog.getFont(self._font, self)
         if ok:
             self._font = font
             btnText = ', '.join(self._font.toString().split(',')[0:2])
             self._btnEditorFont.setText(btnText)
     except:
         QMessageBox.warning(
             self,
             translations.TR_PREFERENCES_EDITOR_GENERAL_FONT_MESSAGE_TITLE,
             translations.TR_PREFERENCES_EDITOR_GENERAL_FONT_MESSAGE_BODY)
开发者ID:Salmista-94,项目名称:Ninja_3.0_PyQt5,代码行数:12,代码来源:preferences_editor_general.py

示例9: on_select_font

 def on_select_font(self):
     action = self._font_menu.exec_(QCursor.pos())
     if action is None:
         return
     if action == self._font_menu_text:
         name = 'text_font'
         font_options = ()
     elif action == self._font_menu_strokes:
         name = 'strokes_font'
         font_options = (QFontDialog.MonospacedFonts,)
     font = self._get_font(name)
     font, ok = QFontDialog.getFont(font, self, '', *font_options)
     if ok:
         self._set_font(name, font)
开发者ID:morinted,项目名称:plover,代码行数:14,代码来源:suggestions_dialog.py

示例10: choose_font

def choose_font(mono=True, parent=None):
    fonts_logger.debug('choose_font mono={0}'.format(mono))
    if mono :
        caption = _TR('fonts.py',
                      'Select a monospaced font for editing'
                      'Font choice dialog caption')
        initial = _MONO_QFONT
    else :
        caption = _TR('fonts.py',
                      'Select the font for titles, menus, and buttons',
                      'Font choice dialog caption')
        initial = _GENL_QFONT
    (new_font, ok) = QFontDialog.getFont(initial,parent,caption)
    if ok : return new_font
    else: return None
开发者ID:B-Rich,项目名称:PPQT2,代码行数:15,代码来源:fonts.py

示例11: _baseDialog

 def _baseDialog(self, parent, initialValue):
     """
 Adapter: !!! the value returned by QFontDialog.getFont() is a tuple.
 Adapt (flip) to tuple required by Super
 """
     # Use overloaded PyQt signature whose first parameter is initial, not a keyword.
     assert isinstance(initialValue, QFont)
     result, ok = QFontDialog.getFont(initialValue, parent=parent)
     assert isinstance(ok, bool), str(type(ok))
     assert result is None or isinstance(result, QFont), str(type(result))
     """
 Qt docs say: ok==False implies canceled and result is Qt's default font
 But doesn't work??? assert isinstance(result, QFont)
 """
     return ok, result
开发者ID:bootchk,项目名称:documentStyle,代码行数:15,代码来源:fontPickerWidget.py

示例12: __change_font

 def __change_font(self):
     font = CONFIG.get("fontFamily")
     size = CONFIG.get("fontSize")
     if font is None:
         font, size = CONFIG._get_font()
     font, ok = QFontDialog.getFont(QFont(font, size), self)
     if ok:
         CONFIG.set_value("fontFamily", font.family())
         CONFIG.set_value("fontSize", font.pointSize())
         central = Pireal.get_service("central")
         mcontainer = central.get_active_db()
         if mcontainer is not None:
             query_widget = mcontainer.query_container.currentWidget()
             if query_widget is not None:
                 weditor = query_widget.get_editor()
                 if weditor is not None:
                     weditor.set_font(font.family(), font.pointSize())
         # Cambio el texto en la interfáz QML
         self.__root.setFontFamily(font.family(), font.pointSize())
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:19,代码来源:preferences.py

示例13: selectFont

 def selectFont(self, fontSample, fontVar, showFontInfo=False):
     """
     Public method used by the font selection buttons.
     
     @param fontSample reference to the font sample widget (QLineEdit)
     @param fontVar reference to the variable containing the font (QFont)
     @param showFontInfo flag indicating to show some font info
         as the sample (boolean)
     @return selected font (QFont)
     """
     font, ok = QFontDialog.getFont(fontVar)
     if ok:
         fontSample.setFont(font)
         if showFontInfo:
             fontSample.setText(
                 "{0} {1}".format(font.family(), font.pointSize()))
     else:
         font = fontVar
     return font
开发者ID:chiamingyen,项目名称:kmol2016,代码行数:19,代码来源:ConfigurationPageBase.py

示例14: __init__

 def __init__(self, parent=None):
     """Init class."""
     super(MainWindow, self).__init__()
     self.setWindowTitle(__doc__.strip().capitalize())
     self.statusBar().showMessage(" Choose one App and move the sliders !")
     self.setMinimumSize(480, 240)
     self.setMaximumSize(640, 2048)
     self.setWindowIcon(QIcon.fromTheme("preferences-system"))
     self.center()
     QShortcut("Ctrl+q", self, activated=lambda: self.close())
     self.menuBar().addMenu("&File").addAction("Exit", exit)
     windowMenu = self.menuBar().addMenu("&Window")
     windowMenu.addAction("Minimize", lambda: self.showMinimized())
     windowMenu.addAction("Maximize", lambda: self.showMaximized())
     windowMenu.addAction("Restore", lambda: self.showNormal())
     windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
     windowMenu.addAction("Center", lambda: self.center())
     windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
     windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
     windowMenu.addSeparator()
     windowMenu.addAction(
         "Increase size", lambda:
         self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
     windowMenu.addAction("Decrease size", lambda: self.resize(
         self.size().width() // 1.4, self.size().height() // 1.4))
     windowMenu.addAction("Minimum size", lambda:
                          self.resize(self.minimumSize()))
     windowMenu.addAction("Maximum size", lambda:
                          self.resize(self.maximumSize()))
     windowMenu.addAction("Horizontal Wide", lambda: self.resize(
         self.maximumSize().width(), self.minimumSize().height()))
     windowMenu.addAction("Vertical Tall", lambda: self.resize(
         self.minimumSize().width(), self.maximumSize().height()))
     windowMenu.addSeparator()
     windowMenu.addAction("Disable Resize", lambda:
                          self.setFixedSize(self.size()))
     windowMenu.addAction("Set Interface Font...", lambda:
                          self.setFont(QFontDialog.getFont()[0]))
     helpMenu = self.menuBar().addMenu("&Help")
     helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
     helpMenu.addAction("About Python 3",
                        lambda: open_new_tab('https://www.python.org'))
     helpMenu.addAction("About" + __doc__,
                        lambda: QMessageBox.about(self, __doc__, HELP))
     helpMenu.addSeparator()
     helpMenu.addAction(
         "Keyboard Shortcut",
         lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
     helpMenu.addAction("View Source Code",
                        lambda: call('xdg-open ' + __file__, shell=True))
     helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
     helpMenu.addAction("Report Bugs", lambda: open_new_tab(
         'https://github.com/juancarlospaco/pyority/issues?state=open'))
     helpMenu.addAction("Check Updates", lambda: Downloader(self))
     container, child_container = QWidget(), QWidget()
     container_layout = QVBoxLayout(container)
     child_layout = QHBoxLayout(child_container)
     self.setCentralWidget(container)
     # widgets
     group0 = QGroupBox("My Apps")
     group1, group2 = QGroupBox("CPU Priority"), QGroupBox("HDD Priority")
     child_layout.addWidget(group0)
     child_layout.addWidget(group1)
     child_layout.addWidget(group2)
     container_layout.addWidget(child_container)
     # table
     self.table = QTableWidget()
     self.table.setColumnCount(1)
     self.table.verticalHeader().setVisible(True)
     self.table.horizontalHeader().setVisible(False)
     self.table.setShowGrid(False)
     self.table.setAlternatingRowColors(True)
     self.table.setIconSize(QSize(64, 64))
     self.table.setSelectionMode(QAbstractItemView.SingleSelection)
     self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
     # Graphic effect
     glow = QGraphicsDropShadowEffect(self)
     glow.setOffset(0)
     glow.setBlurRadius(9)
     glow.setColor(QColor(99, 255, 255))
     self.table.setGraphicsEffect(glow)
     glow.setEnabled(True)
     processes = self.generate_process_list()
     self.table.setRowCount(len(processes))
     for index, process in enumerate(processes):
         item = QTableWidgetItem(
             QIcon.fromTheme(process.name().split()[0].split('/')[0]),
             process.name().split()[0].split('/')[0].strip())
         item.setData(Qt.UserRole, process)
         item.setToolTip("{}, {}, {}, {}".format(
             process.name(), process.nice(),
             process.ionice()[1], process.pid))
         self.table.setItem(index, 0, item)
     self.table.clicked.connect(lambda: self.sliderhdd.setDisabled(False))
     self.table.clicked.connect(lambda: self.slidercpu.setDisabled(False))
     self.table.clicked.connect(lambda: self.slidercpu.setValue(
         int(tuple(self.table.currentItem().toolTip().split(","))[1])))
     self.table.clicked.connect(lambda: self.sliderhdd.setValue(
         int(tuple(self.table.currentItem().toolTip().split(","))[2])))
     self.table.resizeColumnsToContents()
#.........这里部分代码省略.........
开发者ID:juancarlospaco,项目名称:pyority,代码行数:101,代码来源:pyority.py

示例15: showDialog

 def showDialog(self):
     font, ok = QFontDialog.getFont()
     if ok:
         self.lbl.setFont(font)
开发者ID:anontx,项目名称:pyqt_study,代码行数:4,代码来源:font_dialog.py


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