示例#1
0
    def __init__(self, *args):
        AnalysisModule.__init__(self, *args)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.postGuiInit()
        self.man = getManager()
        #devs = self.man.listDevices()
        #for d in devs:
        #self.ui.scannerDevCombo.addItem(d)
        #self.ui.clampDevCombo.addItem(d)

        #self.fillModuleList()
        self.ui.scannerDevCombo.setTypes('scanner')
        self.ui.clampDevCombo.setTypes('clamp')
        self.ui.cameraModCombo.setTypes('cameraModule')

        self.tasks = {}
        self.currentTask = None
        self.ui.deleteBtn.clicked.connect(self.deleteSelected)
        self.stateGroup.sigChanged.connect(self.stateChanged)
        self.ui.taskList.currentItemChanged.connect(self.itemSelected)
        self.ui.taskList.itemClicked.connect(self.itemClicked)
        self.ui.recomputeBtn.clicked.connect(self.recompute)
示例#2
0
文件: interface.py 项目: hiuwo/acq4
 def __init__(self, *args):
     AnalysisModule.__init__(self, *args)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.postGuiInit()
     self.man = getManager()
     #devs = self.man.listDevices()
     #for d in devs:
         #self.ui.scannerDevCombo.addItem(d)
         #self.ui.clampDevCombo.addItem(d)
         
     #self.fillModuleList()
     self.ui.scannerDevCombo.setTypes('scanner')
     self.ui.clampDevCombo.setTypes('clamp')
     self.ui.cameraModCombo.setTypes('cameraModule')
     
     
     self.tasks = {}
     self.currentTask = None
     self.ui.deleteBtn.clicked.connect(self.deleteSelected)
     self.stateGroup.sigChanged.connect(self.stateChanged)
     self.ui.taskList.currentItemChanged.connect(self.itemSelected)
     self.ui.taskList.itemClicked.connect(self.itemClicked)
     self.ui.recomputeBtn.clicked.connect(self.recompute)
示例#3
0
文件: interface.py 项目: hiuwo/acq4
class UncagingModule(AnalysisModule):
    def __init__(self, *args):
        AnalysisModule.__init__(self, *args)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.postGuiInit()
        self.man = getManager()
        #devs = self.man.listDevices()
        #for d in devs:
            #self.ui.scannerDevCombo.addItem(d)
            #self.ui.clampDevCombo.addItem(d)
            
        #self.fillModuleList()
        self.ui.scannerDevCombo.setTypes('scanner')
        self.ui.clampDevCombo.setTypes('clamp')
        self.ui.cameraModCombo.setTypes('cameraModule')
        
        
        self.tasks = {}
        self.currentTask = None
        self.ui.deleteBtn.clicked.connect(self.deleteSelected)
        self.stateGroup.sigChanged.connect(self.stateChanged)
        self.ui.taskList.currentItemChanged.connect(self.itemSelected)
        self.ui.taskList.itemClicked.connect(self.itemClicked)
        self.ui.recomputeBtn.clicked.connect(self.recompute)
        #self.man.sigModulesChanged.connect(self.fillModuleList)
        
    def quit(self):
        AnalysisModule.quit(self)
        for k in self.tasks:
            self.tasks[k].close()
        self.tasks.clear()
        self.currentTask = None
        
        
    #def fillModuleList(self):
        #mods = self.man.listModules()
        #self.ui.cameraModCombo.clear()
        #for m in mods:
            #self.ui.cameraModCombo.addItem(m)
        
    def taskSequenceStarted(self, *args):
        #print "start:",args
        #self.newTask()
        pass
    
    def taskFinished(self):
        self.currentTask = None
        
    def newFrame(self, frame):
        if not self.ui.enabledCheck.isChecked():
            return
        if self.currentTask is None:
            self.newTask()
        self.currentTask.addFrame(frame)

    def newTask(self):
        n = self.pr.currentTask.name()
        if n is None:
            n = 'protocol'
       
        i = 0
        while True:
            name = n + ("_%03d" % i)
            if name not in self.tasks:
                break
            i += 1
        p = Task(name, self)
        self.currentTask = p
        self.tasks[name] = p
        item = QtGui.QListWidgetItem(name)
        item.setCheckState(QtCore.Qt.Checked)
        self.ui.taskList.addItem(item)
        self.ui.taskList.setCurrentItem(item)

    def deleteSelected(self):
        row = self.ui.taskList.currentRow()
        if row == -1:
            return
        item = self.ui.taskList.takeItem(row)
        name = str(item.text())
        self.tasks[name].close()
        del self.tasks[name]
        if self.currentTask is not None and self.currentTask.name == name:
            self.currentTask = None
    
    def selectedTask(self):
        row = self.ui.taskList.currentRow()
        if row == -1:
            return None
        item = self.ui.taskList.item(row)
        name = str(item.text())
        return self.tasks[name]
        
    
    def stateChanged(self, *args):
        sp = self.selectedTask()
        if sp is not None:
            sp.updateParams(*args)
            
    def itemSelected(self, *args):
        sp = self.selectedTask()
        if sp is not None:
            self.stateGroup.setState(sp.getState())
            
    def itemClicked(self, item):
        task = self.tasks[str(item.text())]
        if item.checkState() == QtCore.Qt.Checked:
            task.show()
        else:
            task.hide()

    def recompute(self):
        sp = self.selectedTask()
        if sp is not None:
            sp.recalculate(allFrames=True)

    def quit(self):
        #QtCore.QObject.disconnect(getManager(), QtCore.SIGNAL('modulesChanged'), self.fillModuleList)
        #getManager().sigModulesChanged.disconnect(self.fillModuleList)
        AnalysisModule.quit(self)
        for p in self.tasks.values():
            p.close()
            
    def cameraModule(self):
        return self.ui.cameraModCombo.getSelectedObj()
        #return str(self.ui.cameraModCombo.currentText())
        
    def cameraDevice(self):
        camMod = self.cameraModule()
        #mod = self.man.getModule(camMod)
        if 'camDev' in camMod.config:
            return camMod.config['camDev']
        else:
            return None

    def clampDevice(self):
        return str(self.ui.clampDevCombo.currentText())
        
    def scannerDevice(self):
        return str(self.ui.scannerDevCombo.currentText())
示例#4
0
class UncagingModule(AnalysisModule):
    def __init__(self, *args):
        AnalysisModule.__init__(self, *args)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.postGuiInit()
        self.man = getManager()
        #devs = self.man.listDevices()
        #for d in devs:
        #self.ui.scannerDevCombo.addItem(d)
        #self.ui.clampDevCombo.addItem(d)

        #self.fillModuleList()
        self.ui.scannerDevCombo.setTypes('scanner')
        self.ui.clampDevCombo.setTypes('clamp')
        self.ui.cameraModCombo.setTypes('cameraModule')

        self.tasks = {}
        self.currentTask = None
        self.ui.deleteBtn.clicked.connect(self.deleteSelected)
        self.stateGroup.sigChanged.connect(self.stateChanged)
        self.ui.taskList.currentItemChanged.connect(self.itemSelected)
        self.ui.taskList.itemClicked.connect(self.itemClicked)
        self.ui.recomputeBtn.clicked.connect(self.recompute)
        #self.man.sigModulesChanged.connect(self.fillModuleList)

    def quit(self):
        AnalysisModule.quit(self)
        for k in self.tasks:
            self.tasks[k].close()
        self.tasks.clear()
        self.currentTask = None

    #def fillModuleList(self):
    #mods = self.man.listModules()
    #self.ui.cameraModCombo.clear()
    #for m in mods:
    #self.ui.cameraModCombo.addItem(m)

    def taskSequenceStarted(self, *args):
        #print "start:",args
        #self.newTask()
        pass

    def taskFinished(self):
        self.currentTask = None

    def newFrame(self, frame):
        if not self.ui.enabledCheck.isChecked():
            return
        if self.currentTask is None:
            self.newTask()
        self.currentTask.addFrame(frame)

    def newTask(self):
        n = self.pr.currentTask.name()
        if n is None:
            n = 'protocol'

        i = 0
        while True:
            name = n + ("_%03d" % i)
            if name not in self.tasks:
                break
            i += 1
        p = Task(name, self)
        self.currentTask = p
        self.tasks[name] = p
        item = QtGui.QListWidgetItem(name)
        item.setCheckState(QtCore.Qt.Checked)
        self.ui.taskList.addItem(item)
        self.ui.taskList.setCurrentItem(item)

    def deleteSelected(self):
        row = self.ui.taskList.currentRow()
        if row == -1:
            return
        item = self.ui.taskList.takeItem(row)
        name = str(item.text())
        self.tasks[name].close()
        del self.tasks[name]
        if self.currentTask is not None and self.currentTask.name == name:
            self.currentTask = None

    def selectedTask(self):
        row = self.ui.taskList.currentRow()
        if row == -1:
            return None
        item = self.ui.taskList.item(row)
        name = str(item.text())
        return self.tasks[name]

    def stateChanged(self, *args):
        sp = self.selectedTask()
        if sp is not None:
            sp.updateParams(*args)

    def itemSelected(self, *args):
        sp = self.selectedTask()
        if sp is not None:
            self.stateGroup.setState(sp.getState())

    def itemClicked(self, item):
        task = self.tasks[str(item.text())]
        if item.checkState() == QtCore.Qt.Checked:
            task.show()
        else:
            task.hide()

    def recompute(self):
        sp = self.selectedTask()
        if sp is not None:
            sp.recalculate(allFrames=True)

    def quit(self):
        #QtCore.QObject.disconnect(getManager(), QtCore.SIGNAL('modulesChanged'), self.fillModuleList)
        #getManager().sigModulesChanged.disconnect(self.fillModuleList)
        AnalysisModule.quit(self)
        for p in self.tasks.values():
            p.close()

    def cameraModule(self):
        return self.ui.cameraModCombo.getSelectedObj()
        #return str(self.ui.cameraModCombo.currentText())

    def cameraDevice(self):
        camMod = self.cameraModule()
        #mod = self.man.getModule(camMod)
        if 'camDev' in camMod.config:
            return camMod.config['camDev']
        else:
            return None

    def clampDevice(self):
        return str(self.ui.clampDevCombo.currentText())

    def scannerDevice(self):
        return str(self.ui.scannerDevCombo.currentText())