PyQt6-Frameless-Window 0.7.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.
Files changed (27) hide show
  1. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PKG-INFO +1 -1
  2. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PyQt6_Frameless_Window.egg-info/PKG-INFO +1 -1
  3. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/__init__.py +1 -1
  4. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/titlebar/__init__.py +2 -9
  5. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/utils/__init__.py +11 -0
  6. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/utils/linux_utils.py +7 -0
  7. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/utils/mac_utils.py +7 -0
  8. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/utils/win32_utils.py +17 -1
  9. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/windows/__init__.py +9 -9
  10. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/setup.py +1 -1
  11. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/LICENSE +0 -0
  12. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PyQt6_Frameless_Window.egg-info/SOURCES.txt +0 -0
  13. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PyQt6_Frameless_Window.egg-info/dependency_links.txt +0 -0
  14. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PyQt6_Frameless_Window.egg-info/requires.txt +0 -0
  15. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/PyQt6_Frameless_Window.egg-info/top_level.txt +0 -0
  16. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/README.md +0 -0
  17. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/_rc/__init__.py +0 -0
  18. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/_rc/resource.py +0 -0
  19. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/linux/__init__.py +0 -0
  20. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/linux/window_effect.py +0 -0
  21. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/mac/__init__.py +0 -0
  22. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/mac/window_effect.py +0 -0
  23. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/titlebar/title_bar_buttons.py +0 -0
  24. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/webengine/__init__.py +0 -0
  25. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/windows/c_structures.py +0 -0
  26. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/qframelesswindow/windows/window_effect.py +0 -0
  27. {pyqt6_frameless_window-0.7.0 → pyqt6_frameless_window-0.7.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQt6-Frameless-Window
3
- Version: 0.7.0
3
+ Version: 0.7.2
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyQt6-Frameless-Window
3
- Version: 0.7.0
3
+ Version: 0.7.2
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
@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/
12
12
  :license: GPLv3, see LICENSE for more details.
13
13
  """
14
14
 
15
- __version__ = "0.7.0"
15
+ __version__ = "0.7.2"
16
16
  __author__ = "zhiyiYo"
17
17
 
18
18
  import sys
@@ -5,7 +5,7 @@ from PyQt6.QtCore import Qt, QEvent
5
5
  from PyQt6.QtGui import QIcon
6
6
  from PyQt6.QtWidgets import QLabel, QHBoxLayout, QWidget
7
7
 
8
- from ..utils import startSystemMove
8
+ from ..utils import startSystemMove, toggleMaxState
9
9
  from .title_bar_buttons import (CloseButton, MaximizeButton, MinimizeButton,
10
10
  SvgTitleBarButton, TitleBarButton)
11
11
 
@@ -60,14 +60,7 @@ class TitleBarBase(QWidget):
60
60
 
61
61
  def __toggleMaxState(self):
62
62
  """ Toggles the maximization state of the window and change icon """
63
- if self.window().isMaximized():
64
- self.window().showNormal()
65
- else:
66
- self.window().showMaximized()
67
-
68
- if sys.platform == "win32":
69
- from ..utils.win32_utils import releaseMouseLeftButton
70
- releaseMouseLeftButton(self.window().winId())
63
+ toggleMaxState(self.window())
71
64
 
72
65
  def _isDragRegion(self, pos):
73
66
  """ Check whether the position belongs to the area where dragging is allowed """
@@ -29,6 +29,17 @@ def startSystemMove(window, globalPos):
29
29
  MoveResize.startSystemMove(window, globalPos)
30
30
 
31
31
 
32
+ def toggleMaxState(window):
33
+ """toggle maximized state of window
34
+
35
+ Parameters
36
+ ----------
37
+ window: QWidget
38
+ the window to be toggled
39
+ """
40
+ MoveResize.toggleMaxState(window)
41
+
42
+
32
43
  def starSystemResize(window, globalPos, edges):
33
44
  """ resize window
34
45
 
@@ -29,6 +29,13 @@ class LinuxMoveResize:
29
29
  """
30
30
  window.windowHandle().startSystemResize(edges)
31
31
 
32
+ @classmethod
33
+ def toggleMaxState(cls, window):
34
+ if window.isMaximized():
35
+ window.showNormal()
36
+ else:
37
+ window.showMaximized()
38
+
32
39
 
33
40
  def getSystemAccentColor():
34
41
  """ get the accent color of system
@@ -60,6 +60,13 @@ class MacMoveResize:
60
60
  """
61
61
  pass
62
62
 
63
+ @classmethod
64
+ def toggleMaxState(cls, window):
65
+ if window.isMaximized():
66
+ window.showNormal()
67
+ else:
68
+ window.showMaximized()
69
+
63
70
 
64
71
  def getNSWindow(winId):
65
72
  """ convert window handle to NSWindow
@@ -10,10 +10,11 @@ import win32api
10
10
  import win32con
11
11
  import win32gui
12
12
  import win32print
13
- from PyQt6.QtCore import QOperatingSystemVersion, QObject, QEvent
13
+ from PyQt6.QtCore import QOperatingSystemVersion, QObject, QEvent, qVersion
14
14
  from PyQt6.QtGui import QGuiApplication, QColor
15
15
  from PyQt6.QtWidgets import QWidget
16
16
  from win32comext.shell import shellcon
17
+ QT_VERSION = tuple(int(v) for v in qVersion().split('.'))
17
18
 
18
19
 
19
20
  def getSystemAccentColor():
@@ -369,6 +370,21 @@ class WindowsMoveResize:
369
370
  """
370
371
  pass
371
372
 
373
+ @classmethod
374
+ def toggleMaxState(cls, window):
375
+ if QT_VERSION < (6, 8, 0):
376
+ if window.isMaximized():
377
+ window.showNormal()
378
+ else:
379
+ window.showMaximized()
380
+ else:
381
+ if window.isMaximized():
382
+ win32gui.PostMessage(int(window.winId()), win32con.WM_SYSCOMMAND, win32con.SC_RESTORE, 0)
383
+ else:
384
+ win32gui.PostMessage(int(window.winId()), win32con.WM_SYSCOMMAND, win32con.SC_MAXIMIZE, 0)
385
+
386
+ releaseMouseLeftButton(window.winId())
387
+
372
388
 
373
389
  class WindowsScreenCaptureFilter(QObject):
374
390
  """ Filter for screen capture """
@@ -116,18 +116,18 @@ class WindowsFramelessWindow(QWidget):
116
116
  return False, 0
117
117
 
118
118
  if msg.message == win32con.WM_NCHITTEST and self._isResizeEnabled:
119
- pos = QCursor.pos()
120
- xPos = pos.x() - self.x()
121
- yPos = pos.y() - self.y()
122
- w = self.frameGeometry().width()
123
- h = self.frameGeometry().height()
119
+ xPos, yPos = win32gui.ScreenToClient(msg.hWnd, (msg.lParam & 65535, msg.lParam >> 16))
120
+ clientRect = win32gui.GetClientRect(msg.hWnd)
121
+
122
+ w = clientRect[2] - clientRect[0]
123
+ h = clientRect[3] - clientRect[1]
124
124
 
125
125
  # fixes https://github.com/zhiyiYo/PyQt-Frameless-Window/issues/98
126
126
  bw = 0 if win_utils.isMaximized(msg.hWnd) or win_utils.isFullScreen(msg.hWnd) else self.BORDER_WIDTH
127
- lx = xPos < bw
128
- rx = xPos > w - bw
129
- ty = yPos < bw
130
- by = yPos > h - bw
127
+ lx = xPos < bw # left
128
+ rx = xPos > w - bw # right
129
+ ty = yPos < bw # top
130
+ by = yPos > h - bw # bottom
131
131
  if lx and ty:
132
132
  return True, win32con.HTTOPLEFT
133
133
  elif rx and by:
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
6
6
 
7
7
  setuptools.setup(
8
8
  name="PyQt6-Frameless-Window",
9
- version="0.7.0",
9
+ version="0.7.2",
10
10
  keywords="pyqt6 frameless",
11
11
  author="zhiyiYo",
12
12
  author_email="shokokawaii@outlook.com",