SamplePlugin module

filename:SamplePlugin.py
author:roar@tordivel.no
requirements:Scorpion 9.0.0.494 or higher

Scorpion sample plugin for hosting controls inside a PluginManager hosted panel/page

1.0.0.2, 11nov2015, RL: modified for autodoc
1.0.0.1, 03jun2015, RL: created
class SamplePlugin.SamplePlugin(cntr, name)[source]

Bases: object

The SamplePlugin class

cntr - native Scorpion WinControl

name - Scorpion supplied instance unique name

__str__()[source]

Returns an instance unique name for the plugin.

The unique name is used for persistance key by the host application if the plugin has configuration. Python objects default’s to an instance name like “<__main__.A object at 0x053E02D0>” where the address part will change for each instance of the plugin.

This method is not required if the plugin don’t have any configuration but it’s still good practice implementing.

getConfig()[source]

Return the plugin configuration as a string, any format. The host application don’t care the content so any suitable string content may be used. It is still recommended to use a format that is prepared for plugin upgrades so the plugin will still work with configuration from a previous version of the plugin.

In this sample an spbxml object is used as this is suitable for querying the configuration content. A string representation of a dictionary is also suitable.

The configuration persistance is maintained by the host application.

setConfig(value)[source]

Set plugin configuration from the string ‘value’. The host application sets the configuration after the plugin is created.

value - string representation of new configuration

configure()[source]

Launches the configuration dialog for plugin configuration.

If changed, notify the host applicaton if the configuration is changed for configuration persistance.

SamplePlugin.CreatePlugin(hWnd, name='')[source]

Scorpion Plugin Stub - Required - called by Scorpion for plugin creation

hWnd - parent window handle

name - Scorpion supplied unique instance name