28 lines
841 B
Python
28 lines
841 B
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.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) |