-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
167 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Created on 2024/04/26 | ||
@author: Irony | ||
@site: https://pyqt.site | https://github.com/PyQt5 | ||
@email: [email protected] | ||
@file: TestWigglyWidget.py | ||
@description: | ||
""" | ||
|
||
import os | ||
import sys | ||
|
||
sys.path.append( | ||
os.path.join(os.path.dirname(os.path.abspath(__file__)), "build/WigglyWidget") | ||
) | ||
|
||
from PyQt5.QtWidgets import QApplication, QLineEdit, QVBoxLayout, QWidget | ||
from WigglyWidget import WigglyWidget | ||
|
||
|
||
class TestWigglyWidget(QWidget): | ||
def __init__(self, *args, **kwargs): | ||
super(TestWigglyWidget, self).__init__(*args, **kwargs) | ||
self._layout = QVBoxLayout(self) | ||
self._lineEdit = QLineEdit(self) | ||
self._wigglyWidget = WigglyWidget(self) | ||
self._layout.addWidget(self._lineEdit) | ||
self._layout.addWidget(self._wigglyWidget) | ||
|
||
self._lineEdit.textChanged.connect(self._wigglyWidget.setText) | ||
self._lineEdit.setText("pyqt.site") | ||
|
||
|
||
if __name__ == "__main__": | ||
import cgitb | ||
import sys | ||
|
||
cgitb.enable(format="text") | ||
app = QApplication(sys.argv) | ||
w = TestWigglyWidget() | ||
w.show() | ||
sys.exit(app.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Specify sip v6 as the build system for the package. | ||
[build-system] | ||
requires = ["sip >=5.3, <7", "PyQt-builder >=1.9, <2"] | ||
build-backend = "sipbuild.api" | ||
|
||
# Specify the PEP 621 metadata for the project. | ||
[project] | ||
name = "WigglyWidget" | ||
version = "0.1.0" | ||
description = "Python bindings for the WigglyWidget library" | ||
urls.homepage = "https://github.com/PyQt5/PyQt" | ||
dependencies = ["PyQt5 (>=5.15.0, <6.0.0)"] | ||
|
||
[[project.authors]] | ||
name = "Irony" | ||
email = "[email protected]" | ||
|
||
# Specify a PyQt-based project. | ||
[tool.sip] | ||
project-factory = "pyqtbuild:PyQtProject" | ||
|
||
# Specify the PEP 566 metadata for the project. | ||
[tool.sip.metadata] | ||
name = "WigglyWidget" | ||
summary = "Python bindings for the WigglyWidget library" | ||
home-page = "https://github.com/PyQt5/PyQt" | ||
author = "Irony" | ||
author-email = "[email protected]" | ||
requires-dist = "PyQt5 (>=5.15.0, <6.0.0)" | ||
|
||
# Configure the project. | ||
[tool.sip.project] | ||
tag-prefix = "WigglyWidget" | ||
sip-include-dirs = [ | ||
"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PyQt5/bindings", | ||
"/usr/local/lib64/python3.6/site-packages/PyQt5/bindings", | ||
"C:/soft/Python311/Lib/site-packages/PyQt5/bindings", | ||
] | ||
|
||
# Configure the building of the fib bindings. | ||
[tool.sip.bindings.WigglyWidget] | ||
qmake-QT = ["core", "gui", "widgets"] | ||
headers = ["wigglywidget.h"] | ||
include-dirs = ["../dist/include"] | ||
libraries = ["LibWigglyWidget"] | ||
library-dirs = ["../dist/lib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PyQt5 | ||
sip | ||
PyQt5-sip | ||
PyQt-builder |
16 changes: 16 additions & 0 deletions
16
Test/WigglyWidget/PyQtWrapper/sip/WigglyWidget/WigglyWidget.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class WigglyWidget : QWidget | ||
{ | ||
%TypeHeaderCode | ||
#include "wigglywidget.h" | ||
%End | ||
|
||
public: | ||
WigglyWidget(QWidget *parent /TransferThis/ = 0); | ||
|
||
public slots: | ||
void setText(const QString &newText); | ||
|
||
protected: | ||
virtual void paintEvent(QPaintEvent *); | ||
virtual void timerEvent(QTimerEvent *); | ||
}; |
9 changes: 9 additions & 0 deletions
9
Test/WigglyWidget/PyQtWrapper/sip/WigglyWidget/WigglyWidgetmod.sip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
%Module(name=WigglyWidget, keyword_arguments="Optional", use_limited_api=True) | ||
|
||
|
||
%Import QtCore/QtCoremod.sip | ||
%Import QtWidgets/QtWidgetsmod.sip | ||
|
||
%DefaultSupertype sip.simplewrapper | ||
|
||
%Include WigglyWidget.sip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# WigglyWidget | ||
|
||
## Build | ||
|
||
Windows | ||
|
||
1. 使用 `QtCreator` 打开项目 `CMakeLists.txt`,勾选对应的Qt版本。 | ||
2. 在 `QtCreator` 中通过 `项目`->`构建`->`构建步骤`->`详情` 里勾选 `all` 和 `install` | ||
3. 进入 `PyQtWrapper` 目录,打开`vs cmd`,运行 `python -m pip install -r requirements.txt` | ||
4. `sip-build --verbose --tracing --qmake=你的Qt目录下的qmake.exe路径`,等待编译完成 | ||
5. `python TestWigglyWidget.py` 进行测试 |