-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
173 lines (131 loc) · 5.79 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import sys
from PySide2 import QtGui, QtWidgets
from PySide2.QtCore import Qt, QRect, QCoreApplication, QSize, QMetaObject
from Screens.Home import Ui_Home
from modules.mica.styleSheet import ApplyMenuBlur
from PySide2.QtWidgets import QMainWindow, QApplication
from PySide2.QtWinExtras import QtWin
from modules.mica.styleSheet import setMicaWindow
from modules.mica.styleSheet import ApplyMenuBlur, setStyleSheet
import matplotlib
from icons import icon_rc
matplotlib.use("Qt5Agg")
class TheWindow(QMainWindow):
min_size = QSize(980, 650)
font_family = "Segoe UI Variable Small"
font_size = 11
font_weight = 50
def setupUI(self):
self.setWindowIcon(QtGui.QIcon(":/icons/icon.ico"))
self.setObjectName("MainWindow")
self.setEnabled(True)
self.resize(self.min_size)
self.setMinimumSize(self.min_size)
font = QtGui.QFont()
font.setFamily(self.font_family)
font.setPointSize(self.font_size)
font.setWeight(self.font_weight)
font.setBold(False)
font.setItalic(False)
font.setUnderline(False)
font.setStrikeOut(False)
font.setKerning(True)
self.setFont(font)
setStyleSheet(self)
self.menuBar = QtWidgets.QMenuBar(self)
self.menuBar.setEnabled(True)
self.menuBar.setGeometry(QRect(0, 0, self.min_size.width(), 63))
self.menuBar.setStyleSheet("")
self.menuBar.setObjectName("menuBar")
self.menuFile = QtWidgets.QMenu(self.menuBar)
self.menuFile.setEnabled(True)
self.menuFile.setObjectName("menuFile")
self.actionNew = QtWidgets.QMenu(self.menuFile)
self.actionNew.setEnabled(True)
self.actionNew.setStyleSheet("")
self.actionNew.setObjectName("actionNew")
self.menuHelp = QtWidgets.QMenu(self.menuBar)
self.menuHelp.setObjectName("menuHelp")
self.setMenuBar(self.menuBar)
self.actionSave = QtWidgets.QAction(self)
self.actionSave.setEnabled(True)
self.actionSave.setObjectName("actionSave")
self.actionExit = QtWidgets.QAction(self)
self.actionExit.setObjectName("actionExit")
self.actionPlain_Text_Document = QtWidgets.QAction(self)
self.actionPlain_Text_Document.setObjectName("actionPlain_Text_Document")
self.actionRich_Text_Document = QtWidgets.QAction(self)
self.actionRich_Text_Document.setObjectName("actionRich_Text_Document")
self.actionOpen = QtWidgets.QAction(self)
self.actionOpen.setObjectName("actionOpen")
self.actionAbout = QtWidgets.QAction(self)
self.actionAbout.setEnabled(True)
self.actionAbout.setObjectName("actionAbout")
self.actionNew.addAction(self.actionPlain_Text_Document)
self.actionNew.addAction(self.actionRich_Text_Document)
self.menuFile.addAction(self.actionNew.menuAction())
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionSave)
self.menuFile.addAction(self.actionExit)
self.menuHelp.addAction(self.actionAbout)
self.menuBar.addAction(self.menuFile.menuAction())
self.menuBar.addAction(self.menuHelp.menuAction())
# ---
self.tabWidget = QtWidgets.QTabWidget(self)
self.tabWidget.setEnabled(True)
self.tabWidget.setMinimumSize(self.min_size)
self.tabWidget.setStyleSheet("")
self.tabWidget.setObjectName("tabWidget")
self.tabWidget.setFont(font)
self.tabWidget.tabBar().setVisible(False)
self.tabWidget.setStyleSheet(
"""
QTabWidget::pane {
border: none;
}"""
)
self.tabHome = QtWidgets.QWidget(self.tabWidget)
self.tabHome.setStyleSheet("")
self.tabHome.setObjectName("home")
self.homeUi = Ui_Home()
self.homeUi.setupUi(self, self.tabHome)
self.tabWidget.addTab(self.tabHome, "Home")
self.setCentralWidget(self.tabWidget)
self.valuesUI()
self.actionUI()
def valuesUI(self):
_translate = QCoreApplication.translate
self.setWindowTitle(_translate("MainWindow", "PIF"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.actionNew.setTitle(_translate("MainWindow", "New"))
self.menuHelp.setTitle(_translate("MainWindow", "Help"))
self.actionSave.setText(_translate("MainWindow", "Save"))
self.actionSave.setShortcut(_translate("MainWindow", "Ctrl+S"))
self.actionExit.setText(_translate("MainWindow", "Exit"))
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+E"))
self.actionPlain_Text_Document.setText(_translate("MainWindow", "Project"))
self.actionRich_Text_Document.setText(_translate("MainWindow", "Project File"))
self.actionOpen.setText(_translate("MainWindow", "Open"))
self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.actionAbout.setText(_translate("MainWindow", "About"))
self.actionAbout.setShortcut(_translate("MainWindow", "Ctrl+I"))
ApplyMenuBlur(self.menuFile.winId().__int__())
ApplyMenuBlur(self.actionNew.winId().__int__())
ApplyMenuBlur(self.menuHelp.winId().__int__())
QMetaObject.connectSlotsByName(self)
def actionUI(self):
self.actionExit.triggered.connect(self.close)
def __init__(self):
QMainWindow.__init__(self)
self.setupUI()
setMicaWindow(self)
self.setAttribute(Qt.WA_TranslucentBackground)
if QtWin.isCompositionEnabled():
QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
else:
QtWin.resetExtendedFrame(self)
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
centralwidget = TheWindow()
sys.exit(app.exec_())