AstrodataGUI: connect to db

This commit is contained in:
2024-03-04 11:34:19 +01:00
parent 67a471a49d
commit 5da26a99bf
+17 -1
View File
@@ -1,10 +1,26 @@
from PyQt5 import QtWidgets, uic from PyQt5 import QtWidgets, uic
import os import os
from .db.StarsDB import StarDB
DB_FILENAME = "stars.db"
class AstrodataGUI(QtWidgets.QMainWindow): class AstrodataGUI(QtWidgets.QMainWindow):
def __init__(self): def __init__(self):
super(AstrodataGUI, self).__init__() super(AstrodataGUI, self).__init__()
classFileDir = os.path.dirname(os.path.abspath(__file__)) classFileDir = os.path.dirname(os.path.abspath(__file__))
absUiFilePath = os.path.join(classFileDir, "astrodatagui.ui") absUiFilePath = os.path.join(classFileDir, "astrodatagui.ui")
uic.loadUi(absUiFilePath, self) uic.loadUi(absUiFilePath, self)
self.show() self.show()
self.loadDB()
def loadDB(self):
try:
self.starDB = StarDB.getInstance()
except:
self.showErrorMessage("DB Connection failed",
f"Could not connect to local database file {DB_FILENAME}")
def showErrorMessage(self, title: str, msg: str):
return