Python Forum
[PyQt] How is this tray icon throbber done? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [PyQt] How is this tray icon throbber done? (/thread-8740.html)



How is this tray icon throbber done? - JackDinn - Mar-05-2018

I writing a tray widget/notifier for Manjaro KDE and i would like to use this tray icon throbber effect. Anyone know how? (using PyQt5)

[attachment=378]


RE: How is this tray icon throbber done? - Larz60+ - Mar-05-2018

The way I would do it is to have two icons identical size, with the two views of the throbbed icon.
Use a timer event (not sleep) to toggle the icon change on each iteration.


RE: How is this tray icon throbber done? - JackDinn - Mar-05-2018

Yea that was what i thought, or maybe (if its even possible) use a .gif but there seems to be some method to do it because you can set any icon you like in the settings of the example i have shown and it still applies the throbbing effect to it even though its a single icon, so there is something somewhere other than messing with multiple icons and looping them on a timer type thing.


RE: How is this tray icon throbber done? - Larz60+ - Mar-05-2018

a .gif .ico or .png will do, just don't make it too large or it will have strange flicker effect.


RE: How is this tray icon throbber done? - JackDinn - Mar-05-2018

I'll have to try and dig through the octopi-notifier-frameworks code and see how he's done it because he is not using multiple icons, as i say there must be a proper method to do it because you can change the icon and it still applies the throb.

Hate digging through someone else's code, especially when its Cpp ^^


RE: How is this tray icon throbber done? - JackDinn - Mar-05-2018

well i suspect its got something to do with these snipets of code iv found but i have not a clue what to make of them when talking about pyqt5

from octopi-notifier code Wrote:#ifdef KSTATUS
m_systemTrayIcon->setAttentionIconByPixmap(m_icon);
m_systemTrayIcon->setStatus(KStatusNotifierItem::NeedsAttention);
#endif

https://api.kde.org/frameworks/knotifications/html/classKStatusNotifierItem.html#a5a724a726f39f52275ee62e1fe2ff539

Quote:enum KStatusNotifierItem::ItemStatus

All the possible status this icon can have, depending on the importance of the events that happens in the parent application.
Enumerator

Passive
Nothing is happening in the application, so showing this icon is not required.

Active
The application is doing something, or it is important that the icon is always reachable from the user.

NeedsAttention
The application requests the attention of the user, for instance battery running out or a new IM message was received.


So to me it looks like in Cpp there is a KStatusNotifierItem::NeedsAttention Enumerator that i believe might be doing the work of throbbing the icon but after that im lost how to impliment that info into python


RE: How is this tray icon throbber done? - Larz60+ - Mar-05-2018

found this: https://pypi.python.org/pypi/eea.icons/2.5


RE: How is this tray icon throbber done? - JackDinn - Mar-05-2018

great stuff, that I can understand and will take a good bash at using, Thank you :)