forked from Galaxy1036/SC-Assets-Downloader-GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (25 loc) · 1.04 KB
/
main.py
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
27
28
29
30
31
32
33
34
35
import os
import sys
import json
import qdarkstyle
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QMessageBox
from ui.main_window import MainWindow
if __name__ == '__main__':
app = QApplication([])
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
if os.path.isfile('config.json'):
with open('config.json') as f:
config = json.load(f)
application = MainWindow(app, config)
# Disable window resize and the maximize button
application.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint)
application.show()
application.setFixedSize(application.size())
sys.exit(app.exec_())
else:
msg = QMessageBox()
msg.setWindowTitle('Config missing')
msg.setText("""<p style='text-align: center;'><img src='ui/assets/warning-icon.png' alt='' width='42' height='42'/></p>
<p style='align: center;'><strong>config.json file is missing, cannot continue !</strong></p>""")
msg.exec_()