def set_prefs(self): """Write preferences to the config file.""" dialog = preferences.PrefsDialog(self) if dialog.exec_() == QDialog.Accepted: self.auto_orient = dialog.auto_orient self.slide_delay = dialog.delay_spinb.value() self.quality = dialog.qual_spinb.value() conf = preferences.Config() conf.write_config(self.auto_orient, self.slide_delay, self.quality) self.reload_img = self.reload_auto if self.auto_orient else self.reload_nonauto
def read_prefs(self): """Parse the preferences from the config file, or set default values.""" try: conf = preferences.Config() values = conf.read_config() self.auto_orient = values[0] self.slide_delay = values[1] self.quality = values[2] except: self.auto_orient = True self.slide_delay = 5 self.quality = 90 self.reload_img = self.reload_auto if self.auto_orient else self.reload_nonauto
def read_prefs(self): """Parse the preferences from the config file, or set default values.""" conf = preferences.Config(__name__ + ".ini") try: values = conf.read_config() self.auto_orient = values[0] self.slide_delay = values[1] self.quality = values[2] except KeyError: self.auto_orient = True self.slide_delay = 5 self.quality = 90 except: log.error("Unexpected error:", sys.exc_info()[0]) raise self.reload_img = self.reload_auto if self.auto_orient else self.reload_nonauto