def __init__(self, parent, **kwargs): pyVacObject.__init__(self, parent, **kwargs) self.resize(kwargs['width'], kwargs['height']) self.move(kwargs['x'], kwargs['y']) self.plotWidget = CCDTwoDPlot(self) self.updateCheckBox = QtGui.QCheckBox("Live Update", self) self.updateCheckBox.move(625, 610) self.updateCheckBox.setChecked(True) self.connect(self.updateCheckBox, QtCore.SIGNAL('stateChanged(int)'), self.updateCheckBoxChanged) # Plot the slider for ringbuffer self.ringbufferLabel = QtGui.QLabel("Ringbuffer", self) self.ringbufferLabel.move(0, 610) self.ringbufferLabel.resize(100, 25) self.ringbufferValueLabel = QtGui.QLabel("", self) self.ringbufferValueLabel.move(525, 610) self.ringbufferValueLabel.resize(75, 25) self.ringbufferSelect = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.ringbufferSelect.move(100, 610) self.ringbufferSelect.resize(400, 25) self.ringbufferSelect.setMinimum(0) self.ringbufferSelect.setMaximum(0) self.ringbufferSelect.setValue(0) #self.connect(self.ringbufferSelect,QtCore.SIGNAL('valueChanged(int)'), # self.ringbufferChanged) self.ringbufferChanged(0)
def __init__(self, parent, **kwargs): pyVacObject.__init__(self, parent, **kwargs) self.resize(kwargs['width'], kwargs['height']) self.move(kwargs['x'], kwargs['y']) self.plotWidget = CCDTwoDPlot(self) self.updateCheckBox = QtGui.QCheckBox("Live Update", self) self.updateCheckBox.move(625,610) self.updateCheckBox.setChecked(True) self.connect(self.updateCheckBox,QtCore.SIGNAL('stateChanged(int)'), self.updateCheckBoxChanged) # Plot the slider for ringbuffer self.ringbufferLabel = QtGui.QLabel("Ringbuffer", self) self.ringbufferLabel.move(0,610) self.ringbufferLabel.resize(100,25) self.ringbufferValueLabel = QtGui.QLabel("", self) self.ringbufferValueLabel.move(525,610) self.ringbufferValueLabel.resize(75,25) self.ringbufferSelect = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.ringbufferSelect.move(100,610) self.ringbufferSelect.resize(400,25) self.ringbufferSelect.setMinimum(0) self.ringbufferSelect.setMaximum(0) self.ringbufferSelect.setValue(0) #self.connect(self.ringbufferSelect,QtCore.SIGNAL('valueChanged(int)'), # self.ringbufferChanged) self.ringbufferChanged(0)
class pyVacCCDImage(pyVacObject): def __init__(self, parent, **kwargs): pyVacObject.__init__(self, parent, **kwargs) self.resize(kwargs['width'], kwargs['height']) self.move(kwargs['x'], kwargs['y']) self.plotWidget = CCDTwoDPlot(self) self.updateCheckBox = QtGui.QCheckBox("Live Update", self) self.updateCheckBox.move(625, 610) self.updateCheckBox.setChecked(True) self.connect(self.updateCheckBox, QtCore.SIGNAL('stateChanged(int)'), self.updateCheckBoxChanged) # Plot the slider for ringbuffer self.ringbufferLabel = QtGui.QLabel("Ringbuffer", self) self.ringbufferLabel.move(0, 610) self.ringbufferLabel.resize(100, 25) self.ringbufferValueLabel = QtGui.QLabel("", self) self.ringbufferValueLabel.move(525, 610) self.ringbufferValueLabel.resize(75, 25) self.ringbufferSelect = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.ringbufferSelect.move(100, 610) self.ringbufferSelect.resize(400, 25) self.ringbufferSelect.setMinimum(0) self.ringbufferSelect.setMaximum(0) self.ringbufferSelect.setValue(0) #self.connect(self.ringbufferSelect,QtCore.SIGNAL('valueChanged(int)'), # self.ringbufferChanged) self.ringbufferChanged(0) def updateCheckBoxChanged(self, val): if not val: self.noUpdate = True else: self.noUpdate = False def ringbufferChanged(self, val): rbval = False if val == self.ringbufferSelect.maximum(): self.ringbufferValueLabel.setText('Current') self.updateCheckBox.setChecked(True) if self.ringbuffer.nValues(): rbval = self.ringbuffer.get(-1) else: self.ringbufferValueLabel.setText("Image %d" % val) self.noUpdate = True rbval = self.ringbuffer.get(val) self.updateCheckBox.setChecked(False) if rbval: self.plotWidget.setImage(rbval[1]) self.plotWidget.setTitle('Image %d' % val) self.plotWidget.update() def updateDisplay(self): if self.status == VacObject.ON: if self.ringbufferSelect.maximum() == self.ringbufferSelect.value( ): # We are updating self.plotWidget.setImage(self.value) self.plotWidget.setTitle(time.asctime(self.lastUpdate)) try: self.plotWidget.update() except: print "Unexpected error:", sys.exc_info()[0] #print self.ringbuffer.nValues() self.ringbufferSelect.setMaximum(self.ringbuffer.nValues()) self.ringbufferSelect.setValue(self.ringbuffer.nValues()) else: # We are on the ringbuffer self.ringbufferSelect.setMaximum(self.ringbuffer.nValues()) def updateValueLabel(self): """Fake this""" return
class pyVacCCDImage(pyVacObject): def __init__(self, parent, **kwargs): pyVacObject.__init__(self, parent, **kwargs) self.resize(kwargs['width'], kwargs['height']) self.move(kwargs['x'], kwargs['y']) self.plotWidget = CCDTwoDPlot(self) self.updateCheckBox = QtGui.QCheckBox("Live Update", self) self.updateCheckBox.move(625,610) self.updateCheckBox.setChecked(True) self.connect(self.updateCheckBox,QtCore.SIGNAL('stateChanged(int)'), self.updateCheckBoxChanged) # Plot the slider for ringbuffer self.ringbufferLabel = QtGui.QLabel("Ringbuffer", self) self.ringbufferLabel.move(0,610) self.ringbufferLabel.resize(100,25) self.ringbufferValueLabel = QtGui.QLabel("", self) self.ringbufferValueLabel.move(525,610) self.ringbufferValueLabel.resize(75,25) self.ringbufferSelect = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.ringbufferSelect.move(100,610) self.ringbufferSelect.resize(400,25) self.ringbufferSelect.setMinimum(0) self.ringbufferSelect.setMaximum(0) self.ringbufferSelect.setValue(0) #self.connect(self.ringbufferSelect,QtCore.SIGNAL('valueChanged(int)'), # self.ringbufferChanged) self.ringbufferChanged(0) def updateCheckBoxChanged(self, val): if not val: self.noUpdate = True else: self.noUpdate = False def ringbufferChanged(self, val): rbval = False if val == self.ringbufferSelect.maximum(): self.ringbufferValueLabel.setText('Current') self.updateCheckBox.setChecked(True) if self.ringbuffer.nValues(): rbval = self.ringbuffer.get(-1) else: self.ringbufferValueLabel.setText("Image %d" % val) self.noUpdate = True rbval = self.ringbuffer.get(val) self.updateCheckBox.setChecked(False) if rbval: self.plotWidget.setImage(rbval[1]) self.plotWidget.setTitle('Image %d' % val) self.plotWidget.update() def updateDisplay(self): if self.status == VacObject.ON: if self.ringbufferSelect.maximum() == self.ringbufferSelect.value(): # We are updating self.plotWidget.setImage(self.value) self.plotWidget.setTitle(time.asctime(self.lastUpdate)) try: self.plotWidget.update() except: print "Unexpected error:", sys.exc_info()[0] #print self.ringbuffer.nValues() self.ringbufferSelect.setMaximum(self.ringbuffer.nValues()) self.ringbufferSelect.setValue(self.ringbuffer.nValues()) else: # We are on the ringbuffer self.ringbufferSelect.setMaximum(self.ringbuffer.nValues()) def updateValueLabel(self): """Fake this""" return