-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.py
82 lines (66 loc) · 3.12 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
import sys
import os
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QPushButton, QLabel, QFrame, QProgressBar, QMainWindow, QApplication
from PySide2.QtWinExtras import QtWin
from win32mica import ApplyMica, MICAMODE
import darkdetect
from modules.blurwindow import ExtendFrameIntoClientArea, GlobalBlur
if darkdetect.isDark() == True:
from dark import *
else:
from light import *
class Template(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
#MICA FOR WINDOW
hwnd = self.winId().__int__()
mode = MICAMODE.DARK
mode = MICAMODE.LIGHT
mode = darkdetect.isDark()
ApplyMica(hwnd, mode)
#MICA FOR MENUS
def ApplyMenuBlur(hwnd: int, window: self.ui.window):
hwnd = int(hwnd)
if darkdetect.isDark() == True:
GlobalBlur(hwnd, Acrylic=True, hexColor="#21212140", Dark=True, smallCorners=True)
else:
GlobalBlur(hwnd, Acrylic=True, hexColor="#faf7f740", Dark=True, smallCorners=True)
ApplyMenuBlur(self.ui.menuFile.winId().__int__(), self)
ApplyMenuBlur(self.ui.actionNew.winId().__int__(), self)
ApplyMenuBlur(self.ui.menuEdit.winId().__int__(), self)
ApplyMenuBlur(self.ui.menuHelp.winId().__int__(), self)
self.setAttribute(Qt.WA_TranslucentBackground)
if QtWin.isCompositionEnabled():
QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
else:
QtWin.resetExtendedFrame(self)
#REMOVE TOPBAR IN TREEWIDGET
self.ui.treeWidget.setHeaderHidden(True)
#TRYING TO CHANGE MENU IN CALENDARWIDGET
#self.ui.menu.setAttribute(Qt.WA_TranslucentBackground)
#self.ui.menu.setWindowFlags(self.ui.menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
#CUSTOM LIST IN COMBOBOX
self.ui.listview = QtWidgets.QListView()
self.ui.comboBox.setView(self.ui.listview)
self.ui.comboBox.view().window().setWindowFlags(Qt.Popup | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
self.ui.comboBox.view().window().setAttribute(Qt.WA_TranslucentBackground)
self.ui.comboBox.setCurrentIndex(-1)
ApplyMenuBlur(self.ui.comboBox.view().window().winId().__int__(), self)
#CUSTOM LIST IN FONTCOMBOBOX
self.ui.listview2 = QtWidgets.QListView()
self.ui.fontComboBox.setView(self.ui.listview2)
self.ui.fontComboBox.view().window().setWindowFlags(Qt.Popup | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
self.ui.fontComboBox.view().window().setAttribute(Qt.WA_TranslucentBackground)
ApplyMenuBlur(self.ui.fontComboBox.view().window().winId().__int__(), self)
#BUTTONS CLICK
self.ui.disablebtn.clicked.connect(lambda: self.ui.window.setEnabled(False))
self.ui.enablebtn.clicked.connect(lambda: self.ui.window.setEnabled(True))
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
centralwidget = Template()
sys.exit(app.exec_())