"""
:filename: CameraSetup.py
:author: thor@tordivel.no
:requirements: Scorpion 9.0.0.494 or higher
CameraSetup - panel with a button for camera configuration
::
1.0.0.2, 11nov2015, RL: modified for autodoc
1.0.0.1, 17sep2011, RL: requirements : Scorpion 9.0.0.493 or higher
"""
__version__ = '1.0.0.2'
from Scorpion import PluginNotify,GetControlByHandle,ExecuteCmd,GetTool,SelectTagname,InputInt
[docs]class CameraSetup(object):
'''
CameraSetup - panel with a button for camera configuration
'''
def __init__(self,cntr,name):
self.name=name
cntr.deleteControls() #delete previous added controls if any
self.button=cntr.addControl('Button',0,0)
self.button.left=10
self.button.top=10
self.button.align = 5
self.button.anchors = 2
self.camNo=1
self.button.caption='Camera Setup'
self.button.font.bold=1
self.button.onClick=self.buttonClick
[docs] def __str__(self):
'''
return a unique persistance name for host application storage
'''
return '%s_%s'%(self.__class__.__name__,self.name)
[docs] def getConfig(self):
'''
return plugin configuration as string
'''
import SPB
spb=SPB.CreateSpb()
spb.setInt('camNo',self.camNo)
return spb.xml
[docs] def setConfig(self,value):
'''
set plugin configuration from string
'''
import SPB
spb=SPB.CreateSpb(value)
try:
if spb.isEntry('camNo'):self.camNo=spb.getInt('CamNo')
except:
print self,': invalid configuration'
[docs]def CreatePlugin(hWnd, name=''):
'''
Scorpion Plugin Stub - Required
'''
cntr=GetControlByHandle(hWnd)
return CameraSetup(cntr,name)