From 5da26a99bfb4a3583efb0e6883f5c58acfbf19d1 Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Mon, 4 Mar 2024 11:34:19 +0100 Subject: [PATCH] AstrodataGUI: connect to db --- astrodatagui/AstrodataGUI.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/astrodatagui/AstrodataGUI.py b/astrodatagui/AstrodataGUI.py index dc52096..c8de854 100644 --- a/astrodatagui/AstrodataGUI.py +++ b/astrodatagui/AstrodataGUI.py @@ -1,10 +1,26 @@ from PyQt5 import QtWidgets, uic import os +from .db.StarsDB import StarDB + +DB_FILENAME = "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.show() \ No newline at end of file + 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 \ No newline at end of file