def _readSettingsFromConfigurationFile(self): """Reads the settings from the user configuration file.""" try: self._config.read(self.conf_file_path) except UnicodeDecodeError as e: self.error("Failed to read %s: %s", self.conf_file_path, e) unicode_error_dialog() return except configparser.ParsingError as e: self.error("Failed to parse %s: %s", self.conf_file_path, e) return for (section, attrname, typ, key, env, value) in self.iterAllOptions(): if not self._config.has_section(section): continue if key and self._config.has_option(section, key): if typ == int or typ == int: try: value = self._config.getint(section, key) except ValueError: # In previous configurations we incorrectly stored # ints using float values. value = int(self._config.getfloat(section, key)) elif typ == float: value = self._config.getfloat(section, key) elif typ == bool: value = self._config.getboolean(section, key) else: value = self._config.get(section, key) setattr(self, attrname, value)
def _readSettingsFromConfigurationFile(self): """ Read the configuration from the user configuration file. """ try: conf_file_path = os.path.join(xdg_config_home(), "pitivi.conf") self._config.read(conf_file_path) except UnicodeDecodeError: unicode_error_dialog() return except ParsingError: return for (section, attrname, typ, key, env, value) in self.iterAllOptions(): if not self._config.has_section(section): continue if key and self._config.has_option(section, key): if typ == int or typ == int: try: value = self._config.getint(section, key) except ValueError: # In previous configurations we incorrectly stored # ints using float values. value = int(self._config.getfloat(section, key)) elif typ == float: value = self._config.getfloat(section, key) elif typ == bool: value = self._config.getboolean(section, key) else: value = self._config.get(section, key) setattr(self, attrname, value)
def _readSettingsFromConfigurationFile(self): """ Read the configuration from the user configuration file. """ try: conf_file_path = os.path.join(xdg_config_home(), "pitivi.conf") self._config.read(conf_file_path) except UnicodeDecodeError: unicode_error_dialog() return except ParsingError: return for (section, attrname, typ, key, env, value) in self.iterAllOptions(): if not self._config.has_section(section): continue if key and self._config.has_option(section, key): if typ == int or typ == int: try: value = self._config.getint(section, key) except ValueError: # In previous configurations we incorrectly stored # ints using float values. value = int(self._config.getfloat(section, key)) elif typ == float: value = self._config.getfloat(section, key) elif typ == bool: value = self._config.getboolean(section, key) else: value = self._config.get(section, key) setattr(self, attrname, value)
def _readSettingsFromConfigurationFile(self): """Reads the settings from the user configuration file.""" try: self._config.read(self.conf_file_path) except UnicodeDecodeError as e: self.error("Failed to read %s: %s", self.conf_file_path, e) unicode_error_dialog() return except configparser.ParsingError as e: self.error("Failed to parse %s: %s", self.conf_file_path, e) return for (section, attrname, typ, key, env, value) in self.iterAllOptions(): if not self._config.has_section(section): continue if key and self._config.has_option(section, key): value = self._read_value(section, key, typ) setattr(self, attrname, value)