Beispiel #1
0
 def fontChanged(self):
     currentfont = QtGui.QFont(self.currentPropertyAttrib[0],
                               self.currentPropertyAttrib[2])
     currentfont.setBold(self.currentPropertyAttrib[3])
     currentfont.setItalic(self.currentPropertyAttrib[4])
     font = QtGui.QFontDialog().getFont(currentfont, self)
     if font[1]:
         font = font[0]
         name = font.rawName()
         size = font.pointSize()
         bold = font.bold()
         italic = font.italic()
         if self.fontScopeBG.checkedButton().text() == 'All':
             for key, value in self.currentStyle.items():
                 value[0] = name
                 value[2] = size
                 value[3] = bold
                 value[4] = italic
                 self.currentStyle[key] = value
         else:
             self.currentPropertyAttrib[0] = name
             self.currentPropertyAttrib[2] = size
             self.currentPropertyAttrib[3] = bold
             self.currentPropertyAttrib[4] = italic
             self.currentStyle[self.currentPropertyName] = \
                 self.currentPropertyAttrib
Beispiel #2
0
    def ChangeFont(self):
        FontDialog = QtGui.QFontDialog()
        FontDialog.setWindowIcon(QtGui.QIcon("Icon.ico"))
        SelectedFont, isOK = FontDialog.getFont(self.ui.textEdit)

        if isOK:
            self.ui.textEdit.setFont(SelectedFont)
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        try:
            self.systemFont = parent.system_font
            self.initialFont = parent.font()
        except AttributeError:
            font = QtGui.QApplication.instance().font()
            self.systemFont = font
            self.initialFont = font

        self.fontdialog = QtGui.QFontDialog()
        self.fontdialog.setCurrentFont(self.initialFont)
        self.fontdialog.setOption(self.fontdialog.NoButtons)

        buttonBox = QtGui.QDialogButtonBox(self)
        buttonBox.addButton(buttonBox.Apply)
        self.resetBut = buttonBox.addButton(_("Reset to Original Font"),
                                            buttonBox.RejectRole)
        self.systemBut = buttonBox.addButton(_("Use System Font"),
                                             buttonBox.ResetRole)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.fontdialog)

        layout.addWidget(buttonBox)

        self.connect(buttonBox, QtCore.SIGNAL("clicked (QAbstractButton *)"),
                     self.apply)
 def fontChanged(self):
     currentfont = QtGui.QFont(self.currentPropertyAttrib[2],
                               self.currentPropertyAttrib[3])
     currentfont.setBold(self.currentPropertyAttrib[4])
     currentfont.setItalic(self.currentPropertyAttrib[5])
     font = QtGui.QFontDialog().getFont(currentfont, self)
     if font[1]:
         font = font[0]
         name = font.rawName()
         size = font.pointSize()
         bold = font.bold()
         italic = font.italic()
         self.currentPropertyAttrib[2] = name
         self.currentPropertyAttrib[3] = size
         self.currentPropertyAttrib[4] = bold
         self.currentPropertyAttrib[5] = italic
    def chooseFont(self):

        font = QtGui.QFont(self.label_attributes.family(),
                           self.label_attributes.size())
        font.setBold(self.label_attributes.bold())
        font.setItalic(self.label_attributes.italic())
        font.setStrikeOut(self.label_attributes.strikeOut())
        font.setUnderline(self.label_attributes.underline())

        dlg = QtGui.QFontDialog()
        dlg.setCurrentFont(font)
        dlg.setModal(True)
        dlg.show()
        result = dlg.exec_()

        if result == 1:
            font = dlg.selectedFont()
            self.label_attributes.setFamily(font.family())
            self.label_attributes.setBold(font.bold())
            self.label_attributes.setItalic(font.italic())
            self.label_attributes.setUnderline(font.underline())
            self.label_attributes.setStrikeOut(font.strikeOut())
            self.label_attributes.setSize(font.pointSizeF(),
                                          core.QgsLabelAttributes.PointUnits)
Beispiel #6
0
 def on_pbWidgetFont_pressed(self):
     font, ok = QtGui.QFontDialog().getFont(self.ui.leWidgetFont.font(),
                                            self)
     if ok:
         self.ui.leWidgetFont.setFont(font)
Beispiel #7
0
 def fontButtonClicked(self):
     """Dialogo de selección de color"""
     dialog = QtGui.QFontDialog(self.lineEdit.font())
     if dialog.exec_():
         self.lineEdit.setFont(dialog.currentFont())
         self.fontChanged.emit(dialog.currentFont())
Beispiel #8
0
 def fontEdit(self):
     fontDialog = QtGui.QFontDialog()
     fontDialog.setCurrentFont( self.activeMdiChild().fuente)
     fontDialog.exec_()
     self.activeMdiChild().fuente = fontDialog.currentFont()
Beispiel #9
0
 def font_style(self):
     font, valid = QtGui.QFontDialog().getFont()
     if valid:
         self.style_label.setFont(font)