2020-09-14, 18:23
(2020-08-12, 19:03)pkscout Wrote:(2020-08-12, 12:49)meowmoo Wrote: Hi, a few updates ago the script added 2 options to my context menu and I can't find a way to disable them.I'll be curious about a more "official" answer, but having just done development work on an addon that has a context menu, it doesn't appear there is any simple way to enable/disable them. They are defined in addon.xml, and that is loaded before any of the script is. I was thinking about playing with it some more to try setting a skin or system value that could be used to decide whether to show the menu item, but I haven't had time to dig into it with my own addon yet.
I don't want my context menu to be full of stuff I don't use, so it would be very welcome if we could disable the context menu items if we don't use them.
Thanks.
In AutoWidget, I can control the context menu visibility at runtime by running a service that listens for settings changes, and then using those properties as visibility conditions in addon.xmlhttps://github.com/drinfernoo/plugin.pro...don.xml#L8.
Which setting IDs are listened for is controlled by https://github.com/drinfernoo/plugin.program.autowidget/blob/master/plugin.program.autowidget/resources/lib/refresh.py#L11, so you could expand this easily to cover settings for multiple context items.
EDIT: For clarity, those properties will also be initialized when the script initializes, so the context items will have the correct visibility on boot as well.