How to show UserMessage outside of progress window

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?

Thanks!

image

Hoi Daniel,

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.

Maarten

Ha Maarten,

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

image

Thanks!

Hi Daniel,

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

def calculate(params):
    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(...)
    
    return result
    ...