Skip to content

Commit

Permalink
Merge pull request #418 from Samweli/missing_pwl_icon
Browse files Browse the repository at this point in the history
Add info for PWL items
  • Loading branch information
Samweli authored May 15, 2024
2 parents ee88873 + 10bc7f0 commit ce9f315
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/cplus_plugin/gui/qgis_cplus_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ def initialize_priority_layers(self):
item.setData(QtCore.Qt.DisplayRole, layer.get("name"))
item.setData(QtCore.Qt.UserRole, layer.get("uuid"))

if not os.path.exists(layer.get("path")):
item.setIcon(FileUtils.get_icon("mIndicatorLayerError.svg"))
item.setToolTip(
tr(
"Contains invalid priority layer path, "
"the provided layer path does not exist!"
)
)

if self.pwl_item_flags is None:
self.pwl_item_flags = item.flags()

Expand Down Expand Up @@ -628,6 +637,16 @@ def update_priority_layers(self, update_groups=True):
item.setData(QtCore.Qt.DisplayRole, layer.get("name"))
item.setData(QtCore.Qt.UserRole, layer.get("uuid"))

if os.path.exists(layer.get("path")):
item.setIcon(QtGui.QIcon())
else:
item.setIcon(FileUtils.get_icon("mIndicatorLayerError.svg"))
item.setToolTip(
tr(
"Contains invalid priority layer path, "
"the provided layer path does not exist!"
)
)
self.priority_layers_list.addItem(item)
if update_groups:
for index in range(self.priority_groups_list.topLevelItemCount()):
Expand Down Expand Up @@ -856,6 +875,7 @@ def edit_priority_layer(self):
return

self._show_priority_layer_editor(layer_identifier)
self.update_priority_layers(update_groups=False)

def _on_double_click_priority_layer(self, list_item: QtWidgets.QListWidgetItem):
"""Slot raised when a priority list item has been double clicked."""
Expand Down

0 comments on commit ce9f315

Please sign in to comment.