In some cases I would like to inform the user about the given input without interrupting the process. Since SDK 14 it is possible to make use of non-interuptive messages: UserMessage. This message is however only shown in the progress window. Since the process (SetParamsResult in this case) is quite quick, the user may not see the message at al, let alone read the whole thing.
Is it possible to show the UserMessage as a ‘pop-up’ after the progress is finished to make sure the user sees it?
In the top right corner there is a bell icon. This is the ‘job log’. Here you can find the last jobs that are ran, their status and warnings that are raised during the job.
Hope this helps.
Thanks for your response! Possibly an unaware user may oversee the warning message as it is only shown in the progress window, and in the job log indeed. The user however probably won’t check the job log every time so I would welcome the possibility to show a pop-up after the job has run, or an “warning counter” as is implemented with the “problem” log as below
Thanks for the elaboration. As your post seems to discuss a limitation of the current functionality of the
UserMessage I’ve changed the type of the post to a Feature Request. I will also add this request to our internal issue tracker and update you here if any developments follow from it.
In the meantime you could employ a workaround by just stalling the calculation for a bit. That would allow the user to read the full
UserMessage you’ve written.
Something like the
sleep method might work:
from time import sleep
from viktor import UserMessage
if not is_params_recommended(params):
UserMessage.warning("The current set of params is not recommended")
sleep(5) # stall for 5 seconds in order to let the user read the UserMessage
result = run_calculation(...)