Tellurium Plugins
Python ctypes wrapper documentation
 All Functions Variables Groups Pages
Functions | Variables
Plugin Functions

Functions operating on Plugin Handles. More...

Functions

def getPluginName
 Get the name of a Plugin. More...
 
def getPluginCategory
 Get the Category of a Plugin. More...
 
def getPluginAuthor
 Get the author of a Plugin. More...
 
def getPluginCopyright
 Get the plugin copyright. More...
 
def getPluginVersion
 Get the plugin version. More...
 
def getPluginDescription
 Get the Description of a Plugin. More...
 
def getPluginHint
 Get a plugins Hint. More...
 
def getPluginInfo
 Returns information about a Plugin. More...
 
def getPluginManualAsPDF
 Get Plugin manual as PDF. More...
 
def getPluginManualNrOfBytes
 Get the byte size for the PDF manual. More...
 
def displayPluginManual
 If a plugin has a built-in PDF manual, display it. More...
 
def assignRoadRunnerInstance
 Assign a roadrunner instance handle for the plugin to use. More...
 
def executePlugin
 The executePlugin function is called to start the plugin so that it can carry out its function. More...
 
def executePluginEx
 The executePluginEx is similar to the executePlugin function, except it takes one extra argument. More...
 
def getPluginStatus
 Get status information from a plugin. More...
 
def getPluginResult
 Returns a plugins result, as a string. More...
 
def resetPlugin
 Reset a Plugin. More...
 
def isPluginWorking
 Check if a plugin is actively working. More...
 
def terminateWork
 Terminate any work that is in progress in a plugin. More...
 
def isBeingTerminated
 Check if the work of a plugin is currently being terminated. More...
 
def wasTerminated
 Query a plugin if work was terminated succesfully. More...
 
def assignOnStartedEvent
 Assigns a plugins OnStartedEvent function.Plugin dependent. More...
 
def assignOnProgressEvent
 Assigns a plugins OnProgressEvent function. More...
 
def assignOnFinishedEvent
 Assigns a plugins OnFinishedEvent function. More...
 

Variables

tuple NotifyEvent = CFUNCTYPE(None)
 Plugin function event type definition This is a helper object that a client can use as an argument to a tellurium plugin. More...
 

Detailed Description

Functions operating on Plugin Handles.

Function Documentation

def python.telplugins_c_api.assignOnFinishedEvent (   pluginHandle,
  pluginEvent,
  userData1 = None,
  userData2 = None 
)

Assigns a plugins OnFinishedEvent function.

Plugin dependent. Intended usage is to report back on plugin finalization.

Parameters
pluginHandleHandle to a plugin
pluginEventFunction pointer to event routine
userData1void* pointer to user data.
userData2void* pointer to user data.
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.assignOnProgressEvent (   pluginHandle,
  pluginEvent,
  userData1 = None,
  userData2 = None 
)

Assigns a plugins OnProgressEvent function.

Plugin dependent. Intended usage is to report back progress

Parameters
pluginHandleHandle to a pluginevent routine
userData1void* pointer to user data.
userData2void* pointer to user data.
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.assignOnStartedEvent (   pluginHandle,
  pluginEvent,
  userData1 = None,
  userData2 = None 
)

Assigns a plugins OnStartedEvent function.Plugin dependent.

Intended usage is to report back on plugin initialization.

Parameters
pluginHandleHandle to a plugin
pluginEventFunction pointer to OnEvent routine
userData1void* pointer to user data.
userData2void* pointer to user data.
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.assignRoadRunnerInstance (   pluginHandle,
  rrHandle 
)

Assign a roadrunner instance handle for the plugin to use.

A plugin may use an externally created roadrunner instance for its internal work.

Parameters
pluginHandleHandle to a plugin
rrHandleHandle to a roadrunner instance
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.displayPluginManual (   pluginHandle)

If a plugin has a built-in PDF manual, display it.

Parameters
pluginHandleHandle to a plugin
Returns
Returns False if the plugin has no manual
1 success = displayPluginManual(pluginHandle)

def python.telplugins_c_api.executePlugin (   pluginHandle)

The executePlugin function is called to start the plugin so that it can carry out its function.

The call is plugin dependent meaning that it could result in a calculation, starting up a GUI etc.

Parameters
pluginHandleHandle to a plugin
Returns
Returns true or false indicating success/failure
Note
The execute function is a regular blocking function, meaning it won't return to the caller until the task is complete. If the plugin is asked to carry out a lengthy calculation, consider using the executePluginEx function that has the option to execute the plugin code in the background (in a thread);
def python.telplugins_c_api.executePluginEx (   pluginHandle,
  inAThread = False 
)

The executePluginEx is similar to the executePlugin function, except it takes one extra argument.

Parameters
pluginHandleHandle to a plugin
inAThreadbool indicating if the plugin should be executed in the background (in a thread)
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.getPluginAuthor (   pluginHandle)

Get the author of a Plugin.

This is assigned by the pluging developer

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
def python.telplugins_c_api.getPluginCategory (   pluginHandle)

Get the Category of a Plugin.

This is assigned by the pluging developer

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
1 name = telPlugins.getPluginCategory(pluginHandle)

def python.telplugins_c_api.getPluginCopyright (   pluginHandle)

Get the plugin copyright.

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
def python.telplugins_c_api.getPluginDescription (   pluginHandle)

Get the Description of a Plugin.

This is assigned by the pluging developer

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
1 name = telPlugins.getPluginDescription(pluginHandle)

def python.telplugins_c_api.getPluginHint (   pluginHandle)

Get a plugins Hint.

A plugins hint is a short description on what the plugin is doing.This is assigned by the pluging developer

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
1 name = telPlugins.getPluginHint(pluginHandle)

def python.telplugins_c_api.getPluginInfo (   pluginHandle)

Returns information about a Plugin.

Parameters
pluginHandleHandle to a plugin
Returns
Returns information as a string for the plugin, None otherwise
def python.telplugins_c_api.getPluginManualAsPDF (   pluginHandle)

Get Plugin manual as PDF.

A plugin may embedd a help manual as a PDF. Use the function getPluginManualNrOfBytes to get the exact length of this string.

Parameters
pluginHandleHandle to a plugin
Returns
Returns the plugin's manual pdf file as a unsigned char*. If not available, returns None.
1 ptr = getPluginManualAsPDF(pluginHandle)
2 numOfBytes = getPluginManualNrOfBytes(pluginHandle)
3 manual = cast(ptr, POINTER(c_char * numOfBytes))[0]
4 if numOfBytes == 0:
5  print 'This plugin does not have a manual.'
6  exit()
7 outFName = getPluginName (pluginHandle) + '.pdf'
8 with open(outFName, 'wb') as output:
9  output.write(manual)
10 os.system('start ' + outFName)

def python.telplugins_c_api.getPluginManualNrOfBytes (   pluginHandle)

Get the byte size for the PDF manual.

Parameters
pluginHandleHandle to a plugin
Returns
Returns the number of bytes in the plugin's manual pdf file as an unsigned int.
def python.telplugins_c_api.getPluginName (   pluginHandle)

Get the name of a Plugin.

Parameters
pluginHandleHandle to a plugin
Returns
Returns the internal name of a plugin. None otherwise
1 name = telPlugins.getPluginName(pluginHandle)

def python.telplugins_c_api.getPluginResult (   pluginHandle)

Returns a plugins result, as a string.

This is plugin dependent, and a plugin designer may, or may not, implement this function. See the plugin documentation for details.

Note
If a plugin wants to returns specific result, e.g. an Array, or a a float, these are better communicated through the use of Plugin properties.
Parameters
pluginHandleHandle to a plugin
Returns
Returns a plugins result if available. None otherwise
def python.telplugins_c_api.getPluginStatus (   pluginHandle)

Get status information from a plugin.

This call is plugin dependent, see the plugin documentation for details

Parameters
pluginHandleHandle to a plugin
Returns
Returns plugin status if available, as a string. None otherwise
def python.telplugins_c_api.getPluginVersion (   pluginHandle)

Get the plugin version.

Parameters
pluginHandleHandle to a plugin
Returns
Returns a string if successful, None otherwise
def python.telplugins_c_api.isBeingTerminated (   pluginHandle)

Check if the work of a plugin is currently being terminated.

This function is useful when a plugin is executed in a thread.

Parameters
pluginHandleHandle to the plugin
Returns
Returns true or false indicating if the work within the plugin is in the process of being terminated
def python.telplugins_c_api.isPluginWorking (   pluginHandle)

Check if a plugin is actively working.

This function is used when the work in the plugin is executed in a thread (see executeEx). The isPluginWorking will return true as long work is being active and false when the work is done. This is useful in UI environments. Also, see the various event types on how to get status back from a plugin during its execution.

Parameters
pluginHandleHandle to a plugin
Returns
Returns true or false indicating if the plugin is busy or not
def python.telplugins_c_api.resetPlugin (   pluginHandle)

Reset a Plugin.

Plugin dependent. A reset function should bring the internal state of a plugin to a known state

Parameters
pluginHandleHandle to a plugin
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.terminateWork (   pluginHandle)

Terminate any work that is in progress in a plugin.

If the plugins worker is executed in a thread, this function will signal the internals of the plugin to terminate. This function is used when a plugins work is executed in a thread.

Parameters
pluginHandleHandle to a plugin
Returns
Returns true or false indicating success/failure
def python.telplugins_c_api.wasTerminated (   pluginHandle)

Query a plugin if work was terminated succesfully.

This function may be used in combination with the terminateWork, and isBeingTerminated functions.

Parameters
pluginHandleHandle to the plugin
Returns
Returns true or false indicating if the work in the plugin was terminated or not

Variable Documentation

tuple NotifyEvent = CFUNCTYPE(None)

Plugin function event type definition This is a helper object that a client can use as an argument to a tellurium plugin.

The exact number of plugins functions required arguments, and their type, is plugin dependent. A client of the the plugin needs to get this information from the plugin specific documentation. An example of using NotifyEvent is shown below. The NotifyEvent takes no arguments.

1 def myPluginFunction():
2  print 'The plugin can call this function!'
3  #The user can assign this function as a plugin event to monitor the start of the plugin as follows.
4  #Note, make sure you assign the event to a variable (c_event) so that the Python garbage
5  #collector doesn't delete it
6  c_event = NotifyEvent(myPluginFunction)
7  assignOnStartedEvent(plugin, c_event)