Skip to content

Commit

Permalink
include duration when showing report error
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli committed Dec 11, 2024
1 parent df633fb commit 175928e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/qgis_gea_plugin/gui/qgis_gea.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,17 +1095,29 @@ def cancel_drawing(self):
)
log(f"Encountered an error when clearing the project drawn area.")

def show_message(self, message, level=Qgis.Warning):
def show_message(self, message, level=Qgis.Warning, duration=None):
"""Shows message on the main widget message bar.
:param message: Text message
:type message: str
:param level: Message level type
:type level: Qgis.MessageLevel
:param duration: How to display the message
:type duration: int
"""
self.message_bar.clearWidgets()
self.message_bar.pushMessage(message, level=level)

if duration:
self.message_bar.pushMessage(
message,
level=level,
duration=duration
)
else:
self.message_bar.pushMessage(message, level=level)


def prepare_message_bar(self):
"""Initializes the widget message bar settings"""
Expand Down Expand Up @@ -1365,7 +1377,8 @@ def on_generate_report(self):
if site_layer.dataProvider().dataSourceUri().startswith('memory'):
self.show_message(
message,
Qgis.Warning
Qgis.Warning,
duration=10
)
return

Expand Down

0 comments on commit 175928e

Please sign in to comment.