Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
marc
dtObsGUI
Commits
82b44b12
Commit
82b44b12
authored
Nov 05, 2017
by
marc
Browse files
Added file save as
parent
bcf030de
Changes
4
Hide whitespace changes
Inline
Side-by-side
.project
View file @
82b44b12
...
...
@@ -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>
...
...
DTObs.py
View file @
82b44b12
...
...
@@ -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
()
...
...
pointings.dat
deleted
100644 → 0
View file @
bcf030de
0 83.09576543345065 21.51446
1 83.633212 21.51446
2 83.633212 22.01446
3 83.09388961896134 22.01446
templates/newPointings.pnt
0 → 100644
View file @
82b44b12
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment