PySide2-Frameless-Window 0.7.4__tar.gz → 0.8.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.
Files changed (27) hide show
  1. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PKG-INFO +1 -1
  2. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PySide2_Frameless_Window.egg-info/PKG-INFO +1 -1
  3. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/__init__.py +1 -1
  4. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/linux/__init__.py +4 -0
  5. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/linux/window_effect.py +27 -0
  6. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/mac/__init__.py +4 -0
  7. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/mac/window_effect.py +27 -0
  8. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/windows/__init__.py +15 -1
  9. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/windows/c_structures.py +10 -1
  10. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/windows/window_effect.py +40 -1
  11. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/setup.py +1 -1
  12. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/LICENSE +0 -0
  13. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PySide2_Frameless_Window.egg-info/SOURCES.txt +0 -0
  14. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PySide2_Frameless_Window.egg-info/dependency_links.txt +0 -0
  15. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PySide2_Frameless_Window.egg-info/requires.txt +0 -0
  16. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/PySide2_Frameless_Window.egg-info/top_level.txt +0 -0
  17. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/README.md +0 -0
  18. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/_rc/__init__.py +0 -0
  19. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/_rc/resource.py +0 -0
  20. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/titlebar/__init__.py +0 -0
  21. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/titlebar/title_bar_buttons.py +0 -0
  22. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/utils/__init__.py +0 -0
  23. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/utils/linux_utils.py +0 -0
  24. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/utils/mac_utils.py +0 -0
  25. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/utils/win32_utils.py +0 -0
  26. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/qframelesswindow/webengine/__init__.py +0 -0
  27. {pyside2_frameless_window-0.7.4 → pyside2_frameless_window-0.8.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySide2-Frameless-Window
3
- Version: 0.7.4
3
+ Version: 0.8.0
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.7.4
3
+ Version: 0.8.0
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
@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/
12
12
  :license: LGPLv3, see LICENSE for more details.
13
13
  """
14
14
 
15
- __version__ = "0.7.4"
15
+ __version__ = "0.8.0"
16
16
  __author__ = "zhiyiYo"
17
17
 
18
18
  import sys
@@ -34,6 +34,10 @@ class LinuxFramelessWindow(QWidget):
34
34
  super().resizeEvent(e)
35
35
  self.titleBar.resize(self.width(), self.titleBar.height())
36
36
 
37
+ def refreshBackgroundBlurEffect(self):
38
+ """ Refresh background blur effect """
39
+ pass
40
+
37
41
  def setStayOnTop(self, isTop: bool):
38
42
  """ set the stay on top status """
39
43
  if isTop:
@@ -157,3 +157,30 @@ class LinuxWindowEffect:
157
157
  hWnd : int or `sip.voidptr`
158
158
  Window handle
159
159
  """
160
+
161
+ def enableBlurBehindWindow(self, hWnd):
162
+ """ enable the blur effect behind the whole client
163
+
164
+ Parameters
165
+ ----------
166
+ hWnd: int or `sip.voidptr`
167
+ Window handle
168
+ """
169
+
170
+ def removeWindowAnimation(self, hWnd):
171
+ """ Disables maximize and minimize animation of the window by removing the relevant window styles.
172
+
173
+ Parameters
174
+ ----------
175
+ hWnd: int or `sip.voidptr`
176
+ Window handle
177
+ """
178
+
179
+ def disableBlurBehindWindow(self, hWnd):
180
+ """ disable the blur effect behind the whole client
181
+
182
+ Parameters
183
+ ----------
184
+ hWnd: int or `sip.voidptr`
185
+ Window handle
186
+ """
@@ -168,6 +168,10 @@ class MacFramelessWindow(QWidget):
168
168
  """
169
169
  return QRect(0, 0, 75, size.height())
170
170
 
171
+ def refreshBackgroundBlurEffect(self):
172
+ """ Refresh background blur effect """
173
+ pass
174
+
171
175
 
172
176
  class AcrylicWindow(MacFramelessWindow):
173
177
  """ A frameless window with acrylic effect """
@@ -185,3 +185,30 @@ class MacWindowEffect:
185
185
  hWnd : int or `sip.voidptr`
186
186
  Window handle
187
187
  """
188
+
189
+ def enableBlurBehindWindow(self, hWnd):
190
+ """ enable the blur effect behind the whole client
191
+
192
+ Parameters
193
+ ----------
194
+ hWnd: int or `sip.voidptr`
195
+ Window handle
196
+ """
197
+
198
+ def removeWindowAnimation(self, hWnd):
199
+ """ Disables maximize and minimize animation of the window by removing the relevant window styles.
200
+
201
+ Parameters
202
+ ----------
203
+ hWnd: int or `sip.voidptr`
204
+ Window handle
205
+ """
206
+
207
+ def disableBlurBehindWindow(self, hWnd):
208
+ """ disable the blur effect behind the whole client
209
+
210
+ Parameters
211
+ ----------
212
+ hWnd: int or `sip.voidptr`
213
+ Window handle
214
+ """
@@ -6,7 +6,7 @@ from ctypes.wintypes import LPRECT, MSG
6
6
  import win32api
7
7
  import win32con
8
8
  import win32gui
9
- from PySide2.QtCore import Qt, QSize, QRect
9
+ from PySide2.QtCore import Qt, QSize, QRect, QEvent
10
10
  from PySide2.QtGui import QCloseEvent, QCursor
11
11
  from PySide2.QtWidgets import QApplication, QWidget
12
12
  from PySide2.QtWinExtras import QtWin
@@ -57,6 +57,13 @@ class WindowsFramelessWindow(QWidget):
57
57
  if not isinstance(self, AcrylicWindow):
58
58
  self.windowEffect.addShadowEffect(self.winId())
59
59
 
60
+ def refreshBackgroundBlurEffect(self):
61
+ """ Refresh background blur effect """
62
+ self.windowEffect.disableBlurBehindWindow(self.winId())
63
+ self.windowEffect.removeWindowAnimation(self.winId())
64
+ self.windowEffect.enableBlurBehindWindow(self.winId())
65
+ self.windowEffect.addWindowAnimation(self.winId())
66
+
60
67
  def setTitleBar(self, titleBar):
61
68
  """ set custom title bar
62
69
 
@@ -243,6 +250,13 @@ class AcrylicWindow(WindowsFramelessWindow):
243
250
 
244
251
  return super().nativeEvent(eventType, message)
245
252
 
253
+ def event(self, e: QEvent):
254
+ if e.type() == QEvent.Type.WindowStateChange:
255
+ if win_utils.isMaximized(self.winId()):
256
+ self.refreshBackgroundBlurEffect()
257
+
258
+ return super().event(e)
259
+
246
260
  def closeEvent(self, e):
247
261
  if not self.__closedByKey or QApplication.quitOnLastWindowClosed():
248
262
  self.__closedByKey = False
@@ -1,6 +1,6 @@
1
1
  # coding:utf-8
2
2
  from ctypes import POINTER, Structure, c_int
3
- from ctypes.wintypes import DWORD, HWND, ULONG, POINT, RECT, UINT
3
+ from ctypes.wintypes import DWORD, HWND, ULONG, POINT, RECT, UINT, BOOL, HRGN
4
4
  from enum import Enum
5
5
 
6
6
 
@@ -142,4 +142,13 @@ class NCCALCSIZE_PARAMS(Structure):
142
142
  ]
143
143
 
144
144
 
145
+ class DWM_BLURBEHIND(Structure):
146
+ _fields_ = [
147
+ ('dwFlags', DWORD),
148
+ ('fEnable', BOOL),
149
+ ('hRgnBlur', HRGN),
150
+ ('fTransitionOnMaximized', BOOL),
151
+ ]
152
+
153
+
145
154
  LPNCCALCSIZE_PARAMS = POINTER(NCCALCSIZE_PARAMS)
@@ -13,7 +13,7 @@ from PySide2.QtGui import QColor
13
13
  from .c_structures import (ACCENT_POLICY, ACCENT_STATE, DWMNCRENDERINGPOLICY,
14
14
  DWMWINDOWATTRIBUTE, MARGINS,
15
15
  WINDOWCOMPOSITIONATTRIB,
16
- WINDOWCOMPOSITIONATTRIBDATA)
16
+ WINDOWCOMPOSITIONATTRIBDATA, DWM_BLURBEHIND)
17
17
  from ..utils.win32_utils import isGreaterEqualWin10, isGreaterEqualWin11
18
18
 
19
19
 
@@ -28,9 +28,12 @@ class WindowsWindowEffect:
28
28
  self.dwmapi = WinDLL("dwmapi")
29
29
  self.SetWindowCompositionAttribute = self.user32.SetWindowCompositionAttribute
30
30
  self.DwmExtendFrameIntoClientArea = self.dwmapi.DwmExtendFrameIntoClientArea
31
+ self.DwmEnableBlurBehindWindow = self.dwmapi.DwmEnableBlurBehindWindow
31
32
  self.DwmSetWindowAttribute = self.dwmapi.DwmSetWindowAttribute
33
+
32
34
  self.SetWindowCompositionAttribute.restype = c_bool
33
35
  self.DwmExtendFrameIntoClientArea.restype = LONG
36
+ self.DwmEnableBlurBehindWindow.restype = LONG
34
37
  self.DwmSetWindowAttribute.restype = LONG
35
38
  self.SetWindowCompositionAttribute.argtypes = [
36
39
  c_int,
@@ -38,6 +41,7 @@ class WindowsWindowEffect:
38
41
  ]
39
42
  self.DwmSetWindowAttribute.argtypes = [c_int, DWORD, LPCVOID, DWORD]
40
43
  self.DwmExtendFrameIntoClientArea.argtypes = [c_int, POINTER(MARGINS)]
44
+ self.DwmEnableBlurBehindWindow.argtypes = [c_int, POINTER(DWM_BLURBEHIND)]
41
45
 
42
46
  # Initialize structure
43
47
  self.accentPolicy = ACCENT_POLICY()
@@ -299,3 +303,38 @@ class WindowsWindowEffect:
299
303
  | win32con.CS_DBLCLKS
300
304
  | win32con.WS_THICKFRAME,
301
305
  )
306
+
307
+ def enableBlurBehindWindow(self, hWnd):
308
+ """ enable the blur effect behind the whole client
309
+
310
+ Parameters
311
+ ----------
312
+ hWnd: int or `sip.voidptr`
313
+ Window handle
314
+ """
315
+ blurBehind = DWM_BLURBEHIND(1, True, 0, False)
316
+ self.DwmEnableBlurBehindWindow(int(hWnd), byref(blurBehind))
317
+
318
+ def removeWindowAnimation(self, hWnd):
319
+ """ Disables maximize and minimize animation of the window by removing the relevant window styles. """
320
+ hWnd = int(hWnd)
321
+ style = win32gui.GetWindowLong(hWnd, win32con.GWL_STYLE)
322
+ style &= ~win32con.WS_MINIMIZEBOX
323
+ style &= ~win32con.WS_MAXIMIZEBOX
324
+ style &= ~win32con.WS_CAPTION
325
+ style &= ~win32con.WS_THICKFRAME
326
+ win32gui.SetWindowLong(hWnd, win32con.GWL_STYLE, style)
327
+ win32gui.SetWindowPos(hWnd, None, 0, 0, 0, 0,
328
+ win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_NOZORDER |
329
+ win32con.SWP_FRAMECHANGED)
330
+
331
+ def disableBlurBehindWindow(self, hWnd):
332
+ """ disable the blur effect behind the whole client
333
+
334
+ Parameters
335
+ ----------
336
+ hWnd: int or `sip.voidptr`
337
+ Window handle
338
+ """
339
+ blurBehind = DWM_BLURBEHIND(1, False, 0, False)
340
+ self.DwmEnableBlurBehindWindow(int(hWnd), byref(blurBehind))
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
6
6
 
7
7
  setuptools.setup(
8
8
  name="PySide2-Frameless-Window",
9
- version="0.7.4",
9
+ version="0.8.0",
10
10
  keywords="pyside2 frameless",
11
11
  author="zhiyiYo",
12
12
  author_email="shokokawaii@outlook.com",