def change_font(self, *args): fd = QFontDialog(self.build_font_obj(), self) if fd.exec_() == fd.Accepted: font = fd.selectedFont() fi = QFontInfo(font) self.current_font = [unicode(fi.family()), fi.pointSize(), fi.weight(), fi.italic(), font.stretch()] self.update_font_display() self.changed_signal.emit()
def _debug_choose_font(self): #bruce 050304 experiment; works; could use toString/fromString to store it in prefs... oldfont = self.font() newfont, ok = QFontDialog.getFont(oldfont) ##e can we change QFontDialog to let us provide initial sample text, # and permit typing \n into it? If not, can we fool it by providing # it with a fake "paste" event? if ok: self.setFont(newfont) try: if debug_flags.atom_debug: print "atom_debug: new font.toString():", newfont.toString() except: print_compact_traceback("new font.toString() failed: ") return
def _debug_choose_font( self ): #bruce 050304 experiment; works; could use toString/fromString to store it in prefs... oldfont = self.font() newfont, ok = QFontDialog.getFont(oldfont) ##e can we change QFontDialog to let us provide initial sample text, # and permit typing \n into it? If not, can we fool it by providing # it with a fake "paste" event? if ok: self.setFont(newfont) try: if debug_flags.atom_debug: print "atom_debug: new font.toString():", newfont.toString( ) except: print_compact_traceback("new font.toString() failed: ") return