|
4 | 4 | from tkinter import filedialog, messagebox |
5 | 5 |
|
6 | 6 | from config import APP_NAME |
7 | | -from engine import update_controller_pack, get_local_version, get_github_version |
| 7 | +from engine import ( |
| 8 | + update_controller_pack, |
| 9 | + get_local_version, |
| 10 | + get_github_version, |
| 11 | + tool_update_available, |
| 12 | + self_update_tools, |
| 13 | +) |
8 | 14 |
|
9 | 15 | try: |
10 | 16 | from build_info import BUILD_COMMIT, BUILD_BRANCH |
@@ -130,6 +136,27 @@ def __init__(self, root): |
130 | 136 | self.auto_detect_start_directory() |
131 | 137 | self.refresh_versions() |
132 | 138 | self.refresh_action_button() |
| 139 | + self.check_tool_update_on_startup() |
| 140 | + |
| 141 | + def check_tool_update_on_startup(self): |
| 142 | + try: |
| 143 | + available, latest_tag = tool_update_available() |
| 144 | + |
| 145 | + if not available: |
| 146 | + return |
| 147 | + |
| 148 | + should_update = messagebox.askyesno( |
| 149 | + "Installer update available", |
| 150 | + f"A newer installer release is available: {latest_tag}\n\n" |
| 151 | + "Do you want to update ControllerPackInstaller.exe and ProfileConfigurator.exe now?", |
| 152 | + ) |
| 153 | + |
| 154 | + if should_update: |
| 155 | + current_dir = get_start_directory() |
| 156 | + self_update_tools(current_dir) |
| 157 | + |
| 158 | + except Exception as error: |
| 159 | + print(f"Tool update check failed: {error}") |
133 | 160 |
|
134 | 161 | def auto_detect_start_directory(self): |
135 | 162 | start_dir = get_start_directory() |
@@ -246,7 +273,7 @@ def ask_backup_settings(self) -> bool: |
246 | 273 | "The update will modify files inside LFXX/Settings.\n\n" |
247 | 274 | "No previous settings backup was detected in:\n" |
248 | 275 | "LFXX/Settings/settings_backup\n\n" |
249 | | - "Do you want the installer to create a backup before continuing?" |
| 276 | + "Do you want the installer to create a backup before continuing?", |
250 | 277 | ) |
251 | 278 |
|
252 | 279 | def run_update(self): |
|
0 commit comments