def __init__(self): self.config_dir = os.path.join(ProjectFileManager.shared_config_dir()) os.makedirs(self.config_dir, exist_ok=True) self.config_file = os.path.join(self.config_dir, CONFIG_FILE_NAME) self.loaded_config = configparser.ConfigParser() if os.path.exists(self.config_file): with open_utf8(self.config_file, 'r') as f: self.loaded_config.read_file(f)
def __init__(self): self.config_dir = os.path.join(ProjectFileManager.shared_config_dir()) os.makedirs(self.config_dir, exist_ok=True) self.config_file = os.path.join(self.config_dir, CONFIG_FILE_NAME) self.loaded_config = configparser.ConfigParser() if os.path.exists(self.config_file): try: with open_utf8(self.config_file, 'r') as f: self.loaded_config.read_file(f) except BaseException as err: logger.error("Error reading config, falling back to default.", exc_info=err)
def setup_logging(): """ Creates a rotating log """ sys.excepthook = handle_exception dirn = ProjectFileManager.shared_config_dir() os.makedirs(dirn, exist_ok=True) handler = RotatingFileHandler(os.path.join(dirn, 'skytemple.log'), maxBytes=100000, backupCount=5) logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', handlers=[logging.StreamHandler(), handler])
def on_settings_dir_clicked(self, *args): open_dir(ProjectFileManager.shared_config_dir())