QtFramelessWindow 0.0.1__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.
- qtframelesswindow-0.0.1/LICENSE +165 -0
- qtframelesswindow-0.0.1/PKG-INFO +151 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/__init__.py +52 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/_rc/__init__.py +0 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/_rc/resource.py +74 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/linux/__init__.py +125 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/linux/window_effect.py +188 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/mac/__init__.py +200 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/mac/window_effect.py +217 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/titlebar/__init__.py +151 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/titlebar/title_bar_buttons.py +307 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/utils/__init__.py +57 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/utils/linux_utils.py +67 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/utils/mac_utils.py +121 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/utils/win32_utils.py +414 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/webengine/__init__.py +23 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/windows/__init__.py +264 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/windows/c_structures.py +153 -0
- qtframelesswindow-0.0.1/QtFramelessWindow/windows/window_effect.py +341 -0
- qtframelesswindow-0.0.1/QtFramelessWindow.egg-info/PKG-INFO +151 -0
- qtframelesswindow-0.0.1/QtFramelessWindow.egg-info/SOURCES.txt +25 -0
- qtframelesswindow-0.0.1/QtFramelessWindow.egg-info/dependency_links.txt +1 -0
- qtframelesswindow-0.0.1/QtFramelessWindow.egg-info/requires.txt +8 -0
- qtframelesswindow-0.0.1/QtFramelessWindow.egg-info/top_level.txt +1 -0
- qtframelesswindow-0.0.1/README.md +121 -0
- qtframelesswindow-0.0.1/setup.cfg +4 -0
- qtframelesswindow-0.0.1/setup.py +30 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: QtFramelessWindow
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A cross-platform frameless window based on PyQt/PySide, support Win32, macOS and Linux.
|
|
5
|
+
Home-page: https://github.com/XiaoshuDeXiaowo/QtFramelessWindow
|
|
6
|
+
Author: zhiyiYo, XiaoshuDeXiaowo
|
|
7
|
+
Author-email: shokokawaii@outlook.com, xiaoshu312@xiaoshu312.top
|
|
8
|
+
License: LGPLv3
|
|
9
|
+
Keywords: pyqt pyside frameless
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: qtpy
|
|
16
|
+
Requires-Dist: pywin32; platform_system == "Windows"
|
|
17
|
+
Requires-Dist: pyobjc; platform_system == "Darwin"
|
|
18
|
+
Requires-Dist: PyCocoa; platform_system == "Darwin"
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: keywords
|
|
26
|
+
Dynamic: license
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
Dynamic: requires-dist
|
|
29
|
+
Dynamic: summary
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img width="15%" align="center" src="https://raw.githubusercontent/XiaoshuDeXiaowo/QtFramelessWindow/main/screenshot/logo.png" alt="logo">
|
|
33
|
+
</p>
|
|
34
|
+
<h1 align="center">
|
|
35
|
+
QtFramelessWindow
|
|
36
|
+
</h1>
|
|
37
|
+
<p align="center">
|
|
38
|
+
A cross-platform frameless window library based on QtPy (PyQt/PySide).
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<a style="text-decoration:none">
|
|
45
|
+
<img src="https://img.shields.io/badge/Platform-Win32%20|%20macOS%20|%20Linux-blue?color=#4ec820" alt="Platform Win32 | Linux | macOS"/>
|
|
46
|
+
</a>
|
|
47
|
+
<a style="text-decoration:none">
|
|
48
|
+
<img src="https://static.pepy.tech/personalized-badge/qtframelesswindow?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads" alt="Download"/>
|
|
49
|
+
</a>
|
|
50
|
+
<a style="text-decoration:none">
|
|
51
|
+
<img src="https://img.shields.io/badge/License-LGPLv3-blue?color=#4ec820" alt="LGPLv3"/>
|
|
52
|
+
</a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
* Move
|
|
60
|
+
* Stretching
|
|
61
|
+
* Window shadow
|
|
62
|
+
* Window animation
|
|
63
|
+
* Win11 snap layout
|
|
64
|
+
* Win10 acrylic blur
|
|
65
|
+
* Win11 mica blur
|
|
66
|
+
* Win7 Aero blur
|
|
67
|
+
* MacOS blur
|
|
68
|
+
* Disable screen capture
|
|
69
|
+
|
|
70
|
+
## Install
|
|
71
|
+
To install use pip:
|
|
72
|
+
```shell
|
|
73
|
+
pip install QtFramelessWindow
|
|
74
|
+
```
|
|
75
|
+
Or clone the repo:
|
|
76
|
+
```shell
|
|
77
|
+
git clone https://github.com/XiaoshuDeXiaowo/QtFramelessWindow
|
|
78
|
+
cd QtFramelessWindow
|
|
79
|
+
pip install .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Requirements
|
|
83
|
+
|
|
84
|
+
| Platform | Requirement |
|
|
85
|
+
| :------: | :---------: |
|
|
86
|
+
| Win32 | pywin32 |
|
|
87
|
+
| MacOS | pyobjc |
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
To use the frameless window, you only need to inherit `FramelessWindow`. Here is a minimal example:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
import sys
|
|
94
|
+
|
|
95
|
+
from PySide2.QtWidgets import QApplication
|
|
96
|
+
from QtFramelessWindow import FramelessWindow
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Window(FramelessWindow):
|
|
100
|
+
|
|
101
|
+
def __init__(self, parent=None):
|
|
102
|
+
super().__init__(parent=parent)
|
|
103
|
+
self.setWindowTitle("PyQt-Frameless-Window")
|
|
104
|
+
self.titleBar.raise_()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if __name__ == '__main__':
|
|
108
|
+
app = QApplication(sys.argv)
|
|
109
|
+
demo = Window()
|
|
110
|
+
demo.show()
|
|
111
|
+
sys.exit(app.exec_())
|
|
112
|
+
```
|
|
113
|
+
For more complex requirements, see [examples](https://github.com/XiaoshuDeXiaowo/QtFramelessWindow/blob/master/examples).
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
* Normal frameless window
|
|
117
|
+

|
|
118
|
+
* Acrylic frameless window
|
|
119
|
+

|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
<!--## Document
|
|
123
|
+
Want to know more about PySide2-Frameless-Window? Please read the [help document](https://pyqt-frameless-window.readthedocs.io/) 👈-->
|
|
124
|
+
|
|
125
|
+
## Notes
|
|
126
|
+
1. `FramelessWindow` provides a default custom title bar. If you don't like it, just rewrite it as [demo.py](https://raw.githubusercontent.com/XiaoshuDeXiaowo/QtFramelessWindow/main/examples/demo.py) does.
|
|
127
|
+
|
|
128
|
+
2. Moving the acrylic window on Win10 may get stuck. At present, there is no good solution. Maybe you can disable the acrylic effect when moving the window, but I haven't done this in the source code.
|
|
129
|
+
3. Snap layout is not enabled by default. See [zhiyiYo/PyQt-Frameless-Window#56](https://github.com/zhiyiYo/PyQt-Frameless-Window/issues/56) to learn how to enable it.
|
|
130
|
+
|
|
131
|
+
4. If you encounter this problem on Windows:
|
|
132
|
+
> ImportError: DLL load failed while importing win32api
|
|
133
|
+
|
|
134
|
+
see zhiyiYo's answer on [stackoverflow](https://stackoverflow.com/questions/58612306/how-to-fix-importerror-dll-load-failed-while-importing-win32api/72488468#72488468) or [blog](https://www.cnblogs.com/zhiyiYo/p/16340429.html) for the solution.
|
|
135
|
+
|
|
136
|
+
## See Also
|
|
137
|
+
Here are some projects that use PyQt-Frameless-Window:
|
|
138
|
+
* [**zhiyiYo/QFluentWidgets**: A fluent design widgets library based on Qt](https://qfluentwidgets.com)
|
|
139
|
+
* [**zhiyiYo/Groove**: A cross-platform music player based on PyQt5](https://github.com/zhiyiYo/Groove)
|
|
140
|
+
* [**zhiyiYo/Alpha-Gobang-Zero**: A gobang robot based on reinforcement learning](https://github.com/zhiyiYo/Alpha-Gobang-Zero)
|
|
141
|
+
|
|
142
|
+
## Reference
|
|
143
|
+
* [**zhiyiYo/PyQt-Frameless-Window**:A cross-platform frameless window based on PyQt/PySide, support Win32, Linux and macOS.](https://github.com/zhiyiYo/PyQt-Frameless-Window)
|
|
144
|
+
* [**wangwenx190/framelesshelper**: Frameless windows for Qt Widgets and Qt Quick applications. Support Win32, X11, Wayland and macOS](https://github.com/wangwenx190/framelesshelper)
|
|
145
|
+
* [**libxcb**: Basic Graphics Programming With The XCB Library](https://www.x.org/releases/X11R7.5/doc/libxcb/tutorial)
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
QtFramelessWindow is licensed under [LGPLv3](https://raw.githubusercontent.com/XiaoshuDeXiaowo/QtFramelessWindow/main/LICENSE).
|
|
149
|
+
|
|
150
|
+
Copyright © 2021-2026 by zhiyiYo.
|
|
151
|
+
Copyright © 2026 XiaoshuDeXiaowo.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QtFramelessWindow
|
|
3
|
+
======================
|
|
4
|
+
A cross-platform frameless window based on PyQt/PySide, support Win32, macOS and Linux.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Examples are available at https://github.com/XiaoshuDeXiaowo/QtFramelessWindow/tree/main/examples.
|
|
8
|
+
|
|
9
|
+
:copyright: Copyright (c) 2021-2026 by zhiyiYo. Copyright (c) 2026 XiaoshuDeXiaowo
|
|
10
|
+
:license: LGPLv3, see LICENSE for more details.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__version__ = "0.0.1"
|
|
14
|
+
__author__ = "zhiyiYo, XiaoshuDeXiaowo"
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
|
|
18
|
+
from qtpy.QtWidgets import QDialog, QMainWindow
|
|
19
|
+
|
|
20
|
+
from .titlebar import TitleBar, TitleBarButton, SvgTitleBarButton, StandardTitleBar, TitleBarBase
|
|
21
|
+
|
|
22
|
+
if sys.platform == "win32":
|
|
23
|
+
from .windows import AcrylicWindow
|
|
24
|
+
from .windows import WindowsFramelessWindow as FramelessWindow
|
|
25
|
+
from .windows import WindowsWindowEffect as WindowEffect
|
|
26
|
+
elif sys.platform == "darwin":
|
|
27
|
+
from .mac import AcrylicWindow
|
|
28
|
+
from .mac import MacFramelessWindow as FramelessWindow
|
|
29
|
+
from .mac import MacWindowEffect as WindowEffect
|
|
30
|
+
else:
|
|
31
|
+
from .linux import LinuxFramelessWindow as FramelessWindow
|
|
32
|
+
from .linux import LinuxWindowEffect as WindowEffect
|
|
33
|
+
|
|
34
|
+
AcrylicWindow = FramelessWindow
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class FramelessDialog(QDialog, FramelessWindow):
|
|
38
|
+
""" Frameless dialog """
|
|
39
|
+
|
|
40
|
+
def __init__(self, parent=None):
|
|
41
|
+
super().__init__(parent)
|
|
42
|
+
self.titleBar.minBtn.hide()
|
|
43
|
+
self.titleBar.maxBtn.hide()
|
|
44
|
+
self.titleBar.setDoubleClickEnabled(False)
|
|
45
|
+
self.windowEffect.disableMaximizeButton(self.winId())
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class FramelessMainWindow(QMainWindow, FramelessWindow):
|
|
49
|
+
""" Frameless main window """
|
|
50
|
+
|
|
51
|
+
def __init__(self, parent=None):
|
|
52
|
+
super().__init__(parent)
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Resource object code
|
|
4
|
+
#
|
|
5
|
+
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
|
|
6
|
+
#
|
|
7
|
+
# WARNING! All changes made in this file will be lost!
|
|
8
|
+
|
|
9
|
+
from qtpy import QtCore
|
|
10
|
+
|
|
11
|
+
qt_resource_data = b"\
|
|
12
|
+
\x00\x00\x01\x08\
|
|
13
|
+
\x3c\
|
|
14
|
+
\x73\x76\x67\x20\x77\x69\x64\x74\x68\x3d\x22\x34\x35\x70\x74\x22\
|
|
15
|
+
\x20\x68\x65\x69\x67\x68\x74\x3d\x22\x33\x30\x70\x74\x22\x20\x76\
|
|
16
|
+
\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\x31\x22\x20\x76\x69\x65\
|
|
17
|
+
\x77\x42\x6f\x78\x3d\x22\x30\x20\x30\x20\x31\x35\x2e\x38\x37\x35\
|
|
18
|
+
\x20\x31\x30\x2e\x35\x38\x33\x22\x20\x78\x6d\x6c\x6e\x73\x3d\x22\
|
|
19
|
+
\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x77\x33\x2e\x6f\x72\
|
|
20
|
+
\x67\x2f\x32\x30\x30\x30\x2f\x73\x76\x67\x22\x3e\x0a\x20\x3c\x67\
|
|
21
|
+
\x20\x66\x69\x6c\x6c\x3d\x22\x6e\x6f\x6e\x65\x22\x20\x73\x74\x72\
|
|
22
|
+
\x6f\x6b\x65\x3d\x22\x23\x30\x30\x30\x22\x20\x73\x74\x72\x6f\x6b\
|
|
23
|
+
\x65\x2d\x77\x69\x64\x74\x68\x3d\x22\x2e\x31\x37\x36\x33\x39\x22\
|
|
24
|
+
\x3e\x0a\x20\x20\x3c\x70\x61\x74\x68\x20\x64\x3d\x22\x6d\x36\x2e\
|
|
25
|
+
\x31\x32\x39\x35\x20\x33\x2e\x36\x36\x30\x31\x20\x33\x2e\x32\x36\
|
|
26
|
+
\x33\x32\x20\x33\x2e\x32\x36\x33\x32\x7a\x22\x2f\x3e\x0a\x20\x20\
|
|
27
|
+
\x3c\x70\x61\x74\x68\x20\x64\x3d\x22\x6d\x39\x2e\x33\x39\x32\x37\
|
|
28
|
+
\x20\x33\x2e\x36\x36\x30\x31\x2d\x33\x2e\x32\x36\x33\x32\x20\x33\
|
|
29
|
+
\x2e\x32\x36\x33\x32\x7a\x22\x2f\x3e\x0a\x20\x3c\x2f\x67\x3e\x0a\
|
|
30
|
+
\x3c\x2f\x73\x76\x67\x3e\x0a\
|
|
31
|
+
"
|
|
32
|
+
|
|
33
|
+
qt_resource_name = b"\
|
|
34
|
+
\x00\x11\
|
|
35
|
+
\x09\xc6\x24\x07\
|
|
36
|
+
\x00\x51\
|
|
37
|
+
\x00\x74\x00\x46\x00\x72\x00\x61\x00\x6d\x00\x65\x00\x6c\x00\x65\x00\x73\x00\x73\x00\x57\x00\x69\x00\x6e\x00\x64\x00\x6f\x00\x77\
|
|
38
|
+
\
|
|
39
|
+
\x00\x09\
|
|
40
|
+
\x06\x98\x8e\xa7\
|
|
41
|
+
\x00\x63\
|
|
42
|
+
\x00\x6c\x00\x6f\x00\x73\x00\x65\x00\x2e\x00\x73\x00\x76\x00\x67\
|
|
43
|
+
"
|
|
44
|
+
|
|
45
|
+
qt_resource_struct_v1 = b"\
|
|
46
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
|
47
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
|
48
|
+
\x00\x00\x00\x28\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
49
|
+
"
|
|
50
|
+
|
|
51
|
+
qt_resource_struct_v2 = b"\
|
|
52
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
|
53
|
+
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
54
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
|
55
|
+
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
56
|
+
\x00\x00\x00\x28\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
57
|
+
\x00\x00\x01\x9d\x0e\x20\x0d\xf8\
|
|
58
|
+
"
|
|
59
|
+
|
|
60
|
+
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
|
|
61
|
+
if qt_version < [5, 8, 0]:
|
|
62
|
+
rcc_version = 1
|
|
63
|
+
qt_resource_struct = qt_resource_struct_v1
|
|
64
|
+
else:
|
|
65
|
+
rcc_version = 2
|
|
66
|
+
qt_resource_struct = qt_resource_struct_v2
|
|
67
|
+
|
|
68
|
+
def qInitResources():
|
|
69
|
+
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
70
|
+
|
|
71
|
+
def qCleanupResources():
|
|
72
|
+
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
73
|
+
|
|
74
|
+
qInitResources()
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from qtpy.QtCore import QCoreApplication, QEvent, Qt, QSize, QRect
|
|
3
|
+
from qtpy.QtGui import QMouseEvent
|
|
4
|
+
from qtpy.QtWidgets import QWidget
|
|
5
|
+
|
|
6
|
+
from ..titlebar import TitleBar
|
|
7
|
+
from ..utils.linux_utils import LinuxMoveResize
|
|
8
|
+
from .window_effect import LinuxWindowEffect
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LinuxFramelessWindow(QWidget):
|
|
12
|
+
""" Frameless window for Linux system """
|
|
13
|
+
|
|
14
|
+
BORDER_WIDTH = 5
|
|
15
|
+
|
|
16
|
+
def __init__(self, parent=None):
|
|
17
|
+
super().__init__(parent=parent)
|
|
18
|
+
self.windowEffect = LinuxWindowEffect(self)
|
|
19
|
+
self.titleBar = TitleBar(self)
|
|
20
|
+
self._isSystemButtonVisible = False
|
|
21
|
+
self._isResizeEnabled = True
|
|
22
|
+
|
|
23
|
+
self.updateFrameless()
|
|
24
|
+
QCoreApplication.instance().installEventFilter(self)
|
|
25
|
+
|
|
26
|
+
self.titleBar.raise_()
|
|
27
|
+
self.resize(500, 500)
|
|
28
|
+
|
|
29
|
+
def resizeEvent(self, e):
|
|
30
|
+
super().resizeEvent(e)
|
|
31
|
+
self.titleBar.resize(self.width(), self.titleBar.height())
|
|
32
|
+
|
|
33
|
+
def updateFrameless(self):
|
|
34
|
+
self.setWindowFlags(self.windowFlags() | Qt.WindowType.FramelessWindowHint)
|
|
35
|
+
|
|
36
|
+
def refreshBackgroundBlurEffect(self):
|
|
37
|
+
""" Refresh background blur effect """
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
def setStayOnTop(self, isTop: bool):
|
|
41
|
+
""" set the stay on top status """
|
|
42
|
+
if isTop:
|
|
43
|
+
self.setWindowFlags(self.windowFlags() | Qt.WindowType.WindowStaysOnTopHint)
|
|
44
|
+
else:
|
|
45
|
+
self.setWindowFlags(self.windowFlags() & ~Qt.WindowType.WindowStaysOnTopHint)
|
|
46
|
+
|
|
47
|
+
self.updateFrameless()
|
|
48
|
+
self.show()
|
|
49
|
+
|
|
50
|
+
def toggleStayOnTop(self):
|
|
51
|
+
""" toggle the stay on top status """
|
|
52
|
+
if self.windowFlags() & Qt.WindowType.WindowStaysOnTopHint:
|
|
53
|
+
self.setStayOnTop(False)
|
|
54
|
+
else:
|
|
55
|
+
self.setStayOnTop(True)
|
|
56
|
+
|
|
57
|
+
def setTitleBar(self, titleBar):
|
|
58
|
+
""" set custom title bar
|
|
59
|
+
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
titleBar: TitleBar
|
|
63
|
+
title bar
|
|
64
|
+
"""
|
|
65
|
+
self.titleBar.deleteLater()
|
|
66
|
+
self.titleBar.hide()
|
|
67
|
+
self.titleBar = titleBar
|
|
68
|
+
self.titleBar.setParent(self)
|
|
69
|
+
self.titleBar.raise_()
|
|
70
|
+
|
|
71
|
+
def setResizeEnabled(self, isEnabled: bool):
|
|
72
|
+
""" set whether resizing is enabled """
|
|
73
|
+
self._isResizeEnabled = isEnabled
|
|
74
|
+
|
|
75
|
+
def isSystemButtonVisible(self):
|
|
76
|
+
""" Returns whether the system title bar button is visible """
|
|
77
|
+
return self._isSystemButtonVisible
|
|
78
|
+
|
|
79
|
+
def setSystemTitleBarButtonVisible(self, isVisible):
|
|
80
|
+
""" set the visibility of system title bar button, only works for macOS """
|
|
81
|
+
pass
|
|
82
|
+
|
|
83
|
+
def systemTitleBarRect(self, size: QSize) -> QRect:
|
|
84
|
+
""" Returns the system title bar rect, only works for macOS
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
size: QSize
|
|
89
|
+
original system title bar rect
|
|
90
|
+
"""
|
|
91
|
+
return QRect(0, 0, size.width(), size.height())
|
|
92
|
+
|
|
93
|
+
def eventFilter(self, obj, event):
|
|
94
|
+
et = event.type()
|
|
95
|
+
if et != QEvent.Type.MouseButtonPress and et != QEvent.Type.MouseMove or not self._isResizeEnabled:
|
|
96
|
+
return False
|
|
97
|
+
|
|
98
|
+
edges = Qt.Edge(0)
|
|
99
|
+
pos = event.globalPosition().toPoint() - self.pos()
|
|
100
|
+
if pos.x() < self.BORDER_WIDTH:
|
|
101
|
+
edges |= Qt.Edge.LeftEdge
|
|
102
|
+
if pos.x() >= self.width()-self.BORDER_WIDTH:
|
|
103
|
+
edges |= Qt.Edge.RightEdge
|
|
104
|
+
if pos.y() < self.BORDER_WIDTH:
|
|
105
|
+
edges |= Qt.Edge.TopEdge
|
|
106
|
+
if pos.y() >= self.height()-self.BORDER_WIDTH:
|
|
107
|
+
edges |= Qt.Edge.BottomEdge
|
|
108
|
+
|
|
109
|
+
# change cursor
|
|
110
|
+
if et == QEvent.Type.MouseMove and self.windowState() == Qt.WindowState.WindowNoState:
|
|
111
|
+
if edges in (Qt.Edge.LeftEdge | Qt.Edge.TopEdge, Qt.Edge.RightEdge | Qt.Edge.BottomEdge):
|
|
112
|
+
self.setCursor(Qt.CursorShape.SizeFDiagCursor)
|
|
113
|
+
elif edges in (Qt.Edge.RightEdge | Qt.Edge.TopEdge, Qt.Edge.LeftEdge | Qt.Edge.BottomEdge):
|
|
114
|
+
self.setCursor(Qt.CursorShape.SizeBDiagCursor)
|
|
115
|
+
elif edges in (Qt.Edge.TopEdge, Qt.Edge.BottomEdge):
|
|
116
|
+
self.setCursor(Qt.CursorShape.SizeVerCursor)
|
|
117
|
+
elif edges in (Qt.Edge.LeftEdge, Qt.Edge.RightEdge):
|
|
118
|
+
self.setCursor(Qt.CursorShape.SizeHorCursor)
|
|
119
|
+
else:
|
|
120
|
+
self.setCursor(Qt.CursorShape.ArrowCursor)
|
|
121
|
+
|
|
122
|
+
elif obj in (self, self.titleBar) and et == QEvent.Type.MouseButtonPress and edges:
|
|
123
|
+
LinuxMoveResize.starSystemResize(self, event.globalPosition(), edges)
|
|
124
|
+
|
|
125
|
+
return super().eventFilter(obj, event)
|