Skip to content

Commit 8e75919

Browse files
committed
Reload settings window when loading new profile
1 parent 13da28a commit 8e75919

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

docs/build instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- `python3 -m venv .venv`
2727
- `source .venv/bin/activate`
2828
- Run `./scripts/install.ps1` to install all dependencies.
29-
- If you're having issues with the PySide generated code, you might want to first run `pip uninstall -y shiboken6 PySide PySide-Essentials`
29+
- If you're having issues with the PySide generated code, you might want to first run `pip uninstall -y shiboken6 PySide6 PySide6-Essentials`
3030
- Run the app directly with `./scripts/start.ps1 [--auto-controlled]`.
3131
- Or debug by pressing `F5` in VSCode.
3232
- The `--auto-controlled` flag is passed when AutoSplit is started by LiveSplit.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ exclude = ".venv/*,src/gen/*"
128128
ignore = [
129129
"E124", # Closing bracket may not match multi-line method invocation style (enforced by add-trailing-comma)
130130
"E70", # Allow ... on same line as def
131+
"E721", # Breaks when needing an exact type
131132
# Autofixed by Ruff
132133
# Check for the "Fix" flag https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
133134
"E2", # Whitespace

src/user_profile.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from capture_method import CAPTURE_METHODS, CaptureMethodEnum, Region, change_capture_method
1111
from gen import design
1212
from hotkeys import HOTKEYS, remove_all_hotkeys, set_hotkey
13+
from menu_bar import open_settings
1314
from utils import auto_split_directory
1415

1516
if TYPE_CHECKING:
@@ -120,6 +121,14 @@ def __load_settings_from_file(autosplit: "AutoSplit", load_settings_file_path: s
120121
if load_settings_file_path.endswith(".pkl"):
121122
autosplit.show_error_signal.emit(error_messages.old_version_settings_file)
122123
return False
124+
125+
# Allow seemlessly reloading the entire settings widget
126+
settings_widget_was_open = False
127+
settings_widget = cast(QtWidgets.QWidget | None, autosplit.SettingsWidget)
128+
if settings_widget:
129+
settings_widget_was_open = settings_widget.isVisible()
130+
settings_widget.close()
131+
123132
try:
124133
with open(load_settings_file_path, encoding="utf-8") as file:
125134
# Casting here just so we can build an actual UserProfileDict once we're done validating
@@ -156,6 +165,9 @@ def __load_settings_from_file(autosplit: "AutoSplit", load_settings_file_path: s
156165
+ "\nto automatically load Capture Region",
157166
)
158167

168+
if settings_widget_was_open:
169+
open_settings(autosplit)
170+
159171
return True
160172

161173

0 commit comments

Comments
 (0)