PyQt6-Frameless-Window 0.6.2__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PKG-INFO +4 -3
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PyQt6_Frameless_Window.egg-info/PKG-INFO +4 -3
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/__init__.py +1 -1
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/linux/window_effect.py +25 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/mac/window_effect.py +24 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/titlebar/__init__.py +1 -1
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/win32_utils.py +18 -2
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/windows/__init__.py +7 -1
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/windows/c_structures.py +8 -7
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/windows/window_effect.py +43 -3
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/setup.py +1 -1
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/LICENSE +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PyQt6_Frameless_Window.egg-info/SOURCES.txt +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PyQt6_Frameless_Window.egg-info/dependency_links.txt +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PyQt6_Frameless_Window.egg-info/requires.txt +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/PyQt6_Frameless_Window.egg-info/top_level.txt +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/README.md +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/_rc/__init__.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/_rc/resource.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/linux/__init__.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/mac/__init__.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/titlebar/title_bar_buttons.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/__init__.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/linux_utils.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/mac_utils.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/webengine/__init__.py +0 -0
- {PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/setup.cfg +0 -0
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyQt6-Frameless-Window
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: A cross-platform frameless window based on pyqt6, support Win32, Linux and macOS.
|
|
5
5
|
Home-page: https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/PyQt6
|
|
6
6
|
Author: zhiyiYo
|
|
7
7
|
Author-email: shokokawaii@outlook.com
|
|
8
8
|
License: GPLv3
|
|
9
9
|
Keywords: pyqt6 frameless
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
11
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pywin32; platform_system == "Windows"
|
|
16
|
+
Requires-Dist: pyobjc; platform_system == "Darwin"
|
|
17
|
+
Requires-Dist: PyCocoa; platform_system == "Darwin"
|
|
16
18
|
|
|
17
19
|
<p align="center">
|
|
18
20
|
<img width="15%" align="center" src="https://raw.githubusercontent.com/zhiyiYo/PyQt-Frameless-Window/master/screenshot/logo.png" alt="logo">
|
|
@@ -134,4 +136,3 @@ Here are some projects that use PyQt-Frameless-Window:
|
|
|
134
136
|
PyQt6-Frameless-Window is licensed under [GPLv3](./LICENSE).
|
|
135
137
|
|
|
136
138
|
Copyright © 2021 by zhiyiYo.
|
|
137
|
-
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyQt6-Frameless-Window
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: A cross-platform frameless window based on pyqt6, support Win32, Linux and macOS.
|
|
5
5
|
Home-page: https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/PyQt6
|
|
6
6
|
Author: zhiyiYo
|
|
7
7
|
Author-email: shokokawaii@outlook.com
|
|
8
8
|
License: GPLv3
|
|
9
9
|
Keywords: pyqt6 frameless
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
11
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pywin32; platform_system == "Windows"
|
|
16
|
+
Requires-Dist: pyobjc; platform_system == "Darwin"
|
|
17
|
+
Requires-Dist: PyCocoa; platform_system == "Darwin"
|
|
16
18
|
|
|
17
19
|
<p align="center">
|
|
18
20
|
<img width="15%" align="center" src="https://raw.githubusercontent.com/zhiyiYo/PyQt-Frameless-Window/master/screenshot/logo.png" alt="logo">
|
|
@@ -134,4 +136,3 @@ Here are some projects that use PyQt-Frameless-Window:
|
|
|
134
136
|
PyQt6-Frameless-Window is licensed under [GPLv3](./LICENSE).
|
|
135
137
|
|
|
136
138
|
Copyright © 2021 by zhiyiYo.
|
|
137
|
-
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# coding:utf-8
|
|
2
|
+
from PyQt6.QtGui import QColor
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
class LinuxWindowEffect:
|
|
4
6
|
""" Linux window effect """
|
|
@@ -25,6 +27,29 @@ class LinuxWindowEffect:
|
|
|
25
27
|
"""
|
|
26
28
|
pass
|
|
27
29
|
|
|
30
|
+
def setBorderAccentColor(self, hWnd, color: QColor):
|
|
31
|
+
""" Set the border color of the window
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
hWnd: int or `sip.voidptr`
|
|
36
|
+
Window handle
|
|
37
|
+
|
|
38
|
+
color: QColor
|
|
39
|
+
Border Accent color
|
|
40
|
+
"""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
def removeBorderAccentColor(self, hWnd):
|
|
44
|
+
""" Remove the border color of the window
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
hWnd: int or `sip.voidptr`
|
|
49
|
+
Window handle
|
|
50
|
+
"""
|
|
51
|
+
pass
|
|
52
|
+
|
|
28
53
|
def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):
|
|
29
54
|
""" Add mica effect to the window (Win11 only)
|
|
30
55
|
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/mac/window_effect.py
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Cocoa
|
|
3
3
|
from PyQt6.QtCore import Qt
|
|
4
4
|
from PyQt6.QtWidgets import QWidget
|
|
5
|
+
from PyQt6.QtGui import QColor
|
|
5
6
|
from ..utils.mac_utils import getNSWindow
|
|
6
7
|
|
|
7
8
|
|
|
@@ -54,6 +55,29 @@ class MacWindowEffect:
|
|
|
54
55
|
content.addSubview_positioned_relativeTo_(
|
|
55
56
|
visualEffectView, Cocoa.NSWindowBelow, container)
|
|
56
57
|
|
|
58
|
+
def setBorderAccentColor(self, hWnd, color: QColor):
|
|
59
|
+
""" Set the border color of the window
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
hWnd: int or `sip.voidptr`
|
|
64
|
+
Window handle
|
|
65
|
+
|
|
66
|
+
color: QColor
|
|
67
|
+
Border Accent color
|
|
68
|
+
"""
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
def removeBorderAccentColor(self, hWnd):
|
|
72
|
+
""" Remove the border color of the window
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
hWnd: int or `sip.voidptr`
|
|
77
|
+
Window handle
|
|
78
|
+
"""
|
|
79
|
+
pass
|
|
80
|
+
|
|
57
81
|
def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):
|
|
58
82
|
""" Add mica effect to the window (Win11 only)
|
|
59
83
|
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/win32_utils.py
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# coding:utf-8
|
|
2
|
+
import sys
|
|
3
|
+
import warnings
|
|
2
4
|
from ctypes import Structure, byref, sizeof, windll, c_int, c_ulong, c_bool, POINTER, WinDLL, wintypes
|
|
3
5
|
from ctypes.wintypes import DWORD, HWND, LPARAM, RECT, UINT
|
|
4
6
|
from platform import platform
|
|
5
|
-
import
|
|
6
|
-
import warnings
|
|
7
|
+
from winreg import OpenKey, HKEY_CURRENT_USER, KEY_READ, QueryValueEx, CloseKey
|
|
7
8
|
|
|
8
9
|
import win32api
|
|
9
10
|
import win32con
|
|
@@ -37,6 +38,21 @@ def getSystemAccentColor():
|
|
|
37
38
|
return QColor(color.value)
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
def isSystemBorderAccentEnabled():
|
|
42
|
+
""" Check whether the border accent is enabled """
|
|
43
|
+
if not isGreaterEqualWin11():
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
key = OpenKey(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\DWM", 0, KEY_READ)
|
|
48
|
+
value, _ = QueryValueEx(key, "ColorPrevalence")
|
|
49
|
+
CloseKey(key)
|
|
50
|
+
|
|
51
|
+
return bool(value)
|
|
52
|
+
except:
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
|
|
40
56
|
def isMaximized(hWnd):
|
|
41
57
|
""" Determine whether the window is maximized
|
|
42
58
|
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/windows/__init__.py
RENAMED
|
@@ -12,7 +12,7 @@ from PyQt6.QtWidgets import QApplication, QWidget
|
|
|
12
12
|
|
|
13
13
|
from ..titlebar import TitleBar
|
|
14
14
|
from ..utils import win32_utils as win_utils
|
|
15
|
-
from ..utils.win32_utils import Taskbar
|
|
15
|
+
from ..utils.win32_utils import Taskbar, isSystemBorderAccentEnabled, getSystemAccentColor
|
|
16
16
|
from .c_structures import LPNCCALCSIZE_PARAMS
|
|
17
17
|
from .window_effect import WindowsWindowEffect
|
|
18
18
|
|
|
@@ -177,6 +177,12 @@ class WindowsFramelessWindow(QWidget):
|
|
|
177
177
|
|
|
178
178
|
result = 0 if not msg.wParam else win32con.WVR_REDRAW
|
|
179
179
|
return True, result
|
|
180
|
+
elif msg.message == win32con.WM_SETFOCUS and isSystemBorderAccentEnabled():
|
|
181
|
+
self.windowEffect.setBorderAccentColor(self.winId(), getSystemAccentColor())
|
|
182
|
+
return True, 0
|
|
183
|
+
elif msg.message == win32con.WM_KILLFOCUS:
|
|
184
|
+
self.windowEffect.removeBorderAccentColor(self.winId())
|
|
185
|
+
return True, 0
|
|
180
186
|
|
|
181
187
|
return False, 0
|
|
182
188
|
|
|
@@ -94,13 +94,14 @@ class DWMWINDOWATTRIBUTE(Enum):
|
|
|
94
94
|
DWMWA_FREEZE_REPRESENTATION = 15
|
|
95
95
|
DWMWA_PASSIVE_UPDATE_MODE = 16
|
|
96
96
|
DWMWA_USE_HOSTBACKDROPBRUSH = 17
|
|
97
|
-
DWMWA_USE_IMMERSIVE_DARK_MODE =
|
|
98
|
-
DWMWA_WINDOW_CORNER_PREFERENCE =
|
|
99
|
-
DWMWA_BORDER_COLOR =
|
|
100
|
-
DWMWA_CAPTION_COLOR =
|
|
101
|
-
DWMWA_TEXT_COLOR =
|
|
102
|
-
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS =
|
|
103
|
-
|
|
97
|
+
DWMWA_USE_IMMERSIVE_DARK_MODE = 20
|
|
98
|
+
DWMWA_WINDOW_CORNER_PREFERENCE = 33
|
|
99
|
+
DWMWA_BORDER_COLOR = 34
|
|
100
|
+
DWMWA_CAPTION_COLOR = 35
|
|
101
|
+
DWMWA_TEXT_COLOR = 36
|
|
102
|
+
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37
|
|
103
|
+
DWMWA_SYSTEMBACKDROP_TYPE = 38
|
|
104
|
+
DWMWA_LAST = 39
|
|
104
105
|
|
|
105
106
|
|
|
106
107
|
class MARGINS(Structure):
|
|
@@ -7,6 +7,7 @@ from ctypes.wintypes import DWORD, LONG, LPCVOID
|
|
|
7
7
|
import win32api
|
|
8
8
|
import win32con
|
|
9
9
|
import win32gui
|
|
10
|
+
from PyQt6.QtGui import QColor
|
|
10
11
|
|
|
11
12
|
from .c_structures import (ACCENT_POLICY, ACCENT_STATE, DWMNCRENDERINGPOLICY,
|
|
12
13
|
DWMWINDOWATTRIBUTE, MARGINS,
|
|
@@ -82,6 +83,44 @@ class WindowsWindowEffect:
|
|
|
82
83
|
self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value
|
|
83
84
|
self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))
|
|
84
85
|
|
|
86
|
+
def setBorderAccentColor(self, hWnd, color: QColor):
|
|
87
|
+
""" Set the border color of the window
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
hWnd: int or `sip.voidptr`
|
|
92
|
+
Window handle
|
|
93
|
+
|
|
94
|
+
color: QColor
|
|
95
|
+
Border Accent color
|
|
96
|
+
"""
|
|
97
|
+
if not isGreaterEqualWin11():
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
hWnd = int(hWnd)
|
|
101
|
+
colorref = DWORD(color.red() | (color.green() << 8) | (color.blue() << 16))
|
|
102
|
+
self.DwmSetWindowAttribute(hWnd,
|
|
103
|
+
DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR.value,
|
|
104
|
+
byref(colorref),
|
|
105
|
+
4)
|
|
106
|
+
|
|
107
|
+
def removeBorderAccentColor(self, hWnd):
|
|
108
|
+
""" Remove the border color of the window
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
hWnd: int or `sip.voidptr`
|
|
113
|
+
Window handle
|
|
114
|
+
"""
|
|
115
|
+
if not isGreaterEqualWin11():
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
hWnd = int(hWnd)
|
|
119
|
+
self.DwmSetWindowAttribute(hWnd,
|
|
120
|
+
DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR.value,
|
|
121
|
+
byref(DWORD(0xFFFFFFFF)),
|
|
122
|
+
4)
|
|
123
|
+
|
|
85
124
|
def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):
|
|
86
125
|
""" Add the mica effect to the window (Win11 only)
|
|
87
126
|
|
|
@@ -101,7 +140,8 @@ class WindowsWindowEffect:
|
|
|
101
140
|
return
|
|
102
141
|
|
|
103
142
|
hWnd = int(hWnd)
|
|
104
|
-
|
|
143
|
+
# fix issue #125
|
|
144
|
+
margins = MARGINS(16777215, 16777215, 0, 0)
|
|
105
145
|
self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))
|
|
106
146
|
|
|
107
147
|
self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value
|
|
@@ -116,9 +156,9 @@ class WindowsWindowEffect:
|
|
|
116
156
|
if sys.getwindowsversion().build < 22523:
|
|
117
157
|
self.DwmSetWindowAttribute(hWnd, 1029, byref(c_int(1)), 4)
|
|
118
158
|
else:
|
|
119
|
-
self.DwmSetWindowAttribute(hWnd,
|
|
159
|
+
self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE.value, byref(c_int(4 if isAlt else 2)), 4)
|
|
120
160
|
|
|
121
|
-
self.DwmSetWindowAttribute(hWnd,
|
|
161
|
+
self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE.value, byref(c_int(1*isDarkMode)), 4)
|
|
122
162
|
|
|
123
163
|
def setAeroEffect(self, hWnd):
|
|
124
164
|
""" Add the aero effect to the window
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/_rc/__init__.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/_rc/resource.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/linux/__init__.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/mac/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/__init__.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/linux_utils.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/utils/mac_utils.py
RENAMED
|
File without changes
|
{PyQt6-Frameless-Window-0.6.2 → pyqt6_frameless_window-0.7.0}/qframelesswindow/webengine/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|