astrodatagui: NewStarDialog: show preview of available data

This commit is contained in:
2024-03-05 12:32:43 +01:00
parent b58bb7fdd7
commit 2ef8664fd9
+36 -2
View File
@@ -1,7 +1,10 @@
from PyQt5.QtWidgets import QDialog
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QListWidgetItem
from PyQt5 import uic
import os
from ...astrodatadownloader.astrodatadownloader import ObservationSource, getStarObservations
class NewStarDialog(QDialog):
def __init__(self):
super().__init__()
@@ -13,8 +16,39 @@ class NewStarDialog(QDialog):
self.btOk.clicked.connect(self.btOk_clicked)
self.btCancel.clicked.connect(self.btCancel_clicked)
def showErrorMessage(self, title: str, msg: str):
QtWidgets.QMessageBox.question(self, title, msg,
QtWidgets.QMessageBox.Ok)
def btFetchData_clicked(self):
return
star = self.leStarIdentifier.text()
if not star:
self.showErrorMessage("No star identifier",
"No star identifier given, please insert one before proceeding")
return
sources = []
if(self.gbTESS.isChecked()):
sources.append(ObservationSource.TESS)
if(self.gbKepler.isChecked()):
sources.append(ObservationSource.KEPLER)
if(self.gbK2.isChecked()):
sources.append(ObservationSource.K2)
if(len(sources) == 0):
self.showErrorMessage("No source",
"Please select atleast one source before proceeding")
return
obs = getStarObservations(star, sources)
if(len(obs) == 0):
self.showErrorMessage("No observations found",
"No observationnal data has been found with the current filters")
return
self.listPreview.clear()
for o in obs:
self.listPreview.addItem(QListWidgetItem(f"{o['target_name']} - {o['obs_collection']} - {o['sequence_number']}"))
def btOk_clicked(self):
return