Skip to content

Windows desktop notification not displaying entire message content #59

@Dayan-Zhanchi

Description

@Dayan-Zhanchi

So looking at the code you'd expect the entire message to be displayed on the Windows notification when the model trains successfully:

if master_process:
end_time = datetime.datetime.now()
elapsed_time = end_time - start_time
contents = ["Your training is complete 🎉",
'Machine name: %s' % host_name,
'Main call: %s' % func_name,
'Starting date: %s' % start_time.strftime(DATE_FORMAT),
'End date: %s' % end_time.strftime(DATE_FORMAT),
'Training duration: %s' % str(elapsed_time)]
try:
str_value = str(value)
contents.append('Main call returned value: %s'% str_value)
except:
contents.append('Main call returned value: %s'% "ERROR - Couldn't str the returned value.")
text = '\n'.join(contents)
show_notification(text, title)

However since win10toast sets the height and width to the default size, if the text is too long it will be truncated and not fully displayed:

self.hwnd = CreateWindow(self.classAtom, "Taskbar", style,
                                 0, 0, CW_USEDEFAULT,
                                 CW_USEDEFAULT,
                                 0, 0, self.hinst, None)

Running a test code for it produced the following even when expanded the notification:

@desktop_sender(title="test")
def train():
    import time
    time.sleep(1)
    return {"loss":1}

image

So the end date, training duration and the dictionary returned from the train() function were not displayed.

It would be great if there was a more responsive design to the size of the notification, but I believe that the CreateWindow used in win10toast only expects fixed sizes, so I'm not sure how to resolve this issue. I even tried to change the width and height to no avail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions