huggingface / knockknock

🚪✊Knock Knock: Get notified when your training ends with only two additional lines of code
MIT License
2.78k stars 233 forks source link

Windows desktop notification not displaying entire message content #59

Open Dayan-Zhanchi opened 4 years ago

Dayan-Zhanchi commented 4 years ago

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

https://github.com/huggingface/knockknock/blob/1160ab756d8caa81a3b326c07364e342cf9439b8/knockknock/desktop_sender.py#L63-L80

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.