diff --git a/app/app_fn.py b/app/app_fn.py index 2482110..1ddee54 100644 --- a/app/app_fn.py +++ b/app/app_fn.py @@ -220,12 +220,12 @@ def set_mod_dir_fn(directory_str, mod_type: int): # -- Reset if not directory_str: - AppSettings.mod_data_dirs.pop(mod_type) + AppSettings.mod_data_dirs.pop(mod_type, None) app.mod.update_mod_data_dirs() result = True # -- Set - if app.mod.check_mod_data_dir(Path(directory_str), int(mod_type)): + if app.mod.check_mod_data_dir(Path(directory_str), mod_type): AppSettings.mod_data_dirs[mod_type] = str(WindowsPath(directory_str)) AppSettings.save() result = True diff --git a/app/app_settings.py b/app/app_settings.py index 472decb..5119da4 100644 --- a/app/app_settings.py +++ b/app/app_settings.py @@ -93,6 +93,8 @@ def load(cls) -> bool: logging.error('Could not load application settings! %s', e) return False + # -- Convert str dict keys to int + AppSettings.mod_data_dirs = {int(k): v for k, v in AppSettings.mod_data_dirs.items()} return True @classmethod diff --git a/src/components/Main.vue b/src/components/Main.vue index deca5d0..f7d4395 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -153,15 +153,16 @@ export default { }, setBusy: function (busy) { this.isBusy = busy}, getModDir: async function (modType = 0) { - const r = await window.eel.get_mod_dir(Number(modType))() + const r = await window.eel.get_mod_dir(modType)() if (r !== undefined) { this.modDataDirs[modType] = r } }, resetModDir: async function(modType = 0) { + modType = Number(modType) this.modDirInput = '' await this.setModDir(modType) }, setModDir: async function (modType) { - const r = await getEelJsonObject(window.eel.set_mod_dir(this.modDirInput, Number(modType))()) + const r = await getEelJsonObject(window.eel.set_mod_dir(this.modDirInput, modType)()) if (r !== undefined && r.result) { await this.getModDir(modType) @@ -183,7 +184,7 @@ export default { this.$eventHub.$on('make-toast', this.makeToast) this.$eventHub.$on('set-busy', this.setBusy) for (const modType in this.modTypes) { - await this.getModDir(modType) + await this.getModDir(Number(modType)) } }, beforeDestroy() {