PrevUpNext devguide-20.htmlPlugins
devguide-20.htmlPlugins
devguide-22.htmlImport Filters
Plugin Configuration
On startup, Skencil searches for plugins on the plugin path. Every
Python source file found is scanned for configuration information.
Later, when the the plugin is needed it is imported.
The plugin path is a list of directories stored in
Sketch.config.plugin_path. The directory names should be absolute
pathnames. Skencil uses a notation borrowed from the kpathsea library
(which is used by many TeX programs to search files):
If a directory name ends in a slash ('/') search in that
directory and in the directories immediately contained in it.
If a directory name ends with two slashes ('//') search in
that directory and recursively in all subdirectories.
Else, search only in that directory
The configuration information is a series of Python statements
(assignments), each on its own line, between the lines '
###Sketch
Config
' and `###End'.
One of the assignments must be to a variable named `type'. This
specifies the type of the plugin (import filter, plugin object, etc.).
Another variable that may be used in the future, is `version' which
will be used to specify the version of the plugin-config conventions
used (not the version of the plugin itself).
Other variable names are type dependent.
Each of the lines may be commented out.
Example:
###Sketch Config
#type = Import
#class_name = 'SKLoader'
#rx_magic = '^##Sketch 1 *(?P<minor>[0-9]+)'
#tk_file_type = ('Skencil/Sketch Document', '.sk')
format_name = 'SK-1'
###End
Skencil uses this method--instead of importing every plugin module
and requiring that they register themselves with the plugin
manager--to avoid loading unnecessary modules.
Implementation Note: currently Skencil reads the lines between
`###Sketch Config' and `###End' into a single string (after removing the
initial `#'s if present) and exec's it with a globals dictionary
containing the predefined plugin types and an empty locals dictionary
which receives all the variables. A consequence of this approach is that
it is currently possible to use arbitrary Python statements and not just
assignments. Don't rely on this, it could be changed in the future.
devguide-20.htmlPlugins
devguide-20.htmlPlugins
devguide-22.htmlImport Filters
PrevUpNext