qgpib_plotter.py

changeset 28
0a7270d439d0
parent 27
0f8f2621418f
equal deleted inserted replaced
27:0f8f2621418f 28:0a7270d439d0
4 import time 4 import time
5 5
6 from PyQt4 import QtGui, QtCore, uic 6 from PyQt4 import QtGui, QtCore, uic
7 from PyQt4.QtCore import SIGNAL, Qt 7 from PyQt4.QtCore import SIGNAL, Qt
8 8
9 #from gpib_plotter import GPIBplotter 9 if "-m" in sys.argv:
10 from gpib_plotter_mockup import GPIBplotter 10 from gpib_plotter_mockup import GPIBplotter
11 else:
12 from gpib_plotter import GPIBplotter
11 from hpgl_qt import QHPGLPlotterWidget 13 from hpgl_qt import QHPGLPlotterWidget
12 14
13 form_class, base_class = uic.loadUiType(os.path.join(os.path.dirname(__file__), "qhpgl_plotter.ui")) 15 form_class, base_class = uic.loadUiType(os.path.join(os.path.dirname(__file__), "qhpgl_plotter.ui"))
14 16
15 from qpreferences import PreferenceItem, AbstractPreferences, PreferencesEditor 17 from qpreferences import PreferenceItem, AbstractPreferences, PreferencesEditor
108 110
109 if not self.plotsView.currentIndex().isValid(): 111 if not self.plotsView.currentIndex().isValid():
110 self.plotsView.setCurrentIndex(self.plotsView.model().index(0, 0)) 112 self.plotsView.setCurrentIndex(self.plotsView.model().index(0, 0))
111 113
112 def plotReceived(self, num): 114 def plotReceived(self, num):
113 print "plot received", num
114 self._receiving = False 115 self._receiving = False
115 self.setReceivingLed() 116 self.setReceivingLed()
116 plot, timestamp = self.captureThread.getPlot(num) 117 plot, timestamp = self.captureThread.getPlot(num)
117 name = "plot_%s"%(num) 118 name = "plot_%s"%(num)
118 lst = self.plotsView.model().stringList() 119 lst = self.plotsView.model().stringList()
248 self._plotsmutex.unlock() 249 self._plotsmutex.unlock()
249 250
250 251
251 252
252 253
253 if __name__ == '__main__': 254 def main():
254 a = QtGui.QApplication([]) 255 import optparse
256 opt = optparse.OptionParser('A simple PyQt4 HP7470A GPIB plotter emulator for USB-GPIB bundle (ProLogix)')
257 opt.add_option('-m', '--mockup', default=False,
258 action="store_true",
259 dest='mockup',
260 help='Use a pseudo GPIB connection (for test purpose)',
261 )
262 opt.add_option('-v', '--verbose', default=False,
263 action="store_true",
264 dest="verbose",
265 help="Verbose mode",)
266
267 options, argv = opt.parse_args(sys.argv)
268
269 if options.verbose:
270 sys.stderr.write('connection established\n')
271
272 a = QtGui.QApplication(argv)
255 w = QtHPGLPlotter() 273 w = QtHPGLPlotter()
256 w.show() 274 w.show()
257 a.exec_() 275 a.exec_()
258 276
277 if __name__ == '__main__':
278 main()

mercurial