Beispiel #1
0
    def _get_label_font_from_widget(self):
        """ Helper function extracting the currently selected
        labels font info from the widget.

        """

        fontFamily = self.labelFontComboBox.currentFont().family()
        fontStyle  = self.labelStyleComboBox.currentText()
        if self.labelSizeComboBox.currentText():
            fontSize = int(self.labelSizeComboBox.currentText())
        else:
            fontSize = 20

        fontDataBase  = QFontDatabase()
        newLabelFont = fontDataBase.font(fontFamily, fontStyle, fontSize)

        return newLabelFont
    def _get_label_font_from_widget(self):
        """ Helper function extracting the currently selected
        labels font info from the widget.

        """

        fontFamily = self.labelFontComboBox.currentFont().family()
        fontStyle = self.labelStyleComboBox.currentText()
        if self.labelSizeComboBox.currentText():
            fontSize = int(self.labelSizeComboBox.currentText())
        else:
            fontSize = 20

        fontDataBase = QFontDatabase()
        newLabelFont = fontDataBase.font(fontFamily, fontStyle, fontSize)

        return newLabelFont
Beispiel #3
0
IMC.dictPath = os.path.join(base, u"dict")

# Initialize the font system. We need a monospaced font with clear visual
# separation between 0/O, 1/l, etc, and a good complement of Unicode, with
# at a minimum full support of Greek, Cyrillic and Hebrew. These features are
# found in Liberation Mono, which is free, and by Courier New, which is less
# readable but is bundled in most OSs by default, and by Everson Mono.
# We prefer Liberation Mono, but set that or Courier New as the default font family
# and as our App's default font. pqMain uses it as a default when
# reading the font family name from the saved settings.

pqMsgs.noteEvent("Setting up default font name")

lm_name = QString(u'Liberation Mono')
qfdb = QFontDatabase()
qf = qfdb.font(lm_name, QString(u'Regular'), 12)
if qf.family() == lm_name:
    # Lib. Mono is installed in this system, good to go
    IMC.defaultFontFamily = lm_name
else:
    # Let's try to install Lib. Mono. Was it bundled with us?
    fpath = os.path.join(base, u"fonts")
    if os.path.exists(fpath):
        # It was; add each .ttf in it to the Qt font database
        # We are *assuming* that what's in fonts is Liberation Mono Regular
        # for sure, and optionally other variants like bold.
        for fname in os.listdir(fpath):
            if fname.endswith(u'.ttf'):
                qfdb.addApplicationFont(QString(os.path.join(fpath, fname)))
        IMC.defaultFontFamily = lm_name
    else:
Beispiel #4
0
IMC.dictPath = os.path.join(base,u"dict")

# Initialize the font system. We need a monospaced font with clear visual
# separation between 0/O, 1/l, etc, and a good complement of Unicode, with
# at a minimum full support of Greek, Cyrillic and Hebrew. These features are
# found in Liberation Mono, which is free, and by Courier New, which is less
# readable but is bundled in most OSs by default, and by Everson Mono.
# We prefer Liberation Mono, but set that or Courier New as the default font family
# and as our App's default font. pqMain uses it as a default when
# reading the font family name from the saved settings.

pqMsgs.noteEvent("Setting up default font name")

lm_name = QString(u'Liberation Mono')
qfdb = QFontDatabase()
qf = qfdb.font(lm_name,QString(u'Regular'),12)
if qf.family() == lm_name :
    # Lib. Mono is installed in this system, good to go
    IMC.defaultFontFamily = lm_name
else:
    # Let's try to install Lib. Mono. Was it bundled with us?
    fpath = os.path.join(base,u"fonts")
    if os.path.exists(fpath) :
        # It was; add each .ttf in it to the Qt font database
        # We are *assuming* that what's in fonts is Liberation Mono Regular
        # for sure, and optionally other variants like bold.
        for fname in os.listdir(fpath) :
            if fname.endswith(u'.ttf') :
                qfdb.addApplicationFont(QString(os.path.join(fpath,fname)))
        IMC.defaultFontFamily = lm_name
    else :