Skip to content

Commit f0c5f4f

Browse files
committed
refactor(sfx): rename synthetic tree root to "SFX"
1 parent 232eca7 commit f0c5f4f

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

cue_lib/audio/file_tree_rows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def row_buttons(self, item, target_ok, target_tt, unplayable): # pyright: ignor
230230
in intensity add-mode appends to the active (group, level). An empty
231231
folder gets no buttons (matches the current tree UI).
232232
233-
Display paths carry the synthetic wrapper ("SFX Folder/..." for
233+
Display paths carry the synthetic wrapper ("SFX/..." for
234234
built-in, "ExtA/..." for external); every action that feeds a path
235235
uses ref_from_display to get the stored ref. The file [+] is
236236
index-based and stays."""

cue_lib/audio/sfx_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class CueSfxLibraryTree(CueAudioTreeManager):
350350

351351
_scan_label = "audio folder"
352352
_log_tag = "AUDIO"
353-
# The synthetic "SFX Folder" root opens by default like music's roots;
353+
# The synthetic "SFX" root opens by default like music's roots;
354354
# persisted toggles still win via _restore_expansion.
355355
_auto_expand_roots = True
356356
_persist_key = CUE_PERSIST_SFX_TREE_EXPANDED
@@ -422,7 +422,7 @@ def _discover(self, results_set):
422422
def scan(self):
423423
# type: () -> None
424424
"""Scan every source (built-in audio dir + external folders), then
425-
merge the per-source trees under a synthetic "SFX Folder" root.
425+
merge the per-source trees under a synthetic "SFX" root.
426426
427427
Mirror of CueMusicTree.scan. A built-in scan failure leaves that
428428
source's files/tree empty and sets its scan_error; external folders
@@ -464,7 +464,7 @@ def ref_from_display(self, display_path):
464464
# type: (str) -> str
465465
"""Stored ref for a merged display path.
466466
467-
Inverts the merged tree: the synthetic "SFX Folder" root maps back to
467+
Inverts the merged tree: the synthetic "SFX" root maps back to
468468
the audio-relative ref; an external source label maps to the bare
469469
absolute payload. Any other path passes through unchanged (row
470470
builders feed untagged paths in tests and for legacy trees)."""
@@ -494,7 +494,7 @@ def _merged_tree(self):
494494
# type: () -> List[Dict[str, Any]]
495495
"""Build the combined nested tree from the per-source trees.
496496
497-
Built-in files wrap under the synthetic "SFX Folder" root; external
497+
Built-in files wrap under the synthetic "SFX" root; external
498498
sources render as additional top-level entries below it. A source
499499
with no files (missing folder) still appears so its warning row is
500500
reachable."""
@@ -516,7 +516,7 @@ def _file_node(self, item, full, depth):
516516
# type: (Dict[str, Any], str, int) -> Dict[str, Any]
517517
"""File row with ref/index/enabled for the SFX Library.
518518
519-
``full`` is the merged display path ("SFX Folder/g1/x.ogg" for
519+
``full`` is the merged display path ("SFX/g1/x.ogg" for
520520
built-in, "ExtA/g1/x.ogg" for external); the stored ref inverts it so
521521
both built-in AND external rows get valid indices and disabled
522522
membership without changing the [+] index path."""

cue_lib/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class CueContextType(object):
148148

149149
# Display-only synthetic root for built-in SFX files in the SFX Library tree,
150150
# so the audio dir renders like an external folder (sfx_manager.py).
151-
CUE_SFX_FOLDER = "SFX Folder/"
151+
CUE_SFX_FOLDER = "SFX/"
152152

153153
# Default pool / preset volume (1.0 = identity). CueVolumeManager.VOL_DEFAULT
154154
# aliases this for legacy _cue.volume.VOL_DEFAULT references.

cue_lib/constants.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CUE_MY_MUSIC_FOLDER: Final = "My Music/"
2222
CUE_GAME_MUSIC_FOLDER: Final = "Game Music/"
2323
CUE_MUSIC_USER_TAG: Final = "u:"
2424
CUE_MUSIC_GAME_TAG: Final = "g:"
25-
CUE_SFX_FOLDER: Final = "SFX Folder/"
25+
CUE_SFX_FOLDER: Final = "SFX/"
2626
CUE_VOLUME_DEFAULT: Final = 1.0
2727

2828
CUE_INTENSITY_PRESET_TYPE: Final = "intensity"

test_game/templates/testcases_legacy.rpy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ testcase sfx_external_tree_renders:
16411641
$ _cue.is_overlay_visible = True
16421642
run Jump("start")
16431643
pause 2.0
1644-
# The SFX library wraps built-ins in the synthetic "SFX Folder/" root and
1644+
# The SFX library wraps built-ins in the synthetic "SFX/" root and
16451645
# appends external folders below it; rendering the SFX page under that
16461646
# state exercises the per-source tree rows.
16471647
$ _md, _sd = _cue_external_dirs()
@@ -1650,7 +1650,7 @@ testcase sfx_external_tree_renders:
16501650
$ _ok = len(_cue.sfx.library.external_files) == 1
16511651
$ _ok = _ok and _cue.sfx.library.external_sources[0]["label"] == "ExtSfx"
16521652
$ _ok = _ok and len(_cue.sfx.library.tree) >= 2
1653-
$ _ok = _ok and _cue.sfx.library.tree[0]["name"] == "SFX Folder/"
1653+
$ _ok = _ok and _cue.sfx.library.tree[0]["name"] == "SFX/"
16541654
$ _ok = _ok and any(_e.get("name") == "ExtSfx/" for _e in _cue.sfx.library.tree)
16551655
run Function(_cue_set_page, CuePage.SFX)
16561656
pause 0.5

test_game/templates/testcases_modern.rpy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ testcase music_external_tree_renders:
13561356
testcase sfx_external_tree_renders:
13571357
run Jump("start")
13581358
$ _cue_test_reset()
1359-
# The SFX library wraps built-ins in the synthetic "SFX Folder/" root and
1359+
# The SFX library wraps built-ins in the synthetic "SFX/" root and
13601360
# appends external folders below it; rendering the SFX page under that
13611361
# state exercises the per-source tree rows.
13621362
$ _md, _sd = _cue_external_dirs()
@@ -1365,7 +1365,7 @@ testcase sfx_external_tree_renders:
13651365
assert eval (len(_cue.sfx.library.external_files) == 1)
13661366
assert eval (_cue.sfx.library.external_sources[0]["label"] == "ExtSfx")
13671367
assert eval (len(_cue.sfx.library.tree) >= 2)
1368-
assert eval (_cue.sfx.library.tree[0]["name"] == "SFX Folder/")
1368+
assert eval (_cue.sfx.library.tree[0]["name"] == "SFX/")
13691369
assert eval (any(_e.get("name") == "ExtSfx/" for _e in _cue.sfx.library.tree))
13701370
run Function(_cue_set_page, CuePage.SFX)
13711371
assert eval (_cue.overlay_active_page == CuePage.SFX)

tests/test_audio_tree.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,14 @@ def test_sfx_scan_missing_external_folder_keeps_warning(sfx, tmp_path):
518518

519519

520520
def test_sfx_external_label_disambiguated(sfx):
521-
assert sfx._external_label("E:/SFX Folder", []) == "SFX Folder (2)"
521+
assert sfx._external_label("E:/SFX", []) == "SFX (2)"
522522
assert sfx._external_label("E:/Music", []) == "Music"
523523
assert sfx._external_label("E:/Music", ["Music"]) == "Music (2)"
524524

525525

526526
def test_sfx_ref_from_display(sfx):
527527
sfx.external_sources = [{"label": "ExtA", "abs_root": "E:/SFX/A", "tree": [], "files": [], "scan_error": ""}]
528-
assert sfx.ref_from_display("SFX Folder/g1/drip.ogg") == "g1/drip.ogg"
528+
assert sfx.ref_from_display(CUE_SFX_FOLDER + "g1/drip.ogg") == "g1/drip.ogg"
529529
assert sfx.ref_from_display("ExtA/g1/drip.ogg") == "E:/SFX/A/g1/drip.ogg"
530530
assert sfx.ref_from_display("ExtA/g1/") == "E:/SFX/A/g1/"
531531
# Unknown paths (legacy / unqualified rows) pass through unchanged.
@@ -542,7 +542,7 @@ def test_sfx_file_node_ref_index_enabled(sfx):
542542
sfx.external_sources = [{"label": "ExtA", "abs_root": "E:/SFX/A", "tree": [], "files": [], "scan_error": ""}]
543543
sfx._file_index = {"g1/drip.ogg": 2, "E:/SFX/A/x.ogg": 3}
544544
sfx.disabled_files = {"E:/SFX/A/x.ogg"}
545-
builtin = sfx._file_node({"name": "drip.ogg"}, "SFX Folder/g1/drip.ogg", 1)
545+
builtin = sfx._file_node({"name": "drip.ogg"}, CUE_SFX_FOLDER + "g1/drip.ogg", 1)
546546
assert builtin["ref"] == "g1/drip.ogg"
547547
assert builtin["index"] == 2
548548
assert builtin["enabled"] is True
@@ -1014,7 +1014,7 @@ def test_sfx_row_buttons_use_refs(sfx):
10141014
sfx.external_sources = [{"label": "ExtA", "abs_root": "E:/SFX/A", "tree": [], "files": [], "scan_error": ""}]
10151015
sfx.visible_tree = [
10161016
{"type": "folder", "name": "ExtA/", "full_path": "ExtA/", "depth": 0, "has_files": True},
1017-
{"type": "file", "name": "drip.ogg", "full_path": "SFX Folder/g1/drip.ogg", "depth": 1, "index": 0},
1017+
{"type": "file", "name": "drip.ogg", "full_path": CUE_SFX_FOLDER + "g1/drip.ogg", "depth": 1, "index": 0},
10181018
]
10191019
rows = sfx.tree_rows(True, "tt", {})
10201020
ext_folder, builtin_file = rows
@@ -1742,7 +1742,7 @@ def _discover(results):
17421742

17431743
monkeypatch.setattr(sfx, "_discover", _discover)
17441744
sfx.scan()
1745-
assert sfx.expanded_folders == {"SFX Folder/": True}
1745+
assert sfx.expanded_folders == {CUE_SFX_FOLDER: True}
17461746

17471747

17481748
def test_sfx_scan_restores_expansion(sfx, monkeypatch):
@@ -1752,7 +1752,7 @@ def _discover(results):
17521752
monkeypatch.setattr(sfx, "_discover", _discover)
17531753
persistent._cue[CUE_PERSIST_SFX_TREE_EXPANDED] = {"sub/": True}
17541754
sfx.scan()
1755-
assert sfx.expanded_folders == {"SFX Folder/": True, "sub/": True}
1755+
assert sfx.expanded_folders == {CUE_SFX_FOLDER: True, "sub/": True}
17561756

17571757

17581758
def test_sfx_file_ref_expand_persists(sfx):

0 commit comments

Comments
 (0)