Skip to content

Commit

Permalink
Fixes for status icons
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Nov 29, 2024
1 parent a6126b5 commit 1f7bda1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
27 changes: 16 additions & 11 deletions geest/core/json_tree_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ def getStatus(self):
return ""

data = self.attributes()
# log_message(f"Data: {data}")
analysis_mode = data.get("analysis_mode", "")
qgis_layer_source_key = analysis_mode.replace("use_", "") + "layer_spource"
qgis_layer_shapefile_key = analysis_mode.replace("use_", "") + "shapefile"
status = ""

# First check if the item weighting is 0, or its parent factor is zero
Expand Down Expand Up @@ -301,27 +303,30 @@ def getStatus(self):
if "Failed" in data.get("result", ""):
return "Workflow failed"
# Item required and not configured
if "Do Not Use" in data.get("analysis_mode", "") and data.get(
"indicator_required", False
):
if "Do Not Use" in analysis_mode and data.get("factor_weighting", 0.0) > 0:
return "Required and not configured"
# Item not required but not configured
if "Do Not Use" in data.get("analysis_mode", "") and not data.get(
"indicator_required", False
):
if "Do Not Use" in analysis_mode:
return "Not configured (optional)"
# Item required and not configured
if (
self.isIndicator()
and (data.get("analysis_mode", "") == "")
and data.get("indicator_required", False)
and (analysis_mode == "")
and (data.get("factor_weighting", 0.0) > 0)
):
return "Required and not configured"
# Item not required but not configured
if (
self.isIndicator()
and (data.get("analysis_mode", "") == "")
and not data.get("indicator_required", False)
and (analysis_mode == "")
and (data.get("factor_weighting", 0.0) == 0.0)
):
return "Not configured (optional)"
if (
self.isIndicator()
and analysis_mode != "use_default_index_score"
and not data.get(qgis_layer_source_key, False)
and not data.get(qgis_layer_shapefile_key, False)
):
return "Not configured (optional)"
if "Not Run" in data.get("result", "") and not data.get("result_file", ""):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def update_selected_field(self) -> None:
self.settings.setValue(f"{self.widget_key}_selected_field", selected_field)
if self.attributes.get("id", None) == "Street_Lights":
# retrieve the unique values for the selected field
vectorLayer = self.layer_combo.currentLayer()
idx = vectorLayer.fields().indexOf(selected_field)
values = vectorLayer.uniqueValues(idx)
vector_layer = self.layer_combo.currentLayer()
idx = vector_layer.fields().indexOf(selected_field)
values = vector_layer.uniqueValues(idx)
values_dict = {}

# list the data type of each value
Expand Down

0 comments on commit 1f7bda1

Please sign in to comment.