def update_font_display(self): font = self.build_font_obj() fi = QFontInfo(font) name = str(fi.family()) self.font_display.setFont(font) self.font_display.setText(name + ' [%dpt]' % fi.pointSize())
def change_font(self, *args): fd = QFontDialog(self.build_font_obj(), self) if fd.exec_() == QDialog.DialogCode.Accepted: font = fd.selectedFont() fi = QFontInfo(font) self.current_font = [unicode_type(fi.family()), fi.pointSize(), fi.weight(), fi.italic(), font.stretch()] self.update_font_display() self.changed_signal.emit()