Commit 82b44b12 authored by marc's avatar marc

Added file save as

parent bcf030de
......@@ -3,6 +3,10 @@
<name>DTObs</name>
<comment></comment>
<projects>
<project>backend</project>
<project>measurements</project>
<project>metadata</project>
<project>telescope</project>
</projects>
<buildSpec>
<buildCommand>
......
......@@ -23,6 +23,8 @@ from measurements import Measurements
from metadata import MetaData
from backend import Backend
from createpointings import CreatePointings
#from createpointings import CreatePointings
'''
Setup config ini
'''
......@@ -121,6 +123,7 @@ class DTObservationProgram(Ui_mainWindow):
'''
self.actionNew.triggered.connect(self.newPointingsDialog)
self.actionOpen.triggered.connect(self.openFileNameDialog)
self.actionSave_As.triggered.connect(self.saveFileNameDialog)
self.actionClose.triggered.connect(self.closeMeasurement)
self.actionQuit.triggered.connect(self.quitDTObs)
self.pushButtonStartMeasurement.clicked.connect(self.startMeasurement)
......@@ -152,6 +155,22 @@ class DTObservationProgram(Ui_mainWindow):
self.loadPointingsInTable(self.inputFile)
logger.info('Selected data file is: {}'.format(self.inputFile))
def saveFileNameDialog(self):
'''
Clear tableWidget and read pointings from file
'''
saveFile,_ = QFileDialog.getSaveFileName(None, '|Save File', "templates","Pointing Files (*.pnt);;All Files (*)")
saveFile = open(saveFile,'w')
for meas in range(0,self.tableWidgetPointings.rowCount()):
ra = self.tableWidgetPointings.item(meas, 0).text()
dec = self.tableWidgetPointings.item(meas, 1).text()
pointing = SkyCoord(ra, dec, frame='icrs')
saveFile.write('{}\t{}\t{}\n'.format(meas, pointing.ra.deg, pointing.dec.deg))
logger.debug('{}\t{}\t{}\n'.format(meas, ra, dec))
saveFile.flush()
logger.info('Save file as is: {}'.format(saveFile))
def loadPointingsInTable(self,fileName):
reader = csv.reader(open(self.inputFile),delimiter='\t')
rowPosition = self.tableWidgetPointings.rowCount()
......
0 83.09576543345065 21.51446
1 83.633212 21.51446
2 83.633212 22.01446
3 83.09388961896134 22.01446
0 83.09576543345065 21.51446
1 56.323431431150276 23.605313
2 56.869089 23.605313
3 56.869089 24.105313
4 56.32132166678547 24.105313
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment