-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.py
68 lines (68 loc) · 2.57 KB
/
init.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
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
import os,sys
from PyQt5 import QtCore
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from lib.StyleReader import StyleReader
from newProject import NewProjectWindow
from Main import NewEditor
from lib.ProjectType import ProjectType,ProjectTypeTab
#定义APP_LOG
from lib.base import *
#setting
'''QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QGuiApplication.setAttribute(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)'''
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
#QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
clearLog()
print('Already running the application in Python '+sys.version)
settings = {'IfUseMorePackage':False,
'IfUseMoreCompiler':False,
'IfSaveAsProjectAuto':False}
settings['name'] = ""
settings['path'] = ""
settings['type'] = ""
settings['info'] = ""
settings['w'] = 1000 + 14
settings['h'] = 800 + 14
settings['x'] = None
settings['y'] = None
def readConfigFile():
if os.path.exists('./config/config.json') == False:
with open('./config/config.json','w',encoding='utf-8') as NewConfig:
NewConfig.write(str(settings))
return "new"
else:
with open('./config/config.json','r',encoding='utf-8') as ReadConfig:
getSetting = eval(ReadConfig.read())
return getSetting
def OpenNewProjectWindow():
app = QApplication(sys.argv)
Window = NewProjectWindow()
Window.UseTheme()
Window.show()
sys.exit(app.exec())
getconfig = readConfigFile()
if getconfig == 'new':
OpenNewProjectWindow()
elif settings == getconfig:
OpenNewProjectWindow()
else:
app = QApplication(sys.argv)
editor = NewEditor()
#apply_stylesheet(app, theme='dark_amber.xml')
editor.setting = getconfig
#editor.getAllWidget(editor)
#editor.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
editor.W = getconfig['w']
editor.H = getconfig['h']
editor.resize(editor.W,editor.H)
editor.title = f"MC studio ({editor.User}) - {ProjectType[getconfig['type']]} : {getconfig['name']}"
editor.setWindowTitle(f"MC studio ({editor.User}) - {ProjectType[getconfig['type']]} : {getconfig['name']}")#title
if getconfig['x'] != None and getconfig['y'] != None:
editor.move(getconfig['x'],getconfig['y'])
editor.show()
sys.exit(app.exec())