Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc tweaks #157

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mod/stellaris_dashboard/descriptor.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ tags={
"Gameplay"
}
picture="thumbnail.png"
supported_version="3.6.*"
supported_version="v3.12.*"
remote_file_id="1466534202"
18 changes: 15 additions & 3 deletions stellarisdashboard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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():
Expand Down
5 changes: 4 additions & 1 deletion stellarisdashboard/parsing/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import collections
import dataclasses
import datetime
from functools import cache
import itertools
import json
import logging
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -2383,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

Expand Down
Loading