plotter/qgpib_plotter.py

changeset 34
022e881b758e
parent 32
59da528bc470
child 35
3b7a38af5c42
--- a/plotter/qgpib_plotter.py	Fri Jan 25 21:01:30 2008 +0100
+++ b/plotter/qgpib_plotter.py	Sat Jan 26 11:39:30 2008 +0100
@@ -11,8 +11,11 @@
 else:
     from gpib_plotter import GPIBplotter
 from hpgl_qt import QHPGLPlotterWidget
+import hpgl_plotter_rc
 
-form_class, base_class = uic.loadUiType(os.path.join(os.path.dirname(__file__), "qhpgl_plotter.ui"))
+ldir = os.path.abspath(os.path.dirname(__file__))
+sys.path.append(ldir)
+form_class, base_class = uic.loadUiType(os.path.join(ldir, "qhpgl_plotter.ui"))
 
 from qpreferences import PreferenceItem, AbstractPreferences, PreferencesEditor
 
@@ -128,7 +131,13 @@
     def saveTriggered(self, checked=False):
         print "save"
     def saveAsTriggered(self, checked=False):
-        print "saveAs"
+        index = self.plotsView.selectionModel().currentIndex()
+        if index.isValid():
+            filename = QtGui.QFileDialog.getSaveFileName(self, "Selecte a file name to save HPGL file", '.', 'HPGL files (*.plt)\nAll files (*)')
+            n = index.row()
+            value = unicode(self.plotsView.model().data(index, Qt.DisplayRole).toString())
+            open(filename, 'w').write(self._plots[value])
+            
         
     def initializeGPIB(self):
         self._online = False

mercurial