def get_font(conf, section, option=""): """ Construct a QFont from the specified configuration file entry conf: UserConfig instance section [, option]: configuration entry """ if not option: option = "font" if 'font' not in option: option += '/font' font = QFont() if conf.has_option(section, option+'/family/nt'): families = conf.get(section, option+'/family/'+os.name) elif conf.has_option(section, option+'/family'): families = conf.get(section, option+'/family') else: families = None if families is not None: if not isinstance(families, list): families = [ families ] family = None for family in families: if font_is_installed(family): break font.setFamily(family) if conf.has_option(section, option+'/size'): font.setPointSize(conf.get(section, option+'/size')) if conf.get(section, option+'/bold', False): font.setWeight(QFont.Bold) else: font.setWeight(QFont.Normal) return font
def setup(self): font = QFont("Courier new") font.setPointSize(10) self.set_font(font) self.set_codecompletion_auto(True) self.set_calltips(True) self.setup_calltips(size=600, font=font) self.setup_completion(size=(300, 180), font=font)
def setup(self): font = QFont("Courier new") font.setPointSize(10) self.set_font(font) self.set_codecompletion_auto(True) self.set_calltips(True) try: # Spyder 2 self.setup_completion(size=(300, 180), font=font) except TypeError: pass try: self.traceback_available.connect(self.show_console) except AttributeError: pass