##// END OF EJS Templates
- Added CHANGELOG...
ezust -
r2:b0bd6d44c879
parent child
Show More
@@ -0,0 +1,37
1
2 Version 1.1 ChangeLog:
3
4 florianlink | 2007-11-15 08:38:24 -0800 (Thu, 15 Nov 2007)
5 - added support for mapping Python lists to QList<AnyPtr*> lists on slot calls
6 - added support for QList<AnyPtr*> return values and signal signatures
7 - changed binary output to lib as well, so that the setting of PATH can be avoided
8 - changed profiles to use a new common.prf to facilitate global settings
9 - improved docs
10 - added _d extension for debug build (see common.prf)
11 - added $$PWD, which is important if the file is included from somewhere else (which we do in mevis)
12 - added softspace support (implemented by Andre Kramer)
13 - updated windows documentation and variables which need to be set
14 - changed to use only PYTHON_PATH on Windows
15 - added more build docs
16 - changed date conversion from/to strings to ISODate
17 - fixed return argument initialization to NULL
18 - added mevis doc
19 - fixed handling of unknown reference types
20 - made lookupObject public
21 - added overload calls to introspection
22
23 marcusbarann | 2007-11-08 06:15:55 -0800 (Thu, 08 Nov 2007)
24 - Added PythonQt.pro, cleaned up build system
25
26 akramer | 2007-10-17 08:02:25 -0700 (Wed, 17 Oct 2007)
27 - external variant was missing the "config += qtestlib" needed for using the Qt unit test framework.
28 - provide relative path to Gui extension lib
29 - added a sentence about using the Windows installer version of Python
30 - Fix for converting QByteArray values that include 0 chars.
31 They are still converted to/from Python strings but using
32 size of contents rather than string 0 (null) termination.
33 - bug fix for getMTimeOfSource when PythonQt::importInterface() is null
34 - Linux external build improvements
35
36 2007-01-30 00:11:25 -0800 (Tue, 30 Jan 2007) | 1 line
37 - Released version 1.0
@@ -0,0 +1,34
1 #include <PythonQt.h>
2 #include <QtGui>
3 int main (int argc, char* argv[]) {
4 QApplication app(argc, argv);
5 PythonQt::init();
6 PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
7 Q_ASSERT(!mainModule.isNull());
8 {
9 // evaluate a python file embedded in executable as resource:
10 mainModule.evalFile(":eyed3tagger.py");
11 PythonQtObjectPtr tag = mainModule.evalScript("EyeD3Tagger()\n", Py_eval_input);
12 Q_ASSERT(!tag.isNull());
13 tag.call("setFileName", QVariantList() << "t.mp3");
14 QVariant fn = tag.call("fileName", QVariantList());
15 Q_ASSERT(fn.toString() == QString("t.mp3"));
16 }
17 qDebug() << "test1";
18 { // alternative using import and loading it as a real module from sys.path
19 // import sys first
20 mainModule.evalScript(QString("import sys\n"));
21 // append the current directory to the sys.path
22 mainModule.evalScript(QString("sys.path.append('%1')\n").arg(QDir::currentPath()));
23
24 mainModule.evalScript("import eyed3tagger\n");
25 PythonQtObjectPtr tag = mainModule.evalScript("eyed3tagger.EyeD3Tagger()\n", Py_eval_input);
26 Q_ASSERT(!tag.isNull());
27 tag.call("setFileName", QVariantList() << "t.mp3");
28 QVariant fn = tag.call("fileName", QVariantList());
29 Q_ASSERT(fn.toString() == QString("t.mp3"));
30 }
31
32 qDebug() << "finished";
33 return 0;
34 }
@@ -0,0 +1,9
1 CONFIG += debug
2 VPATH +=
3 INCLUDEPATH += . $$(PYTHONQT_ROOT)/src /usr/include/python2.5
4
5 SOURCES += CPPPyWrapperExample.cpp
6
7 LIBS += -L$$(PYTHONQT_ROOT)/lib -lPythonQt -lutil
8
9 RESOURCES += CPPPyWrapperExample.qrc
@@ -0,0 +1,5
1 <RCC version="1.0">
2 <qresource>
3 <file>eyed3tagger.py</file>
4 </qresource>
5 </RCC>
@@ -0,0 +1,9
1 It also shows how to add user defined Python classes to the
2 embedded Python mainModule.
3 It also shows how to create objects in Python,
4 hold onto reference counted smart pointers to them from
5 a Qt application, and invoke methods on them via
6 the PythonQtObjectPtr interface.
7
8
9
@@ -0,0 +1,10
1 class EyeD3Tagger():
2 def __init__(self, fileName = None):
3 if not fileName is None:
4 self.setFileName(fileName)
5
6 def fileName(self):
7 return self.fn
8
9 def setFileName(self, fileName):
10 self.fn = fileName
@@ -2,7 +2,7 PythonQt
2 --------
2 --------
3
3
4 PythonQt is a dynamic Python (http://www.python.org) binding for Qt (http://www.trolltech.com).
4 PythonQt is a dynamic Python (http://www.python.org) binding for Qt (http://www.trolltech.com).
5 It offers an easy way to embedd the Python scripting language into
5 It offers an easy way to embed the Python scripting language into
6 your Qt applications. It makes heavy use of the QMetaObject system and thus requires Qt4.x.
6 your Qt applications. It makes heavy use of the QMetaObject system and thus requires Qt4.x.
7
7
8 Licensing
8 Licensing
@@ -23,7 +23,7 PROJECT_NAME = PythonQt
23 # This could be handy for archiving the generated documentation or
23 # This could be handy for archiving the generated documentation or
24 # if some version control system is used.
24 # if some version control system is used.
25
25
26 PROJECT_NUMBER = 1.0
26 PROJECT_NUMBER = 1.1
27
27
28 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
28 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
29 # base path where the generated documentation will be put.
29 # base path where the generated documentation will be put.
@@ -82,3 +82,15 QVariant PythonQtObjectPtr::call(const QString& callable, const QVariantList& ar
82 return PythonQt::self()->call(_object, callable, args);
82 return PythonQt::self()->call(_object, callable, args);
83 }
83 }
84
84
85 bool PythonQtObjectPtr::fromVariant(const QVariant& variant)
86 {
87 if (!variant.isNull()) {
88 setObject(qVariantValue<PythonQtObjectPtr>(variant));
89 return true;
90 }
91 else {
92 setObject(0);
93 return false;
94 }
95
96 }
@@ -55,13 +55,21 public:
55 setObject(p.object());
55 setObject(p.object());
56 }
56 }
57
57
58 //! If the given variant holds a PythonQtObjectPtr, extract the value from it and hold onto the reference. This results in an increment of the reference count.
59 PythonQtObjectPtr(const QVariant& variant):_object(NULL) {
60 fromVariant(variant);
61 }
62
58 PythonQtObjectPtr(PyObject* o) {
63 PythonQtObjectPtr(PyObject* o) {
59 _object = o;
64 _object = o;
60 if (o) Py_INCREF(_object);
65 if (o) Py_INCREF(_object);
61 }
66 }
62
67
63 ~PythonQtObjectPtr() { if (_object) Py_DECREF(_object); }
68 ~PythonQtObjectPtr() { if (_object) Py_DECREF(_object); }
64
69
70 //! If the given variant holds a PythonQtObjectPtr, extract the value from it and hold onto the reference. This results in an increment of the reference count.
71 bool fromVariant(const QVariant& variant);
72
65 PythonQtObjectPtr &operator=(const PythonQtObjectPtr &p) {
73 PythonQtObjectPtr &operator=(const PythonQtObjectPtr &p) {
66 setObject(p.object());
74 setObject(p.object());
67 return *this;
75 return *this;
@@ -72,6 +80,13 public:
72 return *this;
80 return *this;
73 }
81 }
74
82
83
84 PythonQtObjectPtr &operator=(const QVariant& variant) {
85 fromVariant(variant);
86 return *this;
87 }
88
89
75 bool operator==( const PythonQtObjectPtr &p ) const {
90 bool operator==( const PythonQtObjectPtr &p ) const {
76 return object() == p.object();
91 return object() == p.object();
77 }
92 }
@@ -133,6 +148,8 public:
133 //! call the given python object (in the scope of the current object), returns the result converted to a QVariant
148 //! call the given python object (in the scope of the current object), returns the result converted to a QVariant
134 QVariant call(const QString& callable, const QVariantList& args);
149 QVariant call(const QString& callable, const QVariantList& args);
135
150
151
152
136
153
137 protected:
154 protected:
138
155
General Comments 0
You need to be logged in to leave comments. Login now