This repository was archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
70 lines (56 loc) · 2.08 KB
/
main.py
File metadata and controls
70 lines (56 loc) · 2.08 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from settings import language, returnLanguage
from windows.mainwindow import MainWindow
_ = returnLanguage(language)
__version__ = '0.0.1.1'
__title__ = 'Colorcode'
def init():
QCoreApplication.setApplicationName(__title__)
QCoreApplication.setOrganizationName('Ketsu8')
QCoreApplication.setApplicationVersion(__version__)
app = QApplication([])
from warnings import filterwarnings
filterwarnings('ignore')
from qtmodern.styles import dark
dark(app)
from resources import __resourcesDirectory__
from os.path import join
splashPicture = QPixmap(join(__resourcesDirectory__, 'splash.png'))
splashScreen = QSplashScreen(splashPicture, Qt.WindowStaysOnTopHint)
splashScreen.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
splashScreen.setEnabled(False)
progressBar = QProgressBar(splashScreen)
progressBar.setMaximum(10)
progressBar.setTextVisible(False)
progressBar.setGeometry(160, 250, 200, 20)
splashScreen.show()
from time import time
for i in range(1, 2):
progressBar.setValue(i)
t = time()
while time() < t + 0.2:
app.processEvents()
from updates import checkUpdatesAvailable
if checkUpdatesAvailable() == True: print('Update available.')
window = MainWindow()
window.setMinimumSize(300, 400)
window.resize(740, 512)
window.show()
splashScreen.finish(window)
app.exec_()
if __name__ == '__main__':
try:
init()
except Exception as exception:
messageBox = QMessageBox()
messageBox.setText(_('Initialization error'))
messageBox.setInformativeText(_('The error that occurred caused the program to stop working.'))
messageBox.setStandardButtons(QMessageBox.Close)
messageBox.setDefaultButton(QMessageBox.Close)
messageBox.setIcon(QMessageBox.Warning)
messageBox.setDetailedText(str(exception))
messageBox.resize(400, 500)
messageBox.exec()
QApplication.quit()