From 65531fb566f1b41ec395b257882e393f30ea0c47 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Sun, 7 Jul 2024 14:10:35 -0500 Subject: [PATCH 1/5] Cache shared descriptions to improvement save processing performance --- stellarisdashboard/parsing/timeline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stellarisdashboard/parsing/timeline.py b/stellarisdashboard/parsing/timeline.py index 6bdf0e1..3525458 100644 --- a/stellarisdashboard/parsing/timeline.py +++ b/stellarisdashboard/parsing/timeline.py @@ -2,6 +2,7 @@ import collections import dataclasses import datetime +from functools import cache import itertools import json import logging @@ -247,6 +248,7 @@ def data(self) -> Any: def extract_data_from_gamestate(self, dependencies: Dict[str, Any]): pass + @cache def _get_or_add_shared_description(self, text: str) -> datamodel.SharedDescription: matching_description = ( self._session.query(datamodel.SharedDescription) From 416c86502a4a03a2f5f681f3ced8c181e9836ad4 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Sun, 7 Jul 2024 14:11:34 -0500 Subject: [PATCH 2/5] Fix crash processing empty policies --- stellarisdashboard/parsing/timeline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stellarisdashboard/parsing/timeline.py b/stellarisdashboard/parsing/timeline.py index 3525458..a6e1e45 100644 --- a/stellarisdashboard/parsing/timeline.py +++ b/stellarisdashboard/parsing/timeline.py @@ -2385,7 +2385,8 @@ def _get_current_policies(self, country_id) -> dict[str, (str, str)]: current_policies = [] current_stance_per_policy = { p.get("policy"): (p.get("selected"), p.get("date")) - for p in current_policies + for p in current_policies if isinstance(p, dict) # ambiguous {} is parsed as empty list, not empty dict + } return current_stance_per_policy From 57dbe3a11d1636e1b953f729eb56b5de352693f7 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Sun, 7 Jul 2024 14:12:14 -0500 Subject: [PATCH 3/5] Check for OneDrive folders when creating default settings --- stellarisdashboard/config.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/stellarisdashboard/config.py b/stellarisdashboard/config.py index 172d377..d00258c 100644 --- a/stellarisdashboard/config.py +++ b/stellarisdashboard/config.py @@ -40,7 +40,12 @@ def _get_default_stellaris_user_data_path(): # according to https://stellaris.paradoxwikis.com/Save-game_editing home = pathlib.Path.home() if platform.system() == "Windows": - return home / "Documents/Paradox Interactive/Stellaris/" + one_drive_path = home / "OneDrive/Documents/Paradox Interactive/Stellaris/" + non_one_drive_path = home / "OneDrive/Documents/Paradox Interactive/Stellaris/" + if one_drive_path.exists(): + return one_drive_path + else: + return non_one_drive_path elif platform.system() == "Linux": return home / ".local/share/Paradox Interactive/Stellaris/" else: @@ -242,12 +247,17 @@ class Config: production: bool = False - PATH_KEYS = { - "base_output_path", + EXISTING_PATH_KEYS = { + # these paths should already exist + # if not, the setting is reset to default + # this helps with issues related to OneDrive "save_file_path", "stellaris_install_path", "stellaris_user_data_path", } + PATH_KEYS = EXISTING_PATH_KEYS | { + "base_output_path", + } BOOL_KEYS = { "check_version", "filter_events_by_type", @@ -311,6 +321,8 @@ def _process_path_keys(self, key, val): val = DEFAULT_SETTINGS[key] else: val = pathlib.Path(val) + if key in Config.EXISTING_PATH_KEYS and not val.exists(): + val = DEFAULT_SETTINGS[key] if key == "base_output_path": try: if not val.exists(): From f4114f3a9150d680fa397708518eb0c11f1dfcd8 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Sun, 7 Jul 2024 14:12:36 -0500 Subject: [PATCH 4/5] Remove outdated colors section from readme --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 79c76dc..d7050e0 100644 --- a/README.md +++ b/README.md @@ -114,11 +114,7 @@ If you installed Stellaris in the default location at (`C:/Program Files (x86)/S If you play the game in another language, you can change the "Stellaris language" and restart the dashboard. Note that this setting should be the language code used by the game (ie `l_braz_por`, `l_english`, `l_french`, `l_german`, `l_japanese`, `l_korean`, `l_polish`, `l_russian`, `l_simp_chinese`, `l_spanish`). -If you use mods that add new names, the dashboard *should* automatically find the required files. Note that if you restart change your mod list, any new modded names will not be loaded until you restart the dashboard. If modded names are not working at all, you might need to change your "Stellaris user data folder" setting and restart the dashboard. This should be the folder containing the `dlc_load.json` file as well as the `mod/` folder. - -## Colors - -Currently, all country colors shown in the dashboard are randomized and completely unrelated to the colors in-game. Unfortunately, it is not that easy to get the country color from the save files, but it could be possible to add this in a future release. +If you use mods that add new names, the dashboard *should* automatically find the required files. Note that if you change your mod list, any new modded names will not be loaded until you restart the dashboard. If modded names are not working at all, you might need to change your "Stellaris user data folder" setting and restart the dashboard. This should be the folder containing the `dlc_load.json` file as well as the `mod/` folder. ## How to improve performance From 4589f42366ff2db7131d48c18029743b3ef864b3 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Sun, 7 Jul 2024 14:13:42 -0500 Subject: [PATCH 5/5] Update mod descriptor --- mod/stellaris_dashboard/descriptor.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/stellaris_dashboard/descriptor.mod b/mod/stellaris_dashboard/descriptor.mod index beba90c..9a97bf6 100644 --- a/mod/stellaris_dashboard/descriptor.mod +++ b/mod/stellaris_dashboard/descriptor.mod @@ -5,5 +5,5 @@ tags={ "Gameplay" } picture="thumbnail.png" -supported_version="3.6.*" +supported_version="v3.12.*" remote_file_id="1466534202" \ No newline at end of file