Added comments in main.py; the Logger utility is used now
This commit is contained in:
parent
bf5ac71380
commit
995b00d65d
12
main.py
12
main.py
@ -20,22 +20,26 @@ import sys
|
||||
from PySide6.QtWidgets import QApplication
|
||||
from PySide6.QtCore import QFile, QIODevice
|
||||
from PySide6.QtUiTools import QUiLoader
|
||||
from utils import Logger
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# needed variables
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
logger = Logger()
|
||||
ui_file_name = "main.ui"
|
||||
|
||||
# create the window
|
||||
ui_file = QFile(ui_file_name)
|
||||
if not ui_file.open(QIODevice.ReadOnly):
|
||||
print(f"Cannot open {ui_file_name}: {ui_file.errorString()}")
|
||||
logger.log(f"Cannot open {ui_file_name}: {ui_file.errorString()}", 1)
|
||||
sys.exit(-1)
|
||||
loader = QUiLoader()
|
||||
window = loader.load(ui_file)
|
||||
window = QUiLoader().load(ui_file)
|
||||
ui_file.close()
|
||||
if not window:
|
||||
print(loader.errorString())
|
||||
sys.exit(-1)
|
||||
window.show()
|
||||
|
||||
# run as long as the app is executing
|
||||
sys.exit(app.exec())
|
||||
|
Loading…
Reference in New Issue
Block a user