def chooseFont_(self, sender): fm = NSFontManager.sharedFontManager() basicAttrs = getBasicTextAttributes() fm.setSelectedFont_isMultiple_(basicAttrs[NSFontAttributeName], False) fm.orderFrontFontPanel_(sender) fp = fm.fontPanel_(False) fp.setDelegate_(self)
def textFontChanged_(self, notification): basicAttrs = getBasicTextAttributes() font = basicAttrs[NSFontAttributeName] self.fontPreview.setFont_(font) size = font.pointSize() if size == int(size): size = int(size) s = u"%s %s" % (font.displayName(), size) self.fontPreview.setStringValue_(s)
def changeFont_(self, sender): oldFont = getBasicTextAttributes()[NSFontAttributeName] newFont = sender.convertFont_(oldFont) if oldFont != newFont: setTextFont(newFont)