Tellurium Plugins
Python ctypes wrapper documentation
Main Page
Related Pages
Modules
Examples
All
Functions
Variables
Groups
Pages
telPluginDocumentation.py
This example shows
How to extract a plugins embedded PDF documentation
1
from
teplugins
import
*
2
3
try
:
4
5
#Create a plugin manager
6
pm =
createPluginManager
()
7
8
pluginName =
"tel_add_noise"
#"tel_levenberg_marquardt"
9
plugin =
loadPlugin
(pm, pluginName)
10
if
not
plugin:
11
print
getLastError
()
12
exit()
13
14
#Get some general info about the plugin
15
print
getPluginInfo
(plugin)
16
17
#Get parameters associated with a capability
18
print
getListOfPluginPropertyNames
(plugin)
19
20
#Get the manual for the plugin (bundled as embedded PDF)
21
ptr =
getPluginManualAsPDF
(plugin)
22
nrOfBytes =
getPluginManualNrOfBytes
(plugin)
23
manual = cast(ptr, POINTER(c_char * nrOfBytes))[0]
24
25
#Check if there is a PDF available
26
if
nrOfBytes == 0:
27
print
'This plugin does not have a manual.'
28
exit()
29
30
#create a (temporary) pdf file from the data
31
outFName = pluginName +
'.pdf'
32
33
with open(outFName,
'wb'
)
as
output:
34
output.write(manual)
35
36
os.system(
'start '
+ outFName)
#a total guess
37
except
Exception
as
e:
38
print
'Problem: '
+ `e`
39
Generated on Mon Mar 31 2014 14:36:34 for Tellurium Plugins by
1.8.4