typos, standardization, and file association for project extensions

This commit is contained in:
2026-08-06 02:00:36 -07:00
parent 68e34484ee
commit 074a0681b9
15 changed files with 539 additions and 38 deletions
+22 -17
View File
@@ -32,6 +32,7 @@ from PySide6.QtCore import Signal, Qt, QTimer
from PySide6.QtGui import QAction, QFontMetrics, QKeySequence, QIcon
from PySide6.QtSvgWidgets import QSvgWidget # needed to show svgs when app is not frozen
from file_ext_registration import register_file_association, ELEVATION_FLAG
from project_manager import ProjectManager
from src.window.about import AboutWindow
from src.window.terminal import TerminalWindow
@@ -42,6 +43,7 @@ from src.window.viewerlauncher import ViewerLauncherWidget
from src.window.welcome import WelcomeDialog
from src.shared.flaresbasewidget import FilePickerWidget, ParamSection, ProgressBubble
from src.shared.shareddata import API_URL, API_URL_SECONDARY, APP_NAME, CURRENT_VERSION, PLATFORM_NAME, DATA_SCHEMA
from startup_args import parse_startup_args
from updater import finish_update_if_needed, UpdateManager, LocalPendingUpdateCheckThread
@@ -498,7 +500,7 @@ class MainApplication(QMainWindow):
metadata_processed = Signal(str, int)
metadata_ui_signal = Signal(dict, str, int)
def __init__(self):
def __init__(self, file_to_open=None):
super().__init__()
self.setWindowTitle(f"{APP_NAME.upper()}")
self.setGeometry(100, 100, 1280, 720)
@@ -602,8 +604,10 @@ class MainApplication(QMainWindow):
welcome = WelcomeDialog(self, direct=True, first=False)
welcome.show()
if file_to_open and os.path.exists(file_to_open):
self.project_manager.load_project(file_to_open)
def init_ui(self):
central = QWidget()
@@ -1362,8 +1366,6 @@ class MainApplication(QMainWindow):
self.sync_file_baselines()
#TODO: Update blue bold text too
# def show_files_as_bubbles(self, folder_paths):
# if isinstance(folder_paths, str):
@@ -2365,9 +2367,8 @@ class MainApplication(QMainWindow):
self.update_window_title()
print("[State] All changes saved to disk.")
def run_gui_entry_wrapper(config, gui_queue, progress_queue, ack_queue):
"""
Where the processing happens
@@ -2450,6 +2451,7 @@ def exception_hook(exc_type, exc_value, exc_traceback):
# Exit the app after user acknowledges
sys.exit(1)
def show_critical_error(error_msg):
msg_box = QMessageBox()
msg_box.setIcon(QMessageBox.Icon.Critical)
@@ -2548,8 +2550,15 @@ def config_init():
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == ELEVATION_FLAG:
_, _ext, _prog_id, _app_name = sys.argv[1:5]
_ok, _msg = register_file_association(ext=_ext, prog_id=_prog_id, app_name=_app_name)
sys.exit(0 if _ok else 1)
startup_args = parse_startup_args(sys.argv)
# Redirect exceptions to the popup window
sys.excepthook = exception_hook
@@ -2578,16 +2587,12 @@ if __name__ == "__main__":
# Only run GUI in the main process
if current_process().name == 'MainProcess':
app = QApplication(sys.argv)
finish_update_if_needed(PLATFORM_NAME, APP_NAME, cfg_path)
window = MainApplication()
if PLATFORM_NAME == "darwin":
app.setWindowIcon(QIcon(resource_path("icons/main.icns")))
window.setWindowIcon(QIcon(resource_path("icons/main.icns")))
else:
app.setWindowIcon(QIcon(resource_path("icons/main.ico")))
window.setWindowIcon(QIcon(resource_path("icons/main.ico")))
finish_update_if_needed(PLATFORM_NAME, APP_NAME, cfg_path, startup_args.finish_update)
icon_ext = "icns" if PLATFORM_NAME == "darwin" else "ico"
app.setWindowIcon(QIcon(resource_path(f"icons/main.{icon_ext}")))
window = MainApplication(file_to_open=startup_args.initial_file)
window.setWindowIcon(QIcon(resource_path(f"icons/main.{icon_ext}")))
window.show()
sys.exit(app.exec())
# Not 6000 lines yay!
# Not 2600 lines yay!