Code cleanup and improvements.

This commit is contained in:
2026-09-03 21:52:06 +02:00
parent ea323e3ab0
commit ecdea827ac
20 changed files with 312 additions and 213 deletions

View File

@@ -164,6 +164,7 @@ def open_settings_dialog(
def add_choice(
parent: ttk.LabelFrame,
row: int,
name: str,
label: str,
description: str,
variable: tk.StringVar,
@@ -181,15 +182,20 @@ def open_settings_dialog(
)
ttk.Combobox(
parent,
name=name,
textvariable=variable,
values=choices,
state="readonly",
style="Settings.TCombobox",
cursor="hand2",
exportselection=False,
takefocus=True,
).grid(row=row + 1, column=0, columnspan=2, sticky="ew", pady=(3, 9))
def add_path(
parent: ttk.LabelFrame,
row: int,
name: str,
label: str,
description: str,
variable: tk.StringVar,
@@ -205,7 +211,14 @@ def open_settings_dialog(
column=1,
sticky="e",
)
ttk.Entry(parent, textvariable=variable, style="Settings.TEntry").grid(
ttk.Entry(
parent,
name=name,
textvariable=variable,
style="Settings.TEntry",
exportselection=False,
takefocus=True,
).grid(
row=row + 1,
column=0,
columnspan=1,
@@ -295,22 +308,27 @@ def open_settings_dialog(
wraplength=360,
).grid(row=0, column=0, columnspan=2, sticky="w", pady=(0, 11))
presentation = ttk.Frame(display_card, style="SettingsCard.TFrame")
presentation.grid(row=1, column=0, columnspan=2, sticky="w")
presentation.grid(row=1, column=0, columnspan=2, sticky="ew")
ttk.Checkbutton(
presentation,
text="Remove title bar and borders (Borderless)",
variable=borderless_value,
style="Settings.TCheckbutton",
).pack(anchor="w")
cursor="hand2",
takefocus=True,
).pack(fill="x")
ttk.Checkbutton(
presentation,
text="Suppress false 'not responding' warnings",
variable=suppress_unresponsive_value,
style="Settings.TCheckbutton",
).pack(anchor="w", pady=(7, 0))
cursor="hand2",
takefocus=True,
).pack(fill="x", pady=(7, 0))
add_choice(
display_card,
2,
"settings_selector_ui_scale",
"Launcher size",
"Applies after launcher restart",
ui_scale_value,
@@ -335,6 +353,7 @@ def open_settings_dialog(
add_choice(
rendering_card,
1,
"settings_selector_runtime",
"Runtime",
"Compatibility layer",
runtime_value,
@@ -343,6 +362,7 @@ def open_settings_dialog(
add_choice(
rendering_card,
3,
"settings_selector_proton_sync",
"Proton synchronization",
"Automatic selects the compatible mode",
proton_sync_value,
@@ -378,7 +398,9 @@ def open_settings_dialog(
text="Low-bandwidth mode (cached news, up to 2 workers and 5 MB/s)",
variable=low_bandwidth_value,
style="Settings.TCheckbutton",
).grid(row=1, column=0, sticky="w", padx=(0, 16))
cursor="hand2",
takefocus=True,
).grid(row=1, column=0, rowspan=2, sticky="ew", padx=(0, 16))
ttk.Label(
downloads_card,
text="Speed limit",
@@ -391,12 +413,16 @@ def open_settings_dialog(
).grid(row=1, column=2, sticky="w", padx=(8, 0))
download_speed_selector = ttk.Combobox(
downloads_card,
name="settings_selector_download_speed",
textvariable=download_speed_value,
values=tuple(DOWNLOAD_SPEED_PRESETS_MBPS) + (
DOWNLOAD_SPEED_CUSTOM_LABEL,
),
state="readonly",
style="Settings.TCombobox",
cursor="hand2",
exportselection=False,
takefocus=True,
)
download_speed_selector.grid(
row=2,
@@ -406,9 +432,13 @@ def open_settings_dialog(
)
custom_download_speed = ttk.Entry(
downloads_card,
name="settings_download_speed",
textvariable=custom_download_speed_value,
style="Settings.TEntry",
width=12,
justify="right",
exportselection=False,
takefocus=True,
)
custom_download_speed.grid(
row=2,
@@ -449,6 +479,7 @@ def open_settings_dialog(
add_path(
overrides_card,
1,
"settings_proton_path",
"Proton script",
"Use a specific Proton executable",
proton_path_value,
@@ -457,6 +488,7 @@ def open_settings_dialog(
add_path(
overrides_card,
3,
"settings_game_source",
"Import source",
"Seed a new managed installation only",
game_source_value,