Beispiel #1
4
    def __init__(self, display):
        GlobalTool.__init__(self, display)

        self.calibrations = []

        self._last_dir  = None
        self._cal_file_path = None
        self._curIndex = 0

        pa = self.setParameterMenu() 

        pNew = pa.addChild({
            'name': 'New',
            'type': 'action'})   
        pNew.sigActivated.connect(self._createNew) 
        
        pLoad = pa.addChild({
            'name': 'Load',
            'type': 'action'})   
        pLoad.sigActivated.connect(self._loadFromFile) 

        self.pCal = pa.addChild({
            'name': 'Calibration',
            'type': 'list',
            'value':'-'}) 
        self.pCal.sigValueChanged.connect(self._pCalChanged)

        self.pAutosave = self.pCal.addChild({
            'name': 'Autosave',
            'type': 'bool',
            'visible':True})   

        self.pModified = self.pCal.addChild({
            'name': 'Modified',
            'type': 'bool',
            'visible':False,
            'readonly':True})   

        self.pAutosave.sigValueChanged.connect(self._pAutoSaveChanged)

        pSave = self.pCal.addChild({
            'name': 'Save as',
            'type': 'action',
            'visible':False})   
        pSave.sigActivated.connect(lambda:self._saveToFile()) 

#         pUnload = self.pCal.addChild({
#             'name': 'Unload',
#             'type': 'action',
#             'visible':False
#             })   
#         pUnload.sigActivated.connect(self._unloadCalibration) 

        self.pLight  = self.pCal.addChild({
            'name': 'Light spectra',
            'type': 'list',
            'limits':[],
            'value':'',
            'visible':False}) 
        self.pLight.sigValueChanged.connect(self._updateInfo)

        for name in ('dark current', 'flat field', 'lens',
                     'noise', 'psf', 'balance'):

            pDates  = self.pCal.addChild({
                'name': name,
                'type': 'list',
                'limits':[],
                'value':'',
                'visible':False}) 
            
            aView = QtGui.QAction('View', self)
            aDel = QtGui.QAction('Remove', self)
            aView.triggered.connect(lambda checked, n=name:
                                    self._viewCurrentCoeff(n))
            aDel.triggered.connect(lambda checked, n=name: 
                                    self._removeCurrentCoeff(n))
            pDates.addChild({
                'name': 'Info',
                'type': 'str',
                'readonly':True,
                'value':'',
                'addToContextMenu':[aView,aDel]}) 
            pDates.sigValueChanged.connect(
                    lambda p,v, n=name: self._pDatesChanged(p,v,n))
Beispiel #2
2
    def restoreState(self, state):
        GlobalTool.restoreState(self, state)
        self._last_dir = state['cal dir']


#     def save(self, session, path):
#         l = {}
#         l['cal dir'] = self._last_dir
#         session.addContentToSave(l, *path+('general.txt',))
# 
# 
#     def restore(self, session, path):
#         l =  eval(session.getSavedContent(*path +('general.txt',) ))
#         self._last_dir = l['cal dir']
Beispiel #3
1
 def saveState(self, state={}):
     GlobalTool.saveState(self, state)
     state['cal dir'] = self._last_dir
 def saveState(self):
     state = GlobalTool.saveState(self)
     state['cal paths'] = [c.path for c in self.calibrations]
     return state
 def restoreState(self, state):
     self.calibrations = []
     for p in state['cal paths']:
         self._loadWithPath(PathStr(p))
     GlobalTool.restoreState(self, state)
     return
Beispiel #6
0
 def restoreState(self, state):
     GlobalTool.restoreState(self, state)
     self._last_dir = state['cal dir']