plugins:01_files
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
plugins:01_files [2018/07/06 17:17] – James Sentman | plugins:01_files [2018/08/11 16:14] – more API v2 updates James Sentman | ||
---|---|---|---|
Line 5: | Line 5: | ||
====Minimum Requirements==== | ====Minimum Requirements==== | ||
- | At the very least the plugin folder must contain the info.json file that describes the plugin and the units that it will create and the main script file that will be executed and passed the setup info from XTension. You can also include any other support files or python includes that are necessary for your plugin to run. | + | At the very least the plugin folder must contain the info.json file that describes the plugin and the units that it will create and the main script file or executable |
====Python Requirements==== | ====Python Requirements==== | ||
Line 12: | Line 12: | ||
If your plugin needs python modules that are not available by default on OSX best practice is to include them alongside the plugin files. You can usually do this by making a copy of the needed library into the plugin folder. I would recommend using pip to install the package onto your development mac. Then going to python’s site packages folder and getting the installed folder from there. You’ll find the site packets folder on OSX in: / | If your plugin needs python modules that are not available by default on OSX best practice is to include them alongside the plugin files. You can usually do this by making a copy of the needed library into the plugin folder. I would recommend using pip to install the package onto your development mac. Then going to python’s site packages folder and getting the installed folder from there. You’ll find the site packets folder on OSX in: / | ||
- | You should also verify that the licenses of any modules you are including allow you to do so. | + | Please |
- | + | Lastly for Python you should pre-compile your python scripts so that you can include both the .py and .pyc files. This makes sure that the plugin folder | |
- | ====Plugin Installation==== | + | |
- | As of version 9.4.5 the plugin manager is not completely implemented. There is no facility to check plugin versions or recommend updates or to install directly from the internet yet but those things are coming. Installing plugins from inside the app is implemented however. Once the plugin is downloaded but the user and unzipped they can select “Install Plugin” from the Database menu. This will drop down a select folder dialog for them to locate | + | |
- | + | ||
- | Plugins are stored in the XTension Database inside the “Plugins” folder. You can manually remove or add them there as well if you wish. Use the “reveal database in finder” menu item from the Database menu to show the Plugins folder inside the current database. The Database is a package | + | |
===XTension Finds New Plugins=== | ===XTension Finds New Plugins=== | ||
- | It is not necessary to quit and restart XTension to have it discover new plugins. The plugin search locations are rescanned whenever the New Interface dialog is opened so your new plugin should be available in the list as soon as it’s in one of those locations and the user opens the window to create a new interface. If the New Interface | + | Plugin installation is discussed on the [[http:// |
+ | |||
+ | It is not necessary to quit and restart XTension to have it discover new plugins. The plugin search locations are rescanned whenever the New Interface dialog is opened so your new plugin should be available in the list as soon as it’s in one of those locations and the user opens the window to create a new interface. If a New Interface | ||
During development it may be necessary to open the edit interface dialog to get changes to a plugins info.json file to be reloaded. | During development it may be necessary to open the edit interface dialog to get changes to a plugins info.json file to be reloaded. | ||
Line 28: | Line 26: | ||
====XTension Standard Python Includes==== | ====XTension Standard Python Includes==== | ||
+ | |||
XTension provides 2 python files that will be necessary for any plugin. If your plugin requires a specific version of the plugin includes you can simply copy them into the same folder with your application. Or to save space you can load them from inside the XTension app via the following code. If changes are ever made to the existing include files that could potentially break previous plugins I will increment the version and continue to include both versions inside XTension. You can link to the “current” version or to a specific version in your plugin code. | XTension provides 2 python files that will be necessary for any plugin. If your plugin requires a specific version of the plugin includes you can simply copy them into the same folder with your application. Or to save space you can load them from inside the XTension app via the following code. If changes are ever made to the existing include files that could potentially break previous plugins I will increment the version and continue to include both versions inside XTension. You can link to the “current” version or to a specific version in your plugin code. | ||
Line 87: | Line 86: | ||
====Custom Script Handlers==== | ====Custom Script Handlers==== | ||
- | Your plugin | + | Just like the user can send custom |
+ | |||
+ | Create a text file that contains the handler definition for AppleScript and enough comments to describe what it does and how to use it. Then include a structure similar to this in the unit definition portion of the info.json file. You can include any number of handler definitions for units or for the Interface script. | ||
+ | |||
+ | At this moment only AppleScript handlers | ||
+ | |||
+ | An example of what you might include | ||
+ | |||
+ | < | ||
+ | " | ||
+ | | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | </ | ||
+ | since the AppleScriptHandlers is an array you can include any number of handlers there. The key “file” should contain the name of the text file that contains the handler prototype. | ||
+ | |||
+ | To add the same for the Edit Interface Script dialog include that same structure but at the root level of the JSON file rather than inside a unit definition. | ||
====Icon Support==== | ====Icon Support==== | ||
Line 93: | Line 110: | ||
If your plugin includes a folder named “Icons” then those icons will be loaded along with your plugin and be made available as unit icons inside the application. You can include custom icon images for your units in this way. Use the defaultOnIcon and defaultOffIcon keys into the info,json file to assign any icons as the default. | If your plugin includes a folder named “Icons” then those icons will be loaded along with your plugin and be made available as unit icons inside the application. You can include custom icon images for your units in this way. Use the defaultOnIcon and defaultOffIcon keys into the info,json file to assign any icons as the default. | ||
- | Icon file format should be png with a mask though jpeg and gif files are also supported. | + | Icon file format should be png with a mask though jpeg and gif files are also supported. |
+ | |||
+ | Note, that this is unimplemented as of XTension 9.4.8.\\ | ||
+ | \\ | ||
Previous: | Previous: |