The setup form groups its fields into Game files and Install sections with short labels, keeps the explanations under a More details link, moves the share notice next to Start in quiet text, and sizes the window to the shown screen so no screen carries the empty band of a taller one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-20 19:30:43 +03:00
1 parent 25a53e5ef2
commit bf96d7d6c8
6 files changed
+116 -49

No files matched your search

+2 -2
View File
@@ -177,8 +177,8 @@ python -m installer --base FILE --update FILE --keys FILE --lang CODE --dest DIR
resume and update are one rule; output kept from another release is re-hashed first.
- Peak space on the install disk is about 36 GiB, not 22: the extraction copies both Program NCAs (16.3 GiB) next to
the merged RomFS (15.9 GiB) before it deletes them. The check computes the exact figure.
- Window (`python -m installer.gui`, `installer/gui.py` draws, `installer/guilogic.py` decides): form, step list with
progress, space line, collapsible log, Cancel (Ctrl+Break to the CLI's process group, then it waits for the exit),
- Window (`python -m installer.gui`, `installer/gui.py` draws, `installer/guilogic.py` decides): form (game files and install
sections, the explanations under More details, the share notice next to Start), step list with progress, space line, collapsible log, Cancel (Ctrl+Break to the CLI's process group, then it waits for the exit),
finish screen with Open folder. English, Russian, Brazilian Portuguese or Simplified Chinese, chosen from the Windows
display language (zh-CN and zh-SG give Chinese; the Traditional Chinese regions give English), switchable in the
window; every sentence is an id in `installer/text/<en|ru|pt-BR|zh-Hans>.json`. A Chinese window still starts with
+82 -35
View File
@@ -43,6 +43,8 @@ from .guilogic import (DONE, FAILED, PENDING, RUNNING, SKIPPED, UI_LANGUAGE_LABE
POLL_MS = 100
GLYPH = {PENDING: '\u25cb', RUNNING: '\u25b6', DONE: '\u2714', SKIPPED: '\u2013', FAILED: '\u2716'}
COLOR = {PENDING: '#808080', RUNNING: '#1a5fb4', DONE: '#26a269', SKIPPED: '#808080', FAILED: '#c01c28'}
HEADING = '#303030' # section titles, the details link and the update line: dark grey, no accent colour
MUTED = '#6b6b6b' # secondary text: the details and the footer notice
# The window's pixels at 100%: Tk scales the fonts by itself (tk scaling), these through installer/dpi.py.
PAD = dpi.px(14) # padding of the window and its frames
WRAP = dpi.px(620) # wrap width of the long labels
@@ -107,6 +109,11 @@ class App:
style.configure('Notice.TLabel', background='#fff3cd', foreground='#664d03', padding=dpi.px(8))
style.configure('Err.TLabel', foreground='#c01c28')
style.configure('Version.TLabel', foreground='#808080')
style.configure('Section.TLabel', foreground=HEADING, font=(self.ui_font, 10, 'bold'))
style.configure('Muted.TLabel', foreground=MUTED)
style.configure('Link.TLabel', foreground=HEADING)
style.configure('Status.TLabel', foreground=HEADING)
style.configure('Main.TButton', padding=(dpi.px(16), dpi.px(4))) # Start: the native button, larger
top = ttk.Frame(root, padding=(PAD, PAD, PAD, 0))
top.pack(fill='x')
@@ -179,7 +186,7 @@ class App:
code = self.selected_lang()
self.retext()
self.vars['lang'].set(self.lang_label(code))
self.fit()
self.fit(shrink=True)
def lang_label(self, code):
return self.cat('lang.' + code)
@@ -205,81 +212,117 @@ class App:
f.pack_forget()
self.frames[name].pack(fill='both', expand=True)
self.screen = name
self.fit()
self.fit(shrink=True)
def fit(self):
"""Size the window to its largest screen (an unpacked frame still reports the size its children ask for), so
a screen or language switch neither cuts text nor moves the buttons. The window only grows: opening the log
makes it taller, and a size the user dragged it to stays. Every text change that can add lines calls it again,
or pack takes the missing height from the button bars."""
def fit(self, shrink=False):
"""Size the window: the width of the widest screen (an unpacked frame still reports the size its children ask
for), so a screen or language switch does not move the buttons sideways, and the height of the shown screen,
so no screen carries the empty band of a taller one. Every text change that can add lines calls it again, or
pack takes the missing height from the button bars. Without `shrink` the window only grows and a size the user
dragged it to stays; a screen or language switch and closing the details or the log shrink it to fit."""
self.root.update_idletasks()
sizes = [(f.winfo_reqwidth(), f.winfo_reqheight()) for f in self.frames.values()]
widths = [f.winfo_reqwidth() for f in self.frames.values()]
shown = self.frames[self.screen] if self.screen else max(self.frames.values(), key=lambda f: f.winfo_reqheight())
chrome = self.root.winfo_reqheight() - self.body.winfo_reqheight() # the title row above the body
w = max(self.root.winfo_reqwidth(), max(s[0] for s in sizes) + 2 * PAD)
h = chrome + max(s[1] for s in sizes) + 2 * PAD
if (w, h) == self.fitted: # refresh_run calls it on every poll: leave the window alone while nothing grew
w = max(self.root.winfo_reqwidth(), max(widths) + 2 * PAD)
h = chrome + shown.winfo_reqheight() + 2 * PAD
# refresh_run calls it on every poll: leave the window alone while nothing grew
if (w, h) == self.fitted and (not shrink or self.root.winfo_height() == h):
return
self.fitted = (w, h)
self.root.minsize(w, h)
self.root.geometry(f'{max(w, self.root.winfo_width())}x{max(h, self.root.winfo_height())}')
self.root.geometry(f'{max(w, self.root.winfo_width())}x{h if shrink else max(h, self.root.winfo_height())}')
def notice(self, parent):
w = ttk.Label(parent, style='Notice.TLabel', wraplength=WRAP, justify='left')
self.bind_text(w, 'text', 'ui.notice')
return w
def section(self, grid, row, id, top):
"""A section title across the form grid with a rule after it."""
head = ttk.Frame(grid)
head.grid(row=row, column=0, columnspan=3, sticky='ew', pady=(top, dpi.px(2)))
self.label(head, id, style='Section.TLabel').pack(side='left')
ttk.Separator(head).pack(side='left', fill='x', expand=True, padx=(dpi.px(8), 0), pady=(dpi.px(2), 0))
def build_form(self):
f = ttk.Frame(self.body)
gap = dpi.px(4) # between the form's rows
bar = ttk.Frame(f) # packed first so pack shrinks the text above it, never the buttons
# The footer goes first so pack shrinks the text above it, never the button. The notice sits next to Start,
# where the player looks before the build begins, in quiet text instead of a banner over the form.
bar = ttk.Frame(f)
bar.pack(side='bottom', fill='x', pady=(dpi.px(12), 0))
self.start_button = self.button(bar, 'ui.start', self.start)
self.start_button.pack(side='right')
self.start_button = self.button(bar, 'ui.start', self.start, style='Main.TButton')
self.start_button.pack(side='right', anchor='s')
self.label(bar, 'ui.notice', style='Muted.TLabel', wraplength=dpi.px(470),
justify='left').pack(side='left', anchor='w', padx=(0, dpi.px(12)))
ttk.Separator(f).pack(side='bottom', fill='x', pady=(dpi.px(10), 0))
# The status lines sit on the footer: a window taller than the form leaves its spare height above them
self.form_error = ttk.Label(f, style='Err.TLabel', wraplength=WRAP, justify='left')
self.form_error.pack(side='bottom', anchor='w', pady=(dpi.px(4), 0))
self.update_hint = ttk.Label(f, style='Status.TLabel', wraplength=WRAP, justify='left')
self.update_hint.pack(side='bottom', anchor='w', pady=(dpi.px(8), 0))
self.form_intro = self.label(f, 'ui.intro', wraplength=WRAP, justify='left')
self.form_intro.pack(anchor='w', pady=(0, dpi.px(8)))
self.notice(f).pack(fill='x', pady=(0, dpi.px(10)))
self.form_intro.pack(anchor='w', pady=(0, dpi.px(4)))
grid = ttk.Frame(f)
grid.pack(fill='x')
grid.columnconfigure(1, weight=1)
self.section(grid, 0, 'ui.section_files', dpi.px(6))
rows = (('base', 'ui.base', 'ui.pick_game'), ('update', 'ui.update', 'ui.pick_update'),
('keys', 'ui.keys', 'ui.pick_keys'))
self.form_rows = {}
for i, (name, label_id, pick_id) in enumerate(rows):
for i, (name, label_id, pick_id) in enumerate(rows, start=1):
lab = self.label(grid, label_id)
lab.grid(row=i, column=0, sticky='w', pady=gap, padx=(0, dpi.px(10)))
lab.grid(row=i, column=0, sticky='w', pady=gap, padx=(0, dpi.px(12)))
ttk.Entry(grid, textvariable=self.vars[name]).grid(row=i, column=1, sticky='ew', pady=gap)
b = self.button(grid, 'ui.browse', lambda n=name, p=pick_id: self.pick_file(n, p))
b.grid(row=i, column=2, padx=(dpi.px(8), 0))
self.form_rows[name] = lab
i = len(rows)
self.label(grid, 'ui.firmware').grid(row=i, column=0, sticky='w', pady=gap)
i = len(rows) + 1
self.label(grid, 'ui.firmware').grid(row=i, column=0, sticky='w', pady=gap, padx=(0, dpi.px(12)))
ttk.Entry(grid, textvariable=self.vars['firmware']).grid(row=i, column=1, sticky='ew', pady=gap)
self.button(grid, 'ui.browse', self.pick_firmware).grid(row=i, column=2, padx=(dpi.px(8), 0))
i += 1
self.label(grid, 'ui.game_language').grid(row=i, column=0, sticky='w', pady=gap)
self.section(grid, i + 1, 'ui.section_install', dpi.px(12))
i += 2
self.label(grid, 'ui.game_language').grid(row=i, column=0, sticky='w', pady=gap, padx=(0, dpi.px(12)))
self.lang_box = ttk.Combobox(grid, textvariable=self.vars['lang'], state='readonly', width=30)
self.lang_box.grid(row=i, column=1, sticky='w', pady=gap)
self.lang_touched = False
self.lang_box.bind('<<ComboboxSelected>>', lambda _e: setattr(self, 'lang_touched', True))
self.fill_languages()
self.label(grid, 'ui.dest').grid(row=i + 1, column=0, sticky='w', pady=gap)
self.label(grid, 'ui.dest').grid(row=i + 1, column=0, sticky='w', pady=gap, padx=(0, dpi.px(12)))
ttk.Entry(grid, textvariable=self.vars['dest']).grid(row=i + 1, column=1, sticky='ew', pady=gap)
self.button(grid, 'ui.browse', self.pick_dest).grid(row=i + 1, column=2, padx=(dpi.px(8), 0))
self.label(f, 'ui.compressed_help', wraplength=WRAP, justify='left').pack(anchor='w', pady=(dpi.px(8), 0))
self.label(f, 'ui.firmware_help', wraplength=WRAP, justify='left').pack(anchor='w', pady=(dpi.px(8), 0))
# On by default and named with its source and licence: the player sees what is downloaded and can untick it
# On by default and named with its source and licence: the player sees what is downloaded and can untick it.
# The source and licence line is the first one under More details.
self.dlss_var = tk.BooleanVar(value=True)
dlss = ttk.Checkbutton(f, variable=self.dlss_var)
self.bind_text(dlss, 'text', 'ui.dlss')
dlss.pack(anchor='w', pady=(dpi.px(8), 0))
self.label(f, 'ui.dlss_help', wraplength=WRAP, justify='left').pack(anchor='w', padx=(dpi.px(22), 0))
self.update_hint = ttk.Label(f, wraplength=WRAP, justify='left')
self.update_hint.pack(anchor='w', pady=(dpi.px(8), 0))
self.form_error = ttk.Label(f, style='Err.TLabel', wraplength=WRAP, justify='left')
self.form_error.pack(anchor='w', pady=(dpi.px(8), 0))
self.label(f, 'ui.keys_private', wraplength=WRAP, justify='left').pack(anchor='w', pady=(dpi.px(8), 0))
dlss.pack(anchor='w', pady=(dpi.px(12), 0))
# The explanations stay out of the way until asked for: a link opens them under it
self.details_toggle = ttk.Label(f, style='Link.TLabel', cursor='hand2', takefocus=True)
self.bind_text(self.details_toggle, 'text', 'ui.more_details')
for seq in ('<Button-1>', '<Return>', '<space>'):
self.details_toggle.bind(seq, lambda _e: self.toggle_details())
self.details_toggle.pack(anchor='w', pady=(dpi.px(8), 0))
self.details = ttk.Frame(f) # packed after the link when open; no holder frame, as an emptied Tk frame keeps
# the height its last child gave it
for id in ('ui.dlss_help', 'ui.formats_help', 'ui.compressed_help', 'ui.firmware_help', 'ui.keys_private'):
self.label(self.details, id, style='Muted.TLabel', wraplength=WRAP - dpi.px(16),
justify='left').pack(anchor='w', pady=(dpi.px(6), 0))
self.details_open = False
return f
def toggle_details(self):
self.details_open = not self.details_open
if self.details_open:
self.details.pack(after=self.details_toggle, fill='x', padx=(dpi.px(16), 0))
else:
self.details.pack_forget()
self.bound = [b for b in self.bound if b[0] is not self.details_toggle]
self.bind_text(self.details_toggle, 'text', 'ui.fewer_details' if self.details_open else 'ui.more_details')
self.fit(shrink=not self.details_open)
def build_run(self):
f = ttk.Frame(self.body)
bar = ttk.Frame(f)
@@ -530,7 +573,7 @@ class App:
self.log_frame.pack_forget()
self.bound = [b for b in self.bound if b[0] is not self.log_toggle]
self.bind_text(self.log_toggle, 'text', 'ui.hide_log' if self.log_open else 'ui.show_log')
self.fit()
self.fit(shrink=not self.log_open)
def clear_log(self):
self.log_entries = []
@@ -596,6 +639,7 @@ class App:
self.open_button.state(['!disabled'])
else:
self.open_button.state(['disabled' if not Path(m.dest or '.').is_dir() else '!disabled'])
self.fit() # an error text can be longer than the screen it replaces
def start_game(self):
"""Starts the game of the install folder and closes the window."""
@@ -687,6 +731,9 @@ def selftest(layout, shots=None):
app.start() # missing files: shows the problems
steps.append(app.form_error.cget('text'))
shot(f'form-{tag}')
app.toggle_details()
shot(f'form-details-{tag}')
app.toggle_details()
app.model = Model()
app.clear_log()
app.build_step_rows(app.model.steps)
+8 -3
View File
@@ -126,10 +126,10 @@
"ui.intro": "Builds a playable Tears of the Kingdom folder from your own game files. This takes a while and runs once.",
"ui.notice": "The folder this setup builds contains the game. It is for your own use only; do not share or upload it.",
"ui.keys_private": "The keys file is read in place. Its contents are never shown, copied or stored.",
"ui.base": "Base game (NSP, XCI, NSZ or XCZ)",
"ui.update": "Update 1.1.0 or 1.2.1 or 1.4.3 (NSP or NSZ)",
"ui.base": "Base game",
"ui.update": "Update",
"ui.keys": "prod.keys",
"ui.firmware": "Firmware folder (optional)",
"ui.firmware": "Firmware (optional)",
"ui.game_language": "Game language",
"ui.dest": "Install folder",
"ui.browse": "Browse...",
@@ -142,6 +142,11 @@
"ui.dlss": "Download NVIDIA DLSS (nvngx_dlss.dll) for NVIDIA RTX graphics cards",
"ui.dlss_help": "From NVIDIA's DLSS SDK on GitHub, under NVIDIA's RTX SDK license (github.com/NVIDIA/DLSS). It makes the dlaa and DLSS settings work; without it they do nothing.",
"ui.compressed_help": "Compressed NSZ and XCZ files work as they are: the setup unpacks them by itself (until the game data is extracted, that needs as much free space as the unpacked files take).",
"ui.section_files": "Game files",
"ui.section_install": "Install",
"ui.more_details": "▸ More details",
"ui.fewer_details": "▾ Hide details",
"ui.formats_help": "Base game: NSP, XCI, NSZ or XCZ. Update: 1.1.0, 1.2.1 or 1.4.3, as NSP or NSZ.",
"ui.type_game": "Game files (NSP, XCI, NSZ, XCZ)",
"ui.type_keys": "Key files (*.keys)",
"ui.type_all": "All files",
+8 -3
View File
@@ -126,10 +126,10 @@
"ui.intro": "Monta uma pasta jogável de Tears of the Kingdom a partir dos seus próprios arquivos do jogo. Isso demora um pouco e só precisa ser feito uma vez.",
"ui.notice": "A pasta que esta instalação monta contém o jogo. Ela é só para seu uso pessoal; não compartilhe nem envie para a internet.",
"ui.keys_private": "O arquivo de chaves é lido no lugar. O conteúdo dele nunca é mostrado, copiado nem guardado.",
"ui.base": "Jogo base (NSP, XCI, NSZ ou XCZ)",
"ui.update": "Atualização 1.1.0, 1.2.1 ou 1.4.3 (NSP ou NSZ)",
"ui.base": "Jogo base",
"ui.update": "Atualização",
"ui.keys": "prod.keys",
"ui.firmware": "Pasta de firmware (opcional)",
"ui.firmware": "Firmware (opcional)",
"ui.game_language": "Idioma do jogo",
"ui.dest": "Pasta de instalação",
"ui.browse": "Procurar...",
@@ -142,6 +142,11 @@
"ui.dlss": "Baixar o NVIDIA DLSS (nvngx_dlss.dll) para placas de vídeo NVIDIA RTX",
"ui.dlss_help": "Do DLSS SDK da NVIDIA no GitHub, sob a licença NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Sem ele as opções dlaa e DLSS não fazem nada.",
"ui.compressed_help": "Arquivos compactados NSZ e XCZ funcionam do jeito que estão: a instalação os descompacta sozinha (para isso, até os dados do jogo serem extraídos, ela precisa de tanto espaço livre quanto ocupam os arquivos descompactados).",
"ui.section_files": "Arquivos do jogo",
"ui.section_install": "Instalação",
"ui.more_details": "▸ Mais detalhes",
"ui.fewer_details": "▾ Ocultar detalhes",
"ui.formats_help": "Jogo base: NSP, XCI, NSZ ou XCZ. Atualização: 1.1.0, 1.2.1 ou 1.4.3, em NSP ou NSZ.",
"ui.type_game": "Arquivos de jogo (NSP, XCI, NSZ, XCZ)",
"ui.type_keys": "Arquivos de chaves (*.keys)",
"ui.type_all": "Todos os arquivos",
+8 -3
View File
@@ -126,10 +126,10 @@
"ui.intro": "Собирает готовую к запуску папку с Tears of the Kingdom из ваших игровых файлов. Занимает много времени и выполняется один раз.",
"ui.notice": "Папка, которую создаёт установка, содержит игру. Она предназначена только для личного использования: не передавайте и не выкладывайте её.",
"ui.keys_private": "Файл ключей читается на месте. Его содержимое не показывается, не копируется и не сохраняется.",
"ui.base": "Базовая игра (NSP, XCI, NSZ или XCZ)",
"ui.update": "Обновление 1.1.0 или 1.2.1 или 1.4.3 (NSP или NSZ)",
"ui.base": "Базовая игра",
"ui.update": "Обновление",
"ui.keys": "prod.keys",
"ui.firmware": "Папка прошивки (необязательно)",
"ui.firmware": "Прошивка (необязательно)",
"ui.game_language": "Язык игры",
"ui.dest": "Папка установки",
"ui.browse": "Обзор...",
@@ -142,6 +142,11 @@
"ui.dlss": "Загрузить NVIDIA DLSS (nvngx_dlss.dll) для видеокарт NVIDIA RTX",
"ui.dlss_help": "Из DLSS SDK от NVIDIA на GitHub, по лицензии NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Без него настройки dlaa и DLSS ничего не делают.",
"ui.compressed_help": "Сжатые файлы NSZ и XCZ подходят как есть: установка сама их распакует (для этого, пока извлекаются данные игры, нужно столько свободного места, сколько занимают распакованные файлы).",
"ui.section_files": "Файлы игры",
"ui.section_install": "Установка",
"ui.more_details": "▸ Подробнее",
"ui.fewer_details": "▾ Скрыть подробности",
"ui.formats_help": "Базовая игра: NSP, XCI, NSZ или XCZ. Обновление: 1.1.0, 1.2.1 или 1.4.3, в NSP или NSZ.",
"ui.type_game": "Файлы игры (NSP, XCI, NSZ, XCZ)",
"ui.type_keys": "Файлы ключей (*.keys)",
"ui.type_all": "Все файлы",
+8 -3
View File
@@ -126,10 +126,10 @@
"ui.intro": "用你自己的游戏文件构建一个可以游玩的《王国之泪》文件夹。耗时较长,只需运行一次。",
"ui.notice": "此安装程序构建的文件夹包含游戏本身,仅供你个人使用;请勿分享或上传。",
"ui.keys_private": "密钥文件只在原位置读取,其内容绝不会被显示、复制或保存。",
"ui.base": "游戏本体(NSP、XCI、NSZ 或 XCZ)",
"ui.update": "1.1.0、1.2.1 或 1.4.3 更新(NSP 或 NSZ)",
"ui.base": "游戏本体",
"ui.update": "更新",
"ui.keys": "prod.keys",
"ui.firmware": "固件文件夹(可选)",
"ui.firmware": "固件(可选)",
"ui.game_language": "游戏语言",
"ui.dest": "安装文件夹",
"ui.browse": "浏览...",
@@ -142,6 +142,11 @@
"ui.dlss": "为 NVIDIA RTX 显卡下载 NVIDIA DLSS(nvngx_dlss.dll)",
"ui.dlss_help": "来自 GitHub 上 NVIDIA 的 DLSS SDK,遵循 NVIDIA RTX SDK 许可(github.com/NVIDIA/DLSS)。没有它,dlaa 和 DLSS 设置不起作用。",
"ui.compressed_help": "压缩的 NSZ 和 XCZ 文件可以直接使用:安装程序会自行解压(在游戏数据提取完成之前,需要与解压后文件大小相同的可用空间)。",
"ui.section_files": "游戏文件",
"ui.section_install": "安装",
"ui.more_details": "▸ 更多说明",
"ui.fewer_details": "▾ 收起说明",
"ui.formats_help": "游戏本体:NSP、XCI、NSZ 或 XCZ。更新:1.1.0、1.2.1 或 1.4.3,NSP 或 NSZ 格式。",
"ui.type_game": "游戏文件(NSP、XCI、NSZ、XCZ)",
"ui.type_keys": "密钥文件(*.keys)",
"ui.type_all": "所有文件",