Launcher: Rework apworld install popup #5508

This commit is contained in:
qwint
2025-10-01 14:54:41 -05:00
committed by GitHub
parent 33b485c0c3
commit b162095f89

View File

@@ -5,7 +5,7 @@ import weakref
from enum import Enum, auto from enum import Enum, auto
from typing import Optional, Callable, List, Iterable, Tuple from typing import Optional, Callable, List, Iterable, Tuple
from Utils import local_path, open_filename, is_frozen from Utils import local_path, open_filename, is_frozen, is_kivy_running
class Type(Enum): class Type(Enum):
@@ -177,10 +177,9 @@ def _install_apworld(apworld_src: str = "") -> Optional[Tuple[pathlib.Path, path
if module_name == loaded_name: if module_name == loaded_name:
found_already_loaded = True found_already_loaded = True
break break
if found_already_loaded: if found_already_loaded and is_kivy_running():
raise Exception(f"Installed APWorld successfully, but '{module_name}' is already loaded,\n" raise Exception(f"Installed APWorld successfully, but '{module_name}' is already loaded, "
"so a Launcher restart is required to use the new installation.\n" "so a Launcher restart is required to use the new installation.")
"If the Launcher is not open, no action needs to be taken.")
world_source = worlds.WorldSource(str(target), is_zip=True) world_source = worlds.WorldSource(str(target), is_zip=True)
bisect.insort(worlds.world_sources, world_source) bisect.insort(worlds.world_sources, world_source)
world_source.load() world_source.load()
@@ -197,7 +196,7 @@ def install_apworld(apworld_path: str = "") -> None:
source, target = res source, target = res
except Exception as e: except Exception as e:
import Utils import Utils
Utils.messagebox(e.__class__.__name__, str(e), error=True) Utils.messagebox("Notice", str(e), error=True)
logging.exception(e) logging.exception(e)
else: else:
import Utils import Utils