def _make_font(font_str): """ A function which converts a font string into a QColor. """ font = parse_font(font_str) if font is not None: return QFont_from_Font(font) return QFont()
def _get_monospace_font(): if sys.platform == 'win32': font = '11pt Consolas' elif sys.platform == 'darwin': font = '12pt Monaco' else: font = '12pt Monospace' return parse_font(font)
def __getitem__(self, font): cache = self._cache if font in cache: return cache[font] if isinstance(font, basestring): font_ = parse_font(font) if font_ is None: return self._default or QFont() qfont = self._make_qfont(font_) cache[font] = cache[font_] = qfont else: qfont = self._make_qfont(font) cache[font] = qfont return qfont