Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block layout should not have zero #681

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions geest/core/workflows/safety_polygon_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def _assign_reclassification_to_safety(
for feature in layer.getFeatures():
perceived_safety = feature[self.selected_field]
score = self.safety_mapping_table.get(perceived_safety)
# Scale perceived safety values between 0 and 5
reclass_val = self._scale_value(score, 0, 100, 0, 5)
# Scale perceived safety values between 1 and 5
# Changed to 1-5 for issue #675
reclass_val = self._scale_value(score, 0, 100, 1, 5)
feature.setAttribute("value", reclass_val)
layer.updateFeature(feature)
return layer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from qgis.PyQt.QtWidgets import QSizePolicy
from qgis.core import Qgis
from .base_configuration_widget import BaseConfigurationWidget
from geest.utilities import log_message
from geest.utilities import log_message, is_qgis_dark_theme_active


class SafetyPolygonConfigurationWidget(BaseConfigurationWidget):
Expand Down Expand Up @@ -95,11 +95,16 @@ def validate_value(value):

def on_value_changed(value):
# Color handling for current cell
if is_qgis_dark_theme_active():
font_color = "color: white;"
else:
font_color = "color: black;"

if value is None or not (0 <= value <= 100):
value_item.setStyleSheet("color: red;")
value_item.setValue(0)
else:
value_item.setStyleSheet("color: black;")
value_item.setStyleSheet(font_color)
self.update_cell_colors()
self.update_data()

Expand All @@ -117,13 +122,15 @@ def update_cell_colors(self):
all_zeros = False
break

if is_qgis_dark_theme_active():
font_color = "color: white;"
else:
font_color = "color: black;"
# Color all cells based on all-zeros check
for r in range(self.table_widget.rowCount()):
spin_widget = self.table_widget.cellWidget(r, 1)
if spin_widget:
spin_widget.setStyleSheet(
"color: red;" if all_zeros else "color: black;"
)
spin_widget.setStyleSheet("color: red;" if all_zeros else font_color)

def table_to_dict(self):
updated_attributes = {}
Expand Down
Loading