Commit 5b13c4ff authored by marc's avatar marc
Browse files

initial commit

parents
.project
.pydevproject
.settings
__pycache__
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QWidget, QApplication
from ui_createpointings import Ui_FormCreatePoinings
from astropy import units as u
from astropy.coordinates import SkyCoord
import sys
import logging
'''
Setup logging
'''
logger = logging.getLogger('root')
FORMAT = "[%(asctime)s%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s,filename='dtobsgui.log',filemode='w'"
logging.basicConfig(format=FORMAT)
logger.setLevel(logging.DEBUG)
class CreatePointings(Ui_FormCreatePoinings):
def __init__(self, formCreatePointings):
logging.info('CreatePointings Intialized')
Ui_FormCreatePoinings.__init__(self)
self.setupUi(formCreatePointings)
self.target = SkyCoord.from_name(self.comboBox.currentText())
self.target = SkyCoord.from_name('M87')
(self.raStr, self.decStr) = self.target.to_string('hmsdms').split()
self.lineEditRA.setText(self.raStr)
self.lineEditDec.setText(self.decStr)
'''
Define slot and connections for GUI
'''
self.comboBox.currentIndexChanged.connect(self.updateRADEC)
logging.debug('Target changed')
def updateRADEC(self):
logging.debug('Target changed')
self.target = SkyCoord.from_name(self.comboBox.currentText())
(self.raStr, self.decStr) = self.target.to_string('hmsdms').split()
self.lineEditRA.setText(self.raStr)
self.lineEditDec.setText(self.decStr)
logging.info('New target is: {}'.format(self.target))
if __name__ == '__main__':
app = QApplication(sys.argv)
formCreatePointings = QWidget()
myForm = CreatePointings(formCreatePointings)
formCreatePointings.show()
sys.exit(app.exec_())
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_createpointings.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FormCreatePoinings(object):
def setupUi(self, FormCreatePoinings):
FormCreatePoinings.setObjectName("FormCreatePoinings")
FormCreatePoinings.resize(482, 241)
self.widget = QtWidgets.QWidget(FormCreatePoinings)
self.widget.setGeometry(QtCore.QRect(10, 10, 463, 220))
self.widget.setObjectName("widget")
self.gridLayout = QtWidgets.QGridLayout(self.widget)
self.gridLayout.setObjectName("gridLayout")
self.label_6 = QtWidgets.QLabel(self.widget)
self.label_6.setAlignment(QtCore.Qt.AlignCenter)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 0, 0, 1, 1)
self.comboBox = QtWidgets.QComboBox(self.widget)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
self.label = QtWidgets.QLabel(self.widget)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.lineEditRA = QtWidgets.QLineEdit(self.widget)
self.lineEditRA.setObjectName("lineEditRA")
self.gridLayout.addWidget(self.lineEditRA, 1, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.widget)
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.lineEditDec = QtWidgets.QLineEdit(self.widget)
self.lineEditDec.setObjectName("lineEditDec")
self.gridLayout.addWidget(self.lineEditDec, 2, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(self.widget)
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1)
self.lineEditRaDistance = QtWidgets.QLineEdit(self.widget)
self.lineEditRaDistance.setObjectName("lineEditRaDistance")
self.gridLayout.addWidget(self.lineEditRaDistance, 3, 1, 1, 1)
self.label_7 = QtWidgets.QLabel(self.widget)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 3, 2, 1, 1)
self.lineEditRaSteps = QtWidgets.QLineEdit(self.widget)
self.lineEditRaSteps.setObjectName("lineEditRaSteps")
self.gridLayout.addWidget(self.lineEditRaSteps, 3, 3, 1, 1)
self.label_4 = QtWidgets.QLabel(self.widget)
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1)
self.lineEditDecDistance = QtWidgets.QLineEdit(self.widget)
self.lineEditDecDistance.setObjectName("lineEditDecDistance")
self.gridLayout.addWidget(self.lineEditDecDistance, 4, 1, 1, 1)
self.label_8 = QtWidgets.QLabel(self.widget)
self.label_8.setObjectName("label_8")
self.gridLayout.addWidget(self.label_8, 4, 2, 1, 1)
self.lineEditDecSteps = QtWidgets.QLineEdit(self.widget)
self.lineEditDecSteps.setObjectName("lineEditDecSteps")
self.gridLayout.addWidget(self.lineEditDecSteps, 4, 3, 1, 1)
self.label_5 = QtWidgets.QLabel(self.widget)
self.label_5.setAlignment(QtCore.Qt.AlignCenter)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 5, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(self.widget)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 5, 1, 1, 1)
self.pushButton = QtWidgets.QPushButton(self.widget)
self.pushButton.setObjectName("pushButton")
self.gridLayout.addWidget(self.pushButton, 5, 3, 1, 1)
self.retranslateUi(FormCreatePoinings)
QtCore.QMetaObject.connectSlotsByName(FormCreatePoinings)
def retranslateUi(self, FormCreatePoinings):
_translate = QtCore.QCoreApplication.translate
FormCreatePoinings.setWindowTitle(_translate("FormCreatePoinings", "Create Pointings"))
self.label_6.setText(_translate("FormCreatePoinings", "Object"))
self.comboBox.setItemText(0, _translate("FormCreatePoinings", "M1"))
self.comboBox.setItemText(1, _translate("FormCreatePoinings", "M13"))
self.comboBox.setItemText(2, _translate("FormCreatePoinings", "M31"))
self.comboBox.setItemText(3, _translate("FormCreatePoinings", "M45"))
self.comboBox.setItemText(4, _translate("FormCreatePoinings", "M101"))
self.label.setText(_translate("FormCreatePoinings", "RA"))
self.label_2.setText(_translate("FormCreatePoinings", "DEC"))
self.label_3.setText(_translate("FormCreatePoinings", "RA Distance"))
self.label_7.setText(_translate("FormCreatePoinings", "RA Steps"))
self.label_4.setText(_translate("FormCreatePoinings", "DEC distance"))
self.label_8.setText(_translate("FormCreatePoinings", "DEC Steps"))
self.label_5.setText(_translate("FormCreatePoinings", "Create Pointings"))
self.pushButton.setText(_translate("FormCreatePoinings", "Clear Settings"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
FormCreatePoinings = QtWidgets.QWidget()
ui = Ui_FormCreatePoinings()
ui.setupUi(FormCreatePoinings)
FormCreatePoinings.show()
sys.exit(app.exec_())
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FormCreatePoinings</class>
<widget class="QWidget" name="FormCreatePoinings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<height>241</height>
</rect>
</property>
<property name="windowTitle">
<string>Create Pointings</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>463</width>
<height>220</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Object</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>M1</string>
</property>
</item>
<item>
<property name="text">
<string>M13</string>
</property>
</item>
<item>
<property name="text">
<string>M31</string>
</property>
</item>
<item>
<property name="text">
<string>M45</string>
</property>
</item>
<item>
<property name="text">
<string>M101</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>RA</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditRA"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>DEC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditDec"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>RA Distance</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditRaDistance"/>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>RA Steps</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLineEdit" name="lineEditRaSteps"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>DEC distance</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEditDecDistance"/>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>DEC Steps</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLineEdit" name="lineEditDecSteps"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Create Pointings</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Clear Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
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