Skip to content

Commit

Permalink
Merge pull request #72 from Samweli/report_updates
Browse files Browse the repository at this point in the history
Add error messages in the report progress dialog
  • Loading branch information
Samweli committed Aug 14, 2024
2 parents a28b9e0 + 23c00b9 commit 92e069b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"author": "Kartoza",
"email": "[email protected]",
"description": "View, browse and navigate through imagery.",
"version": "0.0.1",
"version": "0.0.16dev",
"changelog": ""
}
}
29 changes: 18 additions & 11 deletions src/qgis_gea_plugin/gui/qgis_gea.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,22 +714,29 @@ def cancel_drawing(self):
self.project_inception_date.clear()
self.country_cmb_box.setCurrentIndex(-1)

if self.drawing_layer:
self.drawing_layer.commitChanges()
QgsProject.instance().removeMapLayer(self.drawing_layer)
self.iface.mapCanvas().refresh()
try:
if self.drawing_layer:
self.drawing_layer.commitChanges()
QgsProject.instance().removeMapLayer(self.drawing_layer)
self.iface.mapCanvas().refresh()

self.show_message(
tr("Cleared the project input fields and area successfully."),
Qgis.Info
)
self.show_message(
tr("Cleared the project input fields and area successfully."),
Qgis.Info
)

self.drawing_layer = None
else:
self.drawing_layer = None
else:
self.show_message(
tr("Cleared the project input fields."),
Qgis.Info
)
except RuntimeError as e:
self.show_message(
tr("Cleared the project input fields."),
tr("Cleared the project input fields and area successfully."),
Qgis.Info
)
log(f"Encountered an error when clearing the project drawn area.")

def show_message(self, message, level=Qgis.Warning):
"""Shows message on the main widget message bar.
Expand Down
7 changes: 5 additions & 2 deletions src/qgis_gea_plugin/gui/report_progress_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ def _on_report_error(self):
self.btn_open_pdf.setEnabled(False)
self._set_close_state()
tr_msg = tr(
"Error occurred during report generation. "
f"Error occurred during report generation. "
f"{self._task.error_messages}"
"\nSee logs for more information"
)
self.lbl_message.setText(tr_msg)

log(tr("Error generating report, see logs for more info."))
log(tr(f"Error generating report, {self._task.error_messages} \n"))

log(tr(f"{self._task._result.errors}")) if self._task._result else None

@property
def report_result(self) -> typing.Optional[ReportOutputResult]:
Expand Down

0 comments on commit 92e069b

Please sign in to comment.