Skip to content
Dan edited this page Nov 3, 2015 · 4 revisions

Introduction

About Plugins

The plugins system for SIP has been kept as simple as possible with the intention of allowing both experienced programmers and beginners to add new features to SIP without needing to change the core code. You can experiment with new ideas without breaking the main program.

How plugins work

When the core sip.py program starts up, one of the last things it does is load any files in the plugins directory that have the group permission set to executable. The permission setting allows a plugin to be easily enabled or disabled.

Plugins are able to interact with the core program by sharing variables and functions. This is accomplished by importing one or more of the core program's modules (python files) into the plugin.

The core program also broadcasts a signal when a significant event occurs. The signals can trigger functions in plugins without the need for plugins to keep checking status (polling). There is an example plugin named signalling_examples that contains a simple function for each signal the core program broadcasts. When the program is run manually from the command line, the functions print messages to the console when signals are received. The example functions can be copied into your plugin as a starting point.

There is a simple one-line statement near the start of a plugin's code that causes the plugin to be added to the core program's PLUGINS menu (optional). It can be configured to link the plugin's menu entry to an action or to a user interface (UI) page for the plugin. Not all plugins need to be be added to the menu. For example the mobile_app and signalling_examples plugins do not have any user configurable settings and they are not shown on the menu.

Parts of a plugin

A plugin is basically a python program file that can interact with, or run in parallel with, the main sip.py program. It usually includes other files of various types which provide features such as:

  • A settings and data display page (web.py template)
  • User documentation (HTML page(s))
  • A configuration file for storing settings persistently (json file)
  • A "manifest" file which lists each file of the plugin along with a destination path for installation and brief description of the plugin.
Clone this wiki locally