From e9cae0f6fdf562c47ee37cb9aa01ab9ed94c013c Mon Sep 17 00:00:00 2001 From: qwint Date: Sat, 17 Aug 2024 13:43:15 -0500 Subject: [PATCH] removed script name from component, changed icon path to hopefully merged soon:tm: apworld-compatible format, added component stripping to lauch arg parse, updated Component func to work on --nogui --- worlds/animal_well/__init__.py | 10 +++++++--- worlds/animal_well/client.py | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/worlds/animal_well/__init__.py b/worlds/animal_well/__init__.py index e0cb467ce04a..17bb01529e36 100644 --- a/worlds/animal_well/__init__.py +++ b/worlds/animal_well/__init__.py @@ -18,13 +18,17 @@ def launch_client(): Launch the Animal Well Client """ from .client import launch - launch_subprocess(launch, name="AnimalWellClient") + from CommonClient import gui_enabled + if gui_enabled: + launch_subprocess(launch, name="AnimalWellClient") + else: + launch() -components.append(Component("ANIMAL WELL Client", "AnimalWellClient", func=launch_client, +components.append(Component("ANIMAL WELL Client", func=launch_client, component_type=Type.CLIENT, icon="Potate")) -icon_paths["Potate"] = local_path("data", "Potate.png") +icon_paths["Potate"] = f"ap:{__name__}/data/Potate.png" class AnimalWellWeb(WebWorld): diff --git a/worlds/animal_well/client.py b/worlds/animal_well/client.py index 70333172f12e..112ce379f353 100644 --- a/worlds/animal_well/client.py +++ b/worlds/animal_well/client.py @@ -1199,8 +1199,12 @@ async def main(): """ main function """ + import sys + args = sys.argv[1:] + if "ANIMAL WELL Client" in args: + args.remove("ANIMAL WELL Client") parser = get_base_parser() - args = parser.parse_args() + args = parser.parse_args(args) ctx = AnimalWellContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")