aboutsummaryrefslogtreecommitdiff
path: root/gui/main.py
blob: b3c7e34dd7dd03dd7062baa8745353f2762708d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/python3

import sys
import mariadb
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from PySide6 import *

from login_dialog import *
from main_window import *

if __name__ == '__main__':
  app = QApplication(sys.argv)
  login_dialog = LoginDialog()
  db = None
  while True:
    login_dialog.exec()
    try:
      db = mariadb.connect(host=login_dialog.hostname, user=login_dialog.username, password=login_dialog.password, database=login_dialog.database)
      break
    except:
      print("Login failed, please try again")
  win = MainWindow(db.cursor(buffered=True), db)
  win.show()
  app.exec()