astrodatagui: use new thread for count all flairs

This commit is contained in:
2024-05-14 22:32:41 +02:00
parent 2c11166640
commit 724ce3e13f
+13
View File
@@ -9,6 +9,8 @@ import numpy as np
from .db.StarsDB import StarDB from .db.StarsDB import StarDB
from .ui.NewStarDialog import NewStarDialog from .ui.NewStarDialog import NewStarDialog
from .CalcAllFlaresThread import CalcAllFlaresThread
DEFAULT_DB = "stars.db" DEFAULT_DB = "stars.db"
class AstrodataGUI(QtWidgets.QMainWindow): class AstrodataGUI(QtWidgets.QMainWindow):
@@ -61,6 +63,8 @@ class AstrodataGUI(QtWidgets.QMainWindow):
self.loadDB() self.loadDB()
self.updateStarList() self.updateStarList()
self.calcAllFlaresThread = None
def setupCustomSimbadQueries(self): def setupCustomSimbadQueries(self):
self.simbad = Simbad() self.simbad = Simbad()
self.simbad.add_votable_fields("sptype") self.simbad.add_votable_fields("sptype")
@@ -344,7 +348,12 @@ class AstrodataGUI(QtWidgets.QMainWindow):
view = self.comboPlotPeriodogramView.currentText() view = self.comboPlotPeriodogramView.currentText()
self.flaredetectorPreview.setPeriodogramState(periodogramEnabled, method, view) self.flaredetectorPreview.setPeriodogramState(periodogramEnabled, method, view)
def btCountAllFlaresClickedDone(self, allFlaresDictList):
print(allFlaresDictList)
self.calcAllFlaresThread = None
def btCountAllFlaresClicked(self): def btCountAllFlaresClicked(self):
if(self.calcAllFlaresThread is None):
allStarsDictList = [] allStarsDictList = []
for starName in self.starDB.getAllStars(): for starName in self.starDB.getAllStars():
@@ -363,3 +372,7 @@ class AstrodataGUI(QtWidgets.QMainWindow):
"Source": source, "Source": source,
"Sequence": seq, "Sequence": seq,
"FilePath": filePath}) "FilePath": filePath})
self.calcAllFlaresThread = CalcAllFlaresThread(allStarsDictList)
self.calcAllFlaresThread.finished.connect(self.btCountAllFlaresClickedDone)
self.calcAllFlaresThread.start()