Files
flaredetector/astrodatagui/AstrodataGUI.py
T

37 lines
1.0 KiB
Python

from PyQt5 import QtWidgets, uic
import os
from .db.StarsDB import StarDB
DEFAULT_DB = "stars.db"
class AstrodataGUI(QtWidgets.QMainWindow):
def __init__(self):
super(AstrodataGUI, self).__init__()
classFileDir = os.path.dirname(os.path.abspath(__file__))
absUiFilePath = os.path.join(classFileDir, "astrodatagui.ui")
uic.loadUi(absUiFilePath, self)
self.actionExit.triggered.connect(self.actionExitTriggered)
self.show()
self.loadDB()
def loadDB(self):
try:
self.starDB = StarDB.getInstance(DEFAULT_DB)
except Exception as e:
self.showErrorMessage("DB Connection failed",
f"Could not connect to local database file {DEFAULT_DB}\n\
{e}")
def showErrorMessage(self, title: str, msg: str):
print(title)
print(msg)
def actionExitTriggered(self):
for starDB in StarDB.getAllInstances():
starDB.close()
exit()