Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows desktop notification not displaying entire message content #59

Open
Dayan-Zhanchi opened this issue Jul 10, 2020 · 0 comments
Open

Comments

@Dayan-Zhanchi
Copy link

Dayan-Zhanchi commented Jul 10, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant