diff --git a/geest/core/workflows/analysis_aggregation_workflow.py b/geest/core/workflows/analysis_aggregation_workflow.py index 7857c2c8..34a6c991 100644 --- a/geest/core/workflows/analysis_aggregation_workflow.py +++ b/geest/core/workflows/analysis_aggregation_workflow.py @@ -39,5 +39,6 @@ def __init__( .replace(" ", "_") .replace("'", "") ) # should not be needed any more + self.layer_id = "wee" self.weight_key = "dimension_weighting" self.workflow_name = "analysis_aggregation" diff --git a/geest/gui/geest_dock.py b/geest/gui/geest_dock.py index e8114669..f3f7ded2 100644 --- a/geest/gui/geest_dock.py +++ b/geest/gui/geest_dock.py @@ -21,7 +21,7 @@ CreateProjectPanel, ) from geest.core import set_setting, setting -from geest.utilities import resources_path, log_message +from geest.utilities import resources_path, log_message, is_qgis_dark_theme_active INTRO_PANEL = 0 CREDITS_PANEL = 1 @@ -56,9 +56,14 @@ def __init__( layout.setSpacing(0) # Remove spacing between elements # Load the background image - self.background_image = QPixmap( - resources_path("resources", "images", "background.png") - ) + if is_qgis_dark_theme_active(): + self.background_image = QPixmap( + resources_path("resources", "images", "background-dark.png") + ) + else: + self.background_image = QPixmap( + resources_path("resources", "images", "background.png") + ) # Create a stacked widget self.stacked_widget: QStackedWidget = QStackedWidget() diff --git a/geest/gui/panels/create_project_panel.py b/geest/gui/panels/create_project_panel.py index ff8037fa..d11bcd0a 100644 --- a/geest/gui/panels/create_project_panel.py +++ b/geest/gui/panels/create_project_panel.py @@ -181,6 +181,7 @@ def create_project(self): feedback=feedback, ) # Hook up the QTask feedback signal to the progress bar + self.progress_updated(0) processor.progressChanged.connect(self.progress_updated) processor.taskCompleted.connect(self.on_task_completed) diff --git a/geest/gui/panels/tree_panel.py b/geest/gui/panels/tree_panel.py index 2f4cc0f7..8a91a353 100644 --- a/geest/gui/panels/tree_panel.py +++ b/geest/gui/panels/tree_panel.py @@ -310,8 +310,9 @@ def working_directory_changed(self, new_directory): analysis_data["working_folder"] = self.working_directory # Use the last dir in the working directory path as the analysis name if analysis_data.get("analysis_name", "Not Set"): - analysis_data["analysis_name"] = os.path.basename( - self.working_directory + analysis_name = os.path.basename(self.working_directory) + analysis_data["analysis_name"] = ( + f"Women's Economic Empowerment - {analysis_name}" ) analysis_item.setData(0, analysis_data.get("analysis_name", "Analysis")) settings = QSettings() diff --git a/geest/resources/images/background-dark.png b/geest/resources/images/background-dark.png new file mode 100644 index 00000000..b154f184 Binary files /dev/null and b/geest/resources/images/background-dark.png differ diff --git a/geest/ui/create_project_panel_base.ui b/geest/ui/create_project_panel_base.ui index 731e46e3..3b0eeeb6 100644 --- a/geest/ui/create_project_panel_base.ui +++ b/geest/ui/create_project_panel_base.ui @@ -13,44 +13,15 @@ Form - - - - - - - - ../resources/geest-banner.png - - - true - - - - - - - <html><head/><body><p align="center"><span style=" font-size:16pt; font-weight:600;">GEEST Project Creation</span></p></body></html> - - - Qt::RichText - - - Qt::AlignCenter - - - true - - - - + + Qt::Horizontal - + @@ -68,15 +39,25 @@ - - + + 16 + + + + + + true + - <html><head/><body><p><span style=" font-size:12pt;">Now select a layer containing the </span><span style=" font-size:12pt; font-weight:600;">Admin0</span><span style=" font-size:12pt;"> boundary for your study area and the column in your dataset with the name of our area.</span></p></body></html> + <html><head/><body><p><span style=" font-size:12pt;">Set the analysis cell size (m). Smaller sizes will require longer processing times, but produce more detailed analysis results. Typically a value between </span><span style=" font-size:12pt; font-weight:600;">100m</span><span style=" font-size:12pt;"> and </span><span style=" font-size:12pt; font-weight:600;">1000m</span><span style=" font-size:12pt;"> would be used here.</span></p></body></html> + + + Qt::RichText Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -86,16 +67,7 @@ - - - - - 16 - - - - - + @@ -107,46 +79,20 @@ - - - - Use Coordinate Reference System of your boundary layer - - - - - - - true - + + - <html><head/><body><p><span style=" font-size:12pt;">Set the analysis cell size (m). Smaller sizes will require longer processing times, but produce more detailed analysis results. Typically a value between </span><span style=" font-size:12pt; font-weight:600;">100m</span><span style=" font-size:12pt;"> and </span><span style=" font-size:12pt; font-weight:600;">1000m</span><span style=" font-size:12pt;"> would be used here.</span></p></body></html> - - - Qt::RichText + - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + ../resources/geest-banner.png - + true - - - - Qt::Vertical - - - - 20 - 40 - - - - - + true @@ -170,16 +116,25 @@ - - + + 16 + + <html><head/><body><p><span style=" font-size:12pt;">Now select a layer containing the </span><span style=" font-size:12pt; font-weight:600;">Admin0</span><span style=" font-size:12pt;"> boundary for your study area and the column in your dataset with the name of our area.</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + - + @@ -211,9 +166,41 @@ - - - + + + + + 16 + + + + + + + + Use Coordinate Reference System of your boundary layer + + + + + + + <html><head/><body><p align="center"><span style=" font-size:16pt; font-weight:600;">GEEST Project Creation</span></p></body></html> + + + Qt::RichText + + + Qt::AlignCenter + + + true + + + + + + @@ -237,14 +224,7 @@ - - - - 0 - - - - + @@ -268,9 +248,42 @@ + + + + 0 + + + + + + + Qt::Horizontal + + + + 88 + 20 + + + + - + + + + Qt::Vertical + + + + 20 + 40 + + + + + diff --git a/geest/ui/ors_panel_base.ui b/geest/ui/ors_panel_base.ui index 34aa644c..e6583eb9 100644 --- a/geest/ui/ors_panel_base.ui +++ b/geest/ui/ors_panel_base.ui @@ -222,6 +222,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/geest/utilities.py b/geest/utilities.py index 83c0c2f0..5c93ef71 100644 --- a/geest/utilities.py +++ b/geest/utilities.py @@ -21,9 +21,10 @@ import os import logging import inspect -from qgis.PyQt.QtCore import QUrl +from qgis.PyQt.QtCore import QUrl, QSettings from qgis.PyQt import uic from qgis.core import QgsMessageLog, Qgis, QgsProject +from qgis.PyQt.QtWidgets import QApplication from geest.core import setting @@ -156,3 +157,42 @@ def collect_layer_ids(group: QgsLayerTreeGroup) -> set: geest_layer_ids = collect_layer_ids(geest_group) return geest_layer_ids + + +def is_qgis_dark_theme_active() -> bool: + """ + Determines if QGIS is using the Night Mapping theme or a dark theme. + + Checks: + 1. QGIS settings for the Night Mapping theme. + 2. Application palette for dark mode. + 3. Stylesheet for references to 'nightmapping'. + + Returns: + bool: True if Night Mapping theme or a dark theme is active, False otherwise. + """ + # 1. Check QGIS settings for Night Mapping theme + settings = QSettings() + theme_name = settings.value("UI/Theme", "").lower() + if theme_name == "nightmapping": + return True + + # 2. Access the application instance + app = QApplication.instance() + if not app: + return False + + # Check the application palette for dark colors + palette = app.palette() + window_color = palette.color(palette.Window) + text_color = palette.color(palette.WindowText) + if window_color.lightness() < text_color.lightness(): + return True + + # 3. Check the stylesheet for 'nightmapping' references + stylesheet = app.styleSheet() + if "nightmapping" in stylesheet.lower(): + return True + + # Default to False if none of the conditions are met + return False