qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.34k stars 2.98k forks source link

QgsMessageLog.logMessage: argument notifyUser doesn't change anything #58367

Open pers-ephone opened 1 month ago

pers-ephone commented 1 month ago

What is the bug or the crash?

A call to QgsMessageLog.logMessage with notifyUser=True seem to be the same as with notifyUser=False whatever the level.

The doc states "If notifyUser is True, then the message should be brought to the user’s attention by various UI hints.", one would expect a call to the message bar, a forced opening of the message log window, or other direct and systematic communication to the user. For now as a plugin dev i have to consider this argument as always false and manage all communication to the user.

The argument seem to only allow this messageReceived signal to be sent and not in the case of an INFO message. So info messages fully ignore the argument, and otherwise i don't know what uses the signal but i see no difference in use.

Steps to reproduce the issue

in python console: QgsMessageLog.logMessage("test", "tab", Qgis.Warning, False) QgsMessageLog.logMessage("test", "tab", Qgis.Warning, True)

QgsMessageLog.logMessage("test", "tab", Qgis.Info, False) QgsMessageLog.logMessage("test", "tab", Qgis.Info, True)

QgsMessageLog.logMessage("test", "tab", Qgis.Critical, False) QgsMessageLog.logMessage("test", "tab", Qgis.Critical, True)

Versions

QGIS 3.28.12-Firenze

Supported QGIS version

New profile

Additional context

No response

agiudiceandrea commented 1 month ago

@pers-ephone, QGIS 3.28 is no longer supported. Anyway, it seem to me there is a UI hint using QGIS 3.34:

notifyUser=False image

notifyUser=True image

pers-ephone commented 1 month ago

@agiudiceandrea Ok i was wrong this is just very very subtle if not looking for it. One question still stands, why do log messages with level=Qgis.Info never notify the user, ignoring the notifyUser argument?

agiudiceandrea commented 1 month ago

One question still stands, why do log messages with level=Qgis.Info never notify the user, ignoring the notifyUser argument?

It looks like by design: https://github.com/qgis/QGIS/blob/69f3a387f7ca18371029aa970fdb54d9692ac88a/src/core/qgsmessagelog.cpp#L49-L52

See https://github.com/qgis/QGIS/pull/2310 and https://github.com/qgis/QGIS/pull/7259.

github-actions[bot] commented 2 weeks ago

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue. In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue. If there is no further activity on this issue, it will be closed in a week.