added a start scrip & cleanups

Fri, 25 Jan 2008 20:48:49 +0100

author
David Douard <david.douard@logilab.fr>
date
Fri, 25 Jan 2008 20:48:49 +0100
changeset 28
0a7270d439d0
parent 27
0f8f2621418f
child 29
558a7d3fb123

added a start scrip & cleanups

bin/qgpibplotter file | annotate | diff | comparison | revisions
qgpib_plotter.py file | annotate | diff | comparison | revisions
qhpgl_plotter.ui file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/qgpibplotter	Fri Jan 25 20:48:49 2008 +0100
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+
+from qgpib_plotter import main
+main()
--- a/qgpib_plotter.py	Fri Jan 25 20:25:39 2008 +0100
+++ b/qgpib_plotter.py	Fri Jan 25 20:48:49 2008 +0100
@@ -6,8 +6,10 @@
 from PyQt4 import QtGui, QtCore, uic
 from PyQt4.QtCore import SIGNAL, Qt
 
-#from gpib_plotter import GPIBplotter
-from gpib_plotter_mockup import GPIBplotter
+if "-m" in sys.argv:
+    from gpib_plotter_mockup import GPIBplotter
+else:
+    from gpib_plotter import GPIBplotter
 from hpgl_qt import QHPGLPlotterWidget
 
 form_class, base_class = uic.loadUiType(os.path.join(os.path.dirname(__file__), "qhpgl_plotter.ui"))
@@ -110,7 +112,6 @@
             self.plotsView.setCurrentIndex(self.plotsView.model().index(0, 0))
 
     def plotReceived(self, num):
-        print "plot received", num
         self._receiving = False
         self.setReceivingLed()
         plot, timestamp = self.captureThread.getPlot(num)
@@ -250,9 +251,28 @@
         
             
 
-if __name__ == '__main__':
-    a = QtGui.QApplication([])
+def main():
+    import optparse
+    opt = optparse.OptionParser('A simple PyQt4 HP7470A GPIB plotter emulator for USB-GPIB bundle (ProLogix)')
+    opt.add_option('-m', '--mockup', default=False,
+                   action="store_true",
+                   dest='mockup',
+                   help='Use a pseudo GPIB connection (for test purpose)',
+                   )
+    opt.add_option('-v', '--verbose', default=False,
+                   action="store_true",
+                   dest="verbose",
+                   help="Verbose mode",)
+    
+    options, argv = opt.parse_args(sys.argv)
+
+    if options.verbose:
+        sys.stderr.write('connection established\n')
+
+    a = QtGui.QApplication(argv)
     w = QtHPGLPlotter()
     w.show()
     a.exec_()
         
+if __name__ == '__main__':
+    main()
--- a/qhpgl_plotter.ui	Fri Jan 25 20:25:39 2008 +0100
+++ b/qhpgl_plotter.ui	Fri Jan 25 20:48:49 2008 +0100
@@ -48,6 +48,21 @@
    </attribute>
    <widget class="QWidget" name="dockWidgetContents" >
     <layout class="QVBoxLayout" >
+     <property name="spacing" >
+      <number>4</number>
+     </property>
+     <property name="leftMargin" >
+      <number>1</number>
+     </property>
+     <property name="topMargin" >
+      <number>4</number>
+     </property>
+     <property name="rightMargin" >
+      <number>1</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>1</number>
+     </property>
      <item>
       <layout class="QHBoxLayout" >
        <item>

mercurial