mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 09:18:37 +00:00
launcher: greyed controls where another choice makes them pointless
UI only (switch_args and play_command unchanged; 288 control combinations give the same switches and variables as before). A greyed control keeps its value and ignores clicks and the space bar; undoing the other choice brings it back: - hardware ray tracing greys frame generation's mode and limit, with a note (the scripts leave frame generation off with ray tracing; LEONIDA_FG_WITH_RT=1 in the advanced options overrides); - DLSS off greys the DLSS mode; DLSS with a mode greys the resolution (left out of the command then); - frame generation off greys its limit; - every pipeline precompiled keeps shader preparation on and greyed (it needs it). Toggle and Segmented get enabled(); a disabled drop-down looks muted. Checked in a real window: each rule both ways, clicks on greyed controls change nothing, and the same check fails on the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -75,6 +75,10 @@ needs its line in every file, which `tests/test_leonida_launcher.py` checks (sam
|
||||
`game_scarlett_master.exe` is in it), the data folder (empty = the script's default) and the mods folder.
|
||||
|
||||
`-Capture` is in the diagnostics card.
|
||||
A control another choice makes pointless is greyed (its value is kept, and comes back when that choice is undone):
|
||||
frame generation's mode and limit with hardware ray tracing (the scripts leave frame generation off with it; a note
|
||||
says so), the DLSS mode with DLSS off, the resolution with a DLSS mode, the frame limit with frame generation off,
|
||||
and shader preparation, kept on, while every pipeline is precompiled.
|
||||
On Linux only the game folder and Series X are used.
|
||||
- **Run in diagnostic mode** (Play, Settings and Tools): PLAY with `-Log` and `LEONIDA_D3D12_DRED=1`; when the game
|
||||
ends the logs folder opens, for the newest file to go with a report.
|
||||
|
||||
@ -205,5 +205,6 @@
|
||||
"Performance": "Leistung",
|
||||
"Ultra performance": "Ultra-Leistung",
|
||||
"Series X: pick one for DLSS": "Series X: für DLSS einen wählen",
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S nutzt DLSS von selbst, Series X den Upscaler des Spiels. Ein Modus lässt DLSS das Bild aus diesem Anteil der Zeilen zeichnen, auch auf Series X (-Dlss)."
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S nutzt DLSS von selbst, Series X den Upscaler des Spiels. Ein Modus lässt DLSS das Bild aus diesem Anteil der Zeilen zeichnen, auch auf Series X (-Dlss).",
|
||||
"Off with ray tracing for now.": "Mit Raytracing vorerst aus."
|
||||
}
|
||||
|
||||
@ -205,5 +205,6 @@
|
||||
"Performance": "Rendimiento",
|
||||
"Ultra performance": "Ultra rendimiento",
|
||||
"Series X: pick one for DLSS": "Series X: elige uno para DLSS",
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S usa DLSS por sí sola, Series X el reescalador del juego. Un modo hace que DLSS dibuje la imagen a partir de esa parte de las líneas, también en Series X (-Dlss)."
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: Series S usa DLSS por sí sola, Series X el reescalador del juego. Un modo hace que DLSS dibuje la imagen a partir de esa parte de las líneas, también en Series X (-Dlss).",
|
||||
"Off with ray tracing for now.": "Desactivada con el trazado de rayos por ahora."
|
||||
}
|
||||
|
||||
@ -205,5 +205,6 @@
|
||||
"Performance": "Performance",
|
||||
"Ultra performance": "Ultra performance",
|
||||
"Series X: pick one for DLSS": "Series X : à choisir pour DLSS",
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto : la Series S utilise DLSS d'elle-même, la Series X l'upscaler du jeu. Un mode fait dessiner l'image par DLSS à partir de cette part des lignes, en Series X aussi (-Dlss)."
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto : la Series S utilise DLSS d'elle-même, la Series X l'upscaler du jeu. Un mode fait dessiner l'image par DLSS à partir de cette part des lignes, en Series X aussi (-Dlss).",
|
||||
"Off with ray tracing for now.": "Désactivée avec le ray tracing pour l'instant."
|
||||
}
|
||||
|
||||
@ -205,5 +205,6 @@
|
||||
"Performance": "Desempenho",
|
||||
"Ultra performance": "Ultra desempenho",
|
||||
"Series X: pick one for DLSS": "Series X: escolha um para o DLSS",
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: a Series S usa o DLSS sozinha, a Series X o upscaler do próprio jogo. Um modo faz o DLSS desenhar a imagem a partir dessa parte das linhas, também na Series X (-Dlss)."
|
||||
"Auto: Series S uses DLSS by itself, Series X uses the game's own upscaler. A mode makes DLSS draw the picture from that share of the lines, on Series X too (-Dlss).": "Auto: a Series S usa o DLSS sozinha, a Series X o upscaler do próprio jogo. Um modo faz o DLSS desenhar a imagem a partir dessa parte das linhas, também na Series X (-Dlss).",
|
||||
"Off with ray tracing for now.": "Desligada com o ray tracing por enquanto."
|
||||
}
|
||||
|
||||
@ -792,6 +792,7 @@ def run_gui() -> int:
|
||||
takefocus=1)
|
||||
self.var = var
|
||||
self.focused = False
|
||||
self.active = True
|
||||
self.bind("<Button-1>", lambda _e: self.flip())
|
||||
self.bind("<space>", lambda _e: self.flip())
|
||||
self.bind("<FocusIn>", lambda _e: self.set_focus(True))
|
||||
@ -804,14 +805,33 @@ def run_gui() -> int:
|
||||
self.draw()
|
||||
|
||||
def flip(self):
|
||||
if not self.active:
|
||||
return
|
||||
self.focus_set()
|
||||
self.var.set(not self.var.get())
|
||||
|
||||
def enabled(self, flag):
|
||||
"""Greyed and deaf to clicks and the space bar when off; the value stays as it is."""
|
||||
flag = bool(flag)
|
||||
if flag != self.active:
|
||||
self.active = flag
|
||||
self.configure(cursor="hand2" if flag else "arrow", takefocus=1 if flag else 0)
|
||||
self.draw()
|
||||
|
||||
def draw(self):
|
||||
self.delete("all")
|
||||
on = bool(self.var.get())
|
||||
w, h = self.w, self.h
|
||||
r = h // 2
|
||||
if not self.active:
|
||||
track = blend(VIOLET, PANEL, 0.55) if on else "#2a2547"
|
||||
self.create_oval(0, 0, h - 1, h - 1, fill=track, outline="")
|
||||
self.create_oval(w - h, 0, w - 1, h - 1, fill=track, outline="")
|
||||
self.create_rectangle(r, 0, w - r, h - 1, fill=track, outline="")
|
||||
pad = max(3, h // 7)
|
||||
x = w - h + pad if on else pad
|
||||
self.create_oval(x, pad, x + h - 2 * pad, h - pad, fill="#6b6590", outline="")
|
||||
return
|
||||
if on:
|
||||
self.create_oval(0, 0, h - 1, h - 1, fill=VIOLET, outline="")
|
||||
self.create_oval(w - h, 0, w - 1, h - 1, fill=PINK, outline="")
|
||||
@ -835,21 +855,35 @@ def run_gui() -> int:
|
||||
def __init__(self, parent, var, options, k):
|
||||
super().__init__(parent, bg=LINE)
|
||||
self.var = var
|
||||
self.active = True
|
||||
self.labels: dict = {}
|
||||
for index, (value, text) in enumerate(options):
|
||||
label = tk.Label(self, text=text, bg=PANEL, fg=MUTED, font=("Segoe UI", 9), padx=int(10 * k),
|
||||
pady=int(3 * k), cursor="hand2")
|
||||
label.pack(side="left", padx=(1 if index == 0 else 0, 1), pady=1)
|
||||
label.bind("<Button-1>", lambda _e, v=value: var.set(v))
|
||||
label.bind("<Button-1>", lambda _e, v=value: self.active and var.set(v))
|
||||
self.labels[value] = label
|
||||
var.trace_add("write", lambda *_: self.draw())
|
||||
self.draw()
|
||||
|
||||
def enabled(self, flag):
|
||||
"""Greyed and deaf to clicks when off; the choice stays as it is."""
|
||||
flag = bool(flag)
|
||||
if flag != self.active:
|
||||
self.active = flag
|
||||
for label in self.labels.values():
|
||||
label.configure(cursor="hand2" if flag else "arrow")
|
||||
self.draw()
|
||||
|
||||
def draw(self):
|
||||
current = self.var.get()
|
||||
for value, label in self.labels.items():
|
||||
chosen = value == current
|
||||
label.configure(bg=VIOLET if chosen else PANEL, fg=ON_ACCENT if chosen else MUTED)
|
||||
if self.active:
|
||||
label.configure(bg=VIOLET if chosen else PANEL, fg=ON_ACCENT if chosen else MUTED)
|
||||
else:
|
||||
label.configure(bg=blend(VIOLET, PANEL, 0.55) if chosen else PANEL,
|
||||
fg=blend(ON_ACCENT, PANEL, 0.4) if chosen else "#6b6590")
|
||||
|
||||
class Tip:
|
||||
"""The longer text of an option, shown when the pointer rests on it ("Hover any option for what it does")."""
|
||||
@ -955,6 +989,7 @@ def run_gui() -> int:
|
||||
self.language_shown = self.settings["language"]
|
||||
self.vars: dict = {}
|
||||
self.choices: dict = {} # a drop-down's shown text -> its value, by setting
|
||||
self.controls: dict = {} # the Settings control of a setting, for apply_rules
|
||||
self.nav_buttons: dict = {}
|
||||
self.current = ""
|
||||
self.style()
|
||||
@ -996,7 +1031,8 @@ def run_gui() -> int:
|
||||
s.map("Accent.TButton", background=[("active", ACCENT_HOVER), ("disabled", LINE)])
|
||||
s.configure("TEntry", insertcolor=TEXT, padding=px(5))
|
||||
s.configure("TCombobox", arrowcolor=TEXT, padding=px(4), fieldbackground=PANEL2, background=PANEL2)
|
||||
s.map("TCombobox", fieldbackground=[("readonly", PANEL2)], foreground=[("readonly", TEXT)],
|
||||
s.map("TCombobox", fieldbackground=[("disabled", PANEL), ("readonly", PANEL2)],
|
||||
foreground=[("disabled", "#6b6590"), ("readonly", TEXT)], arrowcolor=[("disabled", "#6b6590")],
|
||||
selectbackground=[("readonly", PANEL2)], selectforeground=[("readonly", TEXT)],
|
||||
background=[("readonly", PANEL2)])
|
||||
self.root.option_add("*TCombobox*Listbox.background", PANEL2)
|
||||
@ -1655,12 +1691,15 @@ def run_gui() -> int:
|
||||
def toggle(self, card, key, label, small=None, tip=None):
|
||||
var = tk.BooleanVar(value=self.settings[key])
|
||||
self.vars[key] = var
|
||||
return self.option(card, label, small, lambda parent: Toggle(parent, var, self.k), tip)
|
||||
self.controls[key] = self.option(card, label, small, lambda parent: Toggle(parent, var, self.k), tip)
|
||||
return self.controls[key]
|
||||
|
||||
def segmented(self, card, key, value, label, options, small=None, tip=None):
|
||||
var = tk.StringVar(value=value)
|
||||
self.vars[key] = var
|
||||
return self.option(card, label, small, lambda parent: Segmented(parent, var, options, self.k), tip)
|
||||
self.controls[key] = self.option(card, label, small, lambda parent: Segmented(parent, var, options,
|
||||
self.k), tip)
|
||||
return self.controls[key]
|
||||
|
||||
def select(self, card, key, value, label, options, small=None, tip=None, width=12):
|
||||
"""A drop-down list; `options` are (value, label) and collect_settings reads the value back."""
|
||||
@ -1668,9 +1707,10 @@ def run_gui() -> int:
|
||||
var = tk.StringVar(value=names.get(value, options[0][1]))
|
||||
self.vars[key] = var
|
||||
self.choices[key] = {text: v for v, text in options}
|
||||
return self.option(card, label, small, lambda parent: ttk.Combobox(
|
||||
self.controls[key] = self.option(card, label, small, lambda parent: ttk.Combobox(
|
||||
parent, textvariable=var, state="readonly", width=width, values=[text for _v, text in options]),
|
||||
tip)
|
||||
return self.controls[key]
|
||||
|
||||
def folder(self, card, key, label, tip):
|
||||
var = tk.StringVar(value=self.settings[key])
|
||||
@ -1736,6 +1776,12 @@ def run_gui() -> int:
|
||||
"frames shown to it; No limit leaves them free."))
|
||||
self.toggle(frames, "smooth_motion", "Smooth Motion", "RTX 40 / 50",
|
||||
t("NVIDIA's driver doubles the frames shown (RTX 40 and 50). A trial."))
|
||||
# Shown with hardware ray tracing: the scripts leave frame generation off with it (LEONIDA_FG_WITH_RT=1 in
|
||||
# the advanced options starts it anyway).
|
||||
self.fg_note = tk.Label(frames, text=t("Off with ray tracing for now."), bg=PANEL, fg=WARN, anchor="w",
|
||||
justify="left", font=("Segoe UI", 8))
|
||||
self.fg_note.grid(row=frames.next_row, column=0, columnspan=2, sticky="w", padx=px(16))
|
||||
frames.next_row += 1
|
||||
self.card_end(frames)
|
||||
|
||||
rays = self.card(inner, 2, 0, t("Ray tracing"), "\u2726", t("Off by default."))
|
||||
@ -1772,6 +1818,8 @@ def run_gui() -> int:
|
||||
self.vars["precompile_all"].trace_add("write", precompile_all_changed)
|
||||
self.vars["precompile"].trace_add(
|
||||
"write", lambda *_: self.vars["precompile"].get() or self.vars["precompile_all"].set(False))
|
||||
for key in ("rt", "dlss", "dlss_mode", "fg_mode", "precompile_all", "precompile"):
|
||||
self.vars[key].trace_add("write", lambda *_: self.apply_rules())
|
||||
|
||||
diag = self.card(inner, 3, 0, t("General, diagnostics & advanced"), "\u2301",
|
||||
t("For bug reports. Nothing here changes how the game looks."), wide=True)
|
||||
@ -1843,6 +1891,41 @@ def run_gui() -> int:
|
||||
legend.bind("<Configure>", lambda e: e.widget.configure(wraplength=max(px(200), e.width - 4)))
|
||||
self.check_game()
|
||||
self.check_advanced()
|
||||
self.apply_rules()
|
||||
|
||||
def set_enabled(self, key, flag):
|
||||
control = self.controls.get(key)
|
||||
if control is None:
|
||||
return
|
||||
if isinstance(control, ttk.Combobox):
|
||||
control.state(["!disabled"] if flag else ["disabled"])
|
||||
else:
|
||||
control.enabled(flag)
|
||||
|
||||
def apply_rules(self):
|
||||
"""Greys what the other choices make pointless, from the controls' values: only the controls change, never
|
||||
a value, so turning the other choice back brings the earlier one back.
|
||||
- hardware ray tracing: frame generation's mode and limit (the scripts leave it off with ray tracing);
|
||||
- DLSS off: the DLSS mode; DLSS with a mode: the resolution (switch_args leaves it out);
|
||||
- frame generation off: its limit;
|
||||
- every pipeline precompiled: shader preparation stays on (it needs it)."""
|
||||
v = self.vars
|
||||
if "rt" not in v or "precompile_all" not in v:
|
||||
return
|
||||
hw = v["rt"].get() == "hw"
|
||||
fg_off = v["fg_mode"].get() == "off"
|
||||
dlss_on = bool(v["dlss"].get())
|
||||
mode = self.choices.get("dlss_mode", {}).get(v["dlss_mode"].get(), "")
|
||||
self.set_enabled("fg_mode", not hw)
|
||||
self.set_enabled("fg_limit", not hw and not fg_off)
|
||||
self.set_enabled("dlss_mode", dlss_on)
|
||||
self.set_enabled("resolution", not (dlss_on and mode))
|
||||
self.set_enabled("precompile", not v["precompile_all"].get())
|
||||
if getattr(self, "fg_note", None) is not None:
|
||||
if hw:
|
||||
self.fg_note.grid()
|
||||
else:
|
||||
self.fg_note.grid_remove()
|
||||
|
||||
def browse(self, var):
|
||||
chosen = filedialog.askdirectory(initialdir=var.get() or os.path.expanduser("~"))
|
||||
|
||||
Reference in New Issue
Block a user