Sat, 16 Feb 2008 22:17:47 +0100
add ability to select display (A or B) from which we get trace/coord
pygpibtoolkit/HP3562A/datablockwidget.py | file | annotate | diff | comparison | revisions | |
pygpibtoolkit/HP3562A/q3562A.py | file | annotate | diff | comparison | revisions |
--- a/pygpibtoolkit/HP3562A/datablockwidget.py Thu Feb 14 19:28:41 2008 +0100 +++ b/pygpibtoolkit/HP3562A/datablockwidget.py Sat Feb 16 22:17:47 2008 +0100 @@ -294,7 +294,9 @@ y = y.clip(min=self.header[1]['Min value of data'], max=self.header[1]['Max value of data'],) - + + if self.header[1]['Y scale factor']: + y *= self.header[1]['Y scale factor'] self.canvas.axes.clear() self.canvas.axes.plot(x, y, 'r') self.canvas.axes.set_xlim(min(x), max(x))
--- a/pygpibtoolkit/HP3562A/q3562A.py Thu Feb 14 19:28:41 2008 +0100 +++ b/pygpibtoolkit/HP3562A/q3562A.py Sat Feb 16 22:17:47 2008 +0100 @@ -160,6 +160,19 @@ self.getCoordAct.setStatusTip(self.tr("Retrieve Coord from GPIB device")) self.connect(self.getCoordAct, QtCore.SIGNAL("triggered()"), self.getCoord) + + self.channelActGroups = QtGui.QActionGroup(self) + self.channelActGroups.setExclusive(True) + self.channelAAct = QtGui.QAction(self.tr("Channel A"), self) + self.channelAAct.setCheckable(True) + self.channelAAct.setChecked(True) + self.channelAAct.setStatusTip(self.tr("Retrieve from channel A")) + self.channelActGroups.addAction(self.channelAAct) + self.channelBAct = QtGui.QAction(self.tr("Channel B"), self) + self.channelBAct.setCheckable(True) + self.channelBAct.setStatusTip(self.tr("Retrieve from channel B")) + self.channelActGroups.addAction(self.channelBAct) + def setupUi(self): self.connect(self.actionPreferences, SIGNAL('triggered(bool)'), @@ -229,18 +242,19 @@ self.fileMenu.addAction(self.saveAsAct) self.fileMenu.addSeparator() self.fileMenu.addAction(self.exitAct) - - self.windowMenu = self.menuBar().addMenu(self.tr("&Window")) - self.connect(self.windowMenu, QtCore.SIGNAL("aboutToShow()"), - self.updateWindowMenu) - - self.deviceMenu = self.menuBar().addMenu(self.tr("&Device")) + self.deviceMenu.addAction(self.channelAAct) + self.deviceMenu.addAction(self.channelBAct) + self.deviceMenu.addSeparator() self.deviceMenu.addAction(self.getStateAct) self.deviceMenu.addAction(self.getTraceAct) self.deviceMenu.addAction(self.getCoordAct) + self.windowMenu = self.menuBar().addMenu(self.tr("&Window")) + self.connect(self.windowMenu, QtCore.SIGNAL("aboutToShow()"), + self.updateWindowMenu) + self.menuBar().addSeparator() self.helpMenu = self.menuBar().addMenu(self.tr("&Help")) self.helpMenu.addAction(self.aboutAct) @@ -252,9 +266,15 @@ self.fileToolBar.addAction(self.openAct) self.fileToolBar.addAction(self.saveAsAct) self.fileToolBar.addSeparator() - self.fileToolBar.addAction(self.getStateAct) - self.fileToolBar.addAction(self.getTraceAct) - self.fileToolBar.addAction(self.getCoordAct) + + self.deviceToolBar = self.addToolBar(self.tr("Device")) + self.deviceToolBar.setObjectName('devicetoolbar') + self.deviceToolBar.addAction(self.channelAAct) + self.deviceToolBar.addAction(self.channelBAct) + self.deviceToolBar.addSeparator() + self.deviceToolBar.addAction(self.getStateAct) + self.deviceToolBar.addAction(self.getTraceAct) + self.deviceToolBar.addAction(self.getCoordAct) def createStatusBar(self): self.statusBar().showMessage(self.tr("Ready")) @@ -332,10 +352,16 @@ self.statusBar().showMessage(self.tr("Received data block"), 2000) self._receiving = False + def selectChannel(self): + if self.channelAAct.isEnabled(): + self.captureThread.sendCommand("A") + else: + self.captureThread.sendCommand("B") + def getState(self): if self._receiving: return - self._receiving = True + self._receiving = True self.statusBar().showMessage(self.tr("Waiting for a %1 data block").arg(self.tr('state'))) self.getStateAct.setChecked(True) self.captureThread.startCapture(mode="state") @@ -346,6 +372,7 @@ self._receiving = True self.statusBar().showMessage(self.tr("Waiting for a %1 data block").arg(self.tr('trace'))) self.getTraceAct.setChecked(True) + self.selectChannel() self.captureThread.startCapture(mode="trace") def getCoord(self): @@ -354,9 +381,10 @@ self._receiving = True self.statusBar().showMessage(self.tr("Waiting for a %1 data block").arg(self.tr('coord'))) self.getCoordAct.setChecked(True) + self.selectChannel() self.captureThread.startCapture(mode="coord") -class GPIBReceiver(QtCore.QThread): +class GPIBConnection(QtCore.QThread): def __init__(self, cnx): QtCore.QThread.__init__(self) self.gpibdumper = cnx @@ -375,6 +403,11 @@ self._cancel = True self._cancelmutex.unlock() + def sendCommand(self, cmd): + if self._capturing: + return + return self.gpibdumper.send_command(cmd) + def startCapture(self, mode): self._modemutex.lock() self._mode = mode