pluginapi:infounits
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
pluginapi:infounits [2023/06/09 18:49] – James Sentman | pluginapi:infounits [2023/06/11 14:29] (current) – Added menu handlers section and hasQuery key James Sentman | ||
---|---|---|---|
Line 64: | Line 64: | ||
=====Unit Behavior Keys:===== | =====Unit Behavior Keys:===== | ||
These keys are not required and are not permanent for the Unit. They can be edited at any time by the user or set programattically from your plugin. These settings offer a default setup for the Unit when created by the User. If you create them automatically from inside your plugin you still need to include the appropriate keys for the behavior you wish. | These keys are not required and are not permanent for the Unit. They can be edited at any time by the user or set programattically from your plugin. These settings offer a default setup for the Unit when created by the User. If you create them automatically from inside your plugin you still need to include the appropriate keys for the behavior you wish. | ||
+ | |||
+ | > | ||
+ | “hasQuery”: | ||
+ | |||
> | > | ||
Line 152: | Line 156: | ||
----- | ----- | ||
=====Menu Handlers: | =====Menu Handlers: | ||
- | You can also add callbacks to the plugin by adding items to the contextual menu for the Unit. This is the same technique that you can use to add menu items to the contextual menu of the Interface itself. In this case the “menuHandlers” key is inside the deviceType dictionary rather than in the root of the info.json where they would be assigned to the Interface as a whole. | + | You can also add callbacks to the plugin by adding items to the contextual menu for the Unit. This is the same technique that you can use to add menu items to the contextual menu of the Interface itself. In this case the “menuHandlers” key is inside the deviceType dictionary rather than in the root of the info.json where they would be assigned to the Interface as a whole. |
+ | |||
+ | The data in this key is a json list of lists. Each of the inner lists has 2 items, first the name of the action as you wish it to appear in the menu, the human readable version, and the second is the name of the script handler callback that will be run when the user selects this. | ||
+ | |||
+ | Use the Unit parent class “addScriptHandler” command to register a callback to be run when that action name is run by the user. | ||
+ | “menuHandlers”: | ||
+ | |||
+ | |||
- | The data at this key is a json list of lists. | ||
pluginapi/infounits.1686336556.txt.gz · Last modified: 2023/06/09 18:49 by James Sentman