Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions faststack/faststack/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Comment thread
AlanRockefeller marked this conversation as resolved.
image_dir = Path(image_dir_str)

if not image_dir.is_dir():
Expand Down
11 changes: 9 additions & 2 deletions faststack/faststack/qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions faststack/faststack/ui/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class UIState(QObject):
imageCountChanged = Signal()
currentImageSourceChanged = Signal()
metadataChanged = Signal()
themeChanged = Signal()

def __init__(self, app_controller):
super().__init__()
Expand Down