def __init__(self, dev, taskRunner, ivModes): DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False) self.ivModes = ivModes self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.splitter1 = QtGui.QSplitter() self.splitter1.setOrientation(QtCore.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.splitter2 = QtGui.QSplitter() self.splitter2.setOrientation(QtCore.Qt.Vertical) self.modeCombo = QtGui.QComboBox() self.splitter2.addWidget(self.modeCombo) self.modeCombo.addItems(self.dev.listModes()) self.splitter3 = QtGui.QSplitter() self.splitter3.setOrientation(QtCore.Qt.Vertical) (w1, p1) = self.createChannelWidget('primary') (w2, p2) = self.createChannelWidget('command') self.cmdWidget = w2 self.inputWidget = w1 self.cmdPlot = p2 self.inputPlot = p1 #self.ctrlWidget = QtGui.QWidget() #self.ctrl = Ui_protoCtrl() #self.ctrl.setupUi(self.ctrlWidget) #self.splitter2.addWidget(self.ctrlWidget) self.splitter1.addWidget(self.splitter2) self.splitter1.addWidget(self.splitter3) self.splitter2.addWidget(w1) self.splitter2.addWidget(w2) self.splitter3.addWidget(p1) self.splitter3.addWidget(p2) self.splitter1.setSizes([100, 500]) self.stateGroup = WidgetGroup([ (self.splitter1, 'splitter1'), (self.splitter2, 'splitter2'), (self.splitter3, 'splitter3'), ]) self.modeCombo.currentIndexChanged.connect(self.modeChanged) self.modeChanged()
def __init__(self, dev, task): DAQGenericTaskGui.__init__(self, dev, task, ownUi=False) self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.splitter1 = QtGui.QSplitter() self.splitter1.setOrientation(QtCore.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.splitter2 = QtGui.QSplitter() self.splitter2.setOrientation(QtCore.Qt.Vertical) self.modeCombo = QtGui.QComboBox() self.splitter2.addWidget(self.modeCombo) self.modeCombo.addItems(self.dev.listModes()) self.splitter3 = QtGui.QSplitter() self.splitter3.setOrientation(QtCore.Qt.Vertical) (w1, p1) = self.createChannelWidget('primary') (w2, p2) = self.createChannelWidget('command') self.cmdWidget = w2 self.inputWidget = w1 self.cmdPlot = p2 self.inputPlot = p1 #self.ctrlWidget = QtGui.QWidget() #self.ctrl = Ui_protoCtrl() #self.ctrl.setupUi(self.ctrlWidget) #self.splitter2.addWidget(self.ctrlWidget) self.splitter1.addWidget(self.splitter2) self.splitter1.addWidget(self.splitter3) self.splitter2.addWidget(w1) self.splitter2.addWidget(w2) self.splitter3.addWidget(p1) self.splitter3.addWidget(p2) self.stateGroup = WidgetGroup([ (self.splitter1, 'splitter1'), (self.splitter2, 'splitter2'), (self.splitter3, 'splitter3'), ]) self.modeCombo.currentIndexChanged.connect(self.modeChanged) self.modeChanged()
def restoreState(self, state): """Restore the state of the widget from a dictionary previously generated using saveState""" self.modeCombo.setCurrentIndex(self.modeCombo.findText(state['mode'])) #self.ctrl.holdingCheck.setChecked(state['holdingEnabled']) #if state['holdingEnabled']: # self.ctrl.holdingSpin.setValue(state['holding']) return DAQGenericTaskGui.restoreState(self, state['daqState'])
def restoreState(self, state): """Restore the state of the widget from a dictionary previously generated using saveState""" self.modeCombo.setCurrentIndex(self.modeCombo.findText(state["mode"])) # self.ctrl.holdingCheck.setChecked(state['holdingEnabled']) # if state['holdingEnabled']: # self.ctrl.holdingSpin.setValue(state['holding']) return DAQGenericTaskGui.restoreState(self, state["daqState"])
def __init__(self, dev, taskRunner): DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False) self.layout = Qt.QGridLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self.splitter1 = Qt.QSplitter() self.splitter1.setOrientation(Qt.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.splitter2 = Qt.QSplitter() self.splitter2.setOrientation(Qt.Qt.Vertical) self.modeCombo = Qt.QComboBox() self.splitter2.addWidget(self.modeCombo) self.modeCombo.addItems(self.dev.listModes()) self.splitter3 = Qt.QSplitter() self.splitter3.setOrientation(Qt.Qt.Vertical) (w1, p1) = self.createChannelWidget('primary') (w2, p2) = self.createChannelWidget('command') self.cmdWidget = w2 self.inputWidget = w1 self.cmdPlot = p2 self.inputPlot = p1 self.cmdWidget.setMeta('x', siPrefix=True, suffix='s', dec=True) self.cmdWidget.setMeta('y', siPrefix=True, dec=True) self.splitter1.addWidget(self.splitter2) self.splitter1.addWidget(self.splitter3) self.splitter2.addWidget(w1) self.splitter2.addWidget(w2) self.splitter3.addWidget(p1) self.splitter3.addWidget(p2) self.splitter1.setSizes([100, 500]) self.stateGroup = WidgetGroup([ (self.splitter1, 'splitter1'), (self.splitter2, 'splitter2'), (self.splitter3, 'splitter3'), ]) self.modeCombo.currentIndexChanged.connect(self.modeChanged) self.modeChanged()
def saveState(self): """Return a dictionary representing the current state of the widget.""" state = {} state['daqState'] = DAQGenericTaskGui.saveState(self) state['mode'] = self.getMode() #state['holdingEnabled'] = self.ctrl.holdingCheck.isChecked() #state['holding'] = self.ctrl.holdingSpin.value() return state
def __init__(self, dev, taskRunner): DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False) self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.splitter1 = QtGui.QSplitter() self.splitter1.setOrientation(QtCore.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.splitter2 = QtGui.QSplitter() self.splitter2.setOrientation(QtCore.Qt.Vertical) self.modeCombo = QtGui.QComboBox() self.splitter2.addWidget(self.modeCombo) self.modeCombo.addItems(self.dev.listModes()) self.splitter3 = QtGui.QSplitter() self.splitter3.setOrientation(QtCore.Qt.Vertical) (w1, p1) = self.createChannelWidget('primary') (w2, p2) = self.createChannelWidget('command') self.cmdWidget = w2 self.inputWidget = w1 self.cmdPlot = p2 self.inputPlot = p1 self.cmdWidget.setMeta('x', siPrefix=True, suffix='s', dec=True) self.cmdWidget.setMeta('y', siPrefix=True, dec=True) self.splitter1.addWidget(self.splitter2) self.splitter1.addWidget(self.splitter3) self.splitter2.addWidget(w1) self.splitter2.addWidget(w2) self.splitter3.addWidget(p1) self.splitter3.addWidget(p2) self.splitter1.setSizes([100, 500]) self.stateGroup = WidgetGroup([ (self.splitter1, 'splitter1'), (self.splitter2, 'splitter2'), (self.splitter3, 'splitter3'), ]) self.modeCombo.currentIndexChanged.connect(self.modeChanged) self.modeChanged()
def generateTask(self, params=None): daqTask = DAQGenericTaskGui.generateTask(self, params) task = { 'mode': self.getMode(), 'daqProtocol': daqTask } return task
def restoreState(self, state): """Restore the state of the widget from a dictionary previously generated using saveState""" #print 'state: ', state #print 'DaqGeneric : ', dir(DAQGenericTaskGui) if 'mode' in state: self.modeCombo.setCurrentIndex(self.modeCombo.findText(state['mode'])) #self.ctrl.holdingCheck.setChecked(state['holdingEnabled']) #if state['holdingEnabled']: # self.ctrl.holdingSpin.setValue(state['holding']) if 'daqState' in state: return DAQGenericTaskGui.restoreState(self, state['daqState']) else: return None
def restoreState(self, state): """Restore the state of the widget from a dictionary previously generated using saveState""" #print 'state: ', state #print 'DaqGeneric : ', dir(DAQGenericTaskGui) if 'mode' in state: self.modeCombo.setCurrentIndex( self.modeCombo.findText(state['mode'])) #self.ctrl.holdingCheck.setChecked(state['holdingEnabled']) #if state['holdingEnabled']: # self.ctrl.holdingSpin.setValue(state['holding']) if 'daqState' in state: return DAQGenericTaskGui.restoreState(self, state['daqState']) else: return None
def saveState(self): """Return a dictionary representing the current state of the widget.""" state = {} state['daqState'] = DAQGenericTaskGui.saveState(self) return state
def restoreState(self, state): """Restore the state of the widget from a dictionary previously generated using saveState""" return DAQGenericTaskGui.restoreState(self, state['daqState'])
def generateTask(self, params=None): daqTask = DAQGenericTaskGui.generateTask(self, params) task = {"mode": self.getMode(), "daqProtocol": daqTask} return task
def quit(self): self.dev.lastResult = None DAQGenericTaskGui.quit(self)
def __init__(self, dev, taskRunner): DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False) self.ui = taskTemplate.Ui_Form() self.cache = {} self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self.splitter1 = QtGui.QSplitter() self.splitter1.setOrientation(QtCore.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.ctrlLayout = QtGui.QVBoxLayout() wid1 = QtGui.QWidget() wid1.setLayout(self.ctrlLayout) self.plotSplitter = QtGui.QSplitter() self.plotSplitter.setOrientation(QtCore.Qt.Vertical) self.splitter1.addWidget(wid1) self.splitter1.addWidget(self.plotSplitter) #wid = QtGui.QWidget() #hLayout = QtGui.QHBoxLayout() #wid.setLayout(hLayout) #self.ctrlLayout.addLayout(hLayout) wid2 = QtGui.QWidget() self.ui.setupUi(wid2) self.ctrlLayout.addWidget(wid2) if not self.dev.hasPowerIndicator: self.ui.checkPowerBtn.setEnabled(False) self.ui.checkPowerCheck.hide() self.ui.checkPowerCheck.setChecked(False) if not self.dev.hasTunableWavelength: self.ui.wavelengthWidget.hide() self.powerWidget, self.powerPlot = self.createChannelWidget( 'power', daqName=self.dev.getDAQName()[0]) ## all we want is the function generator self.powerFnGenerator = self.powerWidget.ui.waveGeneratorWidget self.powerWidget.hide() self.ctrlLayout.addWidget(self.powerFnGenerator) self.powerFnGenerator.show() self.plotSplitter.addWidget(self.powerPlot) self.powerWidget.setMeta('y', units='W', siPrefix=True, dec=True, step=0.5, minStep=1e-3, limits=(0, None)) self.powerWidget.setMeta('xy', units='J', siPrefix=True, dec=True, step=0.5, minStep=1e-6, limits=(0, None)) self.powerWidget.setMeta('x', units='s', siPrefix=True, dec=True, step=0.5, minStep=1e-6, limits=(None, None)) if self.dev.hasTriggerableShutter: #(self.shutterWidget, self.shutterPlot) = self.createChannelWidget('shutter') self.shutterPlot = PlotWidget(name='%s.shutter' % self.dev.name) self.shutterPlot.setLabel('left', text='Shutter') self.plotSplitter.addWidget(self.shutterPlot) #self.shutterPlot.hide() if self.dev.hasQSwitch: #self.qSwitchWidget, self.qSwitchPlot = self.createChannelWidget('qSwitch') self.qSwitchPlot = PlotWidget(name='%s.qSwitch' % self.dev.name) self.qSwitchPlot.setLabel('left', text='Q-Switch') self.plotSplitter.addWidget(self.qSwitchPlot) #self.qSwitchPlot.hide() if self.dev.hasPCell: #self.pCellWidget, self.pCellPlot = self.createChannelWidget('pCell') self.pCellPlot = PlotWidget(name='%s.pCell' % self.dev.name) self.pCellPlot.setLabel('left', text='Pockel Cell', units='V') self.plotSplitter.addWidget(self.pCellPlot) #self.pCellPlot.hide() ## catch self.powerWidget.sigDataChanged and connect it to functions that calculate and plot raw shutter and qswitch traces self.powerWidget.sigDataChanged.connect(self.powerCmdChanged) self.ui.checkPowerBtn.clicked.connect(self.dev.outputPower) self.dev.sigOutputPowerChanged.connect(self.laserPowerChanged) self.dev.sigSamplePowerChanged.connect(self.samplePowerChanged) self.dev.outputPower()
def __init__(self, dev, task): DAQGenericTaskGui.__init__(self, dev, task, ownUi=False) self.ui = taskTemplate.Ui_Form() self.cache = {} self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0,0,0,0) self.setLayout(self.layout) self.splitter1 = QtGui.QSplitter() self.splitter1.setOrientation(QtCore.Qt.Horizontal) self.layout.addWidget(self.splitter1) self.ctrlLayout = QtGui.QVBoxLayout() wid1 = QtGui.QWidget() wid1.setLayout(self.ctrlLayout) self.plotSplitter = QtGui.QSplitter() self.plotSplitter.setOrientation(QtCore.Qt.Vertical) self.splitter1.addWidget(wid1) self.splitter1.addWidget(self.plotSplitter) #wid = QtGui.QWidget() #hLayout = QtGui.QHBoxLayout() #wid.setLayout(hLayout) #self.ctrlLayout.addLayout(hLayout) wid2 = QtGui.QWidget() self.ui.setupUi(wid2) self.ctrlLayout.addWidget(wid2) if not self.dev.hasPowerIndicator: self.ui.checkPowerBtn.setEnabled(False) self.ui.checkPowerCheck.hide() self.ui.checkPowerCheck.setChecked(False) if not self.dev.hasTunableWavelength: self.ui.wavelengthWidget.hide() self.powerWidget, self.powerPlot = self.createChannelWidget('power', daqName=self.dev.getDAQName()[0]) ## all we want is the function generator self.powerFnGenerator = self.powerWidget.ui.waveGeneratorWidget self.powerWidget.hide() self.ctrlLayout.addWidget(self.powerFnGenerator) self.powerFnGenerator.show() self.plotSplitter.addWidget(self.powerPlot) self.powerWidget.setMeta('y', units='W', siPrefix=True, dec=True, step=0.5, minStep=1e-3, limits=(0, None)) self.powerWidget.setMeta('xy', units='J', siPrefix=True, dec=True, step=0.5, minStep=1e-6, limits=(0, None)) self.powerWidget.setMeta('x', units='s', siPrefix=True, dec=True, step=0.5, minStep=1e-6, limits=(None, None)) if self.dev.hasTriggerableShutter: #(self.shutterWidget, self.shutterPlot) = self.createChannelWidget('shutter') self.shutterPlot = PlotWidget(name='%s.shutter'%self.dev.name) self.shutterPlot.setLabel('left', text='Shutter') self.plotSplitter.addWidget(self.shutterPlot) #self.shutterPlot.hide() if self.dev.hasQSwitch: #self.qSwitchWidget, self.qSwitchPlot = self.createChannelWidget('qSwitch') self.qSwitchPlot = PlotWidget(name='%s.qSwitch'%self.dev.name) self.qSwitchPlot.setLabel('left', text='Q-Switch') self.plotSplitter.addWidget(self.qSwitchPlot) #self.qSwitchPlot.hide() if self.dev.hasPCell: #self.pCellWidget, self.pCellPlot = self.createChannelWidget('pCell') self.pCellPlot = PlotWidget(name='%s.pCell'%self.dev.name) self.pCellPlot.setLabel('left', text='Pockel Cell', units='V') self.plotSplitter.addWidget(self.pCellPlot) #self.pCellPlot.hide() ## catch self.powerWidget.sigDataChanged and connect it to functions that calculate and plot raw shutter and qswitch traces self.powerWidget.sigDataChanged.connect(self.powerCmdChanged) self.ui.checkPowerBtn.clicked.connect(self.dev.outputPower) self.dev.sigOutputPowerChanged.connect(self.laserPowerChanged) self.dev.sigSamplePowerChanged.connect(self.samplePowerChanged) self.dev.outputPower()