Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How make reinitialization of System Tray Menu ?

If you have a question or need help, this is the place to be.
Post Reply
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

How make reinitialization of System Tray Menu ?

Post by Pako »

I seek solution of my Feature Request:
http://www.eventghost.org/forum/viewtopic.php?f=5&t=486 .
Seems, that everything work well.
Is here only one "small" problem. :cry:
I must open dialog System Tray Menu and push "OK".
I don't know make reinitialization like a Action.
It is at all possible ?

Pako
Attachments
tree.png
tree.png (9.54 KiB) Viewed 2796 times
Dialog.png
__init__.py
My editing.
(14.2 KiB) Downloaded 245 times
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: How make reinitialization of System Tray Menu ?

Post by Bitmonster »

Rename __start__ to something else. Lets say CreateMenu. Then:

Code: Select all

class SysTrayMenu(eg.PluginClass):
    def __start__(self, menuData=[]):
        self.menuData = menuData
        self.CreateMenu(menuData)

class ReinitMenu(eg.ActionClass):
    def __call__(self):
        self.plugin.__stop__()
        self.plugin.CreateMenu(self.plugin.menuData)
But I don't like the idea to create items on conditions very much. Menus shouldn't change the number of items if a condition changes. They should at best disable some of them.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How make reinitialization of System Tray Menu ?

Post by Pako »

Thanks !
Work it very well !
As it is simple, when it somebody be able to. :)
But I don't like the idea to create items on conditions very much. Menus shouldn't change the number of items if a condition changes. They should at best disable some of them.
I have also preferably disable item, than hidden.
But I don't know how it make. :(
I don't know, where find needed information.
Therefore I am it made this way.
If would it that way work, may would it to be in distribution ?

Pako
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How make reinitialization of System Tray Menu ?

Post by Pako »

I have new version of Sys Tray Menu - Dynamic Menu.
Now already work Enable/Disable Menu Items.
Pako
Attachments
__init__.py
Modified Plugin.
(14.29 KiB) Downloaded 245 times
Dynamic menu DEMO.xml
Example using dynamic menu feature.
(1.59 KiB) Downloaded 146 times
State2.jpg
State2.jpg (10.57 KiB) Viewed 2662 times
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: How make reinitialization of System Tray Menu ?

Post by Bitmonster »

I have uploaded a new version with "Enable" and "Disable" actions. They don't fit perfectly into the action design, because it is possible to delete menu items, while some Enable/Disable actions might refer to them, but it seems to work so far.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How make reinitialization of System Tray Menu ?

Post by Pako »

Hi !
Your solving is naturally better. A in addition (and it is essential), is a part of distributive version.

Thanks !

Pako
You know flattr ? You can Image
Post Reply