Skip to content

Commit

Permalink
Add step name to fomod install wizard
Browse files Browse the repository at this point in the history
Some mods, like ENB Light, have option names that are the same on
several pages, and are only differentiated via the name of the actual
step. This previously made it look like we were displaying the same page
multiple times even though we weren't.

Make the fomod install wizard present the name of the step (if it
exists) so there is more indication that the installer is working as
intended.
  • Loading branch information
cyberrumor committed Mar 19, 2024
1 parent 297ec07 commit 35fb306
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ammo/fomod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Page:
"""

name: str
step_name: str
archtype: str
selections: list[Selection]
visibility_conditions: field(default_factory=dict[str, bool])
Expand Down Expand Up @@ -73,7 +74,7 @@ def __init__(self, mod: Mod):

def __str__(self) -> str:
num_pages = len(self.visible_pages)
result = f"{self.module_name}\n"
result = f"{self.module_name} {self.page.step_name}\n"
result += "--------------------------------\n"
result += f"Page {self.page_index + 1} / {num_pages}: {self.visible_pages[self.page_index].name}\n"
result += "--------------------------------\n\n"
Expand Down Expand Up @@ -143,6 +144,9 @@ def _get_pages(self) -> list[Page]:
steps = []
# Find all the install steps
for step in self.xml_root_node.find("installSteps"):
install_step_name = step.get("name", "")
if install_step_name:
install_step_name = f"- {install_step_name}"
for optional_file_groups in step:
for group in optional_file_groups:
if not (group_of_plugins := group.find("plugins")):
Expand All @@ -162,12 +166,13 @@ def _get_pages(self) -> list[Page]:
dep_op = dep_op.lower()
visibility_conditions["operator"] = dep_op
for xml_flag in dependencies:
visibility_conditions[
xml_flag.get("flag")
] = xml_flag.get("value") in ["On", "1"]
visibility_conditions[xml_flag.get("flag")] = (
xml_flag.get("value") in ["On", "1"]
)

page = Page(
name=group.get("name"),
step_name=install_step_name,
archtype=group.get("type"),
selections=[],
visibility_conditions=visibility_conditions,
Expand Down

0 comments on commit 35fb306

Please sign in to comment.