Skip to content

Commit e01e7be

Browse files
author
florianlink
committed
syncing with my current work, updating to 1.2, see changelog
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@46 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent efa2a6a commit e01e7be

File tree

208 files changed

+57849
-3733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+57849
-3733
lines changed

CHANGELOG.txt

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
Version 1.2 ChangeLog:
2+
3+
florianlink | 2009-03-30
4+
- unified wrapping of CPP heap objects and QVariant/MetaTypes stack objects (this made PythonQtVariantWrapper obsolete)
5+
- added wrapping of the whole Qt API using a modified qtscript generator
6+
-- this makes all non-slots of QObject derived classes available for scripting
7+
-- all constructors of QObject/CPP objects are available
8+
-- comparision based on operator= are mapped to Python compare
9+
-- C++ (non-QObject) classes are completely wrapped (all public methods, enums, constructors, destructor)
10+
-- C++ inheritance is captured and supported for automatic upcasting, automatic downcasting is an open topic
11+
- added delete() method to all wrapped objects to allow C++ deletion (which is handy to remove e.g. QTreeWidgetItems from a QTreeWidget) (use with care!)
12+
- added support for QList<int>, QList<double>, QList<builtin variants> and QVector/std::vector
13+
- simple template to register other types for QList/QVector/std::vector
14+
- added support for custom type conversion between Python<->CPP (to e.g. manually add support for types like QHash<int, QString>, which is currently not supported)
15+
- remove PythonQtGui, which becomes obsolete because of the complete Qt API wrapping, adapted examples
16+
- added PythonQt::registerCPPClass()
17+
- added support for placing classes in packages, default is to place a class directly into PythonQt module
18+
- Qt packages are called:
19+
-- PythonQt.Qt - contains all Qt classes that are wrapped (for convenient to avoid using the different packages below)
20+
-- PythonQt.QtCore - contains the core classes
21+
-- PythonQt.QtGui - contains the gui classes
22+
-- PythonQt.QtNetwork - contains the network classes
23+
-- ...
24+
- Qt namespace is now located in QtCore, so write PythonQt.QtCore.Qt instead of PythonQt.Qt in your scripts!
125

226
Version 1.1 ChangeLog:
327

README

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ PythonQt is a dynamic Python (http://www.python.org) binding for Qt (http://www.
55
It offers an easy way to embed the Python scripting language into
66
your Qt applications. It makes heavy use of the QMetaObject system and thus requires Qt4.x.
77

8-
Licensing
9-
---------
8+
Licensing of PythonQt
9+
---------------------
1010
PythonQt is distributed under the LGPL license.
1111

12+
Licensing of Generator
13+
----------------------
14+
The build system of PythonQt makes use of a patched version of the GPL'ed QtScript generator,
15+
located in the "generator" directory.
16+
17+
See http://labs.trolltech.com/page/Projects/QtScript/Generator for details of the original project.
18+
19+
The PythonQt wrappers generated by the generator are distributed under the LGPL, they are not restriced by the GPL.
20+
21+
The generated wrappers are pre-generated and checked-in for Qt 4.5, so you only need to build and run the
22+
generator when you want to build additional wrappers or you want to upgrade/downgrade to an newer Qt version.
23+
1224
Documentation
1325
-------------
1426

build/PythonQtGui.prf

-13
This file was deleted.

build/PythonQt_QtAll.prf

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# profile for non-mevis users to link to PythonQt_QtAll
2+
3+
INCLUDEPATH += $$PWD/../extensions/PythonQt_QtAll
4+
5+
# check if debug or release
6+
CONFIG(debug, debug|release) {
7+
DEBUG_EXT = _d
8+
} else {
9+
DEBUG_EXT =
10+
}
11+
12+
win32::LIBS += $$PWD/../lib/PythonQt_QtAll$${DEBUG_EXT}.lib
13+
unix::LIBS += -L$$PWD/../lib -lPythonQt_QtAll$${DEBUG_EXT}

doxygen/doc.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PROJECT_NAME = PythonQt
2323
# This could be handy for archiving the generated documentation or
2424
# if some version control system is used.
2525

26-
PROJECT_NUMBER = 1.1
26+
PROJECT_NUMBER = 1.2
2727

2828
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
2929
# base path where the generated documentation will be put.

examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main (int argc, char* argv[]) {
77
PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
88
mainModule.evalScript(QString("import sys\n"));
99
Q_ASSERT(!mainModule.isNull());
10-
{
10+
{
1111
// evaluate a python file embedded in executable as resource:
1212
mainModule.evalFile(":eyed3tagger.py");
1313
// create an object, hold onto its reference
@@ -18,9 +18,8 @@ int main (int argc, char* argv[]) {
1818
Q_ASSERT(fn.toString() == QString("t.mp3"));
1919
// tag goes out of scope, reference count decremented.
2020
}
21-
{
21+
{
2222
// Allow the python system path to recognize QFile paths in the sys.path
23-
//QFileImportInterface qfii;
2423
PythonQt::self()->setImporter(NULL);
2524
// append the Qt resource root directory to the sys.path
2625
mainModule.evalScript("sys.path.append(':')\n");
@@ -30,7 +29,7 @@ int main (int argc, char* argv[]) {
3029
tag.call("setFileName", QVariantList() << "t.mp3");
3130
QVariant fn = tag.call("fileName", QVariantList());
3231
Q_ASSERT(fn.toString() == QString("t.mp3"));
33-
}
32+
}
3433
{ // alternative using import and loading it as a real module from sys.path
3534
// import sys first
3635
mainModule.evalScript(QString("sys.path.append('%1')\n").arg(QDir::currentPath()));
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
CONFIG += debug
2-
VPATH +=
3-
INCLUDEPATH += . $$(PYTHONQT_ROOT)/src /usr/include/python2.5
41

5-
SOURCES += CPPPyWrapperExample.cpp
2+
TARGET = CPPPyWrapperExample
3+
TEMPLATE = app
64

7-
mac { CONFIG -= app_bundle }
5+
mac:CONFIG -= app_bundle
86

9-
LIBS += -L$$(PYTHONQT_ROOT)/lib -lPythonQt_d -lutil
7+
DESTDIR = ../../lib
8+
9+
include ( ../../build/common.prf )
10+
include ( ../../build/PythonQt.prf )
11+
12+
SOURCES += \
13+
CPPPyWrapperExample.cpp
1014

1115
RESOURCES += CPPPyWrapperExample.qrc

examples/PyCustomMetaTypeExample/CustomObject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CustomObjectWrapper : public QObject {
6767

6868
public slots:
6969
// add a constructor
70-
QVariant new_CustomObject(const QString& first, const QString& last) { return qVariantFromValue(CustomObject(first, last)); }
70+
CustomObject* new_CustomObject(const QString& first, const QString& last) { return new CustomObject(first, last); }
7171

7272
// add access methods
7373

examples/PyCustomMetaTypeExample/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PythonQt import *
1+
from PythonQt import CustomObject
22

33
# create a new object
44
custom = CustomObject("John","Doe")

examples/PyCustomMetaTypeExample/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main( int argc, char **argv )
5757
// register the type with QMetaType
5858
qRegisterMetaType<CustomObject>("CustomObject");
5959
// add a wrapper object for the new variant type
60-
PythonQt::self()->addVariantWrapper("CustomObject", new CustomObjectWrapper());
60+
PythonQt::self()->registerCPPWrapper("CustomObject","","", PythonQtCreateObject<CustomObjectWrapper>);
6161

6262
mainContext.evalFile(":example.py");
6363

examples/PyGuiExample/PyGuiExample.pro

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
TARGET = PyGuiExample
88
TEMPLATE = app
99

10+
mac:CONFIG -= app_bundle
11+
1012
DESTDIR = ../../lib
1113

1214
include ( ../../build/common.prf )
1315
include ( ../../build/PythonQt.prf )
14-
include ( ../../build/PythonQtGui.prf )
16+
include ( ../../build/PythonQt_QtAll.prf )
1517

1618
SOURCES += \
1719
main.cpp

examples/PyGuiExample/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PythonQt import *
1+
from PythonQt.QtGui import *
22

33
group = QGroupBox()
44
box = QVBoxLayout(group)

examples/PyGuiExample/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//----------------------------------------------------------------------------------
4141

4242
#include "PythonQt.h"
43-
#include "PythonQtGui.h"
43+
#include "PythonQt_QtAll.h"
4444
#include "gui/PythonQtScriptingConsole.h"
4545

4646
#include <QApplication>
@@ -55,7 +55,7 @@ int main( int argc, char **argv )
5555
QApplication qapp(argc, argv);
5656

5757
PythonQt::init(PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut);
58-
PythonQtGui::init();
58+
PythonQt_QtAll::init();
5959

6060
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
6161
PythonQtScriptingConsole console(NULL, mainContext);

examples/PyScriptingConsole/PyScriptingConsole.pro

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ TEMPLATE = app
99

1010
DESTDIR = ../../lib
1111

12+
mac:CONFIG-= app_bundle
13+
1214
include ( ../../build/common.prf )
1315
include ( ../../build/PythonQt.prf )
14-
include ( ../../build/PythonQtGui.prf )
16+
include ( ../../build/PythonQt_QtAll.prf )
1517

1618
HEADERS += \
1719
PyExampleObject.h

examples/PyScriptingConsole/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PythonQt import *
1+
from PythonQt.QtGui import *
22

33
group = QGroupBox()
44
box = QVBoxLayout(group)

examples/PyScriptingConsole/main.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
//----------------------------------------------------------------------------------
4141

4242
#include "PythonQt.h"
43-
#include "PythonQtGui.h"
43+
#include "PythonQt_QtAll.h"
44+
4445
#include "PyExampleObject.h"
4546
#include "gui/PythonQtScriptingConsole.h"
4647

@@ -56,7 +57,7 @@ int main( int argc, char **argv )
5657
QApplication qapp(argc, argv);
5758

5859
PythonQt::init(PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut);
59-
PythonQtGui::init();
60+
PythonQt_QtAll::init();
6061

6162
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
6263
PythonQtScriptingConsole console(NULL, mainContext);

examples/examples.pro

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
TEMPLATE = subdirs
2-
SUBDIRS = PyGettingStarted \
2+
SUBDIRS = CPPPyWrapperExample \
3+
PyGettingStarted \
34
PyCPPWrapperExample \
45
PyCustomMetaTypeExample \
56
PyGuiExample \

extensions/PythonQtGui/PythonQtGui.bat

-2
This file was deleted.

0 commit comments

Comments
 (0)