Skip to content
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
370 changes: 370 additions & 0 deletions docs/development/usability-plan.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ development/translation
development/packaging
development/testing
development/history
development/usability-plan
```
16 changes: 7 additions & 9 deletions loopstructural/gui/map2loop_tools/basal_contacts_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ...main.vectorLayerWrapper import addGeoDataFrameToproject
from ..background_task import finish_background_task, start_background_task
from ..compatibility import configure_layer_combo
from ..messages import push_success, push_warning


class BasalContactsWidget(QWidget):
Expand Down Expand Up @@ -268,16 +269,13 @@ def _on_extractor_finished(self, payload):
basal_layer, 'basal_unit'
)
else:
QMessageBox.information(
self,
"No Contacts Found",
"No contacts were found with the given parameters.",
contact_type = None
if contact_type is None:
push_warning(
"No Contacts Found", "No contacts were found with the given parameters."
)
QMessageBox.information(
self,
"Success",
f"Successfully extracted {contact_type}!",
)
else:
push_success("Basal Contacts", f"Successfully extracted {contact_type}.")
if self._debug and self._debug.is_debug():
try:
self._debug.save_debug_file(
Expand Down
13 changes: 6 additions & 7 deletions loopstructural/gui/map2loop_tools/thickness_calculator_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from loopstructural.gui.background_task import finish_background_task, start_background_task
from loopstructural.gui.compatibility import configure_layer_combo
from loopstructural.gui.messages import push_success
from loopstructural.toolbelt.preferences import PlgOptionsManager

from ...main.helpers import ColumnMatcher, get_layer_names
Expand Down Expand Up @@ -468,25 +469,23 @@ def _on_calculator_finished(self, result):
addGeoDataFrameToproject(lines, "Thickness Lines")
if location_tracking is not None:
addGeoDataFrameToproject(location_tracking, "Thickness Locations")
QMessageBox.information(
self,
"Success",
push_success(
"Thickness Calculator",
"Thickness calculation completed successfully and added to project.",
)
self.task_succeeded.emit()
return

if hasattr(result, 'geometry'):
addGeoDataFrameToproject(result, "Thickness Results")
QMessageBox.information(
self,
"Success",
push_success(
"Thickness Calculator",
"Thickness calculation completed successfully and added to project.",
)
self.task_succeeded.emit()
return

QMessageBox.information(self, "Success", f"Thickness calculation completed: {result}")
push_success("Thickness Calculator", f"Thickness calculation completed: {result}")
self.task_succeeded.emit()

def _on_calculator_error(self, traceback_text):
Expand Down
33 changes: 33 additions & 0 deletions loopstructural/gui/messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Show the result of an action without a modal dialog."""

from qgis.core import Qgis, QgsMessageLog
from qgis.utils import iface


def push_success(title: str, text: str, duration: int = 5):
"""Show a success message in the message bar of QGIS.

Use a `QMessageBox` only for an error that stops an action, and for the
confirmation before a destructive action.
"""
if iface is not None:
iface.messageBar().pushMessage(title, text, level=Qgis.MessageLevel.Success, duration=duration)
else:
# No main window, for example in the tests
QgsMessageLog.logMessage(f"{title}: {text}", "LoopStructural", Qgis.MessageLevel.Success)


def push_info(title: str, text: str, duration: int = 5):
"""Show an information message in the message bar of QGIS."""
if iface is not None:
iface.messageBar().pushMessage(title, text, level=Qgis.MessageLevel.Info, duration=duration)
else:
QgsMessageLog.logMessage(f"{title}: {text}", "LoopStructural", Qgis.MessageLevel.Info)


def push_warning(title: str, text: str, duration: int = 10):
"""Show a warning in the message bar of QGIS, for a result that is not an error."""
if iface is not None:
iface.messageBar().pushMessage(title, text, level=Qgis.MessageLevel.Warning, duration=duration)
else:
QgsMessageLog.logMessage(f"{title}: {text}", "LoopStructural", Qgis.MessageLevel.Warning)
2 changes: 2 additions & 0 deletions loopstructural/gui/modelling/fault_adjacency_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def init_ui(self):
)
self.fault_fault_instructions_label = QLabel(self.fault_fault_instructions)
self.fault_fault_instructions_label.setWordWrap(True)
self.fault_table_layout.addWidget(self.fault_fault_instructions_label)
self.update_fault_adjacency_table()
self.layout().addWidget(self.fault_table_group)

Expand All @@ -51,6 +52,7 @@ def init_ui(self):
)
self.strat_fault_instructions_label = QLabel(self.strat_fault_instructions)
self.strat_fault_instructions_label.setWordWrap(True)
self.stratigraphic_table_layout.addWidget(self.strat_fault_instructions_label)
self.update_stratigraphic_units_table()

self.layout().addWidget(self.stratigraphic_table_group)
Expand Down
Loading
Loading