Skip to content

Commit

Permalink
If sampling chenge has changed, and user reload it, report is not lon…
Browse files Browse the repository at this point in the history
…ger valid
  • Loading branch information
XavierCLL committed Sep 21, 2024
1 parent f31ab5e commit 3e7163a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/response_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def reload_sampling_file(self):
if modified == 0 and added == 0 and removed == 0:
iface.messageBar().pushMessage("AcATaMa", "The sampling file has not detected changes",
level=Qgis.Success, duration=10)
return
return False
# reassign points
self.points = points_from_shapefile
# update the status and labels for the current sampling file
Expand All @@ -164,6 +164,7 @@ def reload_sampling_file(self):
iface.messageBar().pushMessage("AcATaMa", "Sampling file reloaded successfully: {} modified,"
"{} added and {} removed".format(modified, added, removed),
level=Qgis.Success, duration=10)
return True

@wait_process
def save_sampling_labeled(self, file_out):
Expand Down
11 changes: 8 additions & 3 deletions gui/acatama_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,18 @@ def update_response_design_state(self, sampling_layer=None):
def reload_sampling_file(self):
sampling_layer = self.QCBox_SamplingFile.currentLayer()
if sampling_layer:
# sampling file valid
if sampling_layer in ResponseDesign.instances:
response_design = ResponseDesign.instances[sampling_layer]
response_design.reload_sampling_file()
else:
response_design = ResponseDesign(sampling_layer)
response_design.reload_sampling_file()

sampling_file_changed = response_design.reload_sampling_file()
if sampling_file_changed:
# if sampling report exists, delete it for this sampling layer TODO: update the report
if sampling_layer in SamplingReport.instances:
del SamplingReport.instances[sampling_layer]
self.QPBtn_openSamplingReport.setDisabled(True)

# updated state of sampling file selected for accuracy assessment tab
self.update_analysis_state()
else:
Expand Down

0 comments on commit 3e7163a

Please sign in to comment.