From 61e0e59d3cc78b686c1ef2438fc99cd17efe3e9a Mon Sep 17 00:00:00 2001 From: AlanRockefeller Date: Sat, 1 Nov 2025 22:29:40 -0700 Subject: [PATCH] =?UTF-8?q?Release=20v0.3=20=E2=80=94=20more=20improvement?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- faststack/faststack/app.py | 11 ++++++++--- faststack/faststack/qml/Main.qml | 11 +++++++++-- faststack/faststack/ui/provider.py | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/faststack/faststack/app.py b/faststack/faststack/app.py index 26ba023..3212d77 100644 --- a/faststack/faststack/app.py +++ b/faststack/faststack/app.py @@ -313,6 +313,7 @@ def set_theme(self, theme_index): theme = 'dark' if theme_index == 0 else 'light' config.set('core', 'theme', theme) config.save() + self.ui_state.themeChanged.emit() def get_default_directory(self): return config.get('core', 'default_directory') @@ -361,9 +362,13 @@ def main(image_dir: Optional[Path] = typer.Argument(None, help="Directory of ima if image_dir is None: image_dir_str = config.get('core', 'default_directory') if not image_dir_str: - log.error("No image directory provided and no default directory set in the settings.") - # In a real app, we might open a dialog here to ask for a directory. - sys.exit(1) + log.warning("No image directory provided and no default directory set. Opening directory selection dialog.") + from PySide6.QtWidgets import QFileDialog + selected_dir = QFileDialog.getExistingDirectory(None, "Select Image Directory") + if not selected_dir: + log.error("No image directory selected. Exiting.") + sys.exit(1) + image_dir_str = selected_dir image_dir = Path(image_dir_str) if not image_dir.is_dir(): diff --git a/faststack/faststack/qml/Main.qml b/faststack/faststack/qml/Main.qml index 6f822d7..0dc6232 100644 --- a/faststack/faststack/qml/Main.qml +++ b/faststack/faststack/qml/Main.qml @@ -12,14 +12,21 @@ ApplicationWindow { flags: Qt.FramelessWindowHint title: "FastStack" - property bool isDarkTheme: true + property bool isDarkTheme: uiState.get_theme() === 0 property color currentBackgroundColor: isDarkTheme ? "#000000" : "white" property color currentTextColor: isDarkTheme ? "white" : "black" background: Rectangle { color: root.currentBackgroundColor } function toggleTheme() { - isDarkTheme = !isDarkTheme + uiState.set_theme(isDarkTheme ? 1 : 0) // 0 for dark, 1 for light + } + + Connections { + target: uiState + function onThemeChanged() { + root.isDarkTheme = uiState.get_theme() === 0 + } } // Expose the Python UIState object to QML diff --git a/faststack/faststack/ui/provider.py b/faststack/faststack/ui/provider.py index 1e33f98..c8dd4ba 100644 --- a/faststack/faststack/ui/provider.py +++ b/faststack/faststack/ui/provider.py @@ -56,6 +56,7 @@ class UIState(QObject): imageCountChanged = Signal() currentImageSourceChanged = Signal() metadataChanged = Signal() + themeChanged = Signal() def __init__(self, app_controller): super().__init__()