PySide2-Frameless-Window 0.6.0__tar.gz → 0.7.2__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.
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PKG-INFO +1 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PySide2_Frameless_Window.egg-info/PKG-INFO +1 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/__init__.py +1 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/linux/window_effect.py +25 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/mac/window_effect.py +24 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/titlebar/__init__.py +1 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/utils/win32_utils.py +18 -2
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/windows/__init__.py +16 -10
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/windows/c_structures.py +8 -7
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/windows/window_effect.py +43 -3
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/setup.py +1 -1
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/LICENSE +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PySide2_Frameless_Window.egg-info/SOURCES.txt +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PySide2_Frameless_Window.egg-info/dependency_links.txt +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PySide2_Frameless_Window.egg-info/requires.txt +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/PySide2_Frameless_Window.egg-info/top_level.txt +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/README.md +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/_rc/__init__.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/_rc/resource.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/linux/__init__.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/mac/__init__.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/titlebar/title_bar_buttons.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/utils/__init__.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/utils/linux_utils.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/utils/mac_utils.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/webengine/__init__.py +0 -0
- {pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySide2-Frameless-Window
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: A cross-platform frameless window based on pyside2, support Win32, Linux and macOS.
|
|
5
5
|
Home-page: https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/Pyside2
|
|
6
6
|
Author: zhiyiYo
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySide2-Frameless-Window
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: A cross-platform frameless window based on pyside2, support Win32, Linux and macOS.
|
|
5
5
|
Home-page: https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/Pyside2
|
|
6
6
|
Author: zhiyiYo
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# coding:utf-8
|
|
2
|
+
from PySide2.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
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Cocoa
|
|
3
3
|
from PySide2.QtCore import Qt
|
|
4
4
|
from PySide2.QtWidgets import QWidget
|
|
5
|
-
|
|
5
|
+
from PySide2.QtGui import QColor
|
|
6
6
|
from ..utils.mac_utils import getNSWindow
|
|
7
7
|
|
|
8
8
|
|
|
@@ -55,6 +55,29 @@ class MacWindowEffect:
|
|
|
55
55
|
content.addSubview_positioned_relativeTo_(
|
|
56
56
|
visualEffectView, Cocoa.NSWindowBelow, container)
|
|
57
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
|
+
|
|
58
81
|
def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):
|
|
59
82
|
""" Add mica effect to the window (Win11 only)
|
|
60
83
|
|
|
@@ -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_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
|
|
@@ -38,6 +39,21 @@ def getSystemAccentColor():
|
|
|
38
39
|
return QColor(color.value)
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
def isSystemBorderAccentEnabled():
|
|
43
|
+
""" Check whether the border accent is enabled """
|
|
44
|
+
if not isGreaterEqualWin11():
|
|
45
|
+
return False
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
key = OpenKey(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\DWM", 0, KEY_READ)
|
|
49
|
+
value, _ = QueryValueEx(key, "ColorPrevalence")
|
|
50
|
+
CloseKey(key)
|
|
51
|
+
|
|
52
|
+
return bool(value)
|
|
53
|
+
except:
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
|
|
41
57
|
def isMaximized(hWnd):
|
|
42
58
|
""" Determine whether the window is maximized
|
|
43
59
|
|
|
@@ -13,7 +13,7 @@ from PySide2.QtWinExtras import QtWin
|
|
|
13
13
|
|
|
14
14
|
from ..titlebar import TitleBar
|
|
15
15
|
from ..utils import win32_utils as win_utils
|
|
16
|
-
from ..utils.win32_utils import Taskbar
|
|
16
|
+
from ..utils.win32_utils import Taskbar, isSystemBorderAccentEnabled, getSystemAccentColor
|
|
17
17
|
from .c_structures import LPNCCALCSIZE_PARAMS
|
|
18
18
|
from .window_effect import WindowsWindowEffect
|
|
19
19
|
|
|
@@ -121,18 +121,18 @@ class WindowsFramelessWindow(QWidget):
|
|
|
121
121
|
return super().nativeEvent(eventType, message)
|
|
122
122
|
|
|
123
123
|
if msg.message == win32con.WM_NCHITTEST and self._isResizeEnabled:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
w =
|
|
128
|
-
h =
|
|
124
|
+
xPos, yPos = win32gui.ScreenToClient(msg.hWnd, (msg.lParam & 65535, msg.lParam >> 16))
|
|
125
|
+
clientRect = win32gui.GetClientRect(msg.hWnd)
|
|
126
|
+
|
|
127
|
+
w = clientRect[2] - clientRect[0]
|
|
128
|
+
h = clientRect[3] - clientRect[1]
|
|
129
129
|
|
|
130
130
|
# fixes https://github.com/zhiyiYo/PyQt-Frameless-Window/issues/98
|
|
131
131
|
bw = 0 if win_utils.isMaximized(msg.hWnd) or win_utils.isFullScreen(msg.hWnd) else self.BORDER_WIDTH
|
|
132
|
-
lx = xPos < bw
|
|
133
|
-
rx = xPos > w - bw
|
|
134
|
-
ty = yPos < bw
|
|
135
|
-
by = yPos > h - bw
|
|
132
|
+
lx = xPos < bw # left
|
|
133
|
+
rx = xPos > w - bw # right
|
|
134
|
+
ty = yPos < bw # top
|
|
135
|
+
by = yPos > h - bw # bottom
|
|
136
136
|
if lx and ty:
|
|
137
137
|
return True, win32con.HTTOPLEFT
|
|
138
138
|
elif rx and by:
|
|
@@ -182,6 +182,12 @@ class WindowsFramelessWindow(QWidget):
|
|
|
182
182
|
|
|
183
183
|
result = 0 if not msg.wParam else win32con.WVR_REDRAW
|
|
184
184
|
return True, result
|
|
185
|
+
elif msg.message == win32con.WM_SETFOCUS and isSystemBorderAccentEnabled():
|
|
186
|
+
self.windowEffect.setBorderAccentColor(self.winId(), getSystemAccentColor())
|
|
187
|
+
return True, 0
|
|
188
|
+
elif msg.message == win32con.WM_KILLFOCUS:
|
|
189
|
+
self.windowEffect.removeBorderAccentColor(self.winId())
|
|
190
|
+
return True, 0
|
|
185
191
|
|
|
186
192
|
return super().nativeEvent(eventType, message)
|
|
187
193
|
|
|
@@ -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):
|
|
@@ -8,6 +8,7 @@ import win32api
|
|
|
8
8
|
import win32con
|
|
9
9
|
import win32gui
|
|
10
10
|
from PySide2.QtWinExtras import QtWin
|
|
11
|
+
from PySide2.QtGui import QColor
|
|
11
12
|
|
|
12
13
|
from .c_structures import (ACCENT_POLICY, ACCENT_STATE, DWMNCRENDERINGPOLICY,
|
|
13
14
|
DWMWINDOWATTRIBUTE, MARGINS,
|
|
@@ -78,6 +79,44 @@ class WindowsWindowEffect:
|
|
|
78
79
|
self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value
|
|
79
80
|
self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))
|
|
80
81
|
|
|
82
|
+
def setBorderAccentColor(self, hWnd, color: QColor):
|
|
83
|
+
""" Set the border color of the window
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
hWnd: int or `sip.voidptr`
|
|
88
|
+
Window handle
|
|
89
|
+
|
|
90
|
+
color: QColor
|
|
91
|
+
Border Accent color
|
|
92
|
+
"""
|
|
93
|
+
if not isGreaterEqualWin11():
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
hWnd = int(hWnd)
|
|
97
|
+
colorref = DWORD(color.red() | (color.green() << 8) | (color.blue() << 16))
|
|
98
|
+
self.DwmSetWindowAttribute(hWnd,
|
|
99
|
+
DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR.value,
|
|
100
|
+
byref(colorref),
|
|
101
|
+
4)
|
|
102
|
+
|
|
103
|
+
def removeBorderAccentColor(self, hWnd):
|
|
104
|
+
""" Remove the border color of the window
|
|
105
|
+
|
|
106
|
+
Parameters
|
|
107
|
+
----------
|
|
108
|
+
hWnd: int or `sip.voidptr`
|
|
109
|
+
Window handle
|
|
110
|
+
"""
|
|
111
|
+
if not isGreaterEqualWin11():
|
|
112
|
+
return
|
|
113
|
+
|
|
114
|
+
hWnd = int(hWnd)
|
|
115
|
+
self.DwmSetWindowAttribute(hWnd,
|
|
116
|
+
DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR.value,
|
|
117
|
+
byref(DWORD(0xFFFFFFFF)),
|
|
118
|
+
4)
|
|
119
|
+
|
|
81
120
|
def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):
|
|
82
121
|
""" Add the mica effect to the window (Win11 only)
|
|
83
122
|
|
|
@@ -97,7 +136,8 @@ class WindowsWindowEffect:
|
|
|
97
136
|
return
|
|
98
137
|
|
|
99
138
|
hWnd = int(hWnd)
|
|
100
|
-
|
|
139
|
+
# fix issue #125
|
|
140
|
+
margins = MARGINS(16777215, 16777215, 0, 0)
|
|
101
141
|
self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))
|
|
102
142
|
|
|
103
143
|
self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value
|
|
@@ -111,9 +151,9 @@ class WindowsWindowEffect:
|
|
|
111
151
|
if sys.getwindowsversion().build < 22523:
|
|
112
152
|
self.DwmSetWindowAttribute(hWnd, 1029, byref(c_int(1)), 4)
|
|
113
153
|
else:
|
|
114
|
-
self.DwmSetWindowAttribute(hWnd,
|
|
154
|
+
self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE.value, byref(c_int(4 if isAlt else 2)), 4)
|
|
115
155
|
|
|
116
|
-
self.DwmSetWindowAttribute(hWnd,
|
|
156
|
+
self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE.value, byref(c_int(1*isDarkMode)), 4)
|
|
117
157
|
|
|
118
158
|
def setAeroEffect(self, hWnd):
|
|
119
159
|
""" 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
|
{pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/_rc/__init__.py
RENAMED
|
File without changes
|
{pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/_rc/resource.py
RENAMED
|
File without changes
|
{pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/linux/__init__.py
RENAMED
|
File without changes
|
{pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/mac/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyside2_frameless_window-0.6.0 → pyside2_frameless_window-0.7.2}/qframelesswindow/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|