From 6fc086e9f9a786521492593b92889c735697191e Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Sat, 4 Sep 2010 02:10:33 +0100 Subject: [PATCH 001/913] Treat modules as library targets. This fixes dynamic linking on Mac OS X. Previously modules were been linked to libpyside in the build tree even when installed (ie. hardcoded). --- PySide/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index e4b6a1d..522d1ec 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -43,8 +43,7 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul # install - install(FILES ${pyside_BINARY_DIR}/${module_name}${CMAKE_DEBUG_POSTFIX}${${module_name}_suffix} - DESTINATION ${SITE_PACKAGE}/PySide) + install(TARGETS ${module_name} LIBRARY DESTINATION ${SITE_PACKAGE}/PySide) string(TOLOWER ${module_name} lower_module_name) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module_name}/pyside_${lower_module_name}_python.h DESTINATION include/PySide/${module_name}/) From cbf12bc3a010508081d59bdac832d3e2bb9e0c2a Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 10 Sep 2010 19:33:49 -0300 Subject: [PATCH 002/913] Fix bug#254 - "QWebView.setPage() does not seem to work" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Lauro Moura Renato Araújo --- PySide/QtWebKit/typesystem_webkit.xml | 7 ++++++- tests/QtWebKit/webview_test.py | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index a303388..2ba3d8c 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -49,7 +49,12 @@ - + + + + + + diff --git a/tests/QtWebKit/webview_test.py b/tests/QtWebKit/webview_test.py index c06e437..a6a40fd 100644 --- a/tests/QtWebKit/webview_test.py +++ b/tests/QtWebKit/webview_test.py @@ -2,13 +2,18 @@ '''Test cases for QWebView''' import unittest +import sys from PySide.QtCore import QObject, SIGNAL, QUrl -from PySide.QtWebKit import QWebView +from PySide.QtWebKit import * from helper import adjust_filename, TimedQApplication +class testWebPage(QWebPage): + def sayMyName(self): + return 'testWebPage' + class TestLoadFinished(TimedQApplication): '''Test case for signal QWebView.loadFinished(bool)''' @@ -33,6 +38,23 @@ class TestLoadFinished(TimedQApplication): self.assert_(self.called) + def testSetPageAndGetPage(self): + twp = testWebPage() + self.view.setPage(twp) + del twp + p = self.view.page() + self.assertEqual(p.sayMyName(), 'testWebPage') + + # Setting the same webpage should not incref the python obj + refCount = sys.getrefcount(p) + self.view.setPage(p) + self.assertEquals(sys.getrefcount(p), refCount) + + # Changing the webpage obj should decref the old one + twp2 = testWebPage() + self.view.setPage(twp2) + self.assertEquals(sys.getrefcount(p), refCount - 1) + def load_finished(self, ok): #Callback to check if load was successful self.app.quit() From b315368a1b8bd1af8fadca38d0356c85662ea3a7 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 13 Sep 2010 19:25:41 -0300 Subject: [PATCH 003/913] Fixed crash on qsignal destructor. Reviewer: Hugo Parente Lima Luciano Wolf --- libpyside/qsignal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index 6d829e9..67f58fa 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -226,7 +226,7 @@ void signalUpdateSource(PyObject* source) PyObject *attrName = PyList_GET_ITEM(attrs.object(), i); Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast(source->ob_type), attrName)); if (attr->ob_type == &Signal_Type) { - Shiboken::AutoDecRef signalInstance(_PyObject_New(&SignalInstance_Type)); + Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(SignalInstanceData, &SignalInstance_Type)); signal_instance_initialize(signalInstance, attrName, reinterpret_cast(attr.object()), source, 0); PyObject_SetAttr(source, attrName, signalInstance); } @@ -365,9 +365,9 @@ void signal_instance_free(void* self) free(data->signalName); free(data->signature); - while(data) { + if (data->next) { Py_XDECREF(data->next); - data = reinterpret_cast(data->next); + data->next = 0; } pySelf->ob_type->tp_base->tp_free(self); } From 42f917666904f4eb93002eae2de70d1f225f438f Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 14 Sep 2010 13:03:39 -0300 Subject: [PATCH 004/913] Increased global receiver maximun slots support. Fixes bug #312. Reviewer: Hugo Parente Lima Luciano Wolf --- libpyside/dynamicqmetaobject.cpp | 47 ++++++++++++++++++++++++++------ libpyside/globalreceiver.cpp | 3 +- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 8ca983e..c2e7f04 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -36,6 +36,11 @@ #define MAX_SIGNALS_COUNT 50 #define MAX_SLOTS_COUNT 50 +#define MAX_GLOBAL_SIGNALS_COUNT 500 +#define MAX_GLOBAL_SLOTS_COUNT 500 + +#define GLOBAL_RECEIVER_CLASS_NAME "__GlobalReceiver__" + using namespace PySide; enum PropertyFlags { @@ -110,6 +115,27 @@ static bool isQRealType(const char *type) return strcmp(type, "qreal") == 0; } + + +/* + * Avoid API break keep this on cpp + */ +static int maxSlotsCount(const QString& className) +{ + int maxSlots = MAX_SLOTS_COUNT; + if (className == GLOBAL_RECEIVER_CLASS_NAME) + maxSlots = MAX_GLOBAL_SIGNALS_COUNT; + return maxSlots; +} + +static int maxSignalsCount(const QString& className) +{ + int maxSignals = MAX_SIGNALS_COUNT; + if (className == GLOBAL_RECEIVER_CLASS_NAME) + maxSignals = MAX_GLOBAL_SIGNALS_COUNT; + return maxSignals; +} + uint PropertyData::flags() const { const char* typeName = type().data(); @@ -271,8 +297,9 @@ void DynamicQMetaObject::addSignal(const char* signal, const char* type) return; } - if (m_signals.size() >= MAX_SIGNALS_COUNT) { - qWarning() << "Fail to add dynamic signal to QObject. PySide support at most" << MAX_SIGNALS_COUNT << "dynamic signals."; + int maxSignals = maxSignalsCount(m_className); + if (m_signals.size() >= maxSignals) { + qWarning() << "Fail to add dynamic signal to QObject. PySide support at most" << maxSignals << "dynamic signals."; return; } @@ -286,8 +313,9 @@ void DynamicQMetaObject::addSlot(const char* slot, const char* type) if (i != m_slots.end()) return; - if (m_slots.size() >= MAX_SLOTS_COUNT) { - qWarning() << "Fail to add dynamic slot to QObject. PySide support at most" << MAX_SLOTS_COUNT << "dynamic slots."; + int maxSlots = maxSlotsCount(m_className); + if (m_slots.size() >= maxSlots) { + qWarning() << "Fail to add dynamic slot to QObject. PySide support at most" << maxSlots << "dynamic slots."; return; } @@ -439,8 +467,11 @@ void DynamicQMetaObject::updateMetaObject() MethodScriptable = 0x40 }; - uint n_signals = MAX_SIGNALS_COUNT; - uint n_methods = n_signals + MAX_SLOTS_COUNT; + int maxSignals = maxSignalsCount(m_className); + int maxSlots = maxSlotsCount(m_className); + + uint n_signals = maxSignals; + uint n_methods = n_signals + maxSlots; uint n_properties = m_properties.size(); int header[] = {5, // revision 0, // class name index in m_metadata @@ -465,10 +496,10 @@ void DynamicQMetaObject::updateMetaObject() int index = HEADER_LENGHT; //write signals - writeMethodsData(m_signals, &data, &strings, &index, MAX_SIGNALS_COUNT, NULL_INDEX, AccessPublic | MethodSignal); + writeMethodsData(m_signals, &data, &strings, &index, maxSignals, NULL_INDEX, AccessPublic | MethodSignal); //write slots - writeMethodsData(m_slots, &data, &strings, &index, MAX_SLOTS_COUNT, NULL_INDEX, AccessPublic | MethodSlot); + writeMethodsData(m_slots, &data, &strings, &index, maxSlots, NULL_INDEX, AccessPublic | MethodSlot); if (m_properties.size()) data[7] = index; diff --git a/libpyside/globalreceiver.cpp b/libpyside/globalreceiver.cpp index 1b658e2..2dd82aa 100644 --- a/libpyside/globalreceiver.cpp +++ b/libpyside/globalreceiver.cpp @@ -32,6 +32,7 @@ #include "signalmanager.h" #define RECEIVER_DESTROYED_SLOT_NAME "__receiverDestroyed__(QObject*)" +#define GLOBAL_RECEIVER_CLASS_NAME "__GlobalReceiver__" namespace PySide { @@ -108,7 +109,7 @@ DynamicSlotData::~DynamicSlotData() GlobalReceiver::GlobalReceiver() - : m_metaObject("GlobalReceiver", &QObject::staticMetaObject) + : m_metaObject(GLOBAL_RECEIVER_CLASS_NAME, &QObject::staticMetaObject) { //slot used to be notifyed of object destrouction m_metaObject.addSlot(RECEIVER_DESTROYED_SLOT_NAME); From 3edeee197ac061b3dbd861d63baf489f9031a96d Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 14 Sep 2010 14:06:42 -0300 Subject: [PATCH 005/913] Created unit test for bug #312. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/signals/CMakeLists.txt | 1 + tests/signals/bug_312.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/signals/bug_312.py diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt index 5849dc5..eaa9a84 100644 --- a/tests/signals/CMakeLists.txt +++ b/tests/signals/CMakeLists.txt @@ -1,5 +1,6 @@ PYSIDE_TEST(args_dont_match_test.py) PYSIDE_TEST(bug_311.py) +PYSIDE_TEST(bug_312.py) PYSIDE_TEST(bug_319.py) PYSIDE_TEST(decorators_test.py) PYSIDE_TEST(invalid_callback_test.py) diff --git a/tests/signals/bug_312.py b/tests/signals/bug_312.py new file mode 100644 index 0000000..223b4e1 --- /dev/null +++ b/tests/signals/bug_312.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import unittest +from PySide.QtCore import QObject, SIGNAL + +class MultipleSlots(unittest.TestCase): + def myCB(self): + self._count += 1 + + def testUnboundSignal(self): + o = QObject() + self._count = 0 + for i in range(200): + QObject.connect(o, SIGNAL("fire()"), lambda: self.myCB()) + + o.emit(SIGNAL("fire()")) + self.assertEqual(self._count, 200) + +if __name__ == '__main__': + unittest.main() + + From 2559ae50f05f5135f88361fdc60f558c382d0b80 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 14 Sep 2010 18:19:15 -0300 Subject: [PATCH 006/913] Created unittest for bug #332. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_332.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/QtCore/bug_332.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index f364f4c..e0624e0 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -1,4 +1,5 @@ PYSIDE_TEST(bug_278_test.py) +PYSIDE_TEST(bug_332.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) PYSIDE_TEST(deletelater_test.py) diff --git a/tests/QtCore/bug_332.py b/tests/QtCore/bug_332.py new file mode 100644 index 0000000..ae08742 --- /dev/null +++ b/tests/QtCore/bug_332.py @@ -0,0 +1,16 @@ +#!/usr/bin/python + +import unittest +from PySide import QtCore + +class Lock(QtCore.QMutex): + def tryLock(self,timeoutt=10): + return QtCore.QMutex.tryLock(self,timeoutt) + +class TestBug(unittest.TestCase): + + def testCase(self): + l = Lock() + l.tryLock() # this cause a assertion + + From 5ce6221efae57de30c04f1069d294f4e6275bf85 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 14 Sep 2010 18:19:59 -0300 Subject: [PATCH 007/913] Updated tryLock function to work in thread. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 5464ae0..073da00 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1640,6 +1640,7 @@ + From cd7dac40f758f821514693c6d7d4c449a9f81240 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 15 Sep 2010 10:40:52 -0300 Subject: [PATCH 008/913] Don't ignore exceptions caused by property getters and setters. The exception is ignored only if the call was a meta call. --- libpyside/qproperty.cpp | 6 +----- libpyside/signalmanager.cpp | 2 ++ tests/QtCore/qobject_property_test.py | 7 +++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index dc36e3e..e0f2574 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -188,11 +188,7 @@ PyObject* qproperty_get(PyObject* self, PyObject* source) Shiboken::AutoDecRef args(PyTuple_New(1)); Py_INCREF(source); PyTuple_SET_ITEM(args, 0, source); - PyObject *ret = PyObject_CallObject(data->fget, args); - if (!ret) { - PyErr_Print(); - } - return ret; + return PyObject_CallObject(data->fget, args); } return 0; } diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index f9c36ee..8208796 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -377,6 +377,8 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, args[0] = data; Py_DECREF(value); + } else if (PyErr_Occurred()) { + PyErr_Print(); // Clear any errors but print them to stderr } break; } diff --git a/tests/QtCore/qobject_property_test.py b/tests/QtCore/qobject_property_test.py index 1d8a16c..fcf8e89 100644 --- a/tests/QtCore/qobject_property_test.py +++ b/tests/QtCore/qobject_property_test.py @@ -129,6 +129,13 @@ class PropertyWithConstructorCase(unittest.TestCase): obj = ExQObject(registeredproperty=123) self.assertEqual(obj.registeredproperty, 123) + def testPythonDeclaredPropertyNoSetted(self): + try: + obj = ExQObject() + a = obj.registeredproperty + except AttributeError: + pass + def testConstructorPropertyInQObjectDerived(self): #QTimer(property=value) for existing C++ property obj = QTimer(objectName='dummy') From 87ea5d920c62eed3e9c1185fa66740c13c71f65b Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 15 Sep 2010 10:44:27 -0300 Subject: [PATCH 009/913] Fix bug#347 - "Setting properties in constructors gives incorrect results" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added new function to libpyside: "fillQtProperties". Reviewer: Luciano Wolf Renato Araújo --- libpyside/pyside.cpp | 41 ++++++++++++++++++++++++++++ libpyside/pyside.h | 13 +++++++++ tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/setprop_on_ctor_test.py | 12 ++++++++ 4 files changed, 67 insertions(+) create mode 100644 tests/QtCore/setprop_on_ctor_test.py diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index bfb9889..ddec198 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -24,6 +24,10 @@ #include "pyside.h" #include "signalmanager.h" #include "qproperty.h" +#include +#include +#include +#include "qsignal.h" extern "C" void init_signal(PyObject* module); extern "C" void init_slot(PyObject* module); @@ -41,5 +45,42 @@ void init(PyObject *module) SignalManager::instance(); } +bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize) +{ + + PyObject *key, *value; + Py_ssize_t pos = 0; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + if (!blackListSize || !std::binary_search(blackList, blackList + blackListSize, std::string(PyString_AS_STRING(key)))) { + QByteArray propName(PyString_AS_STRING(key)); + if (metaObj->indexOfProperty(propName) != -1) { + propName[0] = std::toupper(propName[0]); + propName.prepend("set"); + + Shiboken::AutoDecRef propSetter(PyObject_GetAttrString(qObj, propName.constData())); + if (!propSetter.isNull()) { + Shiboken::AutoDecRef args(PyTuple_Pack(1, value)); + Shiboken::AutoDecRef retval(PyObject_CallObject(propSetter, args)); + } else { + PyObject* attr = PyObject_GenericGetAttr(qObj, key); + if (isQPropertyType(attr)) + PySide::qproperty_set(attr, qObj, value); + } + } else { + propName.append("()"); + if (metaObj->indexOfSignal(propName) != -1) { + propName.prepend('2'); + PySide::signal_connect(qObj, propName, value); + } else { + PyErr_Format(PyExc_AttributeError, "'%s' is not a Qt property or a signal", propName.constData()); + return false; + }; + } + } + } + return true; +} + } //namespace PySide diff --git a/libpyside/pyside.h b/libpyside/pyside.h index 21515c8..cae050b 100644 --- a/libpyside/pyside.h +++ b/libpyside/pyside.h @@ -26,6 +26,8 @@ #include #include #include +#include +#include namespace PySide { @@ -41,6 +43,17 @@ inline uint hash(const T& value) return qHash(value.toString()); } +/** + * Fill QObject properties and do signal connections using the values found in \p kwds dictonary. + * \param qObj PyObject fot the QObject. + * \param metaObj QMetaObject of \p qObj. + * \param blackList keys to be ignored in kwds dictionary, this string list MUST be sorted. + * \param blackListSize numbe rof elements in blackList. + * \param kwds key->value dictonary. + * \return True if everything goes well, false with a Python error setted otherwise. + */ +PYSIDE_API bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize); + /** * If the type \p T was registered on Qt meta type system with Q_DECLARE_METATYPE macro, this class will initialize * the meta type. diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index e0624e0..76db54f 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -60,6 +60,7 @@ PYSIDE_TEST(qtimer_singleshot_test.py) PYSIDE_TEST(qtimer_timeout_test.py) PYSIDE_TEST(qtnamespace_test.py) PYSIDE_TEST(qurl_test.py) +PYSIDE_TEST(setprop_on_ctor_test.py) PYSIDE_TEST(static_method_test.py) PYSIDE_TEST(static_protected_methods_test.py) PYSIDE_TEST(thread_signals_test.py) diff --git a/tests/QtCore/setprop_on_ctor_test.py b/tests/QtCore/setprop_on_ctor_test.py new file mode 100644 index 0000000..bd4426c --- /dev/null +++ b/tests/QtCore/setprop_on_ctor_test.py @@ -0,0 +1,12 @@ +#!/usr/bin/python +import unittest +from PySide.QtCore import * + + +class SetPropOnCtorTest(unittest.TestCase): + def testIt(self): + obj = QEventTransition(targetStates = [QState()]) + self.assertEqual(len(obj.targetStates()), 1); + +if __name__ == '__main__': + unittest.main() From 09e087f0bd9b38b59cc738589e216e95c5aa2211 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 15 Sep 2010 17:39:49 -0300 Subject: [PATCH 010/913] Included Notifier signals on genereted code. Fixes bug: #328. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/phonon/typesystem_phonon.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index 2bb9c20..e326436 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -61,7 +61,18 @@ - + + + PyObject* signal_item; + + signal_item = PySide::signalNew("capabilitiesChanged", "void", NULL); + PyDict_SetItemString(SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "capabilitiesChanged", signal_item); + Py_DECREF(signal_item); + + signal_item = PySide::signalNew("availableAudioOutputDevicesChanged", "void", NULL); + PyDict_SetItemString( SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "availableAudioOutputDevicesChanged", signal_item); + Py_DECREF(signal_item); + From f92262928a6ac0463d4fb3fe52e8650fd484fbdc Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 15 Sep 2010 17:40:29 -0300 Subject: [PATCH 011/913] Created unittest for bug 328. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/phonon/CMakeLists.txt | 1 + tests/phonon/bug_328.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/phonon/bug_328.py diff --git a/tests/phonon/CMakeLists.txt b/tests/phonon/CMakeLists.txt index 1174709..c2b939e 100644 --- a/tests/phonon/CMakeLists.txt +++ b/tests/phonon/CMakeLists.txt @@ -1,2 +1,3 @@ PYSIDE_TEST(basic_playing_test.py) +PYSIDE_TEST(bug_328.py) PYSIDE_TEST(capabilities_test.py) diff --git a/tests/phonon/bug_328.py b/tests/phonon/bug_328.py new file mode 100644 index 0000000..4171b3f --- /dev/null +++ b/tests/phonon/bug_328.py @@ -0,0 +1,18 @@ +#!/usr/bin/python + +from PySide import QtCore, QtGui +from PySide.phonon import Phonon +import unittest + +class TestBug(unittest.TestCase): + def myCB(self): + pass + + def testForNotifierSignals(self): + # this test only check if the signals are present + notifier = Phonon.BackendCapabilities.Notifier() + notifier.capabilitiesChanged.connect(self.myCB) + notifier.availableAudioOutputDevicesChanged.connect(self.myCB) + + self.assert_(True) + From c06110168c39e5c44b9b11ff13fd6f9795199df3 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 16 Sep 2010 11:36:32 -0300 Subject: [PATCH 012/913] Fixes bug #348 adding the method QState.addTransition(Signal, QAbstractTransition*). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by Luciano Wolf Reviewed by Renato Araújo --- PySide/QtCore/typesystem_core.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 073da00..4d7e3e4 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2380,6 +2380,26 @@ + + + + + + + // Obviously the label used by the following goto is a very awkward solution, + // since it refers to a name very tied to the generator implementation. + // Check bug #362 for more information on this + // http://bugs.openbossa.org/show_bug.cgi?id=362 + if (!PyObject_TypeCheck(%1, &PySide::SignalInstance_Type)) + goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError; + PySide::SignalInstanceData* signalInstance = reinterpret_cast<PySide::SignalInstanceData*>(%1); + QObject* sender = %CONVERTTOCPP[QObject*](signalInstance->source); + %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->%FUNCTION_NAME(sender, signalInstance->signature, %2)); + + + From 551f6b9c7240d1f68e50edcec0fc41969beaef1d Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 16 Sep 2010 14:14:45 -0300 Subject: [PATCH 013/913] Fixed connection cleanup function. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/glue/qobject_connect.cpp | 11 +++++++++-- PySide/QtCore/typesystem_core.xml | 6 ++++-- libpyside/dynamicqmetaobject.cpp | 8 ++++---- libpyside/globalreceiver.cpp | 26 +++++++++++++------------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp index b140374..cf78779 100644 --- a/PySide/QtCore/glue/qobject_connect.cpp +++ b/PySide/QtCore/glue/qobject_connect.cpp @@ -75,6 +75,8 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject slotIndex = metaObject->indexOfSlot(slot); } if (QMetaObject::connect(source, signalIndex, receiver, slotIndex, type)) { + if (usingGlobalReceiver) + signalManager.globalReceiverConnectNotify(source, slotIndex); #ifndef AVOID_PROTECTED_HACK source->connectNotify(signal - 1); #else @@ -82,8 +84,6 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject // connectNotify when avoiding the protected hack. reinterpret_cast(source)->connectNotify(signal - 1); #endif - if (usingGlobalReceiver) - signalManager.globalReceiverConnectNotify(source, slotIndex); return true; } @@ -114,6 +114,13 @@ static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObj if (usingGlobalReceiver) { int slotIndex = metaObject->indexOfSlot(callbackSig.constData()); signalManager.globalReceiverDisconnectNotify(source, slotIndex); + #ifndef AVOID_PROTECTED_HACK + source->disconnectNotify(signal - 1); + #else + // Need to cast to QObjectWrapper* and call the public version of + // connectNotify when avoiding the protected hack. + reinterpret_cast(source)->disconnectNotify(signal - 1); + #endif } return true; } diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 4d7e3e4..c0b333f 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1230,8 +1230,10 @@ // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife int ret = %CPPSELF.%FUNCTION_NAME(%1); - if (ret > 0 && strcmp(%1, SIGNAL(destroyed())) == 0 && PySide::SignalManager::instance().hasConnectionWith(%CPPSELF)) - ret--; + if (ret > 0 && ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(destroyed(QObject*))) == 0))) { + if (PySide::SignalManager::instance().hasConnectionWith(%CPPSELF)) + ret--; + } %PYARG_0 = %CONVERTTOPYTHON[int](ret); diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index c2e7f04..b97ae0d 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -322,11 +322,10 @@ void DynamicQMetaObject::addSlot(const char* slot, const char* type) //search for a empty space MethodData blank; i = qFind(m_slots.begin(), m_slots.end(), blank); - if (i != m_slots.end()) { + if (i != m_slots.end()) *i = MethodData(slot, type); - } else { + else m_slots << MethodData(slot, type); - } updateMetaObject(); } @@ -438,7 +437,6 @@ void DynamicQMetaObject::writeMethodsData(QLinkedList& methods, if (iMethod != methods.end() && ((*iMethod).signature().size() > 0) ) { (*data)[index++] = registerString((*iMethod).signature(), strings); // func name mType = (*iMethod).type(); - iMethod++; } else { (*data)[index++] = null_index; // func name } @@ -446,6 +444,8 @@ void DynamicQMetaObject::writeMethodsData(QLinkedList& methods, (*data)[index++] = (mType.size() > 0 ? registerString(mType, strings) : null_index); // normalized type (*data)[index++] = null_index; // tags (*data)[index++] = flags; + if (iMethod != methods.end()) + iMethod++; } *prtIndex = index; diff --git a/libpyside/globalreceiver.cpp b/libpyside/globalreceiver.cpp index 2dd82aa..2c12604 100644 --- a/libpyside/globalreceiver.cpp +++ b/libpyside/globalreceiver.cpp @@ -107,7 +107,6 @@ DynamicSlotData::~DynamicSlotData() Py_DECREF(m_callback); } - GlobalReceiver::GlobalReceiver() : m_metaObject(GLOBAL_RECEIVER_CLASS_NAME, &QObject::staticMetaObject) { @@ -126,20 +125,23 @@ GlobalReceiver::~GlobalReceiver() void GlobalReceiver::connectNotify(QObject* source, int slotId) { if (m_slotReceivers.contains(slotId)) { - m_slotReceivers[slotId]->addRef(source); + DynamicSlotData* data = m_slotReceivers[slotId]; + if (!data->hasRefTo(source)) + QObject::connect(source, SIGNAL(destroyed(QObject*)), this, "1"RECEIVER_DESTROYED_SLOT_NAME); + data->addRef(source); } } void GlobalReceiver::disconnectNotify(QObject* source, int slotId) { - if (m_slotReceivers.contains(slotId)) { - QObject::disconnect(source, SIGNAL(destroyed(QObject*)), this, "1"RECEIVER_DESTROYED_SLOT_NAME); - + if (m_slotReceivers.contains(slotId)) { DynamicSlotData *data = m_slotReceivers[slotId]; data->decRef(source); - if (data->refCount() == 0) { + if (data->refCount() == 0) removeSlot(slotId); - } + + if (!hasConnectionWith(source)) + QObject::disconnect(source, SIGNAL(destroyed(QObject*)), this, "1"RECEIVER_DESTROYED_SLOT_NAME); } } @@ -152,9 +154,8 @@ void GlobalReceiver::addSlot(const char* slot, PyObject* callback) { m_metaObject.addSlot(slot); int slotId = m_metaObject.indexOfSlot(slot); - if (!m_slotReceivers.contains(slotId)) { + if (!m_slotReceivers.contains(slotId)) m_slotReceivers[slotId] = new DynamicSlotData(slotId, callback); - } bool isShortCircuit = true; for (int i = 0; slot[i]; ++i) { @@ -167,6 +168,7 @@ void GlobalReceiver::addSlot(const char* slot, PyObject* callback) if (isShortCircuit) m_shortCircuitSlots << slotId; + Q_ASSERT(slotId >= QObject::staticMetaObject.methodCount()); } @@ -236,12 +238,10 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args) retval = PyObject_CallObject(callback, preparedArgs); } - if (!retval) { - qDebug() << "Error calling slot" << m_metaObject.method(id).signature(); + if (!retval) PyErr_Print(); - } else { + else Py_DECREF(retval); - } return -1; } From 1217b7df39a9040d0c579727fa9d15ebb78cff4a Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 16 Sep 2010 14:15:12 -0300 Subject: [PATCH 014/913] Update unit test for bug 312. Now the test verify if is possible connect more then 500 signals, if the signals was disconnected. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/signals/bug_312.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/signals/bug_312.py b/tests/signals/bug_312.py index 223b4e1..46b64fa 100644 --- a/tests/signals/bug_312.py +++ b/tests/signals/bug_312.py @@ -2,8 +2,16 @@ # -*- coding: utf-8 -*- import unittest +import sys from PySide.QtCore import QObject, SIGNAL +class Dummy(object): + def __init__(self, parent): + self._parent = parent + + def callback(self): + self._called = True + class MultipleSlots(unittest.TestCase): def myCB(self): self._count += 1 @@ -17,6 +25,21 @@ class MultipleSlots(unittest.TestCase): o.emit(SIGNAL("fire()")) self.assertEqual(self._count, 200) + def testDisconnectCleanup(self): + for c in range(5): + self._count = 0 + self._senders = [] + for i in range(200): + o = QObject() + QObject.connect(o, SIGNAL("fire()"), lambda: self.myCB()) + self._senders.append(o) + o.emit(SIGNAL("fire()")) + + self.assertEqual(self._count, 200) + + #delete all senders will disconnect the signals + self._senders = [] + if __name__ == '__main__': unittest.main() From 40ccd1fe1f2d553ca25dc6cb10b4c6566879537c Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 16 Sep 2010 16:56:24 -0300 Subject: [PATCH 015/913] Fixed test. The anonymous connections will be considered on QObject.receivers function. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtCore/qobject_protected_methods_test.py | 4 ++-- tests/signals/qobject_receivers_test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/QtCore/qobject_protected_methods_test.py b/tests/QtCore/qobject_protected_methods_test.py index 530b870..37bda37 100644 --- a/tests/QtCore/qobject_protected_methods_test.py +++ b/tests/QtCore/qobject_protected_methods_test.py @@ -23,7 +23,7 @@ class QObjectReceivers(unittest.TestCase): self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 0) QObject.connect(obj, SIGNAL("destroyed()"), self.cb) - self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 0) + self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1) def testQThreadReceiversExtern(self): #QThread.receivers() - Inherited protected method @@ -31,7 +31,7 @@ class QObjectReceivers(unittest.TestCase): obj = QThread() self.assertEqual(obj.receivers(SIGNAL('destroyed()')), 0) QObject.connect(obj, SIGNAL("destroyed()"), self.cb) - self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 0) + self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1) if __name__ == '__main__': diff --git a/tests/signals/qobject_receivers_test.py b/tests/signals/qobject_receivers_test.py index cb4c9ce..22ebb81 100644 --- a/tests/signals/qobject_receivers_test.py +++ b/tests/signals/qobject_receivers_test.py @@ -30,9 +30,9 @@ class TestQObjectReceivers(unittest.TestCase): sender = QObject() receiver = QObject() sender.connect(sender, SIGNAL("destroyed()"), cute_slot) - self.assertEqual(sender.receivers(SIGNAL("destroyed( )")), 0) + self.assertEqual(sender.receivers(SIGNAL("destroyed( )")), 1) sender.connect(sender, SIGNAL("destroyed()"), receiver, SLOT("deleteLater()")) - self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 1) + self.assertEqual(sender.receivers(SIGNAL("destroyed()")), 2) del sender del receiver From b47f82c498ff8dae8a418784026b40cc7ca41e31 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 16 Sep 2010 14:48:57 -0300 Subject: [PATCH 016/913] Fixed the Python names for Signal and Slot objects. In python the Signal object appears as "Signal" instead of "PySide.QtCore.Signal", and the Slot object read as "QtCore.Slot" instead of "PySide.QtCore.Slot". --- libpyside/qsignal.cpp | 4 ++-- libpyside/qslot.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index 67f58fa..aa218ec 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -66,7 +66,7 @@ static PyObject* signal_build_qt_compatible(const char*); PyTypeObject Signal_Type = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ - SIGNAL_CLASS_NAME, /*tp_name*/ + "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ sizeof(SignalData), /*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ @@ -129,7 +129,7 @@ static PyMappingMethods SignalInstance_as_mapping = { PyTypeObject SignalInstance_Type = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ - SIGNAL_CLASS_NAME, /*tp_name*/ + "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ sizeof(SignalInstanceData),/*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp index c89f042..3c7f4fc 100644 --- a/libpyside/qslot.cpp +++ b/libpyside/qslot.cpp @@ -49,7 +49,7 @@ extern char* get_type_name(PyObject*); static PyTypeObject Slot_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - "QtCore."SLOT_DEC_NAME, /*tp_name*/ + "PySide.QtCore."SLOT_DEC_NAME, /*tp_name*/ sizeof(SlotData), /*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ From 562bb8a822a8ef24066d75b613d9c2d05fb2fdee Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 16 Sep 2010 14:56:01 -0300 Subject: [PATCH 017/913] Added test from Lauro's patch on bug #313. http://bugs.openbossa.org/show_bug.cgi?id=313 --- tests/QtCore/qtimer_singleshot_test.py | 33 ++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/QtCore/qtimer_singleshot_test.py b/tests/QtCore/qtimer_singleshot_test.py index 96107ec..09c9ed6 100644 --- a/tests/QtCore/qtimer_singleshot_test.py +++ b/tests/QtCore/qtimer_singleshot_test.py @@ -4,7 +4,7 @@ import unittest -from PySide.QtCore import QObject, QTimer, QCoreApplication, SIGNAL +from PySide.QtCore import QObject, QTimer, QCoreApplication, Signal from helper import UsesQCoreApplication class WatchDog(QObject): @@ -40,7 +40,36 @@ class TestSingleShot(UsesQCoreApplication): self.app.quit() def testSingleShot(self): - timer = QTimer.singleShot(100, self.callback) + QTimer.singleShot(100, self.callback) + self.app.exec_() + self.assert_(self.called) + +class SigEmitter(QObject): + + sig1 = Signal() + + +class TestSingleShotSignal(UsesQCoreApplication): + '''Test case for QTimer.singleShot connecting to signals''' + + def setUp(self): + UsesQCoreApplication.setUp(self) + self.watchdog = WatchDog(self) + self.called = False + + def tearDown(self): + del self.watchdog + del self.called + UsesQCoreApplication.tearDown(self) + + def callback(self): + self.called = True + self.app.quit() + + def testSingleShotSignal(self): + emitter = SigEmitter() + emitter.sig1.connect(self.callback) + QTimer.singleShot(100, emitter.sig1) self.app.exec_() self.assert_(self.called) From 75b44379d3e9e5f6dc4e6943b2f2229e32802892 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 16 Sep 2010 16:47:30 -0300 Subject: [PATCH 018/913] Added the method signature QTimer.singleShot(int, Signal). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes bug #313. The implementation can be improved when bug #362 gets fixed. Reviewed by Luciano Wolf Reviewed by Renato Araújo --- PySide/QtCore/typesystem_core.xml | 52 ++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index c0b333f..d7c5891 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1726,8 +1726,15 @@ Shiboken::SbkType<QTimer>()->tp_init(pyTimer, emptyTuple, 0); QTimer* timer = Converter<QTimer*>::toCpp(pyTimer); - PyObject* result = PyObject_CallMethod(pyTimer, const_cast<char*>("connect"), const_cast<char*>("OsOs"), pyTimer, SIGNAL(timeout()), %PYARG_2, %3); - Py_DECREF(result); + Shiboken::AutoDecRef result( + PyObject_CallMethod(pyTimer, + const_cast<char*>("connect"), + const_cast<char*>("OsOs"), + pyTimer, + SIGNAL(timeout()), + %PYARG_2, + %3) + ); // invalidate to avoid use of python object Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); timer->setSingleShot(true); @@ -1744,10 +1751,45 @@ QTimer* timer = Converter<QTimer*>::toCpp(pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); - PyObject* result = PyObject_CallMethod(pyTimer, const_cast<char*>("connect"), const_cast<char*>("OsO"), pyTimer, SIGNAL(timeout()), pyargs[1]); - Py_DECREF(result); + + Shiboken::AutoDecRef result( + PyObject_CallMethod(pyTimer, + const_cast<char*>("connect"), + const_cast<char*>("OsO"), + pyTimer, + SIGNAL(timeout()), + pyargs[1]) + ); Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); - timer->start(cpp_arg0); + timer->start(%1); + + + + + + if (!PyObject_TypeCheck(%2, &PySide::SignalInstance_Type)) + goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError; + + // %FUNCTION_NAME() - disable generation of c++ function call + Shiboken::AutoDecRef emptyTuple(PyTuple_New(0)); + PyObject* pyTimer = Shiboken::SbkType<QTimer>()->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0); + Shiboken::SbkType<QTimer>()->tp_init(pyTimer, emptyTuple, 0); + QTimer* timer = Converter<QTimer*>::toCpp(pyTimer); + timer->setSingleShot(true); + timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); + PySide::SignalInstanceData* signalInstance = reinterpret_cast<PySide::SignalInstanceData*>(%2); + Shiboken::AutoDecRef signalSignature(PyString_FromFormat("2%s", signalInstance->signature)); + Shiboken::AutoDecRef result( + PyObject_CallMethod(pyTimer, + const_cast<char*>("connect"), + const_cast<char*>("OsOO"), + pyTimer, + SIGNAL(timeout()), + signalInstance->source, + signalSignature.object()) + ); + Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + timer->start(%1); From b8436f6b1e1efb4da51c6bcc6c22d997541d10c6 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 16 Sep 2010 11:39:59 -0300 Subject: [PATCH 019/913] Fix doc generation and only generate docs for QtDeclarative module when it was found. Reviewer: Luciano Wolf Marcelo Lira --- doc/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 37dc8d6..92389b9 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -27,7 +27,7 @@ macro(create_doc module typesystem_path) string(REGEX REPLACE "^Qt" "" module_name ${module}) string(TOLOWER ${module_name} module_name) add_custom_target("${module}-apidoc" -COMMAND ${GENERATOR} --generatorSet=qtdoc +COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=qtdoc ${pyside_BINARY_DIR}/global.h --include-paths=${QT_INCLUDE_DIR}:${QT_QTCORE_INCLUDE_DIR} --typesystem-paths=${pyside_SOURCE_DIR}:${${module}_BINARY_DIR}:${typesystem_path} @@ -61,7 +61,9 @@ create_doc(QtScriptTools "${QtCore_SOURCE_DIR}:${QtScript_SOURCE_DIR}:${QtGui_SO create_doc(QtTest "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") create_doc(QtXmlPatterns "${QtCore_SOURCE_DIR}") create_doc(phonon "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -create_doc(QtDeclarative "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtNetwork_SOURCE_DIR}") +if (QT_QTDECLARATIVE_FOUND) + create_doc(QtDeclarative "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtNetwork_SOURCE_DIR}") +endif() #create devhelp file add_custom_target(apidevhelp From 6974551674d72a828ff9ae19af510c90a62a09ec Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 17 Sep 2010 17:03:01 -0300 Subject: [PATCH 020/913] Created PySide cleanup functions used to register functions to be called before the python die. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/glue/qcoreapplication_init.cpp | 11 +++++----- PySide/QtCore/typesystem_core.xml | 11 +++------- PySide/QtGui/glue/qapplication_init.cpp | 20 ++++++++++++++----- libpyside/pyside.cpp | 21 +++++++++++++++++++- libpyside/pyside.h | 9 +++++++++ libpyside/signalmanager.cpp | 7 +++++++ 6 files changed, 59 insertions(+), 20 deletions(-) diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 7601dbd..14ccbb8 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -1,21 +1,20 @@ // Global variables used to store argc and argv values static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -static bool leavingPython = false; /** * Called at QtCore module exit */ void DeleteQCoreApplicationAtExit() { - leavingPython = true; QCoreApplication *cpp = QCoreApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); PyObject* pySelf = bmngr.retrieveWrapper(cpp); - if (pySelf) - bmngr.invalidateWrapper(pySelf); - cpp->deleteLater(); + cpp->flush(); + QCoreApplication::processEvents(); + bmngr.invalidateWrapper(pySelf); + delete cpp; } } @@ -54,7 +53,7 @@ int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) PySide::signalUpdateSource(self); cptr->metaObject(); - Py_AtExit(DeleteQCoreApplicationAtExit); + PySide::registerCleanupFunction(DeleteQCoreApplicationAtExit); Py_INCREF(self); return 1; } diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index d7c5891..f10ed07 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -552,8 +552,8 @@ - - PySide::SignalManager::instance().clear(); + + PySide::runCleanupFunctions(); @@ -1875,12 +1875,7 @@ - - - Shiboken::ThreadStateSaver threadStateSaver; - if (!leavingPython) - threadStateSaver.save(); - + diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index 699633a..208d59a 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -4,19 +4,29 @@ extern PyObject* moduleQtGui; static int QApplicationArgCount; static char** QApplicationArgValues; static const char QAPP_MACRO[] = "qApp"; -static bool leavingPython = false; void DeleteQApplicationAtExit() { - leavingPython = true; PySide::SignalManager::instance().clear(); QCoreApplication* cpp = QApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - PyObject* pySelf = bmngr.retrieveWrapper(cpp); - if (pySelf) + cpp->flush(); + + // Delete all widgets, this is slow but is necessary to avoid problems with python object + foreach(QWidget* w, QApplication::allWidgets()) { + PyObject* pySelf = bmngr.retrieveWrapper(w); + + w->deleteLater(); + //Make sure all events will send before invalidated the python object + QApplication::processEvents(); bmngr.invalidateWrapper(pySelf); + } + + PyObject* pySelf = bmngr.retrieveWrapper(cpp); cpp->deleteLater(); + QApplication::processEvents(); + bmngr.invalidateWrapper(pySelf); } } @@ -62,7 +72,7 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) } PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self); - Py_AtExit(DeleteQApplicationAtExit); + PySide::registerCleanupFunction(DeleteQApplicationAtExit); Py_INCREF(self); return 1; } diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index ddec198..bd4ab7c 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -24,18 +24,22 @@ #include "pyside.h" #include "signalmanager.h" #include "qproperty.h" +#include "qsignal.h" #include #include #include -#include "qsignal.h" +#include extern "C" void init_signal(PyObject* module); extern "C" void init_slot(PyObject* module); extern "C" void init_qproperty(PyObject* module); +static QStack cleanupFunctionList; + namespace PySide { + void init(PyObject *module) { init_signal(module); @@ -82,5 +86,20 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds return true; } +void registerCleanupFunction(CleanupFunction func) +{ + cleanupFunctionList.push(func); +} + +void runCleanupFunctions() +{ + while (!cleanupFunctionList.isEmpty()) { + CleanupFunction f = cleanupFunctionList.pop(); + f(); + } +} + + + } //namespace PySide diff --git a/libpyside/pyside.h b/libpyside/pyside.h index cae050b..2c5afb5 100644 --- a/libpyside/pyside.h +++ b/libpyside/pyside.h @@ -75,6 +75,15 @@ template struct initQtMetaType { }; + +typedef void (*CleanupFunction)(void); + +/** + * Register a function to be called before python die + */ +PYSIDE_API void registerCleanupFunction(CleanupFunction func); +PYSIDE_API void runCleanupFunctions(); + } //namespace PySide diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 8208796..3724500 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -22,6 +22,7 @@ #include "signalmanager.h" #include "qproperty.h" +#include "pyside.h" #include #include @@ -223,6 +224,11 @@ struct SignalManager::SignalManagerPrivate GlobalReceiver m_globalReceiver; }; +static void clearSignalManager() +{ + PySide::SignalManager::instance().clear(); +} + SignalManager::SignalManager() : m_d(new SignalManagerPrivate) { // Register Qt primitive typedefs used on signals. @@ -234,6 +240,7 @@ SignalManager::SignalManager() : m_d(new SignalManagerPrivate) TypeResolver::createValueTypeResolver(PYTHON_TYPE); TypeResolver::createValueTypeResolver("object"); TypeResolver::createValueTypeResolver("PySide::PyObjectWrapper"); + PySide::registerCleanupFunction(clearSignalManager); } void SignalManager::clear() From 5a86f845c2eabb71a3a19be32a2d34ad5b72bca9 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 10:32:24 -0300 Subject: [PATCH 021/913] Renamed QProperty object to Property. Reviewer: Luciano Wolf Marcelo Lira --- libpyside/pyside.cpp | 3 --- libpyside/qproperty.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index bd4ab7c..d466458 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -39,7 +39,6 @@ static QStack cleanupFunctionList; namespace PySide { - void init(PyObject *module) { init_signal(module); @@ -99,7 +98,5 @@ void runCleanupFunctions() } } - - } //namespace PySide diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index e0f2574..7453876 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -27,7 +27,7 @@ #include "qproperty.h" -#define QPROPERTY_CLASS_NAME "QProperty" +#define QPROPERTY_CLASS_NAME "Property" namespace PySide { From 67cb84debbd19bd47ee0281fd014bd77042f1e4c Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 11:12:47 -0300 Subject: [PATCH 022/913] Removed old comentary (not necessary anymore). Reviewer: Luciano Wolf Marcelo Lira --- libpyside/dynamicqmetaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index b97ae0d..6c7710f 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -512,7 +512,7 @@ void DynamicQMetaObject::updateMetaObject() data[index++] = NULL_INDEX; data[index++] = (pp.isValid() ? registerString(pp.type(), &strings) : NULL_INDEX); // normalized type - data[index++] = pp.flags(); //pp.flags(); //TODO: flags + data[index++] = pp.flags(); } data[index++] = 0; // the end From b476759ed077e45f6d9ec78cf367554f1f5114f3 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 11:17:28 -0300 Subject: [PATCH 023/913] Updated test with new Property name. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtCore/qobject_property_test.py | 4 ++-- tests/QtScript/property_test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/QtCore/qobject_property_test.py b/tests/QtCore/qobject_property_test.py index fcf8e89..7406894 100644 --- a/tests/QtCore/qobject_property_test.py +++ b/tests/QtCore/qobject_property_test.py @@ -23,7 +23,7 @@ class ExQObject(QObject): def getProperty(self): return self._value - registeredproperty = QProperty(int, getProperty, setProperty) + registeredproperty = Property(int, getProperty, setProperty) class MyObject(QObject): '''Test Property''' @@ -34,7 +34,7 @@ class MyObject(QObject): def trySetPP(self): self.pp = 0 - pp = QProperty(int, readPP) + pp = Property(int, readPP) class PropertyCase(unittest.TestCase): '''Test case for QObject properties''' diff --git a/tests/QtScript/property_test.py b/tests/QtScript/property_test.py index 6d20416..52c01f7 100644 --- a/tests/QtScript/property_test.py +++ b/tests/QtScript/property_test.py @@ -1,6 +1,6 @@ import unittest -from PySide.QtCore import QObject, QProperty, QCoreApplication +from PySide.QtCore import QObject, Property, QCoreApplication from PySide.QtScript import QScriptEngine class MyObject(QObject): @@ -20,7 +20,7 @@ class MyObject(QObject): def delX(self): self._p = 0 - x = QProperty(int, getX, setX, resetX, delX) + x = Property(int, getX, setX, resetX, delX) class QPropertyTest(unittest.TestCase): From 80c2ebe62694815e2023b5fbafb9242fbdd1f2c9 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 15:12:08 -0300 Subject: [PATCH 024/913] Created unit test for bug 363. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_363.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/QtGui/bug_363.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 887caa6..ea6b4a6 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -6,6 +6,7 @@ PYSIDE_TEST(bug_300_test.py) PYSIDE_TEST(bug_307.py) PYSIDE_TEST(bug_324.py) PYSIDE_TEST(bug_338.py) +PYSIDE_TEST(bug_363.py) PYSIDE_TEST(add_action_test.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_363.py b/tests/QtGui/bug_363.py new file mode 100644 index 0000000..5ba5dee --- /dev/null +++ b/tests/QtGui/bug_363.py @@ -0,0 +1,25 @@ +''' Test bug 363: http://bugs.openbossa.org/show_bug.cgi?id=363''' + +import sys +import unittest +from helper import UsesQApplication +from PySide import QtCore,QtGui + +# Check for desktop object lifetime +class BugTest(UsesQApplication): + def mySlot(self): + pass + + # test if it is possible to connect with a desktop object after storing that on an auxiliar variable + def testCase1(self): + desktop = QtGui.QApplication.desktop() + desktop.resized[int].connect(self.mySlot) + self.assert_(True) + + # test if it is possible to connect with a desktop object without storing that on an auxiliar variable + def testCase2(self): + QtGui.QApplication.desktop().resized[int].connect(self.mySlot) + self.assert_(True) + +if __name__ == '__main__': + unittest.main() From 0c0a5c128dcccc54ce08f53faec480d5d51f3425 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 15:12:23 -0300 Subject: [PATCH 025/913] Fixed QApplication static functions return policy. Fixes bug #363. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 46 ++++++++++++++++++++++++-- PySide/typesystem_templates.xml | 6 ++++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index a3ed01d..2237278 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -4290,9 +4290,49 @@ - - Shiboken::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0); - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index e2e6fc4..959fe7e 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -181,5 +181,11 @@ %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5); %PYARG_0 = Shiboken::makeTuple(retval_, %4); + + From aa47ffd8956c0071f098fac296e9e081729b810a Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 20 Sep 2010 16:49:45 -0300 Subject: [PATCH 026/913] Added missing classes to QtNetwork module. The missing classes are: QAbstractNetworkCache, QNetworkDiskCache e QNetworkCacheMetaData. Reviewed by Hugo Parente Reviewed by Luciano Wolf --- PySide/QtNetwork/CMakeLists.txt | 7 +++++-- PySide/QtNetwork/typesystem_network.xml | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PySide/QtNetwork/CMakeLists.txt b/PySide/QtNetwork/CMakeLists.txt index 768b80e..faf5a1d 100644 --- a/PySide/QtNetwork/CMakeLists.txt +++ b/PySide/QtNetwork/CMakeLists.txt @@ -11,22 +11,25 @@ else() endif () set(QtNetwork_SRC +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qabstractnetworkcache_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qabstractsocket_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qauthenticator_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qftp_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhostaddress_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhostinfo_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhttp_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhttpheader_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhttprequestheader_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhttpresponseheader_wrapper.cpp -${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qhttp_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qipv6address_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qlocalserver_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qlocalsocket_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkaccessmanager_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkaddressentry_wrapper.cpp -${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkcookiejar_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkcachemetadata_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkcookie_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkcookiejar_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkdiskcache_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkinterface_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkproxy_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkreply_wrapper.cpp diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 89cea39..756f3ec 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -281,5 +281,9 @@ + + + + From ae44c27bb06c721b783a311111efd66465f681fd Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 18:31:29 -0300 Subject: [PATCH 027/913] Created unittest for bug 367. --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_367.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/QtGui/bug_367.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index ea6b4a6..9b928ac 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -7,6 +7,7 @@ PYSIDE_TEST(bug_307.py) PYSIDE_TEST(bug_324.py) PYSIDE_TEST(bug_338.py) PYSIDE_TEST(bug_363.py) +PYSIDE_TEST(bug_367.py) PYSIDE_TEST(add_action_test.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_367.py b/tests/QtGui/bug_367.py new file mode 100644 index 0000000..b27a552 --- /dev/null +++ b/tests/QtGui/bug_367.py @@ -0,0 +1,22 @@ +''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=367''' + +import sys +import unittest +from helper import UsesQApplication +from PySide import QtCore,QtGui + +class BugTest(UsesQApplication): + def testCase(self): + model = QtGui.QStandardItemModel() + parentItem = model.invisibleRootItem() + for i in range(10): + item = QtGui.QStandardItem() + rcount = sys.getrefcount(item) + parentItem.appendRow(item) + self.assertEqual(rcount+1, sys.getrefcount(item)) + parentItem = item + + self.assert_(True) + +if __name__ == '__main__': + unittest.main() From f8a12b7577773f6a02804e1e60920a964f5e01ca Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 18:31:49 -0300 Subject: [PATCH 028/913] Fixed ownership rules for QStandardItem functions. Fixes bug #367. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 112 +++++++++++++++++++++++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 2237278..0ffdf90 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -2004,6 +2004,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // Clear parent from the old child + QStandardItem* _i = %CPPSELF->child(%1, %2); + if (_i) { + PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + Shiboken::setParent(0, _pyI); + } + + + + + + + + // Clear parent from the old child + QStandardItem* _i = %CPPSELF->child(%1); + if (_i) { + PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + Shiboken::setParent(0, _pyI); + } + + + + + + + + + + + + @@ -3628,11 +3699,18 @@ - + + + + + + + + @@ -3643,12 +3721,29 @@ + + + // Clear parent from the old child + QStandardItem* _i = %CPPSELF->item(%1, %2); + if (_i) { + PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + Shiboken::setParent(0, _pyI); + } + + + // Clear parent from the old child + QStandardItem* _i = %CPPSELF->item(%1); + if (_i) { + PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + Shiboken::setParent(0, _pyI); + } + @@ -3658,7 +3753,16 @@ + + + // Clear parent from the old child + QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1); + if (_i) { + PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); + Shiboken::setParent(0, _pyI); + } + @@ -3694,12 +3798,6 @@ - - - - - - From 2a225be9c770ccf774a97457ab409b6b3f60b467 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 20 Sep 2010 19:02:16 -0300 Subject: [PATCH 029/913] Use CMAKE__POSTFIX on config files, used for cmake and pkgconfig. Fixes bug #286. Reviewer: Luciano Wolf Marcelo Lira --- libpyside/CMakeLists.txt | 6 ++++++ libpyside/PySideConfig.cmake.in | 2 +- libpyside/pyside.pc.in | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libpyside/CMakeLists.txt b/libpyside/CMakeLists.txt index 11196f8..20bd03a 100644 --- a/libpyside/CMakeLists.txt +++ b/libpyside/CMakeLists.txt @@ -42,6 +42,12 @@ set(libpyside_HEADERS qproperty.h ) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_DEBUG_POSTFIX}) +else() + set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_RELEASE_POSTFIX}) +endif() + # create pkg-config file configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pyside.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" @ONLY) diff --git a/libpyside/PySideConfig.cmake.in b/libpyside/PySideConfig.cmake.in index 9e0f42e..654e6a3 100644 --- a/libpyside/PySideConfig.cmake.in +++ b/libpyside/PySideConfig.cmake.in @@ -3,5 +3,5 @@ # PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide SET(PYSIDE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PySide@pyside_SUFFIX@") -SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") +SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFFIX@/typesystems") diff --git a/libpyside/pyside.pc.in b/libpyside/pyside.pc.in index 516f8e1..f58c537 100644 --- a/libpyside/pyside.pc.in +++ b/libpyside/pyside.pc.in @@ -7,6 +7,6 @@ typesystemdir=@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFIX@/typesystems Name: PySide@pyside_SUFFIX@ Description: Support library for Python bindings of Qt-based libraries. Version: @BINDING_API_VERSION@ -Libs: -L${libdir} -lpython -lpyside@pyside_SUFFIX@ +Libs: -L${libdir} -lpython -lpyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@ Cflags: -I${includedir} From 4229fa0082135c889094c6cea7baa970b5208587 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 21 Sep 2010 14:29:34 -0300 Subject: [PATCH 030/913] Created unit test for bug #360. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtUiTools/CMakeLists.txt | 1 + tests/QtUiTools/bug_360.py | 36 ++++++++++++++++++++++++++++++++++ tests/QtUiTools/minimal.ui | 6 ++++++ 3 files changed, 43 insertions(+) create mode 100644 tests/QtUiTools/bug_360.py create mode 100644 tests/QtUiTools/minimal.ui diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt index 9118b5b..03ce768 100644 --- a/tests/QtUiTools/CMakeLists.txt +++ b/tests/QtUiTools/CMakeLists.txt @@ -1,2 +1,3 @@ +PYSIDE_TEST(bug_360.py) PYSIDE_TEST(uiloader_test.py) PYSIDE_TEST(ui_test.py) diff --git a/tests/QtUiTools/bug_360.py b/tests/QtUiTools/bug_360.py new file mode 100644 index 0000000..aefc422 --- /dev/null +++ b/tests/QtUiTools/bug_360.py @@ -0,0 +1,36 @@ +import unittest +import os +from helper import UsesQApplication + +from PySide import QtCore, QtGui +from PySide.QtUiTools import QUiLoader + +class MyQUiLoader(QUiLoader): + def __init__(self, baseinstance): + QUiLoader.__init__(self) + self.baseinstance = baseinstance + self._widgets = [] + + def createWidget(self, className, parent=None, name=""): + widget = QUiLoader.createWidget(self, className, parent, name) + self._widgets.append(widget) + if parent is None: + return self.baseinstance + else: + setattr(self.baseinstance, name, widget) + return widget + +class ButTest(UsesQApplication): + def testCase(self): + w = QtGui.QWidget() + loader = MyQUiLoader(w) + + filePath = os.path.join(os.path.dirname(__file__), 'minimal.ui') + ui = loader.load(filePath) + + self.assertEqual(len(loader._widgets), 1) + self.assertEqual(type(loader._widgets[0]), QtGui.QFrame) + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/QtUiTools/minimal.ui b/tests/QtUiTools/minimal.ui new file mode 100644 index 0000000..c6bb70c --- /dev/null +++ b/tests/QtUiTools/minimal.ui @@ -0,0 +1,6 @@ + + + Form + + + From c41f0dc385335890cacdb830054e24d34acd0246 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 21 Sep 2010 15:46:39 -0300 Subject: [PATCH 031/913] The CMake configuration for PySide and Shiboken use the PYTHON_LIBRARIES variable to link against Python. This is not the correct way to link against Python on OS X. Instead of specifying a library or the framework, one simply uses the flag "-undefined dynamic_lookup". The symbols will be resolved at runtime when the extension module loads. Fixes bug #352: Thanks to Robert Kern Reviewer: Hugo Parente Lima Luciano Wolf --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ba7022..47ab784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,7 +169,9 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") else() set(PYSIDE_PYTHON_LIBRARIES ${PYTHON_LIBRARIES}) endif() - +if(APPLE) + set(PYSIDE_PYTHON_LIBRARIES "-undefined dynamic_lookup") +endif() set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic) From fccfafe71fdf148fca9b6c0c9b09feccd57cf0ec Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 21 Sep 2010 17:18:33 -0300 Subject: [PATCH 032/913] Added enum QML_HAS_ATTACHED_PROPERTIES to QtCore type system file. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also suppressed warning about _ISalnum enum from ctypes.h Reviewed by Luciano Wolf Reviewed by Renato Araújo --- PySide/QtCore/typesystem_core.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index f10ed07..ced3194 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -115,6 +115,12 @@ + + + + + + @@ -2546,6 +2552,7 @@ + From 3525b77d69937938aa285f84b995a3a2d8685cce Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 22 Sep 2010 16:59:04 -0300 Subject: [PATCH 033/913] Created unit test for bug #376. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtUiTools/CMakeLists.txt | 1 + tests/QtUiTools/bug_376.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/QtUiTools/bug_376.py diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt index 03ce768..9ede81f 100644 --- a/tests/QtUiTools/CMakeLists.txt +++ b/tests/QtUiTools/CMakeLists.txt @@ -1,3 +1,4 @@ PYSIDE_TEST(bug_360.py) +PYSIDE_TEST(bug_376.py) PYSIDE_TEST(uiloader_test.py) PYSIDE_TEST(ui_test.py) diff --git a/tests/QtUiTools/bug_376.py b/tests/QtUiTools/bug_376.py new file mode 100644 index 0000000..2bd6b5c --- /dev/null +++ b/tests/QtUiTools/bug_376.py @@ -0,0 +1,19 @@ +import unittest +import os +from helper import UsesQApplication + +from PySide import QtCore, QtGui +from PySide.QtUiTools import QUiLoader + +class BugTest(UsesQApplication): + def testCase(self): + w = QtGui.QWidget() + loader = QUiLoader() + + filePath = os.path.join(os.path.dirname(__file__), 'test.ui') + result = loader.load(filePath, w) + self.assertEqual(type(result.child_object), QtGui.QFrame) + +if __name__ == '__main__': + unittest.main() + From bf4b2c7660adc99b6a8b83748787f0ea078ad13b Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 22 Sep 2010 16:59:46 -0300 Subject: [PATCH 034/913] Port old boost code used in QtUiTools. fixes bug #376. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtUiTools/glue/uitools_loadui.h | 68 +++++++++++++++++++++++++ PySide/QtUiTools/typesystem_uitools.xml | 35 ++++++++----- 2 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 PySide/QtUiTools/glue/uitools_loadui.h diff --git a/PySide/QtUiTools/glue/uitools_loadui.h b/PySide/QtUiTools/glue/uitools_loadui.h new file mode 100644 index 0000000..da851c1 --- /dev/null +++ b/PySide/QtUiTools/glue/uitools_loadui.h @@ -0,0 +1,68 @@ +/* + * Based on code provided by: + * Antonio Valentino + * Frédéric + */ + +#include + +static void +_populate_parent(PyObject* pyParent, QWidget *parent) +{ + if (parent->children().isEmpty()) + return; + + foreach(QObject *child, parent->children()) { + QString name(child->objectName()); + if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) { + bool has_attr = PyObject_HasAttrString(pyParent, qPrintable(name)); + Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(child)); + if (!has_attr) + PyObject_SetAttrString(pyParent, qPrintable(name), pyChild); + + Shiboken::setParent(pyParent, pyChild); + _populate_parent(pyChild, qobject_cast(child)); + } + } +} + +static PyObject* +quiloader_load_ui_from_device(QUiLoader* self, QIODevice* dev, QWidget *parent) +{ + QWidget *w = self->load(dev, parent); + if (w) { + if (parent && parent->layout()) + parent->layout()->deleteLater(); + + PyObject* pyParent = Shiboken::Converter::toPython(w); + _populate_parent(pyParent, w); + + return pyParent; + } + + PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file"); + return 0; +} + +static PyObject* +quiloader_load_ui(QUiLoader* self, const QString &ui_file, QWidget *parent) +{ + QFile fd(ui_file); + + if (fd.exists(ui_file) && fd.open(QFile::ReadOnly)) { + QWidget* w = self->load(&fd, parent); + fd.close(); + if (w != 0) { + PyObject* pyParent = Shiboken::Converter::toPython(w); + + if (parent && parent->layout()) + parent->layout()->deleteLater(); + + _populate_parent(pyParent, w); + + return pyParent; + } + } + PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file"); + return 0; +} diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml index 7ea988b..a188aa3 100644 --- a/PySide/QtUiTools/typesystem_uitools.xml +++ b/PySide/QtUiTools/typesystem_uitools.xml @@ -48,13 +48,9 @@ - - - - - - - + + + @@ -63,11 +59,26 @@ - QFile f(%1); - if (f.open(QIODevice::ReadOnly | QIODevice::Text)) - %PYARG_0 = %CONVERTTOPYTHON[QWidget*](%CPPSELF.load(&f, %2)); - else - PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file"); + //Avoid calling the original function: %CPPSELF.load + %PYARG_0 = quiloader_load_ui_from_device(%CPPSELF, %1, %2); + + + + + + + + + + + + + + + + + //Avoid calling the original function: %CPPSELF.load + %PYARG_0 = quiloader_load_ui(%CPPSELF, %1, %2); From 8048bd0c3bcdb1de33aa69d961402b355d6b07af Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 21 Sep 2010 09:32:02 -0300 Subject: [PATCH 035/913] Modified the type system files to make use of nested type declarations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by Luciano Wolf Reviewed by Renato Araújo --- PySide/QtCore/typesystem_core.xml | 371 +++---- .../QtDeclarative/typesystem_declarative.xml | 31 +- PySide/QtGui/typesystem_gui_common.xml | 928 ++++++++++-------- PySide/QtGui/typesystem_gui_maemo.xml | 9 +- PySide/QtHelp/typesystem_help.xml | 6 +- PySide/QtMaemo5/typesystem_maemo5.xml | 3 +- PySide/QtMultimedia/typesystem_multimedia.xml | 39 +- PySide/QtNetwork/typesystem_network.xml | 124 +-- PySide/QtOpenGL/typesystem_opengl.xml | 29 +- PySide/QtScript/typesystem_script.xml | 41 +- .../QtScriptTools/typesystem_scripttools.xml | 9 +- PySide/QtSql/typesystem_sql.xml | 33 +- PySide/QtTest/typesystem_test.xml | 15 +- PySide/QtWebKit/typesystem_webkit.xml | 48 +- PySide/QtXml/typesystem_xml.xml | 16 +- .../QtXmlPatterns/typesystem_xmlpatterns.xml | 19 +- PySide/phonon/typesystem_phonon.xml | 343 +++---- 17 files changed, 1088 insertions(+), 976 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index ced3194..ec78941 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -90,38 +90,19 @@ - - - - - - - + - - - - - - - - - - - - - + - + - + - @@ -537,6 +518,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -563,134 +617,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Shiboken::TypeResolver::createValueTypeResolver<QString>("unicode"); @@ -738,7 +664,9 @@ - + + + @@ -748,6 +676,7 @@ + @@ -785,6 +714,7 @@ + @@ -818,6 +748,8 @@ + + @@ -860,10 +792,17 @@ + + + + + + + @@ -977,6 +916,7 @@ + @@ -988,8 +928,11 @@ - + + + + @@ -1263,6 +1206,8 @@ + + <para>URLs can be represented in two forms: encoded or unencoded. The unencoded representation is suitable for showing to users, but the encoded representation is typically what you would send to a web server. For example, the unencoded URL "http://bühler.example.com" would be sent to the server as "http://xn--bhler-kva.example.com/List%20of%20applicants.xml".</para> @@ -1271,6 +1216,8 @@ + + @@ -1571,6 +1518,8 @@ + + @@ -1581,11 +1530,15 @@ + + + + @@ -1607,6 +1560,7 @@ + @@ -1632,9 +1586,12 @@ + - + + + @@ -1646,6 +1603,7 @@ + @@ -1654,9 +1612,16 @@ - - - + + + + + + + + + + @@ -1670,6 +1635,17 @@ + + + + + + + + + + + @@ -1694,7 +1670,11 @@ - + + + + + @@ -1709,14 +1689,6 @@ - - - - - - - - @@ -1804,6 +1776,11 @@ + + + + + @@ -1823,6 +1800,11 @@ + + + + + @@ -1847,6 +1829,7 @@ + @@ -1898,6 +1881,9 @@ + + + @@ -1908,7 +1894,9 @@ - + + + @@ -1931,6 +1919,9 @@ + + + @@ -2155,6 +2146,10 @@ + + + + @@ -2189,8 +2184,12 @@ - + + + + + @@ -2215,6 +2214,9 @@ + + + @@ -2247,9 +2249,12 @@ - - + + + + + @@ -2263,7 +2268,11 @@ - + + + + + @@ -2358,6 +2367,7 @@ http://bugs.openbossa.org/show_bug.cgi?id=201 --> + @@ -2378,8 +2388,9 @@ - - + + + @@ -2397,8 +2408,8 @@ - + @@ -2452,10 +2463,14 @@ - - - + + + + + + + @@ -2491,8 +2506,6 @@ - - diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index 3d0f56c..888ca6f 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -25,24 +25,27 @@ - - + + + + - - - - - + + + + + + @@ -54,14 +57,16 @@ - - - + + + + - - - + + + + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 0ffdf90..76afecc 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -147,307 +147,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -462,47 +163,157 @@ - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -510,11 +321,22 @@ - + + + + + - + + + + + + + + @@ -525,15 +347,30 @@ + + - + + + - + + + + + + + + + + + + @@ -544,6 +381,9 @@ + + + @@ -565,6 +405,7 @@ + @@ -576,10 +417,20 @@ - + + + + + + + + + + + @@ -587,9 +438,15 @@ + + + + - + + + @@ -610,6 +467,8 @@ + + @@ -623,14 +482,8 @@ - - - - - - - + @@ -639,17 +492,6 @@ - - - - - - - - - - - @@ -690,6 +532,9 @@ + + + @@ -707,15 +552,6 @@ - - - - - - - - - @@ -745,17 +581,14 @@ - - - - - - - - - - + + + + + + + @@ -771,6 +604,8 @@ + + @@ -816,6 +651,7 @@ + @@ -828,6 +664,7 @@ + @@ -1098,7 +935,6 @@ - @@ -1204,7 +1040,12 @@ - + + + + + + @@ -1228,8 +1069,15 @@ - + + + + + + + + PyObject* userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType); PyDict_SetItemString(SbkQGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant); @@ -1359,6 +1207,15 @@ + + + + + + + + + + + + @@ -1498,6 +1370,7 @@ + @@ -1505,9 +1378,17 @@ - - + + + + + + + + + + @@ -1528,8 +1409,11 @@ - + + + + @@ -1584,12 +1468,15 @@ - + + + + @@ -1605,6 +1492,7 @@ + @@ -1614,6 +1502,7 @@ + @@ -1670,8 +1559,16 @@ - - + + + + + + + + + + @@ -1690,6 +1587,7 @@ + @@ -1775,6 +1673,9 @@ + + + @@ -1785,6 +1686,7 @@ + @@ -1949,8 +1851,12 @@ - - + + + + + + @@ -1972,6 +1878,7 @@ + @@ -1994,6 +1901,7 @@ + @@ -2109,9 +2017,19 @@ - - - + + + + + + + + + + + + + @@ -2126,6 +2044,8 @@ + + @@ -2159,7 +2079,9 @@ - + + + @@ -2203,6 +2125,7 @@ + @@ -2294,6 +2217,7 @@ + @@ -2331,6 +2255,7 @@ + @@ -2340,7 +2265,9 @@ - + + + @@ -2356,7 +2283,9 @@ - + + + @@ -2374,7 +2303,16 @@ - + + + + + + + + + + @@ -2385,7 +2323,10 @@ - + + + + @@ -2399,6 +2340,17 @@ + + + + + + + + + + + @@ -2422,6 +2374,7 @@ + @@ -2433,6 +2386,8 @@ + + @@ -2491,6 +2446,7 @@ + addLayoutOwnership(%CPPSELF, %2); @@ -2501,7 +2457,9 @@ - + + + @@ -2600,6 +2558,11 @@ + + + + + @@ -2666,6 +2629,8 @@ + + @@ -2716,6 +2681,8 @@ + + @@ -2866,6 +2833,9 @@ + + + @@ -2932,6 +2902,7 @@ + @@ -2947,6 +2918,7 @@ + @@ -2970,6 +2942,7 @@ + @@ -3024,6 +2997,8 @@ + + @@ -3041,6 +3016,8 @@ + + @@ -3168,6 +3145,8 @@ + + @@ -3304,6 +3283,9 @@ + + + @@ -3346,6 +3328,9 @@ + + + @@ -3372,11 +3357,19 @@ + + + + + + + + @@ -3407,6 +3400,7 @@ + @@ -3423,6 +3417,8 @@ + + @@ -3432,9 +3428,12 @@ + + + @@ -3517,6 +3516,7 @@ + @@ -3541,11 +3541,13 @@ + + @@ -3593,6 +3595,11 @@ + + + + + @@ -3648,6 +3655,9 @@ + + + @@ -3823,6 +3833,7 @@ + @@ -3888,6 +3899,7 @@ + @@ -3901,6 +3913,10 @@ + + + + @@ -3968,6 +3984,10 @@ + + + + @@ -4031,6 +4051,7 @@ + @@ -4043,7 +4064,10 @@ - + + + + @@ -4051,6 +4075,7 @@ + @@ -4075,7 +4100,11 @@ - + + + + + @@ -4150,6 +4179,10 @@ + + + + @@ -4166,6 +4199,8 @@ + + @@ -4208,6 +4243,11 @@ + + + + + @@ -4224,6 +4264,17 @@ + + + + + + + + + + + @@ -4239,6 +4290,10 @@ + + + + @@ -4251,6 +4306,9 @@ + + + @@ -4354,6 +4412,8 @@ + + @@ -4435,6 +4495,7 @@ + @@ -4446,6 +4507,10 @@ + + + + @@ -4683,6 +4748,7 @@ + @@ -4695,7 +4761,10 @@ - + + + + @@ -4714,18 +4783,6 @@ - - - - - - - - - - - - @@ -4796,16 +4853,24 @@ - - + + + + + + - + + + - - + + + + - - + + + - - - + + + + diff --git a/PySide/QtGui/typesystem_gui_maemo.xml b/PySide/QtGui/typesystem_gui_maemo.xml index 99ccb2e..f49da9d 100644 --- a/PySide/QtGui/typesystem_gui_maemo.xml +++ b/PySide/QtGui/typesystem_gui_maemo.xml @@ -20,10 +20,11 @@ --> - - - - + + + + + diff --git a/PySide/QtHelp/typesystem_help.xml b/PySide/QtHelp/typesystem_help.xml index b853c04..bc58957 100644 --- a/PySide/QtHelp/typesystem_help.xml +++ b/PySide/QtHelp/typesystem_help.xml @@ -22,8 +22,6 @@ - - @@ -38,7 +36,9 @@ - + + + diff --git a/PySide/QtMaemo5/typesystem_maemo5.xml b/PySide/QtMaemo5/typesystem_maemo5.xml index 94adaa1..74715ea 100644 --- a/PySide/QtMaemo5/typesystem_maemo5.xml +++ b/PySide/QtMaemo5/typesystem_maemo5.xml @@ -21,8 +21,6 @@ - - @@ -76,6 +74,7 @@ + diff --git a/PySide/QtMultimedia/typesystem_multimedia.xml b/PySide/QtMultimedia/typesystem_multimedia.xml index bd0f6ad..04e064b 100644 --- a/PySide/QtMultimedia/typesystem_multimedia.xml +++ b/PySide/QtMultimedia/typesystem_multimedia.xml @@ -24,22 +24,19 @@ - - - - - - - - - - - - - + + + + + - + + + + + + @@ -55,10 +52,18 @@ - - + + + + + + + - + + + + diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 756f3ec..5e09ab7 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -22,6 +22,11 @@ + + + + + @@ -29,42 +34,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -73,6 +49,11 @@ + + + + + @@ -105,6 +86,9 @@ + + + @@ -143,6 +127,7 @@ + @@ -190,8 +175,13 @@ - + + + + + + @@ -209,16 +199,19 @@ + + + @@ -228,11 +221,18 @@ - + + + - + + + + - + + + @@ -241,45 +241,55 @@ + - + + + + + + + - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 43e097f..2a7557e 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -25,13 +25,8 @@ - - - - - - + @@ -43,9 +38,13 @@ - + + + + + @@ -64,7 +63,9 @@ - + + + @@ -90,7 +91,9 @@ - + + + @@ -102,12 +105,10 @@ - - - - - + + + diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml index a37e6fb..c71a60f 100644 --- a/PySide/QtScript/typesystem_script.xml +++ b/PySide/QtScript/typesystem_script.xml @@ -21,30 +21,35 @@ - - - - - - - - - - - - - + + + + - - - - + + + + + + + + + + + + + + - + + + + + diff --git a/PySide/QtScriptTools/typesystem_scripttools.xml b/PySide/QtScriptTools/typesystem_scripttools.xml index ad68aed..d223112 100644 --- a/PySide/QtScriptTools/typesystem_scripttools.xml +++ b/PySide/QtScriptTools/typesystem_scripttools.xml @@ -22,13 +22,10 @@ - - - - - - + + + diff --git a/PySide/QtSql/typesystem_sql.xml b/PySide/QtSql/typesystem_sql.xml index 40beff0..f7c5325 100644 --- a/PySide/QtSql/typesystem_sql.xml +++ b/PySide/QtSql/typesystem_sql.xml @@ -26,6 +26,10 @@ + + + + @@ -54,6 +58,7 @@ + @@ -78,7 +83,9 @@ - + + + @@ -86,9 +93,14 @@ - + + + + + + @@ -122,6 +134,8 @@ + + @@ -139,6 +153,7 @@ + @@ -151,18 +166,4 @@ - - - - - - - - - - - - - - diff --git a/PySide/QtTest/typesystem_test.xml b/PySide/QtTest/typesystem_test.xml index a1dfa83..b7028eb 100644 --- a/PySide/QtTest/typesystem_test.xml +++ b/PySide/QtTest/typesystem_test.xml @@ -53,6 +53,13 @@ + + + + + + + @@ -61,14 +68,6 @@ - - - - - - - - diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index 2ba3d8c..1c39111 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -25,24 +25,6 @@ - - - - - - - - - - - - - - - - - - @@ -60,6 +42,7 @@ + @@ -69,8 +52,23 @@ - + + + + + + + + + + + + + + + + @@ -87,9 +85,11 @@ - - - + + + + + @@ -98,6 +98,8 @@ - + + + diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index 3db64b5..4cccb8a 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -27,14 +27,6 @@ - - - - - @@ -217,11 +209,15 @@ - + + + + + @@ -322,6 +318,8 @@ @@ -69,7 +68,9 @@ - + + + diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index e326436..4c700bc 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -37,175 +37,180 @@ + + + + Phonon::BackendCapabilities::NotifierWrapper* Phonon::BackendCapabilities::NotifierWrapper::m_instance = 0; + Phonon::BackendCapabilities::Notifier* Phonon::BackendCapabilities::NotifierWrapper::m_notifier = 0; + + + + + Phonon::BackendCapabilities::NotifierWrapper *_notifierWrapper = Phonon::BackendCapabilities::NotifierWrapper::notifier(); + %PYARG_0 = %CONVERTTOPYTHON[Phonon::BackendCapabilities::NotifierWrapper*](_notifierWrapper); + + + + + + + + + + + + + + + PyObject* signal_item; + + signal_item = PySide::signalNew("capabilitiesChanged", "void", NULL); + PyDict_SetItemString(SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "capabilitiesChanged", signal_item); + Py_DECREF(signal_item); + + signal_item = PySide::signalNew("availableAudioOutputDevicesChanged", "void", NULL); + PyDict_SetItemString( SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "availableAudioOutputDevicesChanged", signal_item); + Py_DECREF(signal_item); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - Phonon::BackendCapabilities::NotifierWrapper* Phonon::BackendCapabilities::NotifierWrapper::m_instance = 0; - Phonon::BackendCapabilities::Notifier* Phonon::BackendCapabilities::NotifierWrapper::m_notifier = 0; - - - - - Phonon::BackendCapabilities::NotifierWrapper *_notifierWrapper = Phonon::BackendCapabilities::NotifierWrapper::notifier(); - %PYARG_0 = %CONVERTTOPYTHON[Phonon::BackendCapabilities::NotifierWrapper*](_notifierWrapper); - - - - - - - - - - - - - - - - PyObject* signal_item; - - signal_item = PySide::signalNew("capabilitiesChanged", "void", NULL); - PyDict_SetItemString(SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "capabilitiesChanged", signal_item); - Py_DECREF(signal_item); - - signal_item = PySide::signalNew("availableAudioOutputDevicesChanged", "void", NULL); - PyDict_SetItemString( SbkPhonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "availableAudioOutputDevicesChanged", signal_item); - Py_DECREF(signal_item); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 16579322f177c1fde0336c2b255a4a696ed73e5d Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Thu, 23 Sep 2010 16:16:57 +0300 Subject: [PATCH 036/913] added a tool to compare class hierarchies --- tests/tools/list-class-hierarchy.py | 95 +++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 tests/tools/list-class-hierarchy.py diff --git a/tests/tools/list-class-hierarchy.py b/tests/tools/list-class-hierarchy.py new file mode 100755 index 0000000..381efee --- /dev/null +++ b/tests/tools/list-class-hierarchy.py @@ -0,0 +1,95 @@ +#!/usr/bin/python + +# This file is part of PySide: Python for Qt +# +# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# +# Contact: PySide team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA + + +# This is a small script printing out Qt binding class hierarchies +# for comparison purposes. +# +# Usage: +# +# ./list-class-hierarchy.py PySide > pyside.list +# ./list-class-hierarchy.py PyQt4 > pyqt4.list +# +# meld pyside.list pyqt4.list + +import sys +import pdb +from inspect import isclass + +ignore = ["staticMetaObject", + "pyqtConfigure", + "registerUserData", + "thread", + ] + +def recurse_into(el,obj): + #s = el.split('.')[-1] + #pdb.set_trace() + for item in sorted(dir(obj)): + if item[0]=='_': + continue + mel = el + '.' + item + try: + mobj = eval(mel) + except Exception: + continue + if item in ignore: + continue + print mel + if isclass(mobj): + recurse_into(mel,mobj) + +if __name__=='__main__': + top = sys.argv[1] + + if top=="PyQt4": + import sip + sip.setapi('QDate',2) + sip.setapi('QDateTime',2) + sip.setapi('QString',2) + sip.setapi('QTextStream',2) + sip.setapi('QTime',2) + sip.setapi('QUrl',2) + sip.setapi('QVariant',2) + + if len(sys.argv)>2: + modules = sys.argv[2:] + else: + modules = [ 'QtCore', + 'QtGui', + 'QtHelp', + #'QtMultimedia', + 'QtNetwork', + 'QtOpenGL', + 'QtScript', + 'QtScriptTools', + 'QtSql', + 'QtSvg', + 'QtTest', + #'QtUiTools', + 'QtWebKit', + 'QtXml', + 'QtXmlPatterns' ] + + for m in modules: + exec "from %s import %s" % (top,m) in globals(), locals() + recurse_into(m,eval(m)) From dedc78b3fef25e04cf436ca462714ad8dc0329cd Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 24 Sep 2010 15:47:41 -0300 Subject: [PATCH 037/913] Fixed segmentation fault libpyside's signalUpdateSource function. This function is called when an object is instantiated, and it will go through the class attributes looking for signals and what else is relevant. If the user has set a new attribute in the constructor before the call to its parent QObject-like __init__ method, a segmentation fault would ensue. This commit fixes this condition and also adds an unit test. Reviewed by Hugo Parente Reviewed by Luciano Wolf --- libpyside/qsignal.cpp | 2 +- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/qobject_objectproperty_test.py | 29 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/QtCore/qobject_objectproperty_test.py diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index aa218ec..95fc251 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -225,7 +225,7 @@ void signalUpdateSource(PyObject* source) for(int i = 0, iMax = PyList_GET_SIZE(attrs.object()); i < iMax; ++i) { PyObject *attrName = PyList_GET_ITEM(attrs.object(), i); Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast(source->ob_type), attrName)); - if (attr->ob_type == &Signal_Type) { + if (!attr.isNull() && attr->ob_type == &Signal_Type) { Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(SignalInstanceData, &SignalInstance_Type)); signal_instance_initialize(signalInstance, attrName, reinterpret_cast(attr.object()), source, 0); PyObject_SetAttr(source, attrName, signalInstance); diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 76db54f..210aa01 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -34,6 +34,7 @@ PYSIDE_TEST(qobject_connect_notify_test.py) PYSIDE_TEST(qobject_destructor.py) PYSIDE_TEST(qobject_event_filter_test.py) PYSIDE_TEST(qobject_inherits_test.py) +PYSIDE_TEST(qobject_objectproperty_test.py) PYSIDE_TEST(qobject_parent_test.py) PYSIDE_TEST(qobject_property_test.py) PYSIDE_TEST(qobject_protected_methods_test.py) diff --git a/tests/QtCore/qobject_objectproperty_test.py b/tests/QtCore/qobject_objectproperty_test.py new file mode 100644 index 0000000..2456b82 --- /dev/null +++ b/tests/QtCore/qobject_objectproperty_test.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +'''Test case for the bug #378 +http://bugs.openbossa.org/show_bug.cgi?id=378 +''' + +import unittest +from PySide.QtCore import QObject + +class ExtQObject(QObject): + def __init__(self): + # "foobar" will become a object attribute that will not be + # listed on the among the type attributes. Thus for bug + # condition be correctly triggered the "foobar" attribute + # must not previously exist in the parent class. + self.foobar = None + # The parent __init__ method must be called after the + # definition of "self.foobar". + QObject.__init__(self) + +class TestBug378(unittest.TestCase): + '''Test case for the bug #378''' + + def testBug378(self): + obj = ExtQObject() + +if __name__ == '__main__': + unittest.main() + From 1b754f30983fb870fcbd7f62fe3b0c8001c48426 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 23 Sep 2010 16:14:49 -0300 Subject: [PATCH 038/913] Removed doc files not used. --- doc/_static/.gitignore | 0 doc/_static/basic.css | 417 --------------------- doc/_static/default.css | 248 ------------ doc/_static/images/._background_search.jpg | Bin 4096 -> 0 bytes doc/_static/images/._bread_crumb.png | Bin 4096 -> 0 bytes doc/_static/images/._button_search.jpg | Bin 4096 -> 0 bytes doc/_static/images/._side_background.jpg | Bin 25192 -> 0 bytes doc/_static/images/._top_background.jpg | Bin 4096 -> 0 bytes doc/_static/images/background_search.jpg | Bin 2129 -> 0 bytes doc/_static/images/bg.jpg | Bin 5749 -> 0 bytes doc/_static/images/bread_crumb.png | Bin 743 -> 0 bytes doc/_static/images/button_search.png | Bin 3259 -> 0 bytes doc/_static/images/side_background.jpg | Bin 13760 -> 0 bytes doc/_static/images/top_background.jpg | Bin 500 -> 0 bytes doc/conf.py.in | 2 +- 15 files changed, 1 insertion(+), 666 deletions(-) delete mode 100644 doc/_static/.gitignore delete mode 100644 doc/_static/basic.css delete mode 100644 doc/_static/default.css delete mode 100755 doc/_static/images/._background_search.jpg delete mode 100755 doc/_static/images/._bread_crumb.png delete mode 100755 doc/_static/images/._button_search.jpg delete mode 100755 doc/_static/images/._side_background.jpg delete mode 100755 doc/_static/images/._top_background.jpg delete mode 100644 doc/_static/images/background_search.jpg delete mode 100644 doc/_static/images/bg.jpg delete mode 100644 doc/_static/images/bread_crumb.png delete mode 100644 doc/_static/images/button_search.png delete mode 100644 doc/_static/images/side_background.jpg delete mode 100644 doc/_static/images/top_background.jpg diff --git a/doc/_static/.gitignore b/doc/_static/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/doc/_static/basic.css b/doc/_static/basic.css deleted file mode 100644 index 2509c22..0000000 --- a/doc/_static/basic.css +++ /dev/null @@ -1,417 +0,0 @@ -/** - * Sphinx stylesheet -- basic theme - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -/* -- main layout ----------------------------------------------------------- */ - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 0 0 0 230px; -} - -div.clearer { - clear: both; -} - -/* -- relbar ---------------------------------------------------------------- */ - -div.related { - width: 100%; - font-size: 90%; -} - -div.related h3 { - display: none; -} - -div.related ul { - margin: 0; - padding: 0 0 0 0px; - list-style: none; -} - -div.related li { - float: left; - display: inline; - padding-right:17px; - padding-left:10px; - background-image:url(images/bread_crumb.png); - background-position:right; - background-repeat:no-repeat; -} - -div.related li.right { - float: right; - margin-right: 5px; - padding: 0 0 0 0px; - background-image:none; -} - -/* -- sidebar --------------------------------------------------------------- */ - -div.sphinxsidebarwrapper { - padding: 10px 5px 0 10px; -} - -div.sphinxsidebar { - float: left; - width: 230px; - margin-left: -100%; - font-size: 90%; -} - -div.sphinxsidebar ul { - list-style: none; -} - -div.sphinxsidebar ul ul, -div.sphinxsidebar ul.want-points { - margin-left: 20px; - list-style: square; -} - -div.sphinxsidebar ul ul { - margin-top: 0; - margin-bottom: 0; -} - -div.sphinxsidebar form { - margin-top: 10px; -} - -img { - border: 0; -} - -/* -- search page ----------------------------------------------------------- */ - -ul.search { - margin: 10px 0 0 20px; - padding: 0; -} - -ul.search li { - padding: 5px 0 5px 20px; - background-image: url(file.png); - background-repeat: no-repeat; - background-position: 0 7px; -} - -ul.search li a { - font-weight: bold; -} - -ul.search li div.context { - color: #888; - margin: 2px 0 0 30px; - text-align: left; -} - -ul.keywordmatches li.goodmatch a { - font-weight: bold; -} - -/* -- index page ------------------------------------------------------------ */ - -table.contentstable { - text-align: left; - width: 90%; -} - -table.contentstable p.biglink { - line-height: 150%; -} - -a.biglink { - font-size: 1.3em; -} - -span.linkdescr { - text-align: left; - padding-top: 5px; - font-size: 90%; -} - -/* -- general index --------------------------------------------------------- */ - -table.indextable td { - text-align: left; - vertical-align: top; -} - -table.indextable dl, table.indextable dd { - margin-top: 0; - margin-bottom: 0; -} - -table.indextable tr.pcap { - height: 10px; -} - -table.indextable tr.cap { - margin-top: 10px; - background-color: #f2f2f2; -} - -img.toggler { - margin-right: 3px; - margin-top: 3px; - cursor: pointer; -} - -/* -- general body styles --------------------------------------------------- */ - -a.headerlink { - visibility: hidden; -} - -h1:hover > a.headerlink, -h2:hover > a.headerlink, -h3:hover > a.headerlink, -h4:hover > a.headerlink, -h5:hover > a.headerlink, -h6:hover > a.headerlink, -dt:hover > a.headerlink { - visibility: visible; -} - -div.body p.caption { - text-align: inherit; -} - -div.body td { - text-align: left; -} - -.field-list ul { - padding-left: 1em; -} - -.first { - margin-top: 0 !important; -} - -p.rubric { - margin-top: 30px; - font-weight: bold; -} - -/* -- sidebars -------------------------------------------------------------- */ - -div.sidebar { - margin: 0 0 0.5em 1em; - border: 1px solid #ddb; - padding: 7px 7px 0 7px; - background-color: #ffe; - width: 40%; - float: right; -} - -p.sidebar-title { - font-weight: bold; -} - -/* -- topics ---------------------------------------------------------------- */ - -div.topic { - border: 1px solid #ccc; - padding: 7px 7px 0 7px; - margin: 10px 0 10px 0; -} - -p.topic-title { - font-size: 1.1em; - font-weight: bold; - margin-top: 10px; -} - -/* -- admonitions ----------------------------------------------------------- */ - -div.admonition { - margin-top: 10px; - margin-bottom: 10px; - padding: 7px; -} - -div.admonition dt { - font-weight: bold; -} - -div.admonition dl { - margin-bottom: 0; -} - -p.admonition-title { - margin: 0px 10px 5px 0px; - font-weight: bold; -} - -div.body p.centered { - text-align: center; - margin-top: 25px; -} - -/* -- tables ---------------------------------------------------------------- */ - -table.docutils { - border: 0; - border-collapse: collapse; -} - -table.docutils td, table.docutils th { - padding: 2px 8px 2px 8px; - border-top: 0; - border-left: 0; - border-right: 0; - border-bottom: 1px solid #aaa; -} - -table.field-list td, table.field-list th { - border: 0 !important; -} - -table.footnote td, table.footnote th { - border: 0 !important; -} - -th { - text-align: left; - padding-right: 5px; -} - -/* -- other body styles ----------------------------------------------------- */ - -dl { - margin-bottom: 15px; -} - -dd p { - margin-top: 0px; -} - -dd ul, dd table { - margin-bottom: 10px; -} - -dd { - margin-top: 3px; - margin-bottom: 10px; - margin-left: 30px; -} - -dt:target, .highlight { - background-color: #fbe54e; -} - -dl.glossary dt { - font-weight: bold; - font-size: 1.1em; -} - -.field-list ul { - margin: 0; - padding-left: 1em; -} - -.field-list p { - margin: 0; -} - -.refcount { - color: #060; -} - -.optional { - font-size: 1.3em; -} - -.versionmodified { - font-style: italic; -} - -.system-message { - background-color: #fda; - padding: 5px; - border: 3px solid red; -} - -.footnote:target { - background-color: #ffa -} - -/* -- code displays --------------------------------------------------------- */ - -pre { - overflow: auto; -} - -td.linenos pre { - padding: 5px 0px; - border: 0; - background-color: transparent; - color: #aaa; -} - -table.highlighttable { - margin-left: 0.5em; -} - -table.highlighttable td { - padding: 0 0.5em 0 0.5em; -} - -tt.descname { - background-color: transparent; - font-weight: bold; - font-size: 1.2em; -} - -tt.descclassname { - background-color: transparent; -} - -tt.xref, a tt { - background-color: transparent; - font-weight: bold; -} - -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { - background-color: transparent; -} - -/* -- math display ---------------------------------------------------------- */ - -img.math { - vertical-align: middle; -} - -div.math p { - text-align: center; -} - -span.eqno { - float: right; -} - -/* -- printout stylesheet --------------------------------------------------- */ - -@media print { - div.document, - div.documentwrapper, - div.bodywrapper { - margin: 0; - width: 100%; - } - - div.sphinxsidebar, - div.related, - div.footer, - #top-link { - display: none; - } -} diff --git a/doc/_static/default.css b/doc/_static/default.css deleted file mode 100644 index 721ceb7..0000000 --- a/doc/_static/default.css +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Sphinx stylesheet -- default theme - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: sans-serif; - font-size: 100%; - background-color: #000000; - color: #000; - margin: 0; - padding: 0; -} - -div.document { - background-image:url(images/side_background.jpg); - background-repeat:repeat-y; - background-color:#ffd800; -} - -div.body { - position:relative; - background-color:#fff; - color: #000000; - padding: 0 20px 30px 20px; -} - -div.footer { - color: #ffffff; - width: 100%; - padding: 9px 0 9px 0; - text-align: center; - font-size: 75%; -} - -div.footer a { - color: #ffffff; - text-decoration: underline; -} - -div.related { - background-image:url(images/top_background.jpg); - background-repeat:repeat-x; - background-color: #d7aa00; - line-height:33px; - height:33px; - color: #000000; -} - -div.related a { - color: #000000; -} - -div.related img { - padding-top:3px; -} - -div.sphinxsidebar { -} - -div.sphinxsidebar h3 { - font-family: Arial, Verdana, sans-serif; - color: #000000; - font-size: 1.4em; - font-weight: normal; - margin: 0; - padding: 0; -} - -div.sphinxsidebar h3 a { - color: #000000; -} - -div.sphinxsidebar h4 { - font-family: Arial, Verdana, sans-serif; - color: #000000; - font-size: 1.3em; - font-weight: normal; - margin: 5px 0 0 0; - padding: 0; -} - -div.sphinxsidebar p { - color: #ffffff; -} - -div.sphinxsidebar p.topless { - margin: 5px 10px 10px 10px; -} - -div.sphinxsidebar ul { - margin: 10px; - padding: 0; - color: #ffffff; -} - -div#searchbox p.searchtip { - color:#000000; - font-size:90%; - padding-top:50px; -} - -div#searchbox { - background-image:url(images/background_search.jpg); - background-repeat:no-repeat; - background-position:center; - border:none; -} - -div.sphinxsidebar a { - color: #009491; -} - - -/* -- body styles ----------------------------------------------------------- */ - -a { - color: #009491; - text-decoration: underline; -} - -a:hover { - text-decoration: underline; -} - -div.body p, div.body dd, div.body li { - text-align: left; - line-height: 130%; -} - -div.body h1 { - font-family: Arial, Verdana, sans-serif; - background-color: #f2f2f2; - font-weight: normal; - color: #20435c; - border-bottom: 1px solid #ccc; - margin: 20px -20px 10px -20px; - padding: 3px 0 3px 10px; -} - -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: Arial, Verdana, Helvetica, sans-serif; - font-size:12px; - font-weight:normal; - border-left-width: 1px; - border-right-width: 1px; - border-top-width: 1px; - border-bottom-width: 2px; - border-style: solid; - border-left-color: #b1b1b1; - border-right-color: #b1b1b1; - border-top-color: #b1b1b1; - border-bottom-color: #009491; - background-color: #e0e0e0; - padding-left:5px; -} - -div.body h1 { margin-top: 0; font-size: 200%; } -div.body h2 { font-size: 120%; } -div.body h3 { font-size: 115%; } -div.body h4 { font-size: 110%; } -div.body h5 { font-size: 105%; } -div.body h6 { font-size: 100%; } - -a.headerlink { - color: #c60f0f; - font-size: 0.8em; - padding: 0 4px 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - background-color: #c60f0f; - color: white; -} - -div.body p, div.body dd, div.body li { - text-align: left; - line-height: 130%; -} - -div.admonition p.admonition-title + p { - display: inline; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -div.warning { - background-color: #ffe4e4; - border: 1px solid #f66; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -input[type=text]{ - background-color: #009491; - font: 11px verdana, arial, helvetica, sans-serif; - color:#FFFFFF; - width: 150px; - height: 18px; - border: 1px solid #009491; - margin-left:13px; - margin-top:15px; - margin-bottom:4px; - border:none; -} - -pre { - padding: 5px; - background-color: #eeffcc; - color: #333333; - line-height: 120%; - border: 1px solid #ac9; - border-left: none; - border-right: none; -} - -tt { - background-color: #ecf0f3; - padding: 0 1px 0 1px; - font-size: 0.95em; -} diff --git a/doc/_static/images/._background_search.jpg b/doc/_static/images/._background_search.jpg deleted file mode 100755 index d5c689c31bb9b045cfb9534f0dd71c5f63c85661..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIj;a$cMB&^U!WKc z;207TWIgNTe~1o-3LMHtg-1hRGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLx8Fw zzz8%Aguy^ABqOs}p(wRDzqBYhRUs|EC|e;juOv0EBr`uRF(;=|AtyDhL?J0BF)tg~ U7l!H@(iE!y;a-tpko*510Px@-SpWb4 diff --git a/doc/_static/images/._bread_crumb.png b/doc/_static/images/._bread_crumb.png deleted file mode 100755 index 46b8591c6c018df537faed736270c57745dd4d5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWxd1=+Gz%wBU!WKc z;207TWIgNTe~1o-3LMHtg-1hRGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLx8Fw zzz8%Aguy^ABqOs}p(wRDzqBYhRUs|EC|e;juOv0EBr`uRF(;=|AtyDhL?J0BF)tg~ U7l!H@(iE!y;a-tpko*5106BCZegFUf diff --git a/doc/_static/images/._button_search.jpg b/doc/_static/images/._button_search.jpg deleted file mode 100755 index d5c689c31bb9b045cfb9534f0dd71c5f63c85661..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIj;a$cMB&^U!WKc z;207TWIgNTe~1o-3LMHtg-1hRGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLx8Fw zzz8%Aguy^ABqOs}p(wRDzqBYhRUs|EC|e;juOv0EBr`uRF(;=|AtyDhL?J0BF)tg~ U7l!H@(iE!y;a-tpko*510Px@-SpWb4 diff --git a/doc/_static/images/._side_background.jpg b/doc/_static/images/._side_background.jpg deleted file mode 100755 index a79b91c97466a70bbdcf67be2df78db09871c16a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25192 zcmeI4O>7%Q6oB9UWc^bo7&!@zgjlOYRpp`}(HtUDSt%B20y0Fg521%j)J58mG>&Kv z^yUIZLTRL`RaL1%0;C>tiCUE+iiGH)O_j7x;M@c{BF$ucEms6e=Ix=T)4dg&~ODqj5quO5c%|t zzSj?Syw)35F>zx#5RLYCUYup6BjCf0b5SZ0AOb{y2oM1xKm>>Y5g-CYfCvzQ>JpH! zxX4a`e%xTBx@G?-N^A5TI2u3lp1;qCkHwE0@lk&$vJXI;)F!R^?|?7iS($l&6*1oP zc;hB+;qsOACp7cBek*3BAN=66QRDKF_dx=;mCEy8M2&rv_&W|zdQ4C*(+hr3z-ig- zyRsi1cELD%sI9C%TF>Xr;yN?sqFFf0mYG&8utLGaG~LYSAFV9^@#~K_Z{41my)&1b zzn5BATud*eGnu7aHhVqyAXm(?49mJQn7FvGkh(WtOlmXJKYTj{asgx+=z)l((Zh!I4*8qLJp{Q|z4;^m? z2V*10dDt6z>qYFbpBz=}Bg`f`LrGu(pX_qhaeb4l+hXEA?Xp!TgR$Wb9B{YHVXJ=W zxatzHw}lP$9h(Ycmbni1|K7OaLa&A7gct4%aq;uJ1 z&YR6GppKvLa4y-kEqyN@>A=TVL$ z|CIXQK>PkscTcYX>FEybZx2-ZU#Ri;1GOH1u>v)nfACJQrt>d83qTPz{VY$sN^WUS z1c(3;AOb{y2oM1xKm>>Y5g-CYfCvx)B0vO)01+SpM1Tko0U|&Is!4#qjjF7RIr-aN z`3hgH@p)V$Q;9_T{iyHa>uq7!HaZd?!|>J8np@C)W4W|W*39S5oyG-A=c{X?a9z8V N#Pl2AS$Zag`d>4|UkLyJ diff --git a/doc/_static/images/._top_background.jpg b/doc/_static/images/._top_background.jpg deleted file mode 100755 index d5c689c31bb9b045cfb9534f0dd71c5f63c85661..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIj;a$cMB&^U!WKc z;207TWIgNTe~1o-3LMHtg-1hRGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLx8Fw zzz8%Aguy^ABqOs}p(wRDzqBYhRUs|EC|e;juOv0EBr`uRF(;=|AtyDhL?J0BF)tg~ U7l!H@(iE!y;a-tpko*510Px@-SpWb4 diff --git a/doc/_static/images/background_search.jpg b/doc/_static/images/background_search.jpg deleted file mode 100644 index c0481c561d78056e870b3ef0c7f326f56ddc9128..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2129 zcmex=uI=H%w(=K}(Mey}1a#RK7?>VxzCA7BvVV9;T>$jm6nz$D1XEXer(2*YNevqA0w zx)TN%**G|vm|5Am7(r6ZKoSlZ*;v_`SvZ(D1%TRExtQ2l*;%2Ij6f}Hf|psQE@KxD zPuCCx?ZR5hS(A(6nu#)(EwNy2RG3zdSJj6W0}e5fq`{}uxeGtgy%%z_N|46A>2 ze9aa%>WKTGd*gDzlLeNU+!yX$bXHN!3RRnMQZsbbl+tNV0cU5eR@C~aDC4avv@k{c z`t$zn_8ALqwU*0A8Gn|p=(wzR{YL84m#NYIl}r6*iho+NNlWW%jQ0E$amq(a9;Udw z2-_W6bI-+)H~Zy2)oYO@_qHUoteLV@BlM?#sI1))#Z3bJg*${_tZEhVXXIa4J}F#m zQ`gdb&U9rd{cba5t*;O5d{3f3KTr74(-5l`v(|ea zTas2rABsF?a$hdzSm@_NH8HE&1KKX^J}K4{s$Jo2acuVEvolWZtMKoh8t_WsmUyMo zMX(hTmuo6FONO84{8+R~)=Apwy-Ji}$l8ZGkEQba&62f#KD5&dbzb3|5&NXuO>62N z)j7$&AD^8`jki%h3U$)NjH5x@TQ>J(?z6esv-)|3weRQfH<|V*ZlZw!>KhN z=8J1ByrQ^8@006dQLlSK=L|=^Krj}bB)fi0JAx&&C-!_lJnLgu{k=WvM^8hOMlLvM z6f3@qzs6F?y)Pqg_R%V{?uAy_sggnSM7Dgq{6ZtvNOe>1e&f*4X`xf%LQeF(3cS5; z-`3yO;b8)A?N&#)8}ck#Wpv(o`=shs=YzHOdR#VAf93k-Oz8YTyP{i0KdaB^XMJ5h zFYa>YzSQ>mx#j;ECY}B&7qVGt#q5KT-QUlb|C)TQ=CgUuwMlokDsFn2acjb^vr_Bk zOyeXwOwv=AFrR|cjNvJjYVpybR z!cCXuYeTP0)c8@l;9#wBoaMSz&kg&gh2&0|{xJVuYR#LiT6OAqR-!A?&st}1tmiwb zajfJOx(x`v&EkotzI5DscU^c|+rD=j5UULAMa z*;H`H`P;o^Pfvzg1;8`=^q3dR2}4j~8D>u5S8#qb2A4c1fL|Ha`!SHJQg%3(TFHtvgQ! z$ZOnfe4{x%>U4U$UBTT2d1t;U+`P8w=EL)I%rm4n+jf|huGv;m{G9g|+ne)Ayu(nF z;O2d2QZ^r+Z;^Ka6fTeEFTQss`TNhBdDRbZJKU{&<81NQxYndtGa~fN=X$35hR-Bz zvL~xoPu73?!Sm-%`Rg|_*6;kj%Plw4#%8a)_7Cg(;(PCXsyToAR@5qMyZ9f~_2OG! Q{AY-pY|v{K>Hq&G084;`WdHyG diff --git a/doc/_static/images/bg.jpg b/doc/_static/images/bg.jpg deleted file mode 100644 index 2ceb19583d43d0b5ba9d04767436b668228e9bfd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5749 zcmb7H2Ut^Cx4lW|AP_7J4uS%TbOBKiDWepn3epomsY2+z2u4M!f`k$g1OzEkLX#?? zBPD|ab0D%F(hV%i5 zp8=?fw>82a00A@r0H~2%iva6iHm+8-fK3C*10oWD5P$|k2C1Z>qal6iX=!L^=^5zg z=;`Pfm>3vIU|?cmA%j#NIKaXJCF9U9fM{rG8R!|i4$%831r|Smj)|lkTv+ zeNKMUO|;uT*!vH{o-#FysKHT@=g;_CYg^q}0N_=}`-QCY7~R19o0045T`Ko3AouzE zmZF?00%b0G>P8ml%ba&Cbq_r1!pFFIA|ynsnMM9YbeP*2&5u5*sJ6~Jiogv zGI6**Pmt}ekFRMPbul2jdXD=;Y zKG(Q8TG{^S%G6MuB41TsCyBuJ^3}50(f)?A&RK<9i@5Kx_?~JlllAql@&A1Qc4*NEp9Qzlb zWxY+I_0pPSi=rN1>N|@G?NkEH_9Pa4f7-<7B8zbu=A*IIg?}ZI9~r8Nz*^gegtZKJ z;B67@i|G^&ZMG&6u(@a&TS z?@NE`_w`y~KXj>=p8aPM^~qq?!E3O0MN><=bNMSqBm&+*@`H7B()7DGrbAOp%@*(& z$2UHg%CT~%F`jIOrT%J(!C5m=XvItu4{UJ^d*N0FUM;reSqa~3M7cGib!SCV^NSCb zY&X-X4g6O6RpgG)Gp;MDaS=?dF!O?1#i+kaVO+h&an3HJH2?tedgy0w)xw=0m-m^A zcdS11*U*ogjhwN&h&|HHSAi3>Ny%PzBH)~hK#$o<;-8;9T`N#d-d9pX4{m#XO1X_2 zwQ4KU-ctAYpTi58ibOSO9$L?4hB~zyi=A;{i!+l!|2d$gXYiwE%tYvezE{Kk^5Tw?a8kb) z5=-!27H^h*E>p8|!!T zaMFhjagQMdksODr6(21Ft7_7rMi7IQekzQZ+-5JFlQwEQ|LXUQeVbl>?$NuE0G_Hk zHB(c9g`T0UXCAD~M9HBt8h5dlPFX>XBPHIdByR9tM?yACJU8^2bg=!RBm$qEVqNmT z>^A^dmA%yZ`s|D9CR2%ce;eUoqp9wK_wXWv+tHU^?CQtO_DkvH#+n=U7l-J7OY(Z! zG4c7oF1!71{%(N`?{N7C+GzK)*lS!Ea_kK7giloY4 z<0{Ri#6Woyl>tM-FLpaz>X+ZCXoB;jM_!{Jh?t{V*VM7;(lgh{G|)VILfj)alOAn> z>cOM6sYYBH{03e)_zaGZPnk@h0+cwJXm?WE45>Y2K!LEcBgpB1?`||H6%+8N9vD&Ee}oKiN692GFRuH`;|o9Qos9Hdsy7Iwg}giMQl#A>Yq*a?R==;iBh61VjaP*#DTM&QwxU z;>Ak|J!3YebT9b1WM0dOnVc&Yu0@jh@-{Qo$r-T2v2B^`GSkXr*B(I3k%T!L=b2P? z^MD@>QhU>RKIGKq1KHpLx9(mf^$HTcFXvQL!}mo&Jv-0QdA=sQXH3>sL9sPMmQG*Np1K|}^rLcW z#t+Zc;JXihu~8l5N|ip)wKm$3+u?I_kqJo|V?b-7x_;iyT1aU!Ei{PDRgdn)@qKma z6qwTYWCfF2AEPPy#x_JPAGlfm$HJ9D&D_pas z+Itl^5>#}#pH5RA?GNux2x+K$d z=3W!jMAegz{~Z7rxu@h5YSb}r3FF@$z#{E6(y5|sULzO89+lS$az;XoK{gwvgi`H*8i-BW5uPeRwg=SSM9ucB%kRKE|g<=6z+3;Jqsc zbS?{WCkQiZqxx*BEr-J+lt~Ijmm!iZD-uFJYn)4_+1zg*3p0}3WY8>fKKqfisZ9h9 zJQeJ2-wr=JLGpss+ob(E<*q0|mreUheoY|bxn9j9YXZn#w>s|9;&o?}S%JF49etfD zCP=cD+?c9=WR`aRADZQg26QmF_%cBRrdtGlvLqu^v6btY+472$ zd@ZEB5vN;uzPdOX0_21(s-gp?AeHP9B$~HEO#u^u2X14kqTLHy7Ee@v9Qs!0!MC^b z=(*n;6^!WQ8^tt>yTc&PPl}>2pm|XRly3vW& zG~d718FniP!?LMgGv}dOu9a2p3S;X1{3~OwZj*s^d%Tv7Al_>+xFBqE#NxK%bKbwLa@>L znv}_0_NqPmC+g2}^fM;{gB|!&%PAK*=3?BTX8^8X5#PepGTqR6(pVk4<8tC!B!$bm zX~1<0I((SBE=%R_@-5co?Beh`_yBh zJX@Z;U?hn`KUm2nB<3(#gB)@#((T`sb@jd(0fjumu|)Geb+^DTLe5c-q=Qn>RowHV zF%sTe+9Kr4UnuNu^V#wo@4}bm5dm=;Z%W|kgL9iYKgJg72EhDbJa>L*yvJJw#on-w zOecrI!Rp^#U-bL!-09VWBgvjU(6DUmSnmXV?hdHA%@;dN@j5sXfhnbJK_YNO#dE6T zj(%ljzvc2{uD#bO>OmA0pft1|O*OOfi7B@W8UCjt+N zz$f&sDRlLbI(O8aM7`jzem`$BNwJAZ>IMD&fjONH@ZYs)?HplvT(bJjr{BDFXIi4u z$wA1qbUf3r84)N7gWZLGjkw(3KE`w9>+K6c4Yo{F2F5HfF{k8{ZL~s} z*RT?UDi%o6)$s3n6^Y2c>rIvw=HvFA=@cGKEymurQ31yF(!!!!a`j-Gu13ExB|<7l zqjYaHuJO2tC+F*|%=U8rbJ(B&>)EQcfym0X0dr7~9*#K(rqw~9$eyOR- z{fYUDbw1b&{3TrF^L<6ED%3>{oLu@``K`?Dz6qX}d;3UFv5bl`00{ZbUdJWh`+hDk zt%~Uq^{xd#`bFb;B>h-QDo|O*&jPYbKFXk(2ktOJy9~wjn_pmzVaE=QuV3{E)iM@_ zOqDXj(GKczvoE8EEhVLfd;1a6Wr^Wp{aUXP13PNY9h0M?xLTCoZ6<0rf!?KuIqNHg zRTG$N#Hv_$crnS(P>utOO&`ST(y@-+VCTDV%nj8 z&B5>jn<*vTCzXW{S|}$0g^|`&YWbl)7_o`y6Zb74U0umu8byATX{TFs)bs4h#RZ7O z>8g%5nv8ShC;8(?bT#y#@*XjF z^0r9-XqPQ|1@R2A?1^zZZRRk(zW0jS-AVvTx&VYDMztWXxbyH$p3K=@*M)(BH=B?+$MWMT;z7 z-7?mMTt&5CM}7dB+k=w5h9aI1FcD-`B2UVQA>pXl!6`yj*~uJm>ph zUxiDHJbj}dJrlFse7P;n8k{ECSY|Le-}EW?8OLX)qIg@nDcPzHg!YY2#l1ApVvTbR zto*MYc&y1?d-S-kE@?#aV`j{3H=vwcPN|l{#o3ISPNPYR#q!Agrl=O%k?V#ypFuUm zx~TGfSK5xD>^}$UdzZ~)*iQ^Kh+59qNX??$zgf}vyTRAI)ucb6HpUNkEY)t~FV8#d z{K2c3oVvvU>76j$a?Dz?P)f!TtY#q5q&4=uAi_km(^Ul)*N#yj^KmA53~_97DuP``+89mEh*hjr#wmsO$O_ zX`csI0fGS2Pga8uJFj8;dz3)x;^kYS{dIX>qxNo2- z`bn?SsCH~=9kQNxEY~quHJMah``jI$3&upTHa4PYhcIoeI_#^mY;JF3ZOp^x zG3gRGdh8%M*Vn?Y!wIGWudG|CgnXK_q&f2_Uxulrn=J2Si77HSjdP{@2aBjly!G|L+14Dg|L@8W7=N< Z1^{ctoJ~SsgrNWc002ovPDHLkV1lEqWYhov diff --git a/doc/_static/images/button_search.png b/doc/_static/images/button_search.png deleted file mode 100644 index 0160b81ab5034ba55a704d049534356a289216b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3259 zcmV;s3`FyZP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0005zNklob_00960 zLea#)!0?}efq@Yw+XWS1U|?Wi00000|Nmlu+GP)=8UFwO&%grHf@}s80|Ub~26O<` z@*ir1H%vPNns#ph00030|AMKM{{R2~xBvhD8$)&c|NsBL1hVBY#sp+RD87Nrhxx~h zfq@|k$*P$Q3=EgCIT9ECkM3|>0Op~e00000|NnH7u?Ye}5JevxD2S1PxfWp=mSG^m zrAAg^1-7D?S%GkYEhvJ4Jd-(Dm+?o-?AuxX=a;X?>Pnqt+xtVO?gBcf*9_dKi|S&l zE^F}l$H=jc=aQJ10jD2VY6IMXQOpLwD{H_Tm;zl?{;JRM0nDrKn}CNUm}y_a zb)hr0!0kgy8L}V{L_zpV)&oHhtOu9wmzcDhOoDK~$LfDDiD0$b1e3{Rze5^OF86O*>gML3@$Tlb-pbiz(*OEys^N{lUsgn_0f=`1UebwWBP zcG?aQpp^XR5EBZd(@wtHLYa03LO*~XGyz)ZF9?MKoz9TZrZiJZJ_@BwXVkZQce3Qj zNm@#q1fOQ#?Y@2c_Pw|7c6Il5i*FR)Mh&a`B7KN5QD_zXQ1O`g!QS!oFhbENT8E;&G$x>75kPbeq&&rud^6 z7>8~79;zccZ3;z^srXk^Pf93xJ8oJ09l8tE)zs8DYU&)0y2e^(ZDY&ay1Kb7txZiW zO--$hb>z}-T46e*=G4~Csh`tOU*FJNUtiyhL4C8f*@t$kjS_Tfsd2fElDy!Gqf`uq_q&4>^7@FL|Dkqvw#G*x|*!q9lM&b1cwJ+ zImNfdkL7nvh6Y;_1@GxaHY|XBv2f%l2ytM3vUkX*%EwD0%q+o@DG`cqp*l0^vk|RC zC->}Z*t2u~cOLxmAxGQ1XwPJ%t@+?&WYMy=$;j$R+vETsb`u1rzWC_9LuYRL_VU97 zuFB3UqT-vy_vrl8qrrDDD9{s$TCjs6WdA%oaQK-cxJ3ll@b2lG&w38G?%V&B)Q?_B zzV(^^BJUU?MUQhNmcSj8%JkB1@@`3 z?lvoNjkeRH*Et>MWtmpx(e8X+nwVlL;Ub6x4Gp1Y;BjHKFcT0uv%=4HdPoNIJ+DLs zRZ``?jFc)#1oU7;IVI;;Fr6MFO9b>75_WnFu{#aig-2ptJ}tvIsNhvbXC;-Zw!R$3 zp^8%2;)dDSN(){pLot|;GT_Qr&M-_RA~?{$=S#d zc$(*2{xi}Hij_v=5_u#FWAT`_&gLXo_cx`p!^$ROHLbQv_ecBt!~K{xq$K6F(x_}q zUu7%jzq5{9?1FyYN&DOt-O*{Rjo9SIiiz`BtMh1qN%X%F-F*2!3Zw1x|2g{lSZxWP zT7jmm;f~UR4ZW3C@iMF~Wh||vBx3E$*U~fSP-f?JL1~x%&$gaEsuh3px|5s73aXsM z$N@Q_UXCvRpDBn(sq8_55?RQZ4shtHCH(?umKB6*lw*q~Mxd7NA0xKfCz+Tpq@VUNyKE*EinR!b1 zp{#U8PR$pk;S3MvXJT%yZXm#3Ig|6nsW^iZ%rFhlfWFLU=Ugs%<<8JEDOWa2|G(c; zrY|r08&P+E1m1%2=j*Be%lexY!*p=)5AxzZ*Qyh_vX@M~&GbIW`i$3V?RB<{cj;B@ zd~c=a%4)m>P8aojT*@Ui+Mg?^@mYMjq=ulK9`dn$g_Fbz%#t|63HSC-9ZN!dXl07{EXI7t~oX1EQ6{qW@^AvByLeVRYO zS&+grJPb7%fDo*Mi_$Us9^O;Ja0Gu7K!ZjgnD!|QiFtekWrT7NkgIx`-^JBctBRkb zj##D!^F~-#(A)GyE$LRo0a8RljGBEG;G%gDfTj;FYHd%zeJ(1XG)f{FZ9;J*p#<83 zQYeoUG={Q(Cq3W>6&DUr8W-kb1Vas6$^0dRPNX-?j%6}{!LcPbFt&+vIcBo2j-I!XC4adNB&I~xxIoP_mqJl%6 zgRg}l9+^%~p2ek@8LERstvp5Y+H==P@{~SH;jIdqLu<1jrbni)0l-Gw3#k^eZzI$U zdDsll3ZeYj;Qws!|HOx%UhrS@(}m!B2n|63U&RYTH%$8qECw>7Q9l}iyb7s6ayg)A zx&Q@@LTC{2n4#8#4YKgKYujEZ*bG$vkRHs>7CI!nJ%_~d$EBPHhx-w1BgjcOkWR;C zm{+@8??3abi%uuITsI0)CYlS$Bk5J!^YY;KwXwwZEeSCRy9(&e@!)K$JsVH@9}5yd&8>p z#We=0lnaL7bDS!NA$7U%)~$9X(9Q@k*t*5THZH!M;e!lpIss{dQP_4eJW-95?DDE0 z1@A~os&rArLolFFW$##-1S9%ma#Cta9lE07e_ z;mh%>U@MD~pCC?vjUJ3-Ay|`5$dPcDYiul?3^IK@*XQdE2x5Q__p+=gFy2t0Cm{5B zLqZ_TxoB+VVA(DM*pQvDm!!{uQy)ay51pnj@)D4PaPH9A`hTQs)H z;dDwaV65PCbAlgI0FvnDe4Lx}dm#ZX;B^Z;1Brz^-~+sy6Mb%;Vck3%fF!yF4ie7+ z4*2*PNI>hyWdZ6T@m`+0PUL#SVo#VC`g#I^aJajN6T(cN=<^GFuV3VSumcHPDA=DK zmopo}X?PN}%}E@OHz$>?ArDFd1he>gFdBwH4^YG~0F(f6Up$x) zL);4wro|B20wit0uwK>+wHSi505y!C!FtPP!c)YOa185n!*II61>8Qj-yLv^ZZHkYx>?T6 z@^04ahT#Pw*6#*ifXSEx4*>@O-x0u#zze`(zz?qL5kg{^<9!_43tqv8ybQ~TJ$`S1 z6S{ppe#Yg2N!p{&(l}dMBUTvG`0Rbw0<#vFwZN!vsf%vi_L1aIc$(>Yizcf+B&DR*6FNk&`wV1x9P_yv@&J4+vn8HX>Dj| z{UnDe8qf(d1*Z?D4pV#q4pZ#MFV^K}DUii#HrXhoAEq#w%;mL}-&0JK86T#w+06h< z1+>-rs%%G)+E7cie_%tK6{IHnBf?IRs2+2e#hxWA@AVi{wETJBSLt|{Ra;D z=Esuib4QQYEWXp>Y`yxf-MxJWpIray(9#8G-Z_g8RLEm@KcF3|nBh!CVAY0^@ozlz z$j@JViKYaSvZ=L*DJA7fbTH!#5rN(R? zB?lq!`Hybv4Ir`Y);o4_`yM~leE5}P*Y>mw#Pg^5Hg9OhRg;5@_9vb=VlNyOj)(7@ zAG;rpnzUZM*w?#YNm3p1pE+>oxuwfqedp|5yAM8DDRN)gL6GuuAQdv7N91YeHPYX$ z`O;IjtV;8Bre|8VF8|BW8;?DHWBkW2+_JMu@%3dR$A)|_Ssr=zs}HTd Zxrp9R-o}6Y&E(vJ`-(50{BLu7^IzPYJ<|XH diff --git a/doc/_static/images/top_background.jpg b/doc/_static/images/top_background.jpg deleted file mode 100644 index aafe1f72ef27bd58af06ca3ef6b6a085f6cf4ddc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmex=T;Nd3XdtKm-mL zSy)*)*g5#QxcEi*`1s)BL^J*$U=ZYBP-Kv0W)x@ci+Wc+`GA(w#>2!O6c09F=u zpa?UnC^OKtYyv>V9Lxxn3=Bbx6Bk}&4rUR#!Y&~Q3=}4AWLZY$Kp{b(0;Zr#EFz*} z|8FtyFf#(}W)@_yXIS{uZ}ZN1f9y1m?mhQgxislomEG1IYp3&TmCil${ozOVo%d7n z)paWR$u6o_9l3WzindBlJdY#RqD5hf~+tt#8lVqkVsW@(pEl6osJ<%y}e50pJ kkfth^nWl!vqE=~ Date: Thu, 23 Sep 2010 16:33:19 -0300 Subject: [PATCH 039/913] Removed modindex.hmtm and added domainindex.html to work with newer sphinx versions. --- doc/_themes/pysidedocs/domainindex.html | 57 +++++++++++++++++++++++++ doc/_themes/pysidedocs/modindex.html | 40 ----------------- 2 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 doc/_themes/pysidedocs/domainindex.html delete mode 100644 doc/_themes/pysidedocs/modindex.html diff --git a/doc/_themes/pysidedocs/domainindex.html b/doc/_themes/pysidedocs/domainindex.html new file mode 100644 index 0000000..c136cdd --- /dev/null +++ b/doc/_themes/pysidedocs/domainindex.html @@ -0,0 +1,57 @@ +{# + basic/domainindex.html + ~~~~~~~~~~~~~~~~~~~~~~ + + Template for domain indices (module index, ...). + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +#} +{% extends "layout.html" %} +{% set title = indextitle %} +{% block extrahead %} +{{ super() }} +{% if not embedded and collapse_index %} + +{% endif %} +{% endblock %} +{% block body %} +
+ {%- set curr_group = 0 %} + +

{{ indextitle }}

+ +
+ {%- for (letter, entries) in content %} + {{ letter }} + {%- if not loop.last %} | {% endif %} + {%- endfor %} +
+ + + {%- for letter, entries in content %} + + + {%- for (name, grouptype, page, anchor, extra, qualifier, description) + in entries %} + {%- if grouptype == 1 %}{% set curr_group = curr_group + 1 %}{% endif %} + + + + {%- endfor %} + {%- endfor %} +
 
+ {{ letter }}
{% if grouptype == 1 -%} + + {%- endif %}{% if grouptype == 2 %}   {% endif %} + {% if page %}{% endif -%} + {{ name|e }} + {%- if page %}{% endif %} + {%- if extra %} ({{ extra|e }}){% endif -%} + {% if qualifier %}{{ qualifier|e }}:{% endif %} + {{ description|e }}
+
+{% endblock %} diff --git a/doc/_themes/pysidedocs/modindex.html b/doc/_themes/pysidedocs/modindex.html deleted file mode 100644 index b00a440..0000000 --- a/doc/_themes/pysidedocs/modindex.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends "layout.html" %} -{% set title = _('Global Module Index') %} -{% block extrahead %} -{{ super() }} -{% if not embedded and collapse_modindex %} - -{% endif %} -{% endblock %} -{% block body %} -
-

{{ _('Global Module Index') }}

- - {%- for letter in letters %} - {{ letter }} {% if not loop.last %}| {% endif %} - {%- endfor %} -
- - - {%- for modname, collapse, cgroup, indent, fname, synops, pform, dep, stripped in modindexentries %} - {%- if not modname -%} - {%- else -%} - - - - {%- endif -%} - {% endfor %} -
{% if collapse -%} - - {%- endif %}{% if indent %}   {% endif %} - {% if fname %}{% endif -%} - {{ stripped|e }}{{ modname|e }} - {%- if fname %}{% endif %} - {%- if pform and pform[0] %} ({{ pform|join(', ') }}){% endif -%} - {% if dep %}{{ _('Deprecated')}}:{% endif %} - {{ synops|e }}
- -{% endblock %} From 31db130bbdf4895ff110f3570599b44458b989ad Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 23 Sep 2010 16:34:13 -0300 Subject: [PATCH 040/913] Fixed bug#310 --- PySide/QtCore/typesystem_core.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index ec78941..92a154c 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -739,6 +739,9 @@ + + + int yearNumber; int week = %CPPSELF.%FUNCTION_NAME(&yearNumber); From 9eddff59405f9bfb94c0bb15da3d047eb7029958 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 24 Sep 2010 10:43:04 -0300 Subject: [PATCH 041/913] Fix bug#385 - "Windows build error (MSVC Express 2008)" --- libpyside/pyside.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index d466458..9b8c4cc 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include extern "C" void init_signal(PyObject* module); From 3e0af488ee5820f35462f381c5a1676dc9560a5d Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 24 Sep 2010 15:34:20 -0300 Subject: [PATCH 042/913] Fix bug#168 - "API documentation suggestions" and other fixes. Reviewer: Luciano Wolf Marcelo Lira --- CMakeLists.txt | 10 +- PySide/CMakeLists.txt | 18 +- doc/CMakeLists.txt | 109 ++++-------- doc/pyside.qdocconf | 20 --- doc/pyside.qdocconf.in | 352 ++++++++++++++++++++++++++++++++++++++ doc/typesystem_doc.xml.in | 89 ++++++++++ 6 files changed, 497 insertions(+), 101 deletions(-) delete mode 100644 doc/pyside.qdocconf create mode 100644 doc/pyside.qdocconf.in create mode 100644 doc/typesystem_doc.xml.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 47ab784..5c50500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,12 @@ enable_testing() add_subdirectory(libpyside) # project directories -add_subdirectory(${BINDING_NAME}) +add_subdirectory(PySide) add_subdirectory(tests) -add_subdirectory(doc) + +find_program(DOT_EXEC dot) +if (QT_SRC_DIR AND DOT_EXEC) + add_subdirectory(doc) +else () + message(STATUS "QT_SRC_DIR variable not set or graphviz not found, apidoc generation targets disabled.") +endif() diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 8769d3a..8a1f4d2 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -88,15 +88,12 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" # Only add subdirectory if the associated Qt module is found. macro(HAS_QT_MODULE var name) -if (DISABLE_${name}) - message(STATUS "Generation of ${name} disabled.") -else() - if (${var}) + if (NOT DISABLE_${name} AND ${var}) add_subdirectory(${name}) else() - message(STATUS "${name} NOT found. ${name} support disabled.") + set("if_${name}" "" PARENT_SCOPE) endif() -endif() endmacro() execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" @@ -115,6 +112,9 @@ if (NOT QT_QTMULTIMEDIA_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) find_library(QT_QTMULTIMEDIA_LIBRARY QtMultimedia PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) if (QT_QTMULTIMEDIA_INCLUDE_DIR AND QT_QTMULTIMEDIA_LIBRARY) set(QT_QTMULTIMEDIA_FOUND ON) + else() + set(if_QtMultimedia "" PARENT_SCOPE) endif() endif () @@ -129,6 +129,9 @@ if (NOT QT_QTMAEMO5_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) if (QT_QTMAEMO5_INCLUDE_DIR AND QT_QTMAEMO5_LIBRARY) set(QT_QTMAEMO5_FOUND ON) set(Q_WS_MAEMO_5 ON) + else() + set(if_Maemo5 "" PARENT_SCOPE) endif() endif () @@ -142,6 +145,9 @@ if (NOT QT_QTDECLARATIVE_FOUND AND ${QTVERSION} VERSION_GREATER 4.6.0) find_library(QT_QTDECLARATIVE_LIBRARY QtDeclarative PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) if (QT_QTDECLARATIVE_INCLUDE_DIR AND QT_QTDECLARATIVE_LIBRARY) set(QT_QTDECLARATIVE_FOUND ON) + else() + set(if_QtDeclarative "" PARENT_SCOPE) endif() endif () diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 92389b9..7b29ca6 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,91 +1,54 @@ -find_program(graphviz_exec dot) +project(doc) -if (QT_SRC_DIR) +set(DOC_DATA_DIR "${CMAKE_CURRENT_BINARY_DIR}/qdoc3-output") +configure_file("pyside.qdocconf.in" "pyside.qdocconf" @ONLY) -if (NOT ${graphviz_exec} STREQUAL graphviz_exec-NOTFOUND) +add_custom_target(qdoc3 + COMMAND qdoc3 pyside.qdocconf + COMMENT "Running qdoc3 against Qt source code..." + SOURCE "pyside.qdocconf") add_custom_target(apidoc COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/rst - COMMAND sphinx-build -b html ${CMAKE_CURRENT_BINARY_DIR}/rst htmldocs + COMMAND sphinx-build -b html ${CMAKE_CURRENT_BINARY_DIR}/rst html ) # create conf.py based on conf.py.in configure_file("conf.py.in" "rst/conf.py" @ONLY) +configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY) -# copy pyside.qdocconf to qt source dir. -configure_file("pyside.qdocconf" "${QT_SRC_DIR}/tools/qdoc3/test/pyside.qdocconf" @ONLY) -set(DOC_DATA_DIR "${CMAKE_CURRENT_BINARY_DIR}/qt4xmldoc") -set(ENV{QTDIR} ${QT_SRC_DIR} ) - -add_custom_target(qdoc3 - COMMAND QTDIR=${QT_SRC_DIR} qdoc3 pyside.qdocconf - WORKING_DIRECTORY "${QT_SRC_DIR}/tools/qdoc3/test" - COMMENT "Running qdoc3 against Qt source code..." - SOURCE "pyside.qdocconf") - -macro(create_doc module typesystem_path) -string(REGEX REPLACE "^Qt" "" module_name ${module}) -string(TOLOWER ${module_name} module_name) -add_custom_target("${module}-apidoc" -COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=qtdoc - ${pyside_BINARY_DIR}/global.h - --include-paths=${QT_INCLUDE_DIR}:${QT_QTCORE_INCLUDE_DIR} - --typesystem-paths=${pyside_SOURCE_DIR}:${${module}_BINARY_DIR}:${typesystem_path} - ${pyside_SOURCE_DIR}/${module}/typesystem_${module_name}.xml - --library-source-dir=${QT_SRC_DIR} - --documentation-only - --documentation-data-dir=${DOC_DATA_DIR} - --documentation-out-dir=${CMAKE_CURRENT_BINARY_DIR}/rst - --documentation-code-snippets-dir=${CMAKE_CURRENT_SOURCE_DIR}/codesnippets -WORKING_DIRECTORY ${${module}_SOURCE_DIR} - -COMMENT "Running generator to generate documentation of ${module}..." +add_custom_target("docrsts" + COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=qtdoc + ${pyside_BINARY_DIR}/global.h + --include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${QT_QTCORE_INCLUDE_DIR}" + --api-version=${SUPPORTED_QT_VERSION} + --typesystem-paths="${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR}${PATH_SEP}${QtDeclarative_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}${PATH_SEP}${QtHelp_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtMultimedia_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtOpenGL_SOURCE_DIR}${PATH_SEP}${QtScript_SOURCE_DIR}${PATH_SEP}${QtScriptTools_SOURCE_DIR}${PATH_SEP}${QtSql_SOURCE_DIR}${PATH_SEP}${QtSvg_SOURCE_DIR}${PATH_SEP}${QtTest_SOURCE_DIR}${PATH_SEP}${QtUiTools_SOURCE_DIR}${PATH_SEP}${QtWebKit_SOURCE_DIR}${PATH_SEP}${QtXml_SOURCE_DIR}${PATH_SEP}${QtXmlPatterns_SOURCE_DIR}" + --library-source-dir=${QT_SRC_DIR} + --documentation-only + --documentation-data-dir=${DOC_DATA_DIR} + --output-directory=${CMAKE_CURRENT_BINARY_DIR}/rst + --documentation-code-snippets-dir=${CMAKE_CURRENT_SOURCE_DIR}/codesnippets + ${CMAKE_CURRENT_BINARY_DIR}/typesystem_doc.xml + WORKING_DIRECTORY ${${module}_SOURCE_DIR} + COMMENT "Running generator to generate documentation..." ) -add_dependencies("${module}-apidoc" qdoc3) -add_dependencies(apidoc "${module}-apidoc") -endmacro() +add_dependencies(apidoc docrsts) +add_dependencies(docrsts qdoc3) -create_doc(QtCore "") -create_doc(QtGui "${QtCore_SOURCE_DIR}") -create_doc(QtHelp "${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtHelp_SOURCE_DIR}") -create_doc(QtNetwork "${QtCore_SOURCE_DIR}") -create_doc(QtOpengl "${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtOpenGL_SOURCE_DIR}") -create_doc(QtSql "${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtSql_SOURCE_DIR}") -create_doc(QtSvg "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -create_doc(QtUitools "${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtXml_SOURCE_DIR}:${QtUiTools_SOURCE_DIR}") -create_doc(QtXml "${QtCore_SOURCE_DIR}") -create_doc(QtWebKit "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtNetwork_SOURCE_DIR}") -create_doc(QtMultimedia "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -create_doc(QtScript "${QtCore_SOURCE_DIR}") -create_doc(QtScriptTools "${QtCore_SOURCE_DIR}:${QtScript_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -create_doc(QtTest "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -create_doc(QtXmlPatterns "${QtCore_SOURCE_DIR}") -create_doc(phonon "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}") -if (QT_QTDECLARATIVE_FOUND) - create_doc(QtDeclarative "${QtCore_SOURCE_DIR}:${QtGui_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtNetwork_SOURCE_DIR}") -endif() - -#create devhelp file -add_custom_target(apidevhelp - COMMAND python;${CMAKE_CURRENT_SOURCE_DIR}/pyhtml2devhelp.py;${CMAKE_BINARY_DIR}/apidoc/html;index.html > - ${CMAKE_BINARY_DIR}/apidoc/html/PySide.devhelp;${BINDING_API_VERSION}&&; - gzip;-9v;-f;${CMAKE_BINARY_DIR}/apidoc/html/PySide.devhelp - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_INSTALL_PREFIX}/share/devhelp/books" - COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_INSTALL_PREFIX}/share/doc/${BINDING_NAME}/html" "${CMAKE_INSTALL_PREFIX}/share/devhelp/books/${BINDING_NAME}" -) +# #create devhelp file +# add_custom_target(apidevhelp +# COMMAND python;${CMAKE_CURRENT_SOURCE_DIR}/pyhtml2devhelp.py;${CMAKE_BINARY_DIR}/apidoc/html;index.html > +# ${CMAKE_BINARY_DIR}/apidoc/html/PySide.devhelp;${BINDING_API_VERSION}&&; +# gzip;-9v;-f;${CMAKE_BINARY_DIR}/apidoc/html/PySide.devhelp +# COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_INSTALL_PREFIX}/share/devhelp/books" +# COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_INSTALL_PREFIX}/share/doc/${BINDING_NAME}/html" "${CMAKE_INSTALL_PREFIX}/share/devhelp/books/${BINDING_NAME}" +# ) #install files add_custom_target(apidocinstall - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/share/doc/${BINDING_NAME} && cp -rv ${CMAKE_BINARY_DIR}/apidoc/* ${CMAKE_INSTALL_PREFIX}/share/doc/${BINDING_NAME} + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/share/doc/PySide-${BINDING_API_VERSION} && cp -rv ${CMAKE_CURRENT_BINARY_DIR}/html/* ${CMAKE_INSTALL_PREFIX}/share/doc/PySide-${BINDING_API_VERSION} ) -add_dependencies(apidocinstall apidevhelp) - -else () - message(STATUS "Missing graphviz tool (dot), apidoc generation targets disabled.") -endif () - -else () - message(STATUS "QT_SRC_DIR variable not set, apidoc generation targets disabled.") -endif () +add_dependencies(apidocinstall apidoc) +# add_dependencies(apidocinstall apidevhelp) diff --git a/doc/pyside.qdocconf b/doc/pyside.qdocconf deleted file mode 100644 index 1e940fa..0000000 --- a/doc/pyside.qdocconf +++ /dev/null @@ -1,20 +0,0 @@ -include(qt.qdocconf) - -quotinginformation = true -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs - -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/declarative/pics \ - $QTDIR/doc/src/template/image - -outputdir = @CMAKE_CURRENT_BINARY_DIR@/qt4xmldoc -outputformats = WebXML - -generateindex = false -url = . diff --git a/doc/pyside.qdocconf.in b/doc/pyside.qdocconf.in new file mode 100644 index 0000000..a9b0223 --- /dev/null +++ b/doc/pyside.qdocconf.in @@ -0,0 +1,352 @@ +######################## compat.qdocconf +alias.i = e +alias.include = input + +macro.0 = "\\\\0" +macro.b = "\\\\b" +macro.n = "\\\\n" +macro.r = "\\\\r" +macro.i = "\\o" +macro.i11 = "\\o{1,1}" +macro.i12 = "\\o{1,2}" +macro.i13 = "\\o{1,3}" +macro.i14 = "\\o{1,4}" +macro.i15 = "\\o{1,5}" +macro.i16 = "\\o{1,6}" +macro.i17 = "\\o{1,7}" +macro.i18 = "\\o{1,8}" +macro.i19 = "\\o{1,9}" +macro.i21 = "\\o{2,1}" +macro.i31 = "\\o{3,1}" +macro.i41 = "\\o{4,1}" +macro.i51 = "\\o{5,1}" +macro.i61 = "\\o{6,1}" +macro.i71 = "\\o{7,1}" +macro.i81 = "\\o{8,1}" +macro.i91 = "\\o{9,1}" +macro.img = "\\image" +macro.endquote = "\\endquotation" +macro.relatesto = "\\relates" + +spurious = "Missing comma in .*" \ + "Missing pattern .*" + +######################## macros.qdocconf +macro.aacute.HTML = "á" +macro.Aring.HTML = "Å" +macro.aring.HTML = "å" +macro.Auml.HTML = "Ä" +macro.author = "\\bold{Author:}" +macro.br.HTML = "
" +macro.BR.HTML = "
" +macro.copyright.HTML = "©" +macro.eacute.HTML = "é" +macro.gui = "\\bold" +macro.hr.HTML = "
" +macro.iacute.HTML = "í" +macro.key = "\\bold" +macro.menu = "\\bold" +macro.note = "\\bold{Note:}" +macro.oslash.HTML = "ø" +macro.ouml.HTML = "ö" +macro.QA = "\\e{Qt Assistant}" +macro.QD = "\\e{Qt Designer}" +macro.QL = "\\e{Qt Linguist}" +macro.param = "\\e" +macro.raisedaster.HTML = "*" +macro.rarrow.HTML = "→" +macro.reg.HTML = "®" +macro.return = "Returns" +macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" +macro.uuml.HTML = "ü" +macro.mdash.HTML = "—" + +macro.beginfloatleft.HTML = "
" +macro.beginfloatright.HTML = "
" +macro.endfloat.HTML = "
" +macro.clearfloat.HTML = "
" + +######################## qt-cpp-ignore.qdocconf +Cpp.ignoretokens = QAXFACTORY_EXPORT \ + QDESIGNER_COMPONENTS_LIBRARY \ + QDESIGNER_EXTENSION_LIBRARY \ + QDESIGNER_SDK_LIBRARY \ + QDESIGNER_SHARED_LIBRARY \ + QDESIGNER_UILIB_LIBRARY \ + QM_EXPORT_CANVAS \ + QM_EXPORT_DNS \ + QM_EXPORT_DOM \ + QM_EXPORT_FTP \ + QM_EXPORT_HTTP \ + QM_EXPORT_ICONVIEW \ + QM_EXPORT_NETWORK \ + QM_EXPORT_OPENGL \ + QM_EXPORT_OPENVG \ + QM_EXPORT_SQL \ + QM_EXPORT_TABLE \ + QM_EXPORT_WORKSPACE \ + QM_EXPORT_XML \ + QT_ASCII_CAST_WARN \ + QT_ASCII_CAST_WARN_CONSTRUCTOR \ + QT_BEGIN_HEADER \ + QT_DESIGNER_STATIC \ + QT_END_HEADER \ + QT_FASTCALL \ + QT_WIDGET_PLUGIN_EXPORT \ + Q_COMPAT_EXPORT \ + Q_CORE_EXPORT \ + Q_CORE_EXPORT_INLINE \ + Q_EXPLICIT \ + Q_EXPORT \ + Q_EXPORT_CODECS_CN \ + Q_EXPORT_CODECS_JP \ + Q_EXPORT_CODECS_KR \ + Q_EXPORT_PLUGIN \ + Q_GFX_INLINE \ + Q_AUTOTEST_EXPORT \ + Q_GUI_EXPORT \ + Q_GUI_EXPORT_INLINE \ + Q_GUI_EXPORT_STYLE_CDE \ + Q_GUI_EXPORT_STYLE_COMPACT \ + Q_GUI_EXPORT_STYLE_MAC \ + Q_GUI_EXPORT_STYLE_MOTIF \ + Q_GUI_EXPORT_STYLE_MOTIFPLUS \ + Q_GUI_EXPORT_STYLE_PLATINUM \ + Q_GUI_EXPORT_STYLE_POCKETPC \ + Q_GUI_EXPORT_STYLE_SGI \ + Q_GUI_EXPORT_STYLE_WINDOWS \ + Q_GUI_EXPORT_STYLE_WINDOWSXP \ + QHELP_EXPORT \ + Q_INLINE_TEMPLATE \ + Q_INTERNAL_WIN_NO_THROW \ + Q_NETWORK_EXPORT \ + Q_OPENGL_EXPORT \ + Q_OPENVG_EXPORT \ + Q_OUTOFLINE_TEMPLATE \ + Q_SQL_EXPORT \ + Q_SVG_EXPORT \ + Q_SCRIPT_EXPORT \ + Q_SCRIPTTOOLS_EXPORT \ + Q_TESTLIB_EXPORT \ + Q_TYPENAME \ + Q_XML_EXPORT \ + Q_XMLSTREAM_EXPORT \ + Q_XMLPATTERNS_EXPORT \ + QDBUS_EXPORT \ + QT_BEGIN_NAMESPACE \ + QT_BEGIN_INCLUDE_NAMESPACE \ + QT_END_NAMESPACE \ + QT_END_INCLUDE_NAMESPACE \ + PHONON_EXPORT \ + Q_DECLARATIVE_EXPORT \ + Q_GADGET \ + QWEBKIT_EXPORT +Cpp.ignoredirectives = Q_DECLARE_HANDLE \ + Q_DECLARE_INTERFACE \ + Q_DECLARE_METATYPE \ + Q_DECLARE_OPERATORS_FOR_FLAGS \ + Q_DECLARE_PRIVATE \ + Q_DECLARE_PUBLIC \ + Q_DECLARE_SHARED \ + Q_DECLARE_TR_FUNCTIONS \ + Q_DECLARE_TYPEINFO \ + Q_DISABLE_COPY \ + QT_FORWARD_DECLARE_CLASS \ + Q_DUMMY_COMPARISON_OPERATOR \ + Q_ENUMS \ + Q_FLAGS \ + Q_INTERFACES \ + __attribute__ \ + K_DECLARE_PRIVATE \ + PHONON_OBJECT \ + PHONON_HEIR + +######################## qt-html-templates.qdocconf +HTML.stylesheets = classic.css +HTML.postheader = "\n" \ + "\n" \ + "\n" \ + "" \ + "" \ + "
" \ + "" \ + "  " \ + "" \ + "Home ·" \ + " " \ + "All Classes ·" \ + " " \ + "All Functions ·" \ + " " \ + "Overviews" \ + "
" + +HTML.footer = "


\n" \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt \\version
" + +######################## qt-defines.qdocconf +defines = Q_QDOC \ + QT_.*_SUPPORT \ + QT_.*_LIB \ + QT_COMPAT \ + QT_KEYPAD_NAVIGATION \ + QT3_SUPPORT \ + Q_WS_.* \ + Q_OS_.* \ + Q_BYTE_ORDER \ + QT_DEPRECATED \ + Q_NO_USING_KEYWORD \ + __cplusplus + +versionsym = QT_VERSION_STR + +codeindent = 1 + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo \ + trolltech-logo \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png \ + stylesheet-coffee-plastique.png + +######################## qt.qdocconf + +project = Qt +versionsym = +version = %VERSION% +description = Qt Reference Documentation +url = http://qt.nokia.com/doc/@PYSIDE_QT_VERSION@ + +edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \ + QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ + QtDesigner QtAssistant QAxContainer Phonon \ + QAxServer QtUiTools QtTest QtDBus +edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest +edition.DesktopLight.groups = -graphicsview-api + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.460 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = classic.css \ + images/qt-logo.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + images/stylesheet-coffee-plastique.png + +qhp.Qt.filterAttributes = qt @PYSIDE_QT_VERSION@ qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt @PYSIDE_QT_VERSION@ +qhp.Qt.customFilters.Qt.filterAttributes = qt @PYSIDE_QT_VERSION@ +qhp.Qt.subprojects = classes overviews examples +qhp.Qt.subprojects.classes.title = Classes +qhp.Qt.subprojects.classes.indexTitle = Qt's Classes +qhp.Qt.subprojects.classes.selectors = class fake:headerfile +qhp.Qt.subprojects.classes.sortPages = true +qhp.Qt.subprojects.overviews.title = Overviews +qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs +qhp.Qt.subprojects.overviews.selectors = fake:page,group,module +qhp.Qt.subprojects.examples.title = Tutorials and Examples +qhp.Qt.subprojects.examples.indexTitle = Qt Examples +qhp.Qt.subprojects.examples.selectors = fake:example + +language = Cpp + +headerdirs = @QT_SRC_DIR@/src \ + @QT_SRC_DIR@/extensions/activeqt \ + @QT_SRC_DIR@/tools/assistant/lib \ + @QT_SRC_DIR@/tools/assistant/compat/lib \ + @QT_SRC_DIR@/tools/designer/src/uitools \ + @QT_SRC_DIR@/tools/designer/src/lib/extension \ + @QT_SRC_DIR@/tools/designer/src/lib/sdk \ + @QT_SRC_DIR@/tools/designer/src/lib/uilib \ + @QT_SRC_DIR@/tools/qtestlib/src \ + @QT_SRC_DIR@/tools/qdbus/src +sourcedirs = @QT_SRC_DIR@/src \ + @QT_SRC_DIR@/doc/src \ + @QT_SRC_DIR@/extensions/activeqt \ + @QT_SRC_DIR@/tools/assistant/lib \ + @QT_SRC_DIR@/tools/assistant/compat/lib \ + @QT_SRC_DIR@/tools/designer/src/uitools \ + @QT_SRC_DIR@/tools/designer/src/lib/extension \ + @QT_SRC_DIR@/tools/designer/src/lib/sdk \ + @QT_SRC_DIR@/tools/designer/src/lib/uilib \ + @QT_SRC_DIR@/tools/qtestlib/src \ + @QT_SRC_DIR@/tools/qdbus + +excludedirs = @QT_SRC_DIR@/src/3rdparty/clucene \ + @QT_SRC_DIR@/src/3rdparty/des \ + @QT_SRC_DIR@/src/3rdparty/freetype \ + @QT_SRC_DIR@/src/3rdparty/harfbuzz \ + @QT_SRC_DIR@/src/3rdparty/kdebase \ + @QT_SRC_DIR@/src/3rdparty/libjpeg \ + @QT_SRC_DIR@/src/3rdparty/libmng \ + @QT_SRC_DIR@/src/3rdparty/libpng \ + @QT_SRC_DIR@/src/3rdparty/libtiff \ + @QT_SRC_DIR@/src/3rdparty/md4 \ + @QT_SRC_DIR@/src/3rdparty/md5 \ + @QT_SRC_DIR@/src/3rdparty/patches \ + @QT_SRC_DIR@/src/3rdparty/sha1 \ + @QT_SRC_DIR@/src/3rdparty/sqlite \ + @QT_SRC_DIR@/src/3rdparty/webkit/JavaScriptCore \ + @QT_SRC_DIR@/src/3rdparty/webkit/WebCore \ + @QT_SRC_DIR@/src/3rdparty/wintab \ + @QT_SRC_DIR@/src/3rdparty/zlib \ + @QT_SRC_DIR@/doc/src/snippets \ + @QT_SRC_DIR@/src/3rdparty/phonon/gstreamer \ + @QT_SRC_DIR@/src/3rdparty/phonon/ds9 \ + @QT_SRC_DIR@/src/3rdparty/phonon/qt7 \ + @QT_SRC_DIR@/src/3rdparty/phonon/mmf \ + @QT_SRC_DIR@/src/3rdparty/phonon/waveout + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" + +exampledirs = @QT_SRC_DIR@/doc/src \ + @QT_SRC_DIR@/examples \ + @QT_SRC_DIR@/examples/tutorials \ + @QT_SRC_DIR@ \ + @QT_SRC_DIR@/qmake/examples \ + @QT_SRC_DIR@/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = @QT_SRC_DIR@/doc/src/images \ + @QT_SRC_DIR@/examples +outputdir = @QT_SRC_DIR@/doc/html +tagfile = @QT_SRC_DIR@/doc/html/qt.tags +base = file:@QT_SRC_DIR@/doc/html + +HTML.generatemacrefs = "true" + +######################## pyside.qdocconf +quotinginformation = true +exampledirs = @QT_SRC_DIR@/doc/src \ + @QT_SRC_DIR@/examples \ + @QT_SRC_DIR@/examples/tutorials \ + @QT_SRC_DIR@ \ + @QT_SRC_DIR@/qmake/examples \ + @QT_SRC_DIR@/src/3rdparty/webkit/WebKit/qt/docs + +imagedirs = @QT_SRC_DIR@/doc/src/images \ + @QT_SRC_DIR@/examples \ + @QT_SRC_DIR@/doc/src/declarative/pics \ + @QT_SRC_DIR@/doc/src/template/image + +outputdir = @DOC_DATA_DIR@ +outputformats = WebXML + +generateindex = false +url = . diff --git a/doc/typesystem_doc.xml.in b/doc/typesystem_doc.xml.in new file mode 100644 index 0000000..eaf5178 --- /dev/null +++ b/doc/typesystem_doc.xml.in @@ -0,0 +1,89 @@ + + + + + + + + @if_QtDeclarative@ + + @end_QtDeclarative@ + + @if_QtGui@ + + @end_QtGui@ + + @if_QtHelp@ + + @end_QtHelp@ + + @if_Maemo5@ + + @end_Maemo5@ + + @if_Multimedia@ + + @end_Multimedia@ + + @if_QtNetwork@ + + @end_QtNetwork@ + + @if_QtOpenGL@ + + @end_QtOpenGL@ + + @if_QtScript@ + + @end_QtScript@ + + @if_QtScriptTools@ + + @end_QtScriptTools@ + + @if_QtSql@ + + @end_QtSql@ + + @if_QtSvg@ + + @end_QtSvg@ + + @if_QtTest@ + + @end_QtTest@ + + @if_QtUiTools@ + + @end_QtUiTools@ + + @if_QtWebKit@ + + @end_QtWebKit@ + + @if_QtXml@ + + @end_QtXml@ + + @if_QtXmlPatterns@ + + @end_QtXmlPatterns@ + \ No newline at end of file From 88fd0c6e0bca1cf0a25a80ba367e6ee3d59b1862 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 23 Sep 2010 11:47:34 -0300 Subject: [PATCH 043/913] Fixed QVariant::Type convertions. Fixed QItemEditorFactory ownership rules on typesystem. Fixes bug #373. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/qvariant_type_conversions.h | 8 ++++++-- PySide/QtGui/typesystem_gui_common.xml | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PySide/QtCore/qvariant_type_conversions.h b/PySide/QtCore/qvariant_type_conversions.h index d1cf9f0..e5384cd 100644 --- a/PySide/QtCore/qvariant_type_conversions.h +++ b/PySide/QtCore/qvariant_type_conversions.h @@ -25,8 +25,12 @@ struct Converter typeName = "double"; // float is a UserType in QVariant. else if (pyObj == reinterpret_cast(&PyLong_Type)) typeName = "int"; // long is a UserType in QVariant. - else if (PyType_Check(pyObj)) - typeName = reinterpret_cast(pyObj)->tp_name; + else if (PyType_Check(pyObj)) { + if (pyObj->ob_type == &Shiboken::SbkBaseWrapperType_Type) + typeName = reinterpret_cast(pyObj)->original_name; + else + typeName = reinterpret_cast(pyObj)->tp_name; + } else if (PyString_Check(pyObj)) typeName = PyString_AS_STRING(pyObj); else if (PyUnicode_Check(pyObj)) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 76afecc..4581e1f 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1550,12 +1550,12 @@ - + - + From 2bd1bab4bb37b44e5ffc94e284e67d7cfe4ce9ff Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 24 Sep 2010 15:55:20 -0300 Subject: [PATCH 044/913] Fixed unit test to avoid put a object child of QApplication. This will cause assert on debug mode. Because qApp is dever destroyed. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtGui/keep_reference_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QtGui/keep_reference_test.py b/tests/QtGui/keep_reference_test.py index 310361a..47c7a59 100644 --- a/tests/QtGui/keep_reference_test.py +++ b/tests/QtGui/keep_reference_test.py @@ -28,7 +28,7 @@ class KeepReferenceTest(UsesQApplication): def testModelWithParent(self): view = QTableView() - model = TestModel(self.app) + model = TestModel(None) view.setModel(model) samemodel = view.model() self.assertEqual(model, samemodel) From 6320bfa4fa3428d05785edc433ff9740799c938f Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 24 Sep 2010 15:58:00 -0300 Subject: [PATCH 045/913] Fixed QCoreApplication and QApplication cleanup. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/glue/qcoreapplication_init.cpp | 3 +-- PySide/QtGui/glue/qapplication_init.cpp | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 14ccbb8..461757c 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -10,10 +10,9 @@ void DeleteQCoreApplicationAtExit() QCoreApplication *cpp = QCoreApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - PyObject* pySelf = bmngr.retrieveWrapper(cpp); cpp->flush(); QCoreApplication::processEvents(); - bmngr.invalidateWrapper(pySelf); + bmngr.destroyWrapper(cpp); delete cpp; } } diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index 208d59a..246e5d1 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -15,18 +15,15 @@ void DeleteQApplicationAtExit() // Delete all widgets, this is slow but is necessary to avoid problems with python object foreach(QWidget* w, QApplication::allWidgets()) { - PyObject* pySelf = bmngr.retrieveWrapper(w); - w->deleteLater(); //Make sure all events will send before invalidated the python object QApplication::processEvents(); - bmngr.invalidateWrapper(pySelf); + bmngr.destroyWrapper(w); } - PyObject* pySelf = bmngr.retrieveWrapper(cpp); cpp->deleteLater(); QApplication::processEvents(); - bmngr.invalidateWrapper(pySelf); + bmngr.destroyWrapper(cpp); } } From 805824d4b637a240f5f26bde1f09d11780551950 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 24 Sep 2010 15:58:43 -0300 Subject: [PATCH 046/913] Fixed model view ownership rules. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 10 ++-- PySide/QtGui/typesystem_gui_common.xml | 75 +++++++++++--------------- 2 files changed, 35 insertions(+), 50 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 92a154c..0df47a9 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1717,7 +1717,7 @@ %3) ); // invalidate to avoid use of python object - Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL("timeout()"), timer, SLOT("deleteLater()")); timer->start(%1); @@ -1741,7 +1741,7 @@ SIGNAL(timeout()), pyargs[1]) ); - Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer); timer->start(%1); @@ -1769,7 +1769,7 @@ signalInstance->source, signalSignature.object()) ); - Shiboken::BindingManager::instance().invalidateWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer); timer->start(%1); @@ -2288,13 +2288,13 @@ - + - + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 4581e1f..81e0a33 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1216,6 +1216,16 @@ + + + + + + + + + + @@ -2145,17 +2146,6 @@ - - - - - - - - - - - @@ -3971,11 +3961,6 @@ - - - - - From 41bd89393e3203c027cb659771e390a7101c5fc4 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 24 Sep 2010 15:59:11 -0300 Subject: [PATCH 047/913] Inlcluded assert to avoid call objectcts metacall whithout Python relatives. Reviewer: Hugo Parente Lima Luciano Wolf --- libpyside/signalmanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 3724500..b8e97f9 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -355,6 +355,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, QMetaProperty mp; Shiboken::TypeResolver* typeResolver = 0; PyObject* pySelf = Shiboken::BindingManager::instance().retrieveWrapper(object); + Q_ASSERT(pySelf); if (call != QMetaObject::InvokeMetaMethod) { mp = metaObject->property(id); From 51d9d503cd847b5677d7bf438df2f754119f0400 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 27 Sep 2010 15:17:12 -0300 Subject: [PATCH 048/913] Add return value docs to functions returning tuples. --- PySide/QtCore/typesystem_core.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 0df47a9..0eafbb1 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -706,7 +706,7 @@ --> - + @@ -727,7 +727,7 @@ - + int year, month, day; From 199b8b3baee2e3297413636a63ca09abe6aac39a Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 27 Sep 2010 16:14:53 -0300 Subject: [PATCH 049/913] Fix bug#375 - "Just an empty table when using delegate." Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 31 +++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 81e0a33..4ba84e6 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1226,6 +1226,11 @@ + + + + + @@ -430,14 +428,12 @@ - - @@ -2228,9 +2224,8 @@ - + - @@ -2597,7 +2592,11 @@ + + + + diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt index 9d50294..85c61b9 100644 --- a/PySide/QtGui/CMakeLists.txt +++ b/PySide/QtGui/CMakeLists.txt @@ -3,6 +3,8 @@ project(QtGui) if(ENABLE_X11) set(SPECIFIC_OS_FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11info_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11embedcontainer_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11embedwidget_wrapper.cpp ) if(Q_WS_MAEMO_5) @@ -28,6 +30,7 @@ else() ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix4x3_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix4x4_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgesture_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgestureevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgesturerecognizer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgraphicsanchor_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qgraphicsanchorlayout_wrapper.cpp @@ -46,6 +49,8 @@ else() ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpinchgesture_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qquaternion_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qswipegesture_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qtapandholdgesture_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qtapgesture_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qtilerules_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qtouchevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qtouchevent_touchpoint_wrapper.cpp diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 4ba84e6..6e1ef31 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -2333,6 +2333,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4849,6 +4876,8 @@ + + @@ -4912,7 +4941,7 @@ - + diff --git a/PySide/QtGui/typesystem_gui_x11.xml b/PySide/QtGui/typesystem_gui_x11.xml index 0fd3628..920b6a2 100644 --- a/PySide/QtGui/typesystem_gui_x11.xml +++ b/PySide/QtGui/typesystem_gui_x11.xml @@ -26,6 +26,12 @@ - + + + + + + + diff --git a/PySide/global.h.in b/PySide/global.h.in index 7266fe1..0e76e46 100644 --- a/PySide/global.h.in +++ b/PySide/global.h.in @@ -337,6 +337,8 @@ QT_END_HEADER #include "qpytextobject.h" #if @ENABLE_X11@ #include + #include + #include #endif #include #include From 6ad03f2a795563aec47d45d6426639323f981975 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 29 Sep 2010 11:15:42 -0300 Subject: [PATCH 053/913] Added support on script to compare symbols in both Qt bindings (PySide/PyQt4) Reviewer: Luciano Wolf Marcelo Lira --- tests/tools/list-class-hierarchy.py | 78 +++++++++++++++++------------ 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/tests/tools/list-class-hierarchy.py b/tests/tools/list-class-hierarchy.py index 381efee..a4faf60 100755 --- a/tests/tools/list-class-hierarchy.py +++ b/tests/tools/list-class-hierarchy.py @@ -44,6 +44,7 @@ ignore = ["staticMetaObject", def recurse_into(el,obj): #s = el.split('.')[-1] #pdb.set_trace() + symbols = [] for item in sorted(dir(obj)): if item[0]=='_': continue @@ -52,44 +53,55 @@ def recurse_into(el,obj): mobj = eval(mel) except Exception: continue + if item in ignore: continue - print mel + else: + symbols.append(mel) + if isclass(mobj): - recurse_into(mel,mobj) + symbols += recurse_into(mel,mobj) + + return symbols if __name__=='__main__': - top = sys.argv[1] + modules = [ 'QtCore', + 'QtGui', + 'QtHelp', + #'QtMultimedia', + 'QtNetwork', + 'QtOpenGL', + 'QtScript', + 'QtScriptTools', + 'QtSql', + 'QtSvg', + 'QtTest', + #'QtUiTools', + 'QtWebKit', + 'QtXml', + 'QtXmlPatterns' ] - if top=="PyQt4": - import sip - sip.setapi('QDate',2) - sip.setapi('QDateTime',2) - sip.setapi('QString',2) - sip.setapi('QTextStream',2) - sip.setapi('QTime',2) - sip.setapi('QUrl',2) - sip.setapi('QVariant',2) + libraries = ["PySide", "PyQt4"] + librarySymbols = {} + for l in libraries: + dictionary = [] + if l =="PyQt4": + import sip + sip.setapi('QDate',2) + sip.setapi('QDateTime',2) + sip.setapi('QString',2) + sip.setapi('QTextStream',2) + sip.setapi('QTime',2) + sip.setapi('QUrl',2) + sip.setapi('QVariant',2) - if len(sys.argv)>2: - modules = sys.argv[2:] - else: - modules = [ 'QtCore', - 'QtGui', - 'QtHelp', - #'QtMultimedia', - 'QtNetwork', - 'QtOpenGL', - 'QtScript', - 'QtScriptTools', - 'QtSql', - 'QtSvg', - 'QtTest', - #'QtUiTools', - 'QtWebKit', - 'QtXml', - 'QtXmlPatterns' ] + for m in modules: + exec "from %s import %s" % (l,m) in globals(), locals() + dictionary += recurse_into(m, eval(m)) + librarySymbols[l] = dictionary - for m in modules: - exec "from %s import %s" % (top,m) in globals(), locals() - recurse_into(m,eval(m)) + print "PyQt4: ", len(librarySymbols["PyQt4"]), " PySide: ", len(librarySymbols["PySide"]) + + for symbol in librarySymbols["PyQt4"]: + if not (symbol in librarySymbols["PySide"]): + print "Symbol not found in PySide:", symbol From eabb9d37a78d1c584fe7e70928f0e820bd6e0afc Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 28 Sep 2010 18:07:02 -0300 Subject: [PATCH 054/913] Fix bug#372 - "DiagramScene (GraphicsView) Example not working" The correct title would be "QVariant doesn't correct store a QGraphicsScene object." --- PySide/QtCore/qvariant_conversions.h | 5 +---- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/qvariant_test.py | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 tests/QtGui/qvariant_test.py diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 06a8368..fc2dca5 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -47,9 +47,6 @@ struct Converter return convertToVariantMap(pyObj); } else if (PySequence_Check(pyObj)) { return convertToVariantList(pyObj); - } else if (!isShibokenType(pyObj) || isUserType(pyObj)) { - // QVariant(User class) - return QVariant::fromValue(pyObj); } else { // a class supported by QVariant? if (Shiboken::isShibokenType(pyObj)) { @@ -60,7 +57,7 @@ struct Converter void** data = reinterpret_cast(pyObj)->cptr; if (typeName[strlen(typeName)-1] == '*') return QVariant(typeCode, data); - else + else if (!isUserType(pyObj)) // User types inherited from Value types *should* not be converted. return QVariant(typeCode, data[0]); } } diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 9b928ac..a26c1f6 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -61,6 +61,7 @@ PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) +PYSIDE_TEST(qvariant_test.py) PYSIDE_TEST(qwidget_setlayout_test.py) PYSIDE_TEST(qwidget_test.py) PYSIDE_TEST(reference_count_test.py) diff --git a/tests/QtGui/qvariant_test.py b/tests/QtGui/qvariant_test.py new file mode 100644 index 0000000..faa755a --- /dev/null +++ b/tests/QtGui/qvariant_test.py @@ -0,0 +1,23 @@ + +import unittest +from PySide.QtCore import * +from PySide.QtGui import * + +class MyDiagram(QGraphicsScene): + pass + +class MyItem(QGraphicsRectItem): + def itemChange(self, change, value): + return value; + +class QGraphicsSceneOnQVariantTest(unittest.TestCase): + """Test storage ot QGraphicsScene into QVariants""" + def testIt(self): + app = QApplication([]) + s = MyDiagram() + i = MyItem() + s.addItem(i) + self.assertEqual(len(s.items()), 1) + +if __name__ == '__main__': + unittest.main() From 169d0f8147316f9c1b287953f03113dca997a37b Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 28 Sep 2010 18:24:11 -0300 Subject: [PATCH 055/913] Add test to check iterability of QPolygonF. --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/qpolygonf_test.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/QtGui/qpolygonf_test.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index a26c1f6..c8db7a2 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -48,6 +48,7 @@ PYSIDE_TEST(qobject_mi_test.py) PYSIDE_TEST(qpainter_test.py) PYSIDE_TEST(qpen_test.py) PYSIDE_TEST(qpixmap_test.py) +PYSIDE_TEST(qpolygonf_test.py) PYSIDE_TEST(qpushbutton_test.py) PYSIDE_TEST(qradialgradient_test.py) PYSIDE_TEST(qregion_test.py) diff --git a/tests/QtGui/qpolygonf_test.py b/tests/QtGui/qpolygonf_test.py new file mode 100644 index 0000000..83e643c --- /dev/null +++ b/tests/QtGui/qpolygonf_test.py @@ -0,0 +1,22 @@ + +import unittest +from PySide.QtCore import * +from PySide.QtGui import * + +class QPolygonFNotIterableTest(unittest.TestCase): + """Test if a QPolygonF is iterable""" + def testIt(self): + p = QPolygonF(4) + self.assertEqual(len(p), 4) + + for i in range(0, 4): + p[i] = QPointF(float(i), float(i)) + + i = 0 + for point in p: + self.assertEqual(int(point.x()), i) + self.assertEqual(int(point.y()), i) + i += 1; + +if __name__ == '__main__': + unittest.main() From 492ac5c64ca75fbed346d3b13b3b0dd99c140910 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 29 Sep 2010 15:16:52 -0300 Subject: [PATCH 056/913] Modify return type QLineF::intersect to look nice in the documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Luciano Wolf Renato Araújo --- PySide/QtCore/typesystem_core.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index f364dd0..68bd04c 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -685,6 +685,9 @@ + + + QPointF p; %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &p); From fa87b811adbe0930523c927adcdeaf8272fbf865 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 29 Sep 2010 18:02:31 -0300 Subject: [PATCH 057/913] Fix bug#388 - "Fatal Python error: PyEval_SaveThread: NULL tstate" Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/glue/qapplication_init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index 246e5d1..be90d10 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -21,9 +21,9 @@ void DeleteQApplicationAtExit() bmngr.destroyWrapper(w); } - cpp->deleteLater(); - QApplication::processEvents(); + cpp->processEvents(); bmngr.destroyWrapper(cpp); + delete cpp; } } From 866c76ff1fd8246ffb1be557670a522dd678050a Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 29 Sep 2010 18:31:18 -0300 Subject: [PATCH 058/913] Use PyObject as default type on signal/slot signature. Fixes bug #390. Reviewer: Luciano Wolf --- libpyside/qsignal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index 95fc251..76fc450 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -255,7 +255,7 @@ char* get_type_name(PyObject* type) else if (objType == &PyBool_Type) typeName = strdup("bool"); else - typeName = strdup("object"); + typeName = strdup("PyObject"); } return typeName; } else if (PyString_Check(type)) { From 5222609f31c298f4f729789a0f7764a4496b5ae9 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 30 Sep 2010 12:07:04 -0300 Subject: [PATCH 059/913] Unit test for bug 390. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_389.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/QtGui/bug_389.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index c8db7a2..f260321 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -8,6 +8,7 @@ PYSIDE_TEST(bug_324.py) PYSIDE_TEST(bug_338.py) PYSIDE_TEST(bug_363.py) PYSIDE_TEST(bug_367.py) +PYSIDE_TEST(bug_389.py) PYSIDE_TEST(add_action_test.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_389.py b/tests/QtGui/bug_389.py new file mode 100644 index 0000000..b01019a --- /dev/null +++ b/tests/QtGui/bug_389.py @@ -0,0 +1,15 @@ +''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389''' + +import sys +import unittest +from helper import UsesQApplication +from PySide import QtCore,QtGui + +class BugTest(UsesQApplication): + def testCase(self): + s = QtGui.QWidget().style() + i = s.standardIcon(QtGui.QStyle.SP_TitleBarMinButton) + self.assertEqual(type(i), QtGui.QIcon) + +if __name__ == '__main__': + unittest.main() From 44af04703081f529c433f0fbc5229e9e0d12304f Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 30 Sep 2010 12:07:20 -0300 Subject: [PATCH 060/913] Fix QWidget::style / QWidget::setStyle ownership rules. Fixes bug #389. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 6e1ef31..b490319 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3248,6 +3248,31 @@ + + + Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(%PYSELF), "__style__", %PYARG_1); + + + + + QStyle* myStyle = %CPPSELF->style(); + if (myStyle && qApp) { + %PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle); + QStyle *appStyle = qApp->style(); + if (appStyle == myStyle) { + Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); + Shiboken::setParent(pyApp, %PYARG_0); + SbkBaseWrapper_setOwnership(%PYARG_0, false); + } else { + Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(%PYSELF), "__style__", %PYARG_0); + } + } + + + + + + From 846c9a151f23ec727540f1bda8d6b43609f5ad43 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 30 Sep 2010 15:35:49 -0300 Subject: [PATCH 061/913] Unit test for bug #392. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtUiTools/CMakeLists.txt | 1 + tests/QtUiTools/bug_392.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/QtUiTools/bug_392.py diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt index 9ede81f..7cb8b6a 100644 --- a/tests/QtUiTools/CMakeLists.txt +++ b/tests/QtUiTools/CMakeLists.txt @@ -1,4 +1,5 @@ PYSIDE_TEST(bug_360.py) PYSIDE_TEST(bug_376.py) +PYSIDE_TEST(bug_392.py) PYSIDE_TEST(uiloader_test.py) PYSIDE_TEST(ui_test.py) diff --git a/tests/QtUiTools/bug_392.py b/tests/QtUiTools/bug_392.py new file mode 100644 index 0000000..ebda08c --- /dev/null +++ b/tests/QtUiTools/bug_392.py @@ -0,0 +1,19 @@ +import unittest +import os +from helper import UsesQApplication + +from PySide import QtCore, QtGui +from PySide.QtUiTools import QUiLoader + +class BugTest(UsesQApplication): + def testCase(self): + w = QtGui.QWidget() + loader = QUiLoader() + + filePath = os.path.join(os.path.dirname(__file__), 'action.ui') + result = loader.load(filePath, w) + self.assertEqual(type(result.statusbar.actionFoo), QtGui.QAction) + +if __name__ == '__main__': + unittest.main() + From 7633675d1154eda8d799aa340c5513baa34621b9 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 30 Sep 2010 15:36:20 -0300 Subject: [PATCH 062/913] Support any QObject in QUiLoader.load function. Fix bug #392. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtUiTools/glue/uitools_loadui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtUiTools/glue/uitools_loadui.h b/PySide/QtUiTools/glue/uitools_loadui.h index da851c1..bce1367 100644 --- a/PySide/QtUiTools/glue/uitools_loadui.h +++ b/PySide/QtUiTools/glue/uitools_loadui.h @@ -7,7 +7,7 @@ #include static void -_populate_parent(PyObject* pyParent, QWidget *parent) +_populate_parent(PyObject* pyParent, QObject *parent) { if (parent->children().isEmpty()) return; @@ -21,7 +21,7 @@ _populate_parent(PyObject* pyParent, QWidget *parent) PyObject_SetAttrString(pyParent, qPrintable(name), pyChild); Shiboken::setParent(pyParent, pyChild); - _populate_parent(pyChild, qobject_cast(child)); + _populate_parent(pyChild, qobject_cast(child)); } } } From 288a53369fa8df74a92c7517e8744c5139797c78 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Fri, 1 Oct 2010 13:23:04 -0300 Subject: [PATCH 063/913] Removing deprecated and duplicated test Reviewer: Hugo Lima --- tests/signals/CMakeLists.txt | 1 - tests/signals/segfault_proxyparent_test.py | 14 ----- tests/signals/upstream_segfault_test.py | 64 ---------------------- 3 files changed, 79 deletions(-) delete mode 100644 tests/signals/upstream_segfault_test.py diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt index eaa9a84..9aafe75 100644 --- a/tests/signals/CMakeLists.txt +++ b/tests/signals/CMakeLists.txt @@ -34,4 +34,3 @@ PYSIDE_TEST(signal_signature_test.py) PYSIDE_TEST(signal_with_primitive_type_test.py) PYSIDE_TEST(slot_reference_count_test.py) PYSIDE_TEST(static_metaobject_test.py) -PYSIDE_TEST(upstream_segfault_test.py) diff --git a/tests/signals/segfault_proxyparent_test.py b/tests/signals/segfault_proxyparent_test.py index 2b41f67..791e19c 100644 --- a/tests/signals/segfault_proxyparent_test.py +++ b/tests/signals/segfault_proxyparent_test.py @@ -54,20 +54,6 @@ class SegfaultCase(unittest.TestCase): self.assert_(self.called) - def testSameReference(self): - """Example of how sip(?) reuses memory positions""" - obj = Dummy() - s1 = str(obj) - del obj - obj = Dummy() - s2 = str(obj) - self.assertEqual(s1, s2) - - obj2 = Dummy() - s3 = str(obj2) - self.assertNotEqual(s2, s3) - - if __name__ == '__main__': unittest.main() diff --git a/tests/signals/upstream_segfault_test.py b/tests/signals/upstream_segfault_test.py deleted file mode 100644 index 793b04b..0000000 --- a/tests/signals/upstream_segfault_test.py +++ /dev/null @@ -1,64 +0,0 @@ - -import unittest - -from PySide.QtCore import QObject, SIGNAL, SLOT - -# Upstream version of segfault_test - -class Dummy(QObject): - def __init__(self, parent=None): - QObject.__init__(self, parent) - -class Joe(QObject): - def __init__(self, parent=None): - QObject.__init__(self, parent) - -class SegfaultCase(unittest.TestCase): - """Test case for the segfault happening when parent() is called inside - ProxyObject""" - - def setUp(self): - self.called = False - - def tearDown(self): - try: - del self.args - except: - pass - - def callback(self, *args): - if tuple(self.args) == args: - self.called = True - - def testSegfault(self): - obj = Dummy() - QObject.connect(obj, SIGNAL('bar(int)'), self.callback) - self.args = (33,) - obj.emit(SIGNAL('bar(int)'), self.args[0]) - self.assert_(self.called) - - del obj - obj = Joe() - QObject.connect(obj, SIGNAL('bar(int)'), self.callback) - self.args = (33,) - obj.emit(SIGNAL('bar(int)'), self.args[0]) - self.assert_(self.called) - - - def testSameReference(self): - """Example of how sip reuses an already used PyObject""" - obj = Dummy() - s1 = str(obj) - del obj - obj = Dummy() - s2 = str(obj) - self.assertEqual(s1, s2) - - obj2 = Dummy() - s3 = str(obj2) - self.assertNotEqual(s2, s3) - - -if __name__ == '__main__': - unittest.main() - From 940b90e80a7ec21e513ac16ff73d8fa8cf23d489 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 1 Oct 2010 19:00:36 -0300 Subject: [PATCH 064/913] Implement python conversion to QTime, QDate, QDateTime Fixes bug #371. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/qdate_conversions.h | 35 +++++++++++++++++++ PySide/QtCore/qdatetime_conversions.h | 41 ++++++++++++++++++++++ PySide/QtCore/qtime_conversions.h | 36 +++++++++++++++++++ PySide/QtCore/typesystem_core.xml | 20 +++++++++-- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/python_conversion.py | 50 +++++++++++++++++++++++++++ 6 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 PySide/QtCore/qdate_conversions.h create mode 100644 PySide/QtCore/qdatetime_conversions.h create mode 100644 PySide/QtCore/qtime_conversions.h create mode 100644 tests/QtCore/python_conversion.py diff --git a/PySide/QtCore/qdate_conversions.h b/PySide/QtCore/qdate_conversions.h new file mode 100644 index 0000000..e0f1dd9 --- /dev/null +++ b/PySide/QtCore/qdate_conversions.h @@ -0,0 +1,35 @@ +namespace Shiboken { +template <> +struct PythonConverter +{ + static bool isPythonConvertible(PyObject* pyObj) + { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + return pyObj && PyDate_Check(pyObj); + } + + static QDate* transformFromPython(PyObject* obj) + { + if (isPythonConvertible(obj)) { + int day = PyDateTime_GET_DAY(obj); + int month = PyDateTime_GET_MONTH(obj); + int year = PyDateTime_GET_YEAR(obj); + return new QDate(year, month, day); + } + return 0; + } + + static PyObject* transformToPython(QDate* d) + { + if (d) { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + return PyDate_FromDate(d->year(), d->month(), d->day()); + } + return 0; + } +}; +} diff --git a/PySide/QtCore/qdatetime_conversions.h b/PySide/QtCore/qdatetime_conversions.h new file mode 100644 index 0000000..a3cdf09 --- /dev/null +++ b/PySide/QtCore/qdatetime_conversions.h @@ -0,0 +1,41 @@ +namespace Shiboken { +template <> +struct PythonConverter +{ + static bool isPythonConvertible(PyObject* pyObj) + { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + return pyObj && PyDateTime_Check(pyObj); + } + + static QDateTime* transformFromPython(PyObject* obj) + { + if (isPythonConvertible(obj)) { + int day = PyDateTime_GET_DAY(obj); + int month = PyDateTime_GET_MONTH(obj); + int year = PyDateTime_GET_YEAR(obj); + int hour = PyDateTime_DATE_GET_HOUR(obj); + int min = PyDateTime_DATE_GET_MINUTE(obj); + int sec = PyDateTime_DATE_GET_SECOND(obj); + int msec = PyDateTime_DATE_GET_MICROSECOND(obj); + return new QDateTime(QDate(year, month, day), QTime(hour, min, sec, msec)); + } + return 0; + } + + static PyObject* transformToPython(QDateTime* d) + { + if (d) { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + QDate date = d->date(); + QTime time = d->time(); + return PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()); + } + return 0; + } +}; +} diff --git a/PySide/QtCore/qtime_conversions.h b/PySide/QtCore/qtime_conversions.h new file mode 100644 index 0000000..5e172fa --- /dev/null +++ b/PySide/QtCore/qtime_conversions.h @@ -0,0 +1,36 @@ +namespace Shiboken { +template <> +struct PythonConverter +{ + static bool isPythonConvertible(PyObject* pyObj) + { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + return pyObj && PyTime_Check(pyObj); + } + + static QTime* transformFromPython(PyObject* obj) + { + if (isPythonConvertible(obj)) { + int hour = PyDateTime_TIME_GET_HOUR(obj); + int min = PyDateTime_TIME_GET_MINUTE(obj); + int sec = PyDateTime_TIME_GET_SECOND(obj); + int msec = PyDateTime_TIME_GET_MICROSECOND(obj); + return new QTime(hour, min, sec, msec); + } + return 0; + } + + static PyObject* transformToPython(QTime* d) + { + if (d) { + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + return PyTime_FromTime(d->hour(), d->minute(), d->second(), d->msec()); + } + return 0; + } +}; +} diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 68bd04c..704e8d4 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -721,6 +721,10 @@ + + + + @@ -756,7 +760,14 @@ - + + + + + + + + @@ -818,7 +829,12 @@ - + + + + + + diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 210aa01..30f3ff6 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -6,6 +6,7 @@ PYSIDE_TEST(deletelater_test.py) PYSIDE_TEST(duck_punching_test.py) PYSIDE_TEST(hash_test.py) PYSIDE_TEST(missing_symbols_test.py) +PYSIDE_TEST(python_conversion.py) PYSIDE_TEST(qabs_test.py) PYSIDE_TEST(qabstractitemmodel_test.py) PYSIDE_TEST(qabstracttransition_test.py) diff --git a/tests/QtCore/python_conversion.py b/tests/QtCore/python_conversion.py new file mode 100644 index 0000000..43dfccf --- /dev/null +++ b/tests/QtCore/python_conversion.py @@ -0,0 +1,50 @@ +#!/usr/bin/python +'''Test cases for QLineF''' + +import unittest +import os +import datetime + +from PySide.QtCore import * + +class TestDateTimeConversions (unittest.TestCase): + def testQDate(self): + date = datetime.date(2010, 04, 23) + other = QDate(date) + self.assertEqual(date.year, other.year()) + self.assertEqual(date.month, other.month()) + self.assertEqual(date.day, other.day()) + + self.assertEqual(date, other.toPython()) + + def testQTime(self): + time = datetime.time(11, 14, 00, 01) + other = QTime(time) + self.assertEqual(time.hour, other.hour()) + self.assertEqual(time.minute, other.minute()) + self.assertEqual(time.second, other.second()) + self.assertEqual(time.microsecond, other.msec()) + + self.assertEqual(time, other.toPython()) + + def testQDateTime(self): + dateTime = datetime.datetime(2010, 04, 23, 11, 14, 00, 01) + other = QDateTime(dateTime) + + otherDate = other.date() + self.assertEqual(dateTime.year, otherDate.year()) + self.assertEqual(dateTime.month, otherDate.month()) + self.assertEqual(dateTime.day, otherDate.day()) + + otherTime = other.time() + self.assertEqual(dateTime.hour, otherTime.hour()) + self.assertEqual(dateTime.minute, otherTime.minute()) + self.assertEqual(dateTime.second, otherTime.second()) + self.assertEqual(dateTime.microsecond, otherTime.msec()) + + self.assertEqual(dateTime, other.toPython()) + + + +if __name__ == '__main__': + unittest.main() From 51cbe9d49e3a992f1d02dd97fe68e34fae6957ee Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 1 Oct 2010 19:43:53 -0300 Subject: [PATCH 065/913] Added missing file on QtUitools tests. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtUiTools/action.ui | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/QtUiTools/action.ui diff --git a/tests/QtUiTools/action.ui b/tests/QtUiTools/action.ui new file mode 100644 index 0000000..9eda559 --- /dev/null +++ b/tests/QtUiTools/action.ui @@ -0,0 +1,16 @@ + + main_window + + + + + + + foo + + + + + + + From 2f8381e71213a1ecaed3ceda9ed9cdd981b79893 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 4 Oct 2010 11:15:56 -0300 Subject: [PATCH 066/913] Implemented detection for VideoCaptureDevice on phonon module. Fixes bug #355. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/CMakeLists.txt | 27 ++++++++++++++++++++++++--- PySide/phonon/CMakeLists.txt | 5 ++++- PySide/phonon/typesystem_phonon.xml | 8 ++++++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 8a1f4d2..05191e3 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -47,19 +47,41 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul install(FILES ${typesystem_files} DESTINATION share/PySide${pyside_SUFFIX}/typesystems) endmacro() +#macro(check_qt_class_with_namespace module namespace class global_sources [namespace]) macro(check_qt_class module class global_sources) + if (${ARGC} GREATER 3) + set (namespace ${ARGV3}) + string(TOLOWER ${namespace} _namespace) + else () + set (namespace "") + endif () + if (${ARGC} GREATER 4) + set (include_file ${ARGV4}) + else () + set (include_file ${module}) + endif () string(TOLOWER ${class} _class) string(TOUPPER ${module} _module) - set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) + if (${namespace}) + set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp) + else () + set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) + endif () if (DEFINED PYSIDE_${class}) if (PYSIDE_${class}) list(APPEND ${global_sources} ${_cppfile}) endif() else() + if (NOT ${namespace} STREQUAL "" ) + set (NAMESPACE_USE "using namespace ${namespace};") + else () + set (NAMESPACE_USE "") + endif () set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx) file(WRITE ${SRC_FILE} - "#include <${module}>\n" + "#include <${include_file}>\n" "#include \n" + "${NAMESPACE_USE}\n" "int main() { typeid(${class}); }\n" ) try_compile(Q_WORKS ${CMAKE_BINARY_DIR} @@ -85,7 +107,6 @@ endmacro() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY) - # Only add subdirectory if the associated Qt module is found. macro(HAS_QT_MODULE var name) if (NOT DISABLE_${name} AND ${var}) diff --git a/PySide/phonon/CMakeLists.txt b/PySide/phonon/CMakeLists.txt index 5961a9e..198ed6e 100644 --- a/PySide/phonon/CMakeLists.txt +++ b/PySide/phonon/CMakeLists.txt @@ -3,7 +3,7 @@ project(phonon) # workaround for a cmake bug under MacOSX, it finds phonon but not the include path if (NOT QT_PHONON_INCLUDE_DIR AND CMAKE_HOST_APPLE) set(QT_PHONON_INCLUDE_DIR "${QT_LIBRARY_DIR}/phonon.framework/Headers") -endif() +endif () set(phonon_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_abstractaudiooutput_wrapper.cpp @@ -43,6 +43,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumeslider_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_backendcapabilities_notifierwrapper_wrapper.cpp ) + +check_qt_class("phonon" "VideoCaptureDevice" phonon_SRC "Phonon" "ObjectDescription") + set(phonon_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${phonon_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") set(phonon_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${QT_QTCORE_INCLUDE_DIR} diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index 4c700bc..ef05c26 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -158,8 +158,12 @@ - - + + + + + + From 73fea931819ee1f6a32c50c9d67a9c292e69d45a Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 4 Oct 2010 16:15:25 -0300 Subject: [PATCH 067/913] Fixed QApplication cleanup. Fixes bug #396. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtGui/glue/qapplication_init.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index be90d10..d082b99 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -11,18 +11,18 @@ void DeleteQApplicationAtExit() QCoreApplication* cpp = QApplication::instance(); if (cpp) { Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance(); - cpp->flush(); // Delete all widgets, this is slow but is necessary to avoid problems with python object foreach(QWidget* w, QApplication::allWidgets()) { - w->deleteLater(); - //Make sure all events will send before invalidated the python object - QApplication::processEvents(); - bmngr.destroyWrapper(w); + PyObject* wrapper = bmngr.retrieveWrapper(w); + if (wrapper) { + if (SbkBaseWrapper_hasOwnership(wrapper)) + delete w; // destroy C++ object and invalidate wrapper object + else + bmngr.destroyWrapper(wrapper); // only invalidate wrapper object + } } - - cpp->processEvents(); - bmngr.destroyWrapper(cpp); + cpp->flush(); delete cpp; } } From 7f4e85f6501aa58623244303cdaf6e129c02af4d Mon Sep 17 00:00:00 2001 From: renatofilho Date: Mon, 4 Oct 2010 16:16:20 -0300 Subject: [PATCH 068/913] Fixed QWidget setLayout rules. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtGui/glue/qwidget_glue.h | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h index 9488522..6be6518 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.h @@ -17,11 +17,13 @@ qwidgetReparentLayout(QWidget *parent, QLayout *layout) { QLayoutItem *item = layout->itemAt(i); QWidget *w = item->widget(); - if (w) { - Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(w)); - Shiboken::setParent(pyParent, pyChild); + QWidget* pw = w->parentWidget(); + if (pw != parent) { + Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(w)); + Shiboken::setParent(pyParent, pyChild); + } } else { @@ -33,7 +35,6 @@ qwidgetReparentLayout(QWidget *parent, QLayout *layout) Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(layout)); Shiboken::setParent(pyParent, pyChild); - //remove previous references Shiboken::keepReference(reinterpret_cast(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None); } @@ -41,9 +42,24 @@ qwidgetReparentLayout(QWidget *parent, QLayout *layout) static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) { - if (self->layout()) + if (!layout || self->layout()) return; - qwidgetReparentLayout(self, layout); - self->setLayout(layout); + QObject* oldParent = layout->parent(); + if (oldParent && oldParent != self) { + if (oldParent->isWidgetType()) { + // remove old parent policy + Shiboken::AutoDecRef pyLayout(Shiboken::Converter::toPython(layout)); + Shiboken::setParent(Py_None, pyLayout); + } else { + PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent", + qPrintable(layout->objectName()), self->metaObject()->className(), qPrintable(self->objectName())); + return; + } + } + + if (oldParent != self) { + qwidgetReparentLayout(self, layout); + self->setLayout(layout); + } } From 4adb686fc15dc3dfdb872157df27b534f1ca7f98 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Tue, 5 Oct 2010 12:07:08 -0300 Subject: [PATCH 069/913] Extend QUiLoader test to test ui files with custom widgets. --- tests/QtUiTools/bug_392.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/QtUiTools/bug_392.py b/tests/QtUiTools/bug_392.py index ebda08c..5717d45 100644 --- a/tests/QtUiTools/bug_392.py +++ b/tests/QtUiTools/bug_392.py @@ -2,7 +2,7 @@ import unittest import os from helper import UsesQApplication -from PySide import QtCore, QtGui +from PySide import QtCore, QtGui, QtDeclarative from PySide.QtUiTools import QUiLoader class BugTest(UsesQApplication): @@ -14,6 +14,16 @@ class BugTest(UsesQApplication): result = loader.load(filePath, w) self.assertEqual(type(result.statusbar.actionFoo), QtGui.QAction) + def testCustomWidgets(self): + w = QtGui.QWidget() + loader = QUiLoader() + + filePath = os.path.join(os.path.dirname(__file__), 'customwidget.ui') + result = loader.load(filePath, w) + self.assert_(type(result.declarativeView), QtDeclarative.QDeclarativeView) + self.assert_(type(result.worldTimeClock), QtGui.QWidget) + + if __name__ == '__main__': unittest.main() From 254d365d5c8017a63916bf524c69313cefdeccb2 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 4 Oct 2010 18:59:17 -0300 Subject: [PATCH 070/913] Use QByteArray instead of QString in some internal QLayout functions. As only latin1 chars are expected, we don't need waste memory with QString. --- PySide/QtGui/glue/qlayout_help_functions.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h index 9e07ff5..e62077a 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.h @@ -3,10 +3,10 @@ void addLayoutOwnership(QLayout *layout, QLayoutItem *item); -inline QString retrieveObjectName(PyObject *obj) +inline QByteArray retrieveObjectName(PyObject *obj) { Shiboken::AutoDecRef objName(PyObject_Str(obj)); - return QString(PyString_AsString(objName)); + return PyString_AsString(objName); } inline void addLayoutOwnership(QLayout *layout, QWidget *widget) @@ -18,7 +18,7 @@ inline void addLayoutOwnership(QLayout *layout, QWidget *widget) //keep the reference while the layout is orphan Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(layout)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(widget)); - Shiboken::keepReference(reinterpret_cast(pyParent.object()), qPrintable(retrieveObjectName(pyParent)), pyChild, true); + Shiboken::keepReference(reinterpret_cast(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); } else { Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(parent)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(widget)); @@ -34,7 +34,7 @@ inline void addLayoutOwnership(QLayout *layout, QLayout *other) //keep the reference while the layout is orphan Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(layout)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(other)); - Shiboken::keepReference(reinterpret_cast(pyParent.object()), qPrintable(retrieveObjectName(pyParent)), pyChild, true); + Shiboken::keepReference(reinterpret_cast(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); return; } From 4caa8e8ab32ffdad8d8c9c47b9bc2b52600fd5d5 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 4 Oct 2010 19:04:28 -0300 Subject: [PATCH 071/913] Sort typesystem according to their dependencies to avoid the inclusion of a typesystem with generate=no. --- doc/typesystem_doc.xml.in | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/typesystem_doc.xml.in b/doc/typesystem_doc.xml.in index eaf5178..9d87adc 100644 --- a/doc/typesystem_doc.xml.in +++ b/doc/typesystem_doc.xml.in @@ -23,9 +23,18 @@ - @if_QtDeclarative@ - - @end_QtDeclarative@ + + @if_QtNetwork@ + + @end_QtNetwork@ + + @if_QtXml@ + + @end_QtXml@ + + @if_QtScript@ + + @end_QtScript@ @if_QtGui@ @@ -43,18 +52,14 @@ @end_Multimedia@ - @if_QtNetwork@ - - @end_QtNetwork@ + @if_QtDeclarative@ + + @end_QtDeclarative@ @if_QtOpenGL@ @end_QtOpenGL@ - @if_QtScript@ - - @end_QtScript@ - @if_QtScriptTools@ @end_QtScriptTools@ @@ -79,9 +84,6 @@ @end_QtWebKit@ - @if_QtXml@ - - @end_QtXml@ @if_QtXmlPatterns@ From 5f21b20e722a41bd3d1d9bbf4c36f8f08aba4f63 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 4 Oct 2010 19:05:46 -0300 Subject: [PATCH 072/913] Generate documentation for phonon. --- doc/CMakeLists.txt | 4 ++-- doc/typesystem_doc.xml.in | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 7b29ca6..7f72f41 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -20,9 +20,9 @@ configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY) add_custom_target("docrsts" COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=qtdoc ${pyside_BINARY_DIR}/global.h - --include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${QT_QTCORE_INCLUDE_DIR}" + --include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}" --api-version=${SUPPORTED_QT_VERSION} - --typesystem-paths="${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR}${PATH_SEP}${QtDeclarative_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}${PATH_SEP}${QtHelp_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtMultimedia_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtOpenGL_SOURCE_DIR}${PATH_SEP}${QtScript_SOURCE_DIR}${PATH_SEP}${QtScriptTools_SOURCE_DIR}${PATH_SEP}${QtSql_SOURCE_DIR}${PATH_SEP}${QtSvg_SOURCE_DIR}${PATH_SEP}${QtTest_SOURCE_DIR}${PATH_SEP}${QtUiTools_SOURCE_DIR}${PATH_SEP}${QtWebKit_SOURCE_DIR}${PATH_SEP}${QtXml_SOURCE_DIR}${PATH_SEP}${QtXmlPatterns_SOURCE_DIR}" + --typesystem-paths="${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR}${PATH_SEP}${QtDeclarative_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}${PATH_SEP}${QtHelp_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtMultimedia_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtOpenGL_SOURCE_DIR}${PATH_SEP}${QtScript_SOURCE_DIR}${PATH_SEP}${QtScriptTools_SOURCE_DIR}${PATH_SEP}${QtSql_SOURCE_DIR}${PATH_SEP}${QtSvg_SOURCE_DIR}${PATH_SEP}${QtTest_SOURCE_DIR}${PATH_SEP}${QtUiTools_SOURCE_DIR}${PATH_SEP}${QtWebKit_SOURCE_DIR}${PATH_SEP}${QtXml_SOURCE_DIR}${PATH_SEP}${QtXmlPatterns_SOURCE_DIR}${PATH_SEP}${phonon_SOURCE_DIR}" --library-source-dir=${QT_SRC_DIR} --documentation-only --documentation-data-dir=${DOC_DATA_DIR} diff --git a/doc/typesystem_doc.xml.in b/doc/typesystem_doc.xml.in index 9d87adc..2ed2068 100644 --- a/doc/typesystem_doc.xml.in +++ b/doc/typesystem_doc.xml.in @@ -88,4 +88,8 @@ @if_QtXmlPatterns@ @end_QtXmlPatterns@ - \ No newline at end of file + + @if_phonon@ + + @end_phonon@ + From ebe20bd63fa677804a520df6ce1a2fd64a9401ad Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 4 Oct 2010 19:08:29 -0300 Subject: [PATCH 073/913] Add unit test for bug#172 --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_172.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/QtGui/bug_172.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index f260321..350948b 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -1,6 +1,7 @@ #Keep this in alphabetical sort PYSIDE_TEST(api2_test.py) +PYSIDE_TEST(bug_172.py) PYSIDE_TEST(bug_243.py) PYSIDE_TEST(bug_300_test.py) PYSIDE_TEST(bug_307.py) diff --git a/tests/QtGui/bug_172.py b/tests/QtGui/bug_172.py new file mode 100644 index 0000000..d14c94c --- /dev/null +++ b/tests/QtGui/bug_172.py @@ -0,0 +1,13 @@ +from PySide.QtGui import * + +if __name__ == '__main__': + app = QApplication([]) + + wdg = QWidget() + + hbox = QHBoxLayout() + + vbox = QVBoxLayout() + vbox.addLayout(hbox) + + wdg.setLayout(vbox) From 79f837715f1a3bb91ed728e62eb27a5b0887b215 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 5 Oct 2010 11:48:44 -0300 Subject: [PATCH 074/913] Removed whitespaces. --- PySide/QtGui/typesystem_gui_common.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index b490319..29b1657 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3250,13 +3250,13 @@ - Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(%PYSELF), "__style__", %PYARG_1); + Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(%PYSELF), "__style__", %PYARG_1); QStyle* myStyle = %CPPSELF->style(); - if (myStyle && qApp) { + if (myStyle && qApp) { %PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle); QStyle *appStyle = qApp->style(); if (appStyle == myStyle) { @@ -4966,7 +4966,7 @@ - + From bebede17c03c5f6180262a4031c53998142564ad Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 5 Oct 2010 11:49:13 -0300 Subject: [PATCH 075/913] Fixed doc of return values. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 7 +++-- PySide/QtGui/typesystem_gui_common.xml | 11 +++++--- PySide/QtNetwork/typesystem_network.xml | 6 ++--- PySide/QtOpenGL/typesystem_opengl.xml | 3 +++ PySide/QtWebKit/typesystem_webkit.xml | 3 +++ PySide/QtXml/typesystem_xml.xml | 36 ++++++++++++++++++++----- 6 files changed, 51 insertions(+), 15 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 704e8d4..37decba 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1867,6 +1867,9 @@ + + + qint64 pid; %RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &pid); @@ -2531,7 +2534,7 @@ - + %PYARG_0 = PySet_New(0); foreach(QAbstractState* abs_state, %CPPSELF.configuration()) { @@ -2542,7 +2545,7 @@ - + %PYARG_0 = PyList_New(0); foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) { diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 29b1657..68d5c0d 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1156,6 +1156,9 @@ + + + QGraphicsItem *item_ = NULL; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); @@ -3664,7 +3667,7 @@ - + @@ -3675,7 +3678,7 @@ - + @@ -3686,7 +3689,7 @@ - + @@ -3892,7 +3895,7 @@ - + %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 5e09ab7..0321a65 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -118,7 +118,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -170,7 +170,7 @@ - + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 2a7557e..b94e8af 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -136,6 +136,9 @@ + + + char *data = new char[%3]; bool result = %CPPSELF.read(%1, data, %3); diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index 1c39111..f11c6e3 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -76,6 +76,9 @@ + + + QString str; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, &str); diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index 4cccb8a..dac7b56 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -68,6 +68,9 @@ + + + @@ -85,6 +88,9 @@ + + + @@ -102,6 +108,9 @@ + + + @@ -119,6 +128,9 @@ + + + @@ -136,6 +148,9 @@ + + + @@ -153,6 +168,9 @@ + + + @@ -170,6 +188,9 @@ + + + @@ -187,6 +208,9 @@ + + + @@ -278,7 +302,7 @@ - + @@ -301,7 +325,7 @@ - + @@ -336,7 +360,7 @@ - + @@ -351,7 +375,7 @@ - + @@ -403,7 +427,7 @@ - + @@ -418,7 +442,7 @@ - + From 829ffd3dfd31eef3b98678adfcba1609445305b3 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 5 Oct 2010 16:42:40 -0300 Subject: [PATCH 076/913] Revert "Fixed doc of return values." This reverts commit bebede17c03c5f6180262a4031c53998142564ad. --- PySide/QtCore/typesystem_core.xml | 7 ++--- PySide/QtGui/typesystem_gui_common.xml | 11 +++----- PySide/QtNetwork/typesystem_network.xml | 6 ++--- PySide/QtOpenGL/typesystem_opengl.xml | 3 --- PySide/QtWebKit/typesystem_webkit.xml | 3 --- PySide/QtXml/typesystem_xml.xml | 36 +++++-------------------- 6 files changed, 15 insertions(+), 51 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 37decba..704e8d4 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1867,9 +1867,6 @@ - - - qint64 pid; %RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &pid); @@ -2534,7 +2531,7 @@ - + %PYARG_0 = PySet_New(0); foreach(QAbstractState* abs_state, %CPPSELF.configuration()) { @@ -2545,7 +2542,7 @@ - + %PYARG_0 = PyList_New(0); foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) { diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 68d5c0d..29b1657 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1156,9 +1156,6 @@ - - - QGraphicsItem *item_ = NULL; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); @@ -3667,7 +3664,7 @@ - + @@ -3678,7 +3675,7 @@ - + @@ -3689,7 +3686,7 @@ - + @@ -3895,7 +3892,7 @@ - + %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 0321a65..5e09ab7 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -118,7 +118,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -170,7 +170,7 @@ - + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index b94e8af..2a7557e 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -136,9 +136,6 @@ - - - char *data = new char[%3]; bool result = %CPPSELF.read(%1, data, %3); diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index f11c6e3..1c39111 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -76,9 +76,6 @@ - - - QString str; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, &str); diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index dac7b56..4cccb8a 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -68,9 +68,6 @@ - - - @@ -88,9 +85,6 @@ - - - @@ -108,9 +102,6 @@ - - - @@ -128,9 +119,6 @@ - - - @@ -148,9 +136,6 @@ - - - @@ -168,9 +153,6 @@ - - - @@ -188,9 +170,6 @@ - - - @@ -208,9 +187,6 @@ - - - @@ -302,7 +278,7 @@ - + @@ -325,7 +301,7 @@ - + @@ -360,7 +336,7 @@ - + @@ -375,7 +351,7 @@ - + @@ -427,7 +403,7 @@ - + @@ -442,7 +418,7 @@ - + From 1508831725b74ce7962a1dba79848cad8e87258f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 5 Oct 2010 14:55:20 -0300 Subject: [PATCH 077/913] Fixed some code snippets used in the PySide docs. --- .../dialogs/classwizard/classwizard.cpp | 28 +++++++++---------- .../examples/dialogs/extension/finddialog.cpp | 8 +++--- .../dialogs/licensewizard/licensewizard.cpp | 2 +- .../dialogs/standarddialogs/dialog.cpp | 4 +-- .../dialogs/trivialwizard/trivialwizard.cpp | 2 +- .../sql/querymodel/editablesqlmodel.cpp | 4 +-- .../relationaltablemodel.cpp | 6 ++-- .../snippets/textdocument-resources/main.cpp | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp b/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp index 5814d5f..0d5c221 100644 --- a/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp +++ b/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp @@ -60,14 +60,14 @@ def __init__(self, parent): //! [3] def accept(self): //! [3] //! [4] - className = self.field("className").toByteArray() - baseClass = self.field("baseClass").toByteArray() - macroName = self.field("macroName").toByteArray() - baseInclude = self.field("baseInclude").toByteArray() + className = self.field("className") + baseClass = self.field("baseClass") + macroName = self.field("macroName") + baseInclude = self.field("baseInclude") - outputDir = self.field("outputDir").toString() - header = self.field("header").toString() - implementation = self.field("implementation").toString() + outputDir = self.field("outputDir") + header = self.field("header") + implementation = self.field("implementation") //! [4] ... @@ -223,17 +223,17 @@ class CodeStylePage(QWizardPage): //! [16] def initializePage(self): - className = self.field("className").toString() + className = self.field("className") self.macroNameLineEdit.setText(className.toUpper() + "_H") - baseClass = self.field("baseClass").toString() + baseClass = self.field("baseClass") - self.includeBaseCheckBox.setChecked(not baseClass.isEmpty()) - self.includeBaseCheckBox.setEnabled(not baseClass.isEmpty()) - self.baseIncludeLabel.setEnabled(not baseClass.isEmpty()) - self.baseIncludeLineEdit.setEnabled(not baseClass.isEmpty()) + self.includeBaseCheckBox.setChecked(len(baseClass)) + self.includeBaseCheckBox.setEnabled(len(baseClass)) + self.baseIncludeLabel.setEnabled(len(baseClass)) + self.baseIncludeLineEdit.setEnabled(len(baseClass)) - if baseClass.isEmpty(): + if not baseClass: self.baseIncludeLineEdit.clear() elsif QRegExp("Q[A-Z].*").exactMatch(baseClass): baseIncludeLineEdit.setText("<" + baseClass + ">") diff --git a/doc/codesnippets/examples/dialogs/extension/finddialog.cpp b/doc/codesnippets/examples/dialogs/extension/finddialog.cpp index 3ccf847..d557b06 100644 --- a/doc/codesnippets/examples/dialogs/extension/finddialog.cpp +++ b/doc/codesnippets/examples/dialogs/extension/finddialog.cpp @@ -78,7 +78,7 @@ def __init__(self, parent): //! [3] connect(moreButton, SIGNAL("toggled(bool)"), extension, SLOT("setVisible(bool)")) - QVBoxLayout *extensionLayout = QVBoxLayout + extensionLayout = QVBoxLayout() extensionLayout.setMargin(0) extensionLayout.addWidget(wholeWordsCheckBox) extensionLayout.addWidget(backwardCheckBox) @@ -87,17 +87,17 @@ def __init__(self, parent): //! [3] //! [4] - topLeftLayout = QHBoxLayout + topLeftLayout = QHBoxLayout() topLeftLayout.addWidget(label) topLeftLayout.addWidget(lineEdit) - leftLayout = QVBoxLayout + leftLayout = QVBoxLayout() leftLayout.addLayout(topLeftLayout) leftLayout.addWidget(caseCheckBox) leftLayout.addWidget(fromStartCheckBox) leftLayout.addSself.tretch(1) - mainLayout = QGridLayout + mainLayout = QGridLayout() mainLayout.setSizeConsself.traint(QLayout.SetFixedSize) mainLayout.addLayout(leftLayout, 0, 0) mainLayout.addWidget(buttonBox, 0, 1) diff --git a/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp b/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp index 5229acd..731bdd1 100644 --- a/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp +++ b/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp @@ -83,7 +83,7 @@ void LicenseWizard::showHelp() { static QString lastHelpMessage; - QString message; + message = "" switch (currentId()) { case Page_Intro: diff --git a/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp b/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp index bf196ed..be048d6 100644 --- a/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp +++ b/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp @@ -63,9 +63,9 @@ //! [2] //! [3] - QString text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"), + text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"), self.tr("User name:"), QLineEdit.Normal, QDir().home().dirName(), ok) - if ok and not text.isEmpty(): + if ok and text: textLabel.setText(text) //! [3] diff --git a/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp b/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp index bcae8c8..cc59b36 100644 --- a/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp +++ b/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp @@ -113,7 +113,7 @@ def createConclusionPage(self): def main(): app = QApplication(sys.argv) - translatorFileName = QLatin1String("qt_") + translatorFileName = "qt_" translatorFileName += QLocale.system().name() translator = QTranslator(app) if translator.load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)): diff --git a/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp b/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp index b1d14de..743df78 100644 --- a/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp +++ b/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp @@ -68,9 +68,9 @@ def setData(self, index, value, role): ok = False if index.column() == 1: - ok = self.setFirstName(id, value.toString()) + ok = self.setFirstName(id, value) else: - ok = self.setLastName(id, value.toString()) + ok = self.setLastName(id, value) self.refresh() return ok } diff --git a/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp index 93c5209..b59646d 100644 --- a/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp +++ b/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp @@ -100,11 +100,11 @@ def main(): createRelationalTables() - QSqlRelationalTableModel model + model = QSqlRelationalTableModel() - initializeModel(&model) + initializeModel(model) - view = createView(QObject.tr("Relational Table Model"), &model) + view = createView(QObject.tr("Relational Table Model"), model) view.show() return app.exec_() diff --git a/doc/codesnippets/snippets/textdocument-resources/main.cpp b/doc/codesnippets/snippets/textdocument-resources/main.cpp index e8f010a..86da5e2 100644 --- a/doc/codesnippets/snippets/textdocument-resources/main.cpp +++ b/doc/codesnippets/snippets/textdocument-resources/main.cpp @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) //! [Adding a resource] document.addResource(QTextDocument.ImageResource, - QUrl("mydata://image.png"), QVariant(image)) + QUrl("mydata://image.png"), image) //! [Adding a resource] //! [Inserting an image with a cursor] From ec252fae3f8c231cac63711b9e7522aaa6a53a79 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 11:37:15 -0300 Subject: [PATCH 078/913] Update pyside.qdocconf.in removing useless entries. --- doc/pyside.qdocconf.in | 101 +++++------------------------------------ 1 file changed, 12 insertions(+), 89 deletions(-) diff --git a/doc/pyside.qdocconf.in b/doc/pyside.qdocconf.in index a9b0223..76f4680 100644 --- a/doc/pyside.qdocconf.in +++ b/doc/pyside.qdocconf.in @@ -52,6 +52,8 @@ macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" +macro.QQV = "\\e{Qt QML Viewer}" +macro.qmlbasictype = "\\e" macro.param = "\\e" macro.raisedaster.HTML = "*" macro.rarrow.HTML = "→" @@ -161,34 +163,10 @@ Cpp.ignoredirectives = Q_DECLARE_HANDLE \ __attribute__ \ K_DECLARE_PRIVATE \ PHONON_OBJECT \ - PHONON_HEIR - -######################## qt-html-templates.qdocconf -HTML.stylesheets = classic.css -HTML.postheader = "\n" \ - "\n" \ - "\n" \ - "" \ - "" \ - "
" \ - "" \ - "  " \ - "" \ - "Home ·" \ - " " \ - "All Classes ·" \ - " " \ - "All Functions ·" \ - " " \ - "Overviews" \ - "
" - -HTML.footer = "


\n" \ - "\n" \ - "\n" \ - "\n" \ - "\n" \ - "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt \\version
" + PHONON_HEIR \ + Q_PRIVATE_PROPERTY \ + Q_DECLARE_PRIVATE_D \ + Q_CLASSINFO ######################## qt-defines.qdocconf defines = Q_QDOC \ @@ -208,61 +186,13 @@ versionsym = QT_VERSION_STR codeindent = 1 -# Files not referenced in any qdoc file (last four needed by qtdemo) -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png \ - stylesheet-coffee-plastique.png - ######################## qt.qdocconf project = Qt versionsym = -version = %VERSION% +version = @PYSIDE_QT_VERSION@ description = Qt Reference Documentation -url = http://qt.nokia.com/doc/@PYSIDE_QT_VERSION@ - -edition.Desktop.modules = QtCore QtDBus QtGui QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg \ - QtWebKit QtXml QtXmlPatterns Qt3Support QtHelp \ - QtDesigner QtAssistant QAxContainer Phonon \ - QAxServer QtUiTools QtTest QtDBus -edition.DesktopLight.modules = QtCore QtDBus QtGui Qt3SupportLight QtTest -edition.DesktopLight.groups = -graphicsview-api - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.460 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = classic.css \ - images/qt-logo.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - images/stylesheet-coffee-plastique.png - -qhp.Qt.filterAttributes = qt @PYSIDE_QT_VERSION@ qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt @PYSIDE_QT_VERSION@ -qhp.Qt.customFilters.Qt.filterAttributes = qt @PYSIDE_QT_VERSION@ -qhp.Qt.subprojects = classes overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example +url = http://www.pyside.org/docs/pyside-@PYSIDE_QT_VERSION@ language = Cpp @@ -306,26 +236,19 @@ excludedirs = @QT_SRC_DIR@/src/3rdparty/clucene \ @QT_SRC_DIR@/src/3rdparty/webkit/WebCore \ @QT_SRC_DIR@/src/3rdparty/wintab \ @QT_SRC_DIR@/src/3rdparty/zlib \ - @QT_SRC_DIR@/doc/src/snippets \ @QT_SRC_DIR@/src/3rdparty/phonon/gstreamer \ @QT_SRC_DIR@/src/3rdparty/phonon/ds9 \ @QT_SRC_DIR@/src/3rdparty/phonon/qt7 \ @QT_SRC_DIR@/src/3rdparty/phonon/mmf \ - @QT_SRC_DIR@/src/3rdparty/phonon/waveout + @QT_SRC_DIR@/src/3rdparty/phonon/waveout \ + @QT_SRC_DIR@/doc/src/snippets \ + @QT_SRC_DIR@/doc/src/ja_JP \ + @QT_SRC_DIR@/doc/src/zh_CN sources.fileextensions = "*.cpp *.qdoc *.mm" examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" examples.imageextensions = "*.png" -exampledirs = @QT_SRC_DIR@/doc/src \ - @QT_SRC_DIR@/examples \ - @QT_SRC_DIR@/examples/tutorials \ - @QT_SRC_DIR@ \ - @QT_SRC_DIR@/qmake/examples \ - @QT_SRC_DIR@/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = @QT_SRC_DIR@/doc/src/images \ - @QT_SRC_DIR@/examples -outputdir = @QT_SRC_DIR@/doc/html tagfile = @QT_SRC_DIR@/doc/html/qt.tags base = file:@QT_SRC_DIR@/doc/html From 673c0d26757526a068e758195d235c047150d789 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 11:40:42 -0300 Subject: [PATCH 079/913] Added documentation to QPyTextObject class. --- PySide/qpytextobject.cpp | 33 +++++++++++++++++++++++++++++++++ doc/pyside.qdocconf.in | 6 ++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 PySide/qpytextobject.cpp diff --git a/PySide/qpytextobject.cpp b/PySide/qpytextobject.cpp new file mode 100644 index 0000000..90462f5 --- /dev/null +++ b/PySide/qpytextobject.cpp @@ -0,0 +1,33 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "qpytextobject.h" + +/*! + \class QPyTextObject + \brief Workaround to make possible use QTextObjectInterface on PySide. + \ingroup richtext-processing + Due to the technical details of how to bind C++ classes to Python, you need to use this class when you need to implement + your own QTextObjectInterface rather than create a class inheriting from QObject and QTextObjectInterface. + + \sa QTextObjectInterface +*/ diff --git a/doc/pyside.qdocconf.in b/doc/pyside.qdocconf.in index 76f4680..1c8d0e3 100644 --- a/doc/pyside.qdocconf.in +++ b/doc/pyside.qdocconf.in @@ -205,7 +205,8 @@ headerdirs = @QT_SRC_DIR@/src \ @QT_SRC_DIR@/tools/designer/src/lib/sdk \ @QT_SRC_DIR@/tools/designer/src/lib/uilib \ @QT_SRC_DIR@/tools/qtestlib/src \ - @QT_SRC_DIR@/tools/qdbus/src + @QT_SRC_DIR@/tools/qdbus/src \ + @pyside_SOURCE_DIR@ sourcedirs = @QT_SRC_DIR@/src \ @QT_SRC_DIR@/doc/src \ @QT_SRC_DIR@/extensions/activeqt \ @@ -216,7 +217,8 @@ sourcedirs = @QT_SRC_DIR@/src \ @QT_SRC_DIR@/tools/designer/src/lib/sdk \ @QT_SRC_DIR@/tools/designer/src/lib/uilib \ @QT_SRC_DIR@/tools/qtestlib/src \ - @QT_SRC_DIR@/tools/qdbus + @QT_SRC_DIR@/tools/qdbus \ + @pyside_SOURCE_DIR@ excludedirs = @QT_SRC_DIR@/src/3rdparty/clucene \ @QT_SRC_DIR@/src/3rdparty/des \ From 6b8d262b4067bffd4e5a9611c07b862aa64d2538 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 14:48:25 -0300 Subject: [PATCH 080/913] Workaround to change the documentation about the return value of some functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 7 +++++-- PySide/QtGui/typesystem_gui_common.xml | 11 +++++++---- PySide/QtNetwork/typesystem_network.xml | 6 +++--- PySide/QtOpenGL/typesystem_opengl.xml | 3 +++ PySide/QtWebKit/typesystem_webkit.xml | 3 +++ PySide/QtXml/typesystem_xml.xml | 24 ++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 704e8d4..37decba 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1867,6 +1867,9 @@ + + + qint64 pid; %RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &pid); @@ -2531,7 +2534,7 @@ - + %PYARG_0 = PySet_New(0); foreach(QAbstractState* abs_state, %CPPSELF.configuration()) { @@ -2542,7 +2545,7 @@ - + %PYARG_0 = PyList_New(0); foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) { diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 29b1657..68d5c0d 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1156,6 +1156,9 @@ + + + QGraphicsItem *item_ = NULL; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_); @@ -3664,7 +3667,7 @@ - + @@ -3675,7 +3678,7 @@ - + @@ -3686,7 +3689,7 @@ - + @@ -3892,7 +3895,7 @@
- + %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2); diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 5e09ab7..0321a65 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -118,7 +118,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -170,7 +170,7 @@ - + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 2a7557e..b94e8af 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -136,6 +136,9 @@ + + + char *data = new char[%3]; bool result = %CPPSELF.read(%1, data, %3); diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index 1c39111..f11c6e3 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -76,6 +76,9 @@ + + + QString str; %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, &str); diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index 4cccb8a..f5d6f2c 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -68,6 +68,9 @@ + + + @@ -85,6 +88,9 @@ + + + @@ -102,6 +108,9 @@ + + + @@ -119,6 +128,9 @@ + + + @@ -136,6 +148,9 @@ + + + @@ -153,6 +168,9 @@ + + + @@ -170,6 +188,9 @@ + + + @@ -187,6 +208,9 @@ + + + From 15b0e9aa2b16109aa293ab446a8edc533af56658 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 14:49:12 -0300 Subject: [PATCH 081/913] Add a d-pointer to DynamicMetaObject. This break the ABI. --- libpyside/dynamicqmetaobject.cpp | 111 ++++++++++++++++++------------- libpyside/dynamicqmetaobject.h | 54 ++------------- libpyside/dynamicqmetaobject_p.h | 69 +++++++++++++++++++ libpyside/qproperty.cpp | 2 +- libpyside/qslot.cpp | 2 +- 5 files changed, 138 insertions(+), 100 deletions(-) create mode 100644 libpyside/dynamicqmetaobject_p.h diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 6c7710f..f8902c6 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -21,10 +21,12 @@ */ #include "dynamicqmetaobject.h" +#include "dynamicqmetaobject_p.h" #include #include #include #include +#include #include #include #include @@ -66,6 +68,18 @@ enum PropertyFlags { Notify = 0x00400000 }; +class DynamicQMetaObject::DynamicQMetaObjectPrivate +{ +public: + QLinkedList m_signals; + QLinkedList m_slots; + QLinkedList m_properties; + QByteArray m_className; + + void updateMetaObject(QMetaObject* metaObj); + void writeMethodsData(QLinkedList& methods, unsigned int** data, QList* strings, int* prtIndex, int maxCount, int nullIndex, int flags); +}; + static int registerString(const QByteArray& s, QList* strings) { int idx = 0; @@ -266,76 +280,77 @@ bool PropertyData::operator==(const char* name) const } -DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject) +DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject) : m_d(new DynamicQMetaObjectPrivate) { d.superdata = metaObject; d.stringdata = 0; d.data = 0; d.extradata = 0; - m_className = QByteArray(className); - updateMetaObject(); + m_d->m_className = QByteArray(className); + m_d->updateMetaObject(this); } DynamicQMetaObject::~DynamicQMetaObject() { delete[] d.stringdata; delete[] d.data; + delete m_d; } void DynamicQMetaObject::addSignal(const char* signal, const char* type) { - QLinkedList::iterator i = qFind(m_signals.begin(), m_signals.end(), signal); - if (i != m_signals.end()) + QLinkedList::iterator i = qFind(m_d->m_signals.begin(), m_d->m_signals.end(), signal); + if (i != m_d->m_signals.end()) return; //search for a empty space MethodData blank; - i = qFind(m_signals.begin(), m_signals.end(), blank); - if (i != m_signals.end()) { + i = qFind(m_d->m_signals.begin(), m_d->m_signals.end(), blank); + if (i != m_d->m_signals.end()) { *i = MethodData(signal, type); - updateMetaObject(); + m_d->updateMetaObject(this); return; } - int maxSignals = maxSignalsCount(m_className); - if (m_signals.size() >= maxSignals) { + int maxSignals = maxSignalsCount(m_d->m_className); + if (m_d->m_signals.size() >= maxSignals) { qWarning() << "Fail to add dynamic signal to QObject. PySide support at most" << maxSignals << "dynamic signals."; return; } - m_signals << MethodData(signal, type); - updateMetaObject(); + m_d->m_signals << MethodData(signal, type); + m_d->updateMetaObject(this); } void DynamicQMetaObject::addSlot(const char* slot, const char* type) { - QLinkedList::iterator i = qFind(m_slots.begin(), m_slots.end(), slot); - if (i != m_slots.end()) + QLinkedList::iterator i = qFind(m_d->m_slots.begin(), m_d->m_slots.end(), slot); + if (i != m_d->m_slots.end()) return; - int maxSlots = maxSlotsCount(m_className); - if (m_slots.size() >= maxSlots) { + int maxSlots = maxSlotsCount(m_d->m_className); + if (m_d->m_slots.size() >= maxSlots) { qWarning() << "Fail to add dynamic slot to QObject. PySide support at most" << maxSlots << "dynamic slots."; return; } //search for a empty space MethodData blank; - i = qFind(m_slots.begin(), m_slots.end(), blank); - if (i != m_slots.end()) + i = qFind(m_d->m_slots.begin(), m_d->m_slots.end(), blank); + if (i != m_d->m_slots.end()) *i = MethodData(slot, type); else - m_slots << MethodData(slot, type); - updateMetaObject(); + m_d->m_slots << MethodData(slot, type); + m_d->updateMetaObject(this); } void DynamicQMetaObject::removeSlot(uint index) { QMetaMethod m = method(index); - foreach(MethodData md, m_slots) { + foreach(MethodData md, m_d->m_slots) { if (md.signature() == m.signature()) { md.clear(); - updateMetaObject(); + m_d->updateMetaObject(this); break; } } @@ -343,19 +358,19 @@ void DynamicQMetaObject::removeSlot(uint index) void DynamicQMetaObject::addProperty(const char* property, PyObject* data) { - QLinkedList::iterator i = qFind(m_properties.begin(), m_properties.end(), property); - if (i != m_properties.end()) + QLinkedList::iterator i = qFind(m_d->m_properties.begin(), m_d->m_properties.end(), property); + if (i != m_d->m_properties.end()) return; //search for a empty space PropertyData blank; - i = qFind(m_properties.begin(), m_properties.end(), blank); - if (i != m_properties.end()) { + i = qFind(m_d->m_properties.begin(), m_d->m_properties.end(), blank); + if (i != m_d->m_properties.end()) { *i = PropertyData(property, data); } else { - m_properties << PropertyData(property, data); + m_d->m_properties << PropertyData(property, data); } - updateMetaObject(); + m_d->updateMetaObject(this); } @@ -412,46 +427,46 @@ void DynamicQMetaObject::removeSignal(uint index) { //Current Qt implementation does not support runtime remove signal QMetaMethod m = method(index); - foreach(MethodData md, m_signals) { + foreach(MethodData md, m_d->m_signals) { if (md.signature() == m.signature()) { md.clear(); - updateMetaObject(); + m_d->updateMetaObject(this); break; } } } -void DynamicQMetaObject::writeMethodsData(QLinkedList& methods, - unsigned int **data, - QList *strings, - int *prtIndex, - int max_count, - int null_index, - int flags) +void DynamicQMetaObject::DynamicQMetaObjectPrivate::writeMethodsData(QLinkedList& methods, + unsigned int** data, + QList* strings, + int* prtIndex, + int maxCount, + int nullIndex, + int flags) { int index = *prtIndex; QLinkedList::iterator iMethod = methods.begin(); - for(int i=0; i < max_count; i++) { + for(int i=0; i < maxCount; i++) { QByteArray mType; if (iMethod != methods.end() && ((*iMethod).signature().size() > 0) ) { (*data)[index++] = registerString((*iMethod).signature(), strings); // func name mType = (*iMethod).type(); } else { - (*data)[index++] = null_index; // func name + (*data)[index++] = nullIndex; // func name } - (*data)[index++] = null_index; // arguments - (*data)[index++] = (mType.size() > 0 ? registerString(mType, strings) : null_index); // normalized type - (*data)[index++] = null_index; // tags + (*data)[index++] = nullIndex; // arguments + (*data)[index++] = (mType.size() > 0 ? registerString(mType, strings) : nullIndex); // normalized type + (*data)[index++] = nullIndex; // tags (*data)[index++] = flags; - if (iMethod != methods.end()) + if (iMethod != methods.end()) iMethod++; } *prtIndex = index; } -void DynamicQMetaObject::updateMetaObject() +void DynamicQMetaObject::DynamicQMetaObjectPrivate::updateMetaObject(QMetaObject* metaObj) { // these values are from moc source code, generator.cpp:66 enum MethodFlags { @@ -485,7 +500,7 @@ void DynamicQMetaObject::updateMetaObject() const int HEADER_LENGHT = sizeof(header)/sizeof(int); header[5] = HEADER_LENGHT; // header size + 5 indexes per method + an ending zero - delete[] d.data; + delete[] metaObj->d.data; unsigned int* data; data = new unsigned int[HEADER_LENGHT + n_methods*5 + n_properties*3 + 1]; std::memcpy(data, header, sizeof(header)); @@ -524,9 +539,9 @@ void DynamicQMetaObject::updateMetaObject() str.append(char(0)); } - delete[] d.stringdata; + delete[] metaObj->d.stringdata; char* stringData = new char[str.count()]; std::copy(str.begin(), str.end(), stringData); - d.data = data; - d.stringdata = stringData; + metaObj->d.data = data; + metaObj->d.stringdata = stringData; } diff --git a/libpyside/dynamicqmetaobject.h b/libpyside/dynamicqmetaobject.h index 22387a6..b2f018e 100644 --- a/libpyside/dynamicqmetaobject.h +++ b/libpyside/dynamicqmetaobject.h @@ -26,59 +26,18 @@ #include "pysidemacros.h" #include #include -#include -#include -#include - -#define PYSIDE_SLOT_LIST_ATTR "_slots" - -class QObject; namespace PySide { -class MethodData -{ -public: - MethodData(){} - MethodData(const char* signature, const char* type); - void clear(); - bool isValid() const; - QByteArray signature() const; - QByteArray type() const; - bool operator==(const MethodData& other) const; - bool operator==(const char* other) const; - -private: - QSharedPointer m_signature; - QSharedPointer m_type; -}; - -class PropertyData -{ -public: - PropertyData(); - PropertyData(const char*name, PyObject *data); - QByteArray name() const; - QByteArray type() const; - uint flags() const; - bool isValid() const; - bool operator==(const PropertyData& other) const; - bool operator==(const char* name) const; - -private: - QByteArray m_name; - PyObject* m_data; -}; - class PYSIDE_API DynamicQMetaObject : public QMetaObject { public: DynamicQMetaObject(const char* className, const QMetaObject* metaObject); ~DynamicQMetaObject(); - void addSignal(const char* signal, const char* type=0); - void addSlot(const char* slot, const char* type=0); + void addSignal(const char* signal, const char* type = 0); + void addSlot(const char* slot, const char* type = 0); void addProperty(const char* property, PyObject* data); void removeSignal(uint idex); @@ -89,13 +48,8 @@ public: static DynamicQMetaObject* createBasedOn(PyObject* obj, PyTypeObject* type, const QMetaObject* base); private: - QLinkedList m_signals; - QLinkedList m_slots; - QLinkedList m_properties; - QByteArray m_className; - - void updateMetaObject(); - void writeMethodsData(QLinkedList& methods, unsigned int **data, QList *strings, int *index, int max_count, int null_index, int flags); + class DynamicQMetaObjectPrivate; + DynamicQMetaObjectPrivate* m_d; }; PYSIDE_API inline void deleteDynamicQMetaObject(void* data) diff --git a/libpyside/dynamicqmetaobject_p.h b/libpyside/dynamicqmetaobject_p.h new file mode 100644 index 0000000..4488f07 --- /dev/null +++ b/libpyside/dynamicqmetaobject_p.h @@ -0,0 +1,69 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DYNAMICMETAPROPERTY_P_H +#define DYNAMICMETAPROPERTY_P_H + +#include +#include +#include + +#define PYSIDE_SLOT_LIST_ATTR "_slots" + +namespace PySide +{ + class MethodData + { + public: + MethodData(){} + MethodData(const char* signature, const char* type); + void clear(); + bool isValid() const; + QByteArray signature() const; + QByteArray type() const; + bool operator==(const MethodData& other) const; + bool operator==(const char* other) const; + + private: + QSharedPointer m_signature; + QSharedPointer m_type; + }; + + class PropertyData + { + public: + PropertyData(); + PropertyData(const char* name, PyObject* data); + QByteArray name() const; + QByteArray type() const; + uint flags() const; + bool isValid() const; + bool operator==(const PropertyData& other) const; + bool operator==(const char* name) const; + + private: + QByteArray m_name; + PyObject* m_data; + }; +} + +#endif diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index 7453876..7a35edb 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -25,7 +25,7 @@ #include #include "qproperty.h" - +#include "dynamicqmetaobject_p.h" #define QPROPERTY_CLASS_NAME "Property" diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp index 3c7f4fc..273de27 100644 --- a/libpyside/qslot.cpp +++ b/libpyside/qslot.cpp @@ -21,7 +21,7 @@ */ #include -#include +#include "dynamicqmetaobject_p.h" #include From 9257cd1783c96401b4736e48b1f9741624183124 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 15:28:20 -0300 Subject: [PATCH 082/913] Changed name of qproperty functions --- libpyside/dynamicqmetaobject.cpp | 20 ++++++++++---------- libpyside/pyside.cpp | 2 +- libpyside/qproperty.cpp | 28 ++++++++++++++-------------- libpyside/qproperty.h | 28 ++++++++++++++-------------- libpyside/signalmanager.cpp | 8 ++++---- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index f8902c6..89a35ef 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -159,39 +159,39 @@ uint PropertyData::flags() const else if (!isQRealType(typeName)) flags |= qvariant_nameToType(typeName) << 24; - if (qproperty_is_readble(m_data)) + if (qpropertyIsReadable(m_data)) flags |= Readable; - if (qproperty_is_writable(m_data)) + if (qpropertyIsWritable(m_data)) flags |= Writable; - if (qproperty_has_reset(m_data)) + if (qpropertyHasReset(m_data)) flags |= Resettable; - if (!qproperty_is_designable(m_data)) + if (!qpropertyIsDesignable(m_data)) flags |= ResolveDesignable; else flags |= Designable; - if (!qproperty_is_scriptable(m_data)) + if (!qpropertyIsScriptable(m_data)) flags |= ResolveScriptable; else flags |= Scriptable; - if (!qproperty_is_stored(m_data)) + if (!qpropertyIsStored(m_data)) flags |= ResolveStored; else flags |= Stored; - if (!qproperty_is_user(m_data)) + if (!qpropertyIsUser(m_data)) flags |= ResolveUser; else flags |= User; - if (qproperty_is_constant(m_data)) + if (qpropertyIsConstant(m_data)) flags |= Constant; - if (qproperty_is_final(m_data)) + if (qpropertyIsFinal(m_data)) flags |= Final; return flags; @@ -255,7 +255,7 @@ PropertyData::PropertyData(const char* name, PyObject* data) QByteArray PropertyData::type() const { - return QByteArray(qproperty_get_type(m_data)); + return QByteArray(qpropertyGetType(m_data)); } diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 9b8c4cc..bb22fa7 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -69,7 +69,7 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds } else { PyObject* attr = PyObject_GenericGetAttr(qObj, key); if (isQPropertyType(attr)) - PySide::qproperty_set(attr, qObj, value); + PySide::qpropertySet(attr, qObj, value); } } else { propName.append("()"); diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index 7a35edb..32ff8a8 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -164,7 +164,7 @@ bool isQPropertyType(PyObject* pyObj) return false; } -int qproperty_set(PyObject* self, PyObject* source, PyObject* value) +int qpropertySet(PyObject* self, PyObject* source, PyObject* value) { QPropertyData *data = reinterpret_cast(self); if (data->fset) { @@ -181,7 +181,7 @@ int qproperty_set(PyObject* self, PyObject* source, PyObject* value) return -1; } -PyObject* qproperty_get(PyObject* self, PyObject* source) +PyObject* qpropertyGet(PyObject* self, PyObject* source) { QPropertyData *data = reinterpret_cast(self); if (data->fget) { @@ -193,7 +193,7 @@ PyObject* qproperty_get(PyObject* self, PyObject* source) return 0; } -int qproperty_reset(PyObject* self, PyObject* source) +int qpropertyReset(PyObject* self, PyObject* source) { QPropertyData *data = reinterpret_cast(self); if (data->freset) { @@ -207,13 +207,13 @@ int qproperty_reset(PyObject* self, PyObject* source) } -const char* qproperty_get_type(PyObject* self) +const char* qpropertyGetType(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->typeName; } -PyObject* qproperty_get_object(PyObject* source, PyObject* name) +PyObject* qpropertyGetObject(PyObject* source, PyObject* name) { PyObject* attr = PyObject_GenericGetAttr(source, name); if (attr && isQPropertyType(attr)) @@ -249,55 +249,55 @@ char* translate_type_name(PyObject* type) return 0; } -bool qproperty_is_readble(PyObject* self) +bool qpropertyIsReadable(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return (data->fget != 0); } -bool qproperty_is_writable(PyObject* self) +bool qpropertyIsWritable(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return (data->fset != 0); } -bool qproperty_has_reset(PyObject* self) +bool qpropertyHasReset(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return (data->freset != 0); } -bool qproperty_is_designable(PyObject* self) +bool qpropertyIsDesignable(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->designable; } -bool qproperty_is_scriptable(PyObject* self) +bool qpropertyIsScriptable(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->scriptable; } -bool qproperty_is_stored(PyObject* self) +bool qpropertyIsStored(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->stored; } -bool qproperty_is_user(PyObject* self) +bool qpropertyIsUser(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->user; } -bool qproperty_is_constant(PyObject* self) +bool qpropertyIsConstant(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->constant; } -bool qproperty_is_final(PyObject* self) +bool qpropertyIsFinal(PyObject* self) { QPropertyData *data = reinterpret_cast(self); return data->final; diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h index 56ed32f..645a468 100644 --- a/libpyside/qproperty.h +++ b/libpyside/qproperty.h @@ -46,7 +46,7 @@ PYSIDE_API bool isQPropertyType(PyObject* pyObj); * @param value The value to set in property * @return Return 0 if ok or -1 if this function fail **/ -PYSIDE_API int qproperty_set(PyObject* self, PyObject* source, PyObject* value); +PYSIDE_API int qpropertySet(PyObject* self, PyObject* source, PyObject* value); /** * This function call get property function @@ -56,7 +56,7 @@ PYSIDE_API int qproperty_set(PyObject* self, PyObject* source, PyObject* value); * @param source The QObject witch has the property * @return Return the result of property get function or 0 if this fail **/ -PYSIDE_API PyObject* qproperty_get(PyObject* self, PyObject* source); +PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source); /** * This function call reset property function @@ -66,7 +66,7 @@ PYSIDE_API PyObject* qproperty_get(PyObject* self, PyObject* source); * @param source The QObject witch has the property * @return Return 0 if ok or -1 if this function fail **/ -PYSIDE_API int qproperty_reset(PyObject* self, PyObject* source); +PYSIDE_API int qpropertyReset(PyObject* self, PyObject* source); /** @@ -76,7 +76,7 @@ PYSIDE_API int qproperty_reset(PyObject* self, PyObject* source); * @param self The property object * @return Return the property type name **/ -PYSIDE_API const char* qproperty_get_type(PyObject* self); +PYSIDE_API const char* qpropertyGetType(PyObject* self); /** * This function search in the source object for desired property @@ -85,7 +85,7 @@ PYSIDE_API const char* qproperty_get_type(PyObject* self); * @param name The property name * @return Return a new reference to property object **/ -PYSIDE_API PyObject* qproperty_get_object(PyObject* source, PyObject* name); +PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name); /** @@ -95,7 +95,7 @@ PYSIDE_API PyObject* qproperty_get_object(PyObject* source, PyObject* name); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_readble(PyObject* self); +PYSIDE_API bool qpropertyIsReadable(PyObject* self); /** * This function check if property has write function @@ -104,7 +104,7 @@ PYSIDE_API bool qproperty_is_readble(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_writable(PyObject* self); +PYSIDE_API bool qpropertyIsWritable(PyObject* self); /** * This function check if property has reset function @@ -113,7 +113,7 @@ PYSIDE_API bool qproperty_is_writable(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_has_reset(PyObject* self); +PYSIDE_API bool qpropertyHasReset(PyObject* self); /** * This function check if property has the flag DESIGNABLE setted @@ -122,7 +122,7 @@ PYSIDE_API bool qproperty_has_reset(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_designable(PyObject* self); +PYSIDE_API bool qpropertyIsDesignable(PyObject* self); /** * This function check if property has the flag SCRIPTABLE setted @@ -131,7 +131,7 @@ PYSIDE_API bool qproperty_is_designable(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_scriptable(PyObject* self); +PYSIDE_API bool qpropertyIsScriptable(PyObject* self); /** * This function check if property has the flag STORED setted @@ -140,7 +140,7 @@ PYSIDE_API bool qproperty_is_scriptable(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_stored(PyObject* self); +PYSIDE_API bool qpropertyIsStored(PyObject* self); /** * This function check if property has the flag USER setted @@ -149,7 +149,7 @@ PYSIDE_API bool qproperty_is_stored(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_user(PyObject* self); +PYSIDE_API bool qpropertyIsUser(PyObject* self); /** * This function check if property has the flag CONSTANT setted @@ -158,7 +158,7 @@ PYSIDE_API bool qproperty_is_user(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_constant(PyObject* self); +PYSIDE_API bool qpropertyIsConstant(PyObject* self); /** * This function check if property has the flag FINAL setted @@ -167,7 +167,7 @@ PYSIDE_API bool qproperty_is_constant(PyObject* self); * @param self The property object * @return Return a boolean value **/ -PYSIDE_API bool qproperty_is_final(PyObject* self); +PYSIDE_API bool qpropertyIsFinal(PyObject* self); } //namespace PySide diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index b8e97f9..c770fba 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -363,7 +363,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, return id - metaObject->methodCount(); pp_name = PyString_FromString(mp.name()); - pp = qproperty_get_object(pySelf, pp_name); + pp = qpropertyGetObject(pySelf, pp_name); if (!pp) { qWarning("Invalid property."); Py_XDECREF(pp_name); @@ -376,7 +376,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, #ifndef QT_NO_PROPERTIES case QMetaObject::ReadProperty: { - PyObject* value = qproperty_get(pp, pySelf); + PyObject* value = qpropertyGet(pp, pySelf); if (value) { void *data = typeResolver->toCpp(value); if (Shiboken::TypeResolver::getType(mp.typeName()) == Shiboken::TypeResolver::ObjectType) @@ -394,12 +394,12 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, case QMetaObject::WriteProperty: { Shiboken::AutoDecRef value(typeResolver->toPython(args[0])); - qproperty_set(pp, pySelf, value); + qpropertySet(pp, pySelf, value); break; } case QMetaObject::ResetProperty: - qproperty_reset(pp, pp_name); + qpropertyReset(pp, pp_name); break; case QMetaObject::QueryPropertyDesignable: From 16ccce72d8c2763051806a5fc9caa574fa1dcc61 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 16:10:03 -0300 Subject: [PATCH 083/913] Don't export functions not used outsise libpyside and move them to an private header. --- libpyside/dynamicqmetaobject.cpp | 1 + libpyside/pyside.cpp | 4 +- libpyside/qproperty.cpp | 29 +++---- libpyside/qproperty.h | 103 ----------------------- libpyside/qproperty_p.h | 139 +++++++++++++++++++++++++++++++ libpyside/signalmanager.cpp | 6 +- 6 files changed, 161 insertions(+), 121 deletions(-) create mode 100644 libpyside/qproperty_p.h diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 89a35ef..ce3ba3b 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -34,6 +34,7 @@ #include "qsignal.h" #include "qproperty.h" +#include "qproperty_p.h" #define MAX_SIGNALS_COUNT 50 #define MAX_SLOTS_COUNT 50 diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index bb22fa7..ebc17cf 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -23,6 +23,7 @@ #include "pyside.h" #include "signalmanager.h" +#include "qproperty_p.h" #include "qproperty.h" #include "qsignal.h" #include @@ -33,7 +34,6 @@ extern "C" void init_signal(PyObject* module); extern "C" void init_slot(PyObject* module); -extern "C" void init_qproperty(PyObject* module); static QStack cleanupFunctionList; @@ -44,7 +44,7 @@ void init(PyObject *module) { init_signal(module); init_slot(module); - init_qproperty(module); + initQProperty(module); // Init signal manager, so it will register some meta types used by QVariant. SignalManager::instance(); } diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index 32ff8a8..d7c4d81 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -25,6 +25,7 @@ #include #include "qproperty.h" +#include "qproperty_p.h" #include "dynamicqmetaobject_p.h" #define QPROPERTY_CLASS_NAME "Property" @@ -32,6 +33,9 @@ namespace PySide { +// aux function +static char* translateTypeName(PyObject*); + extern "C" { @@ -52,11 +56,8 @@ typedef struct { bool final; } QPropertyData; -static int qproperty_init(PyObject*, PyObject*, PyObject*); -static void qproperty_free(void*); - -//aux -static char* translate_type_name(PyObject*); +static int qpropertyTpInit(PyObject*, PyObject*, PyObject*); +static void qpropertyFree(void*); PyTypeObject QProperty_Type = { PyObject_HEAD_INIT(0) @@ -95,10 +96,10 @@ PyTypeObject QProperty_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - (initproc)qproperty_init, /*tp_init */ + qpropertyTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ - qproperty_free, /*tp_free */ + qpropertyFree, /*tp_free */ 0, /*tp_is_gc */ 0, /*tp_bases */ 0, /*tp_mro */ @@ -108,7 +109,9 @@ PyTypeObject QProperty_Type = { 0, /*tp_del */ }; -void init_qproperty(PyObject* module) +} // extern "C" + +void initQProperty(PyObject* module) { if (PyType_Ready(&QProperty_Type) < 0) return; @@ -117,9 +120,7 @@ void init_qproperty(PyObject* module) PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type)); } -} // extern "C" - -int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds) +int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds) { PyObject* type = 0; QPropertyData *data = reinterpret_cast(self); @@ -141,11 +142,11 @@ int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds) if (!data->fset && data->fget) data->constant = true; - data->typeName = translate_type_name(type); + data->typeName = translateTypeName(type); return 1; } -void qproperty_free(void *self) +void qpropertyFree(void *self) { PyObject *pySelf = reinterpret_cast(self); QPropertyData *data = reinterpret_cast(self); @@ -226,7 +227,7 @@ PyObject* qpropertyGetObject(PyObject* source, PyObject* name) return 0; } -char* translate_type_name(PyObject* type) +char* translateTypeName(PyObject* type) { if (PyType_Check(type)) { char *typeName = NULL; diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h index 645a468..bb256b4 100644 --- a/libpyside/qproperty.h +++ b/libpyside/qproperty.h @@ -58,26 +58,6 @@ PYSIDE_API int qpropertySet(PyObject* self, PyObject* source, PyObject* value); **/ PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source); -/** - * This function call reset property function - * This function does not check the property object type - * - * @param self The property object - * @param source The QObject witch has the property - * @return Return 0 if ok or -1 if this function fail - **/ -PYSIDE_API int qpropertyReset(PyObject* self, PyObject* source); - - -/** - * This function return the property type - * This function does not check the property object type - * - * @param self The property object - * @return Return the property type name - **/ -PYSIDE_API const char* qpropertyGetType(PyObject* self); - /** * This function search in the source object for desired property * @@ -87,89 +67,6 @@ PYSIDE_API const char* qpropertyGetType(PyObject* self); **/ PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name); - -/** - * This function check if property has read function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsReadable(PyObject* self); - -/** - * This function check if property has write function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsWritable(PyObject* self); - -/** - * This function check if property has reset function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyHasReset(PyObject* self); - -/** - * This function check if property has the flag DESIGNABLE setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsDesignable(PyObject* self); - -/** - * This function check if property has the flag SCRIPTABLE setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsScriptable(PyObject* self); - -/** - * This function check if property has the flag STORED setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsStored(PyObject* self); - -/** - * This function check if property has the flag USER setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsUser(PyObject* self); - -/** - * This function check if property has the flag CONSTANT setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsConstant(PyObject* self); - -/** - * This function check if property has the flag FINAL setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsFinal(PyObject* self); - - } //namespace PySide #endif diff --git a/libpyside/qproperty_p.h b/libpyside/qproperty_p.h new file mode 100644 index 0000000..dbd6dd1 --- /dev/null +++ b/libpyside/qproperty_p.h @@ -0,0 +1,139 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PYSIDE_QPROPERTY_P_H +#define PYSIDE_QPROPERTY_P_H + +#include + +namespace PySide +{ + +/** + * Init PySide QProperty support system + */ +void initQProperty(PyObject* module); + +/** + * This function call reset property function + * This function does not check the property object type + * + * @param self The property object + * @param source The QObject witch has the property + * @return Return 0 if ok or -1 if this function fail + **/ +int qpropertyReset(PyObject* self, PyObject* source); + + +/** + * This function return the property type + * This function does not check the property object type + * + * @param self The property object + * @return Return the property type name + **/ +const char* qpropertyGetType(PyObject* self); + +/** + * This function check if property has read function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsReadable(PyObject* self); + +/** + * This function check if property has write function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsWritable(PyObject* self); + +/** + * This function check if property has reset function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyHasReset(PyObject* self); + +/** + * This function check if property has the flag DESIGNABLE setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsDesignable(PyObject* self); + +/** + * This function check if property has the flag SCRIPTABLE setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsScriptable(PyObject* self); + +/** + * This function check if property has the flag STORED setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsStored(PyObject* self); + +/** + * This function check if property has the flag USER setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsUser(PyObject* self); + +/** + * This function check if property has the flag CONSTANT setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsConstant(PyObject* self); + +/** + * This function check if property has the flag FINAL setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsFinal(PyObject* self); + +} // namespace PySide + +#endif diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index c770fba..3f0a0a5 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -21,8 +21,6 @@ */ #include "signalmanager.h" -#include "qproperty.h" -#include "pyside.h" #include #include @@ -35,6 +33,10 @@ #include #include +#include "qproperty.h" +#include "qproperty_p.h" +#include "pyside.h" + #if QSLOT_CODE != 1 || QSIGNAL_CODE != 2 #error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value! #endif From f2c59b613b28bfc8c1351d09ec7edaaedb174bfc Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 16:38:35 -0300 Subject: [PATCH 084/913] Move structs tagged as "export C" outside C++ namespaces. Also don't export structs that don't need to be exported. --- libpyside/dynamicqmetaobject.cpp | 2 +- libpyside/qproperty.cpp | 116 +++++++++++++++---------------- libpyside/qproperty.h | 5 -- libpyside/qproperty_p.h | 5 ++ 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index ce3ba3b..3882ea2 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -388,7 +388,7 @@ DynamicQMetaObject* DynamicQMetaObject::createBasedOn(PyObject* pyObj, PyTypeObj while (PyDict_Next(type->tp_dict, &pos, &key, &value)) { //Register properties - if (value->ob_type == &QProperty_Type) { + if (value->ob_type == &PySideQPropertyType) { mo->addProperty(PyString_AsString(key), value); } diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index d7c4d81..2c53932 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -30,16 +30,34 @@ #define QPROPERTY_CLASS_NAME "Property" -namespace PySide +char* translateTypeName(PyObject* type) { + if (PyType_Check(type)) { + char* typeName = 0; + if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) { + Shiboken::SbkBaseWrapperType* objType = reinterpret_cast(type); + typeName = strdup(objType->original_name); + } else { + //tp_name return the full name + Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__")); + typeName = strdup(PyString_AS_STRING(otypeName.object())); + } + if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) { + typeName = reinterpret_cast(realloc(typeName, strlen(typeName) + 1)); + typeName = strcat(typeName, "*"); + } + return typeName; + } else if (PyString_Check(type)) { + return strdup(PyString_AS_STRING(type)); + } + return 0; +} -// aux function -static char* translateTypeName(PyObject*); extern "C" { -typedef struct { +struct PySideQPropertyData { PyObject_HEAD char* typeName; PyObject* type; @@ -54,16 +72,16 @@ typedef struct { bool user; bool constant; bool final; -} QPropertyData; +}; static int qpropertyTpInit(PyObject*, PyObject*, PyObject*); static void qpropertyFree(void*); -PyTypeObject QProperty_Type = { +PyTypeObject PySideQPropertyType = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ QPROPERTY_CLASS_NAME, /*tp_name*/ - sizeof(QPropertyData), /*tp_basicsize*/ + sizeof(PySideQPropertyData), /*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ 0, /*tp_print*/ @@ -96,7 +114,7 @@ PyTypeObject QProperty_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - qpropertyTpInit, /*tp_init */ + qpropertyTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ qpropertyFree, /*tp_free */ @@ -109,21 +127,10 @@ PyTypeObject QProperty_Type = { 0, /*tp_del */ }; -} // extern "C" - -void initQProperty(PyObject* module) -{ - if (PyType_Ready(&QProperty_Type) < 0) - return; - - Py_INCREF(&QProperty_Type); - PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type)); -} - int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds) { PyObject* type = 0; - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); data->designable = true; data->scriptable = true; data->stored = true; @@ -149,7 +156,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds) void qpropertyFree(void *self) { PyObject *pySelf = reinterpret_cast(self); - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); free(data->typeName); free(data->doc); @@ -157,17 +164,33 @@ void qpropertyFree(void *self) pySelf->ob_type->tp_base->tp_free(self); } + +} // extern "C" + + +namespace PySide +{ + +void initQProperty(PyObject* module) +{ + if (PyType_Ready(&PySideQPropertyType) < 0) + return; + + Py_INCREF(&PySideQPropertyType); + PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&PySideQPropertyType)); +} + bool isQPropertyType(PyObject* pyObj) { if (pyObj) { - return pyObj->ob_type == &QProperty_Type; + return pyObj->ob_type == &PySideQPropertyType; } return false; } int qpropertySet(PyObject* self, PyObject* source, PyObject* value) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); if (data->fset) { Shiboken::AutoDecRef args(PyTuple_New(2)); PyTuple_SET_ITEM(args, 0, source); @@ -184,7 +207,7 @@ int qpropertySet(PyObject* self, PyObject* source, PyObject* value) PyObject* qpropertyGet(PyObject* self, PyObject* source) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); if (data->fget) { Shiboken::AutoDecRef args(PyTuple_New(1)); Py_INCREF(source); @@ -196,7 +219,7 @@ PyObject* qpropertyGet(PyObject* self, PyObject* source) int qpropertyReset(PyObject* self, PyObject* source) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); if (data->freset) { Shiboken::AutoDecRef args(PyTuple_New(1)); Py_INCREF(source); @@ -210,7 +233,7 @@ int qpropertyReset(PyObject* self, PyObject* source) const char* qpropertyGetType(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->typeName; } @@ -227,80 +250,57 @@ PyObject* qpropertyGetObject(PyObject* source, PyObject* name) return 0; } -char* translateTypeName(PyObject* type) -{ - if (PyType_Check(type)) { - char *typeName = NULL; - if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) { - Shiboken::SbkBaseWrapperType *objType = reinterpret_cast(type); - typeName = strdup(objType->original_name); - } else { - //tp_name return the full name - Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__")); - typeName = strdup(PyString_AS_STRING(otypeName.object())); - } - if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) { - typeName = reinterpret_cast(realloc(typeName, strlen(typeName) + 1)); - typeName = strcat(typeName, "*"); - } - return typeName; - } else if (PyString_Check(type)) { - return strdup(PyString_AS_STRING(type)); - } - return 0; -} - bool qpropertyIsReadable(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return (data->fget != 0); } bool qpropertyIsWritable(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return (data->fset != 0); } bool qpropertyHasReset(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return (data->freset != 0); } bool qpropertyIsDesignable(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->designable; } bool qpropertyIsScriptable(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->scriptable; } bool qpropertyIsStored(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->stored; } bool qpropertyIsUser(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->user; } bool qpropertyIsConstant(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->constant; } bool qpropertyIsFinal(PyObject* self) { - QPropertyData *data = reinterpret_cast(self); + PySideQPropertyData *data = reinterpret_cast(self); return data->final; } diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h index bb256b4..da031db 100644 --- a/libpyside/qproperty.h +++ b/libpyside/qproperty.h @@ -30,11 +30,6 @@ namespace PySide { -extern "C" -{ - extern PYSIDE_API PyTypeObject QProperty_Type; -}; //extern "C" - PYSIDE_API bool isQPropertyType(PyObject* pyObj); /** diff --git a/libpyside/qproperty_p.h b/libpyside/qproperty_p.h index dbd6dd1..85380f6 100644 --- a/libpyside/qproperty_p.h +++ b/libpyside/qproperty_p.h @@ -25,6 +25,11 @@ #include +extern "C" +{ + extern PyTypeObject PySideQPropertyType; +}; //extern "C" + namespace PySide { From 1a10971865153e252d99b19018b5f2444e06a0eb Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 16:47:55 -0300 Subject: [PATCH 085/913] Don't inline function deleteDynamicQMetaObject. It's used by address, so inline it is useless. --- libpyside/dynamicqmetaobject.cpp | 5 +++++ libpyside/dynamicqmetaobject.h | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 3882ea2..db06112 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -546,3 +546,8 @@ void DynamicQMetaObject::DynamicQMetaObjectPrivate::updateMetaObject(QMetaObject metaObj->d.data = data; metaObj->d.stringdata = stringData; } + +void PySide::deleteDynamicQMetaObject(void* data) +{ + delete reinterpret_cast(data); +} diff --git a/libpyside/dynamicqmetaobject.h b/libpyside/dynamicqmetaobject.h index b2f018e..d61ecad 100644 --- a/libpyside/dynamicqmetaobject.h +++ b/libpyside/dynamicqmetaobject.h @@ -52,10 +52,7 @@ private: DynamicQMetaObjectPrivate* m_d; }; -PYSIDE_API inline void deleteDynamicQMetaObject(void* data) -{ - delete reinterpret_cast(data); -} +PYSIDE_API void deleteDynamicQMetaObject(void* data); } #endif From a43eafaae46060adfc6e0f15fb14b56c6c887494 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 18:19:42 -0300 Subject: [PATCH 086/913] Don't export symbols that don't need to be exported and rename many functions. --- PySide/QtCore/typesystem_core.xml | 8 +- libpyside/dynamicqmetaobject.cpp | 7 +- libpyside/pyside.cpp | 6 +- libpyside/qsignal.cpp | 499 +++++++++++++++--------------- libpyside/qsignal.h | 31 +- libpyside/qsignal_p.h | 40 +++ libpyside/qslot.cpp | 12 +- 7 files changed, 319 insertions(+), 284 deletions(-) create mode 100644 libpyside/qsignal_p.h diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 37decba..d6fe524 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1793,7 +1793,7 @@ - if (!PyObject_TypeCheck(%2, &PySide::SignalInstance_Type)) + if (!PyObject_TypeCheck(%2, &PySideSignalInstanceType)) goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError; // %FUNCTION_NAME() - disable generation of c++ function call @@ -1803,7 +1803,7 @@ QTimer* timer = Converter<QTimer*>::toCpp(pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); - PySide::SignalInstanceData* signalInstance = reinterpret_cast<PySide::SignalInstanceData*>(%2); + PySideSignalInstanceData* signalInstance = reinterpret_cast<PySideSignalInstanceData*>(%2); Shiboken::AutoDecRef signalSignature(PyString_FromFormat("2%s", signalInstance->signature)); Shiboken::AutoDecRef result( PyObject_CallMethod(pyTimer, @@ -2498,9 +2498,9 @@ // since it refers to a name very tied to the generator implementation. // Check bug #362 for more information on this // http://bugs.openbossa.org/show_bug.cgi?id=362 - if (!PyObject_TypeCheck(%1, &PySide::SignalInstance_Type)) + if (!PyObject_TypeCheck(%1, &PySideSignalInstanceType)) goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError; - PySide::SignalInstanceData* signalInstance = reinterpret_cast<PySide::SignalInstanceData*>(%1); + PySideSignalInstanceData* signalInstance = reinterpret_cast<PySideSignalInstanceData*>(%1); QObject* sender = %CONVERTTOCPP[QObject*](signalInstance->source); %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->%FUNCTION_NAME(sender, signalInstance->signature, %2)); diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index db06112..8bb1a6e 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -33,6 +33,7 @@ #include #include "qsignal.h" +#include "qsignal_p.h" #include "qproperty.h" #include "qproperty_p.h" @@ -393,14 +394,14 @@ DynamicQMetaObject* DynamicQMetaObject::createBasedOn(PyObject* pyObj, PyTypeObj } //Register signals - if (value->ob_type == &Signal_Type) { + if (value->ob_type == &PySideSignalType) { PyObject *attr = PyObject_GetAttr(pyObj, key); - SignalInstanceData *data = reinterpret_cast(attr); + PySideSignalInstanceData *data = reinterpret_cast(attr); while(data) { int index = base->indexOfSignal(data->signature); if (index == -1) mo->addSignal(data->signature); - data = reinterpret_cast(data->next); + data = reinterpret_cast(data->next); } } diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index ebc17cf..3cc1fd4 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -26,13 +26,13 @@ #include "qproperty_p.h" #include "qproperty.h" #include "qsignal.h" +#include "qsignal_p.h" #include #include #include #include #include -extern "C" void init_signal(PyObject* module); extern "C" void init_slot(PyObject* module); static QStack cleanupFunctionList; @@ -42,7 +42,7 @@ namespace PySide void init(PyObject *module) { - init_signal(module); + initSignalSupport(module); init_slot(module); initQProperty(module); // Init signal manager, so it will register some meta types used by QVariant. @@ -75,7 +75,7 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds propName.append("()"); if (metaObj->indexOfSignal(propName) != -1) { propName.prepend('2'); - PySide::signal_connect(qObj, propName, value); + PySide::signalConnect(qObj, propName, value); } else { PyErr_Format(PyExc_AttributeError, "'%s' is not a Qt property or a signal", propName.constData()); return false; diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index 76fc450..46cb1b6 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -25,45 +25,46 @@ #include #include "qsignal.h" +#include "qsignal_p.h" #include "signalmanager.h" #define SIGNAL_CLASS_NAME "Signal" #define QT_SIGNAL_SENTINEL "2" +struct SignalData; + namespace PySide { + //aux + static char* signalBuildSignature(const char*, const char*); + static void signalAppendSignature(SignalData*, char*); + static void signalInstanceInitialize(PyObject*, PyObject*, SignalData*, PyObject *, int); + static char* signalParseSignature(PyObject*); + static PyObject* signalBuildQtCompatible(const char*); +} extern "C" { -char* get_type_name(PyObject*); - -typedef struct { +struct SignalData { PyObject_HEAD bool initialized; char* signalName; char** signatures; int signaturesSize; -} SignalData; +}; -static int signal_init(PyObject*, PyObject*, PyObject*); -static void signal_free(void*); -static void signal_instance_free(void*); +static int signalTpInit(PyObject*, PyObject*, PyObject*); +static void signalFree(void*); +static void signalInstanceFree(void*); //methods -static PyObject* signal_instance_connect(PyObject*, PyObject*, PyObject*); -static PyObject* signal_instance_disconnect(PyObject*, PyObject*); -static PyObject* signal_instance_emit(PyObject*, PyObject*); -static PyObject* signal_instance_get_item(PyObject*, PyObject*); +static PyObject* signalInstanceConnect(PyObject*, PyObject*, PyObject*); +static PyObject* signalInstanceDisconnect(PyObject*, PyObject*); +static PyObject* signalInstanceEmit(PyObject*, PyObject*); +static PyObject* signalInstanceGetItem(PyObject*, PyObject*); -//aux -static char* signal_build_signature(const char*, const char*); -static void signal_append_signature(SignalData*, char*); -static void signal_instance_initialize(PyObject*, PyObject*, SignalData*, PyObject *, int); -static char* signal_parse_signature(PyObject*); -static PyObject* signal_build_qt_compatible(const char*); - -PyTypeObject Signal_Type = { +PyTypeObject PySideSignalType = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ @@ -100,10 +101,10 @@ PyTypeObject Signal_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - signal_init, /*tp_init */ + signalTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ - signal_free, /*tp_free */ + signalFree, /*tp_free */ 0, /*tp_is_gc */ 0, /*tp_bases */ 0, /*tp_mro */ @@ -114,23 +115,23 @@ PyTypeObject Signal_Type = { }; static PyMethodDef SignalInstance_methods[] = { - {"connect", (PyCFunction)signal_instance_connect, METH_VARARGS|METH_KEYWORDS, 0}, - {"disconnect", signal_instance_disconnect, METH_VARARGS, 0}, - {"emit", signal_instance_emit, METH_VARARGS, 0}, + {"connect", (PyCFunction)signalInstanceConnect, METH_VARARGS|METH_KEYWORDS, 0}, + {"disconnect", signalInstanceDisconnect, METH_VARARGS, 0}, + {"emit", signalInstanceEmit, METH_VARARGS, 0}, {0} /* Sentinel */ }; static PyMappingMethods SignalInstance_as_mapping = { 0, - signal_instance_get_item, + signalInstanceGetItem, 0 }; -PyTypeObject SignalInstance_Type = { +PyTypeObject PySideSignalInstanceType = { PyObject_HEAD_INIT(0) 0, /*ob_size*/ "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ - sizeof(SignalInstanceData),/*tp_basicsize*/ + sizeof(PySideSignalInstanceData),/*tp_basicsize*/ 0, /*tp_itemsize*/ 0, /*tp_dealloc*/ 0, /*tp_print*/ @@ -166,7 +167,7 @@ PyTypeObject SignalInstance_Type = { 0, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ - signal_instance_free, /*tp_free */ + signalInstanceFree, /*tp_free */ 0, /*tp_is_gc */ 0, /*tp_bases */ 0, /*tp_mro */ @@ -176,30 +177,153 @@ PyTypeObject SignalInstance_Type = { 0, /*tp_del */ }; - -void init_signal(PyObject* module) +int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds) { - if (PyType_Ready(&Signal_Type) < 0) - return; + static PyObject *emptyTuple = 0; + static const char *kwlist[] = {"name", 0}; + char* argName = 0; - Py_INCREF(&Signal_Type); - PyModule_AddObject(module, SIGNAL_CLASS_NAME, ((PyObject*)&Signal_Type)); + if (emptyTuple == 0) + emptyTuple = PyTuple_New(0); - if (PyType_Ready(&SignalInstance_Type) < 0) - return; + if (!PyArg_ParseTupleAndKeywords(emptyTuple, kwds, + "|s:QtCore."SIGNAL_CLASS_NAME, (char**) kwlist, &argName)) + return 0; - Py_INCREF(&SignalInstance_Type); + bool tupledArgs = false; + SignalData *data = reinterpret_cast(self); + if (argName) { + data->signalName = strdup(argName); + } + + for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) { + PyObject *arg = PyTuple_GET_ITEM(args, i); + if (PySequence_Check(arg) && !PyString_Check(arg)) { + tupledArgs = true; + PySide::signalAppendSignature(data, PySide::signalParseSignature(arg)); + } + } + + if (!tupledArgs) + PySide::signalAppendSignature(data, PySide::signalParseSignature(args)); + + return 1; } - -} // extern "C" - - -PyObject* signal_instance_get_item(PyObject* self, PyObject* key) +void signalFree(void *self) { - SignalInstanceData* data = reinterpret_cast(self); - char* sigKey = signal_parse_signature(key); - char* sig = signal_build_signature(data->signalName, sigKey); + PyObject *pySelf = reinterpret_cast(self); + SignalData *data = reinterpret_cast(self); + + for(int i = 0, i_max = data->signaturesSize; i < i_max; i++) { + if (data->signatures[i]) + free(data->signatures[i]); + } + + free(data->signatures); + free(data->signalName); + data->initialized = 0; + data->signaturesSize = 0; + + pySelf->ob_type->tp_base->tp_free(self); +} + +void signalInstanceFree(void* self) +{ + PyObject *pySelf = reinterpret_cast(self); + PySideSignalInstanceData *data = reinterpret_cast(self); + + free(data->signalName); + free(data->signature); + + if (data->next) { + Py_XDECREF(data->next); + data->next = 0; + } + pySelf->ob_type->tp_base->tp_free(self); +} + +PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject *slot = 0; + PyObject *type = 0; + static const char *kwlist[] = {"slot", "type", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, + "O|O:"SIGNAL_CLASS_NAME, (char**) kwlist, &slot, &type)) + return 0; + + PySideSignalInstanceData *source = reinterpret_cast(self); + Shiboken::AutoDecRef pyArgs(PyList_New(0)); + + bool match = false; + if (slot->ob_type == &PySideSignalInstanceType) { + PySideSignalInstanceData *sourceWalk = source; + PySideSignalInstanceData *targetWalk; + + //find best match + while(sourceWalk && !match) { + targetWalk = reinterpret_cast(slot); + while(targetWalk && !match) { + if (QMetaObject::checkConnectArgs(sourceWalk->signature, targetWalk->signature)) { + PyList_Append(pyArgs, sourceWalk->source); + Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(sourceWalk->signature)); + PyList_Append(pyArgs, sourceSignature); + + PyList_Append(pyArgs, targetWalk->source); + Shiboken::AutoDecRef targetSignature(PySide::signalBuildQtCompatible(targetWalk->signature)); + PyList_Append(pyArgs, targetSignature); + + match = true; + } + targetWalk = reinterpret_cast(targetWalk->next); + } + sourceWalk = reinterpret_cast(sourceWalk->next); + } + } else { + //try the first signature + PyList_Append(pyArgs, source->source); + Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->signature)); + PyList_Append(pyArgs, signature); + + PyList_Append(pyArgs, slot); + match = true; + } + + if (type) + PyList_Append(pyArgs, type); + + if (match) { + Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); + Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "connect")); + return PyObject_CallObject(pyMethod, tupleArgs); + } + + return 0; +} + +PyObject* signalInstanceEmit(PyObject* self, PyObject* args) +{ + PySideSignalInstanceData *source = reinterpret_cast(self); + + Shiboken::AutoDecRef pyArgs(PyList_New(0)); + Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(source->signature)); + + PyList_Append(pyArgs, sourceSignature); + for(Py_ssize_t i = 0, max = PyTuple_Size(args); i < max; i++) + PyList_Append(pyArgs, PyTuple_GetItem(args, i)); + + Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "emit")); + + Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); + return PyObject_CallObject(pyMethod, tupleArgs); +} + +PyObject* signalInstanceGetItem(PyObject* self, PyObject* key) +{ + PySideSignalInstanceData* data = reinterpret_cast(self); + char* sigKey = PySide::signalParseSignature(key); + char* sig = PySide::signalBuildSignature(data->signalName, sigKey); free(sigKey); const char* sigName = data->signalName; @@ -210,7 +334,7 @@ PyObject* signal_instance_get_item(PyObject* self, PyObject* key) Py_INCREF(result); return result; } - data = reinterpret_cast(data->next); + data = reinterpret_cast(data->next); } PyErr_Format(PyExc_IndexError, "Signature %s not found for signal: %s", sig, sigName); free(sig); @@ -218,6 +342,68 @@ PyObject* signal_instance_get_item(PyObject* self, PyObject* key) return 0; } +PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args) +{ + PySideSignalInstanceData *source = reinterpret_cast(self); + Shiboken::AutoDecRef pyArgs(PyList_New(0)); + + PyObject *slot; + if PyTuple_Check(args) + slot = PyTuple_GET_ITEM(args, 0); + else + slot = args; + + bool match = false; + if (slot->ob_type == &PySideSignalInstanceType) { + PySideSignalInstanceData *target = reinterpret_cast(slot); + if (QMetaObject::checkConnectArgs(source->signature, target->signature)) { + PyList_Append(pyArgs, source->source); + Shiboken::AutoDecRef source_signature(PySide::signalBuildQtCompatible(source->signature)); + PyList_Append(pyArgs, source_signature); + + PyList_Append(pyArgs, target->source); + Shiboken::AutoDecRef target_signature(PySide::signalBuildQtCompatible(target->signature)); + PyList_Append(pyArgs, target_signature); + match = true; + } + } else { + //try the first signature + PyList_Append(pyArgs, source->source); + Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->signature)); + PyList_Append(pyArgs, signature); + + PyList_Append(pyArgs, slot); + match = true; + } + + if (match) { + Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); + Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "disconnect")); + return PyObject_CallObject(pyMethod, tupleArgs); + } + + return 0; +} + +} // extern "C" + +namespace PySide +{ + +void initSignalSupport(PyObject* module) +{ + if (PyType_Ready(&PySideSignalType) < 0) + return; + + Py_INCREF(&PySideSignalType); + PyModule_AddObject(module, SIGNAL_CLASS_NAME, ((PyObject*)&PySideSignalType)); + + if (PyType_Ready(&PySideSignalInstanceType) < 0) + return; + + Py_INCREF(&PySideSignalInstanceType); +} + void signalUpdateSource(PyObject* source) { Shiboken::AutoDecRef attrs(PyObject_Dir(source)); @@ -225,15 +411,15 @@ void signalUpdateSource(PyObject* source) for(int i = 0, iMax = PyList_GET_SIZE(attrs.object()); i < iMax; ++i) { PyObject *attrName = PyList_GET_ITEM(attrs.object(), i); Shiboken::AutoDecRef attr(PyObject_GetAttr(reinterpret_cast(source->ob_type), attrName)); - if (!attr.isNull() && attr->ob_type == &Signal_Type) { - Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(SignalInstanceData, &SignalInstance_Type)); - signal_instance_initialize(signalInstance, attrName, reinterpret_cast(attr.object()), source, 0); + if (!attr.isNull() && attr->ob_type == &PySideSignalType) { + Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType)); + signalInstanceInitialize(signalInstance, attrName, reinterpret_cast(attr.object()), source, 0); PyObject_SetAttr(source, attrName, signalInstance); } } } -char* get_type_name(PyObject* type) +char* getTypeName(PyObject* type) { if (PyType_Check(type)) { char *typeName = NULL; @@ -264,22 +450,22 @@ char* get_type_name(PyObject* type) return 0; } -char* signal_build_signature(const char *name, const char *signature) +char* signalBuildSignature(const char *name, const char *signature) { QString signal; signal.sprintf("%s(%s)", name, signature); return strdup(QMetaObject::normalizedSignature(signal.toAscii())); } -char* signal_parse_signature(PyObject *args) +char* signalParseSignature(PyObject *args) { char *signature = 0; if (args && (PyString_Check(args) || (!PySequence_Check(args) && (args != Py_None)))) - return get_type_name(args); + return getTypeName(args); for(Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) { Shiboken::AutoDecRef arg(PySequence_ITEM(args, i)); - char* typeName = get_type_name(arg); + char* typeName = getTypeName(arg); if (typeName) { if (signature) { signature = reinterpret_cast(realloc(signature, (strlen(signature) + 1 + strlen(typeName)) * sizeof(char*))); @@ -294,7 +480,7 @@ char* signal_parse_signature(PyObject *args) return signature; } -void signal_append_signature(SignalData* self, char* signature) +void signalAppendSignature(SignalData* self, char* signature) { self->signaturesSize++; @@ -306,75 +492,9 @@ void signal_append_signature(SignalData* self, char* signature) self->signatures[self->signaturesSize-1] = signature; } -int signal_init(PyObject* self, PyObject* args, PyObject* kwds) +void signalInstanceInitialize(PyObject* instance, PyObject* name, SignalData* data, PyObject* source, int index) { - static PyObject *emptyTuple = 0; - static const char *kwlist[] = {"name", 0}; - char* argName = 0; - - if (emptyTuple == 0) - emptyTuple = PyTuple_New(0); - - if (!PyArg_ParseTupleAndKeywords(emptyTuple, kwds, - "|s:QtCore."SIGNAL_CLASS_NAME, (char**) kwlist, &argName)) - return 0; - - bool tupledArgs = false; - SignalData *data = reinterpret_cast(self); - if (argName) { - data->signalName = strdup(argName); - } - - for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) { - PyObject *arg = PyTuple_GET_ITEM(args, i); - if (PySequence_Check(arg) && !PyString_Check(arg)) { - tupledArgs = true; - signal_append_signature(data, signal_parse_signature(arg)); - } - } - - if (!tupledArgs) - signal_append_signature(data, signal_parse_signature(args)); - - return 1; -} - -void signal_free(void *self) -{ - PyObject *pySelf = reinterpret_cast(self); - SignalData *data = reinterpret_cast(self); - - for(int i = 0, i_max = data->signaturesSize; i < i_max; i++) { - if (data->signatures[i]) - free(data->signatures[i]); - } - - free(data->signatures); - free(data->signalName); - data->initialized = 0; - data->signaturesSize = 0; - - pySelf->ob_type->tp_base->tp_free(self); -} - -void signal_instance_free(void* self) -{ - PyObject *pySelf = reinterpret_cast(self); - SignalInstanceData *data = reinterpret_cast(self); - - free(data->signalName); - free(data->signature); - - if (data->next) { - Py_XDECREF(data->next); - data->next = 0; - } - pySelf->ob_type->tp_base->tp_free(self); -} - -void signal_instance_initialize(PyObject* instance, PyObject* name, SignalData* data, PyObject* source, int index) -{ - SignalInstanceData *self = reinterpret_cast(instance); + PySideSignalInstanceData *self = reinterpret_cast(instance); self->next = 0; if (data->signalName) self->signalName = strdup(data->signalName); @@ -382,75 +502,16 @@ void signal_instance_initialize(PyObject* instance, PyObject* name, SignalData* self->signalName = strdup(PyString_AsString(name)); self->source = source; - self->signature = signal_build_signature(self->signalName, data->signatures[index]); + self->signature = signalBuildSignature(self->signalName, data->signatures[index]); index++; if (index < data->signaturesSize) { - self->next = reinterpret_cast(PyObject_New(SignalInstanceData, &SignalInstance_Type)); - signal_instance_initialize(self->next, name, data, source, index); + self->next = reinterpret_cast(PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType)); + signalInstanceInitialize(self->next, name, data, source, index); } } -PyObject* signal_instance_connect(PyObject* self, PyObject* args, PyObject* kwds) -{ - PyObject *slot = 0; - PyObject *type = 0; - static const char *kwlist[] = {"slot", "type", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, - "O|O:"SIGNAL_CLASS_NAME, (char**) kwlist, &slot, &type)) - return 0; - - SignalInstanceData *source = reinterpret_cast(self); - Shiboken::AutoDecRef pyArgs(PyList_New(0)); - - bool match = false; - if (slot->ob_type == &SignalInstance_Type) { - SignalInstanceData *sourceWalk = source; - SignalInstanceData *targetWalk; - - //find best match - while(sourceWalk && !match) { - targetWalk = reinterpret_cast(slot); - while(targetWalk && !match) { - if (QMetaObject::checkConnectArgs(sourceWalk->signature, targetWalk->signature)) { - PyList_Append(pyArgs, sourceWalk->source); - Shiboken::AutoDecRef sourceSignature(signal_build_qt_compatible(sourceWalk->signature)); - PyList_Append(pyArgs, sourceSignature); - - PyList_Append(pyArgs, targetWalk->source); - Shiboken::AutoDecRef targetSignature(signal_build_qt_compatible(targetWalk->signature)); - PyList_Append(pyArgs, targetSignature); - - match = true; - } - targetWalk = reinterpret_cast(targetWalk->next); - } - sourceWalk = reinterpret_cast(sourceWalk->next); - } - } else { - //try the first signature - PyList_Append(pyArgs, source->source); - Shiboken::AutoDecRef signature(signal_build_qt_compatible(source->signature)); - PyList_Append(pyArgs, signature); - - PyList_Append(pyArgs, slot); - match = true; - } - - if (type) - PyList_Append(pyArgs, type); - - if (match) { - Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); - Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "connect")); - return PyObject_CallObject(pyMethod, tupleArgs); - } - - return 0; -} - -bool signal_connect(PyObject* source, const char* signal, PyObject* callback) +bool signalConnect(PyObject* source, const char* signal, PyObject* callback) { Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source, "connect")); if (pyMethod.isNull()) @@ -461,71 +522,11 @@ bool signal_connect(PyObject* source, const char* signal, PyObject* callback) return PyObject_CallObject(pyMethod, pyArgs); } -PyObject* signal_instance_disconnect(PyObject* self, PyObject* args) -{ - SignalInstanceData *source = reinterpret_cast(self); - Shiboken::AutoDecRef pyArgs(PyList_New(0)); - - PyObject *slot; - if PyTuple_Check(args) - slot = PyTuple_GET_ITEM(args, 0); - else - slot = args; - - bool match = false; - if (slot->ob_type == &SignalInstance_Type) { - SignalInstanceData *target = reinterpret_cast(slot); - if (QMetaObject::checkConnectArgs(source->signature, target->signature)) { - PyList_Append(pyArgs, source->source); - Shiboken::AutoDecRef source_signature(signal_build_qt_compatible(source->signature)); - PyList_Append(pyArgs, source_signature); - - PyList_Append(pyArgs, target->source); - Shiboken::AutoDecRef target_signature(signal_build_qt_compatible(target->signature)); - PyList_Append(pyArgs, target_signature); - match = true; - } - } else { - //try the first signature - PyList_Append(pyArgs, source->source); - Shiboken::AutoDecRef signature(signal_build_qt_compatible(source->signature)); - PyList_Append(pyArgs, signature); - - PyList_Append(pyArgs, slot); - match = true; - } - - if (match) { - Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); - Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "disconnect")); - return PyObject_CallObject(pyMethod, tupleArgs); - } - - return 0; -} - -PyObject* signal_instance_emit(PyObject* self, PyObject* args) -{ - SignalInstanceData *source = reinterpret_cast(self); - - Shiboken::AutoDecRef pyArgs(PyList_New(0)); - Shiboken::AutoDecRef source_signature(signal_build_qt_compatible(source->signature)); - - PyList_Append(pyArgs, source_signature); - for(Py_ssize_t i=0, i_max=PyTuple_Size(args); i < i_max; i++) - PyList_Append(pyArgs, PyTuple_GetItem(args, i)); - - Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->source, "emit")); - - Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); - return PyObject_CallObject(pyMethod, tupleArgs); -} - PyObject* signalNew(const char* name, ...) { va_list listSignatures; char* sig = 0; - SignalData* self = PyObject_New(SignalData, &Signal_Type); + SignalData* self = PyObject_New(SignalData, &PySideSignalType); self->signalName = strdup(name); self->signaturesSize = 0; self->signatures = 0; @@ -535,7 +536,7 @@ PyObject* signalNew(const char* name, ...) sig = va_arg(listSignatures, char*); while(sig != NULL) { - signal_append_signature(self, strdup(sig)); + signalAppendSignature(self, strdup(sig)); sig = va_arg(listSignatures, char*); } @@ -545,7 +546,7 @@ PyObject* signalNew(const char* name, ...) } -PyObject* signal_build_qt_compatible(const char* signature) +PyObject* signalBuildQtCompatible(const char* signature) { char* qtSignature; qtSignature = reinterpret_cast(malloc(strlen(signature)+2)); diff --git a/libpyside/qsignal.h b/libpyside/qsignal.h index 54fa8f0..6177496 100644 --- a/libpyside/qsignal.h +++ b/libpyside/qsignal.h @@ -27,28 +27,25 @@ #include #include +extern "C" +{ + extern PYSIDE_API PyTypeObject PySideSignalInstanceType; + + struct PySideSignalInstanceData + { + PyObject_HEAD + char* signalName; + char* signature; + PyObject* source; + PyObject* next; + }; +}; //extern "C" + namespace PySide { -struct SignalInstanceData -{ - PyObject_HEAD - char* signalName; - char* signature; - PyObject* source; - PyObject* next; -}; - - -extern "C" -{ - extern PYSIDE_API PyTypeObject Signal_Type; - extern PYSIDE_API PyTypeObject SignalInstance_Type; -}; //extern "C" - PYSIDE_API PyObject* signalNew(const char* name, ...); PYSIDE_API void signalUpdateSource(PyObject* source); -PYSIDE_API bool signal_connect(PyObject* source, const char* signal, PyObject* callback); } //namespace PySide diff --git a/libpyside/qsignal_p.h b/libpyside/qsignal_p.h new file mode 100644 index 0000000..7858011 --- /dev/null +++ b/libpyside/qsignal_p.h @@ -0,0 +1,40 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PYSIDE_QSIGNAL_P_H +#define PYSIDE_QSIGNAL_P_H + +#include + +extern "C" +{ + extern PyTypeObject PySideSignalType; +}; //extern "C" + +namespace PySide +{ + bool signalConnect(PyObject* source, const char* signal, PyObject* callback); + char* getTypeName(PyObject*); + void initSignalSupport(PyObject* module); +} //namespace PySide + +#endif diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp index 273de27..762f85f 100644 --- a/libpyside/qslot.cpp +++ b/libpyside/qslot.cpp @@ -21,9 +21,9 @@ */ #include -#include "dynamicqmetaobject_p.h" - #include +#include "dynamicqmetaobject_p.h" +#include "qsignal_p.h" #define SLOT_DEC_NAME "Slot" @@ -41,10 +41,6 @@ extern "C" static int slot_init(PyObject*, PyObject*, PyObject*); static PyObject* slot_call(PyObject*, PyObject*, PyObject*); -//external qsignal.cpp -extern char* get_type_name(PyObject*); - - // Class Definition ----------------------------------------------- static PyTypeObject Slot_Type = { PyObject_HEAD_INIT(NULL) @@ -124,7 +120,7 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw) SlotData *data = reinterpret_cast(self); for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) { PyObject *argType = PyTuple_GET_ITEM(args, i); - char *typeName = get_type_name(argType); + char *typeName = PySide::getTypeName(argType); if (typeName) { if (data->args) { data->args = reinterpret_cast(realloc(data->args, (strlen(data->args) + 1 + strlen(typeName)) * sizeof(char*))); @@ -141,7 +137,7 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw) data->slotName = strdup(argName); if (argResult) - data->resultType = get_type_name(argResult); + data->resultType = PySide::getTypeName(argResult); else data->resultType = strdup("void"); From 740137e51a4c506d03e4de1ab53e418dfab1c8c0 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 18:29:05 -0300 Subject: [PATCH 087/913] Rename some slot internal functions and structures and remove C linkage from init_slot function. --- libpyside/pyside.cpp | 15 +++++++-------- libpyside/qslot.cpp | 41 ++++++++++++++++++++++------------------- libpyside/qslot_p.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 libpyside/qslot_p.h diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 3cc1fd4..30a5e26 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -22,18 +22,17 @@ #include "pyside.h" -#include "signalmanager.h" -#include "qproperty_p.h" -#include "qproperty.h" -#include "qsignal.h" -#include "qsignal_p.h" #include #include #include #include #include - -extern "C" void init_slot(PyObject* module); +#include "signalmanager.h" +#include "qproperty_p.h" +#include "qproperty.h" +#include "qsignal.h" +#include "qsignal_p.h" +#include "qslot_p.h" static QStack cleanupFunctionList; @@ -43,7 +42,7 @@ namespace PySide void init(PyObject *module) { initSignalSupport(module); - init_slot(module); + initSlotSupport(module); initQProperty(module); // Init signal manager, so it will register some meta types used by QVariant. SignalManager::instance(); diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp index 762f85f..5aab654 100644 --- a/libpyside/qslot.cpp +++ b/libpyside/qslot.cpp @@ -38,11 +38,11 @@ typedef struct extern "C" { -static int slot_init(PyObject*, PyObject*, PyObject*); -static PyObject* slot_call(PyObject*, PyObject*, PyObject*); +static int slotTpInit(PyObject*, PyObject*, PyObject*); +static PyObject* slotCall(PyObject*, PyObject*, PyObject*); // Class Definition ----------------------------------------------- -static PyTypeObject Slot_Type = { +static PyTypeObject PySideSlotType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "PySide.QtCore."SLOT_DEC_NAME, /*tp_name*/ @@ -58,7 +58,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ - slot_call, /*tp_call*/ + slotCall, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ @@ -79,7 +79,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - (initproc)slot_init, /*tp_init */ + slotTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ 0, /*tp_free */ @@ -92,19 +92,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_del */ }; -void init_slot(PyObject *module) -{ - if (PyType_Ready(&Slot_Type) < 0) - return; - - Py_INCREF(&Slot_Type); - PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&Slot_Type)); -} - - -} // extern "C" - -int slot_init(PyObject *self, PyObject *args, PyObject *kw) +int slotTpInit(PyObject *self, PyObject *args, PyObject *kw) { static PyObject *emptyTuple = 0; static const char *kwlist[] = {"name", "result", 0}; @@ -144,7 +132,7 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw) return 1; } -PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw) +PyObject* slotCall(PyObject* self, PyObject* args, PyObject* kw) { static PyObject* pySlotName = 0; PyObject* callback; @@ -190,3 +178,18 @@ PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw) return callback; } +} // extern "C" + +namespace PySide +{ + +void initSlotSupport(PyObject* module) +{ + if (PyType_Ready(&PySideSlotType) < 0) + return; + + Py_INCREF(&PySideSlotType); + PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&PySideSlotType)); +} + +} // namespace PySide diff --git a/libpyside/qslot_p.h b/libpyside/qslot_p.h new file mode 100644 index 0000000..56152a1 --- /dev/null +++ b/libpyside/qslot_p.h @@ -0,0 +1,32 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef PYSIDE_SLOT_P_H +#define PYSIDE_SLOT_P_H + +#include + +namespace PySide +{ + void initSlotSupport(PyObject* module); +} + +#endif From 54618cdad9d007023051e8ecad4d7228c16613ad Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 18:33:16 -0300 Subject: [PATCH 088/913] Turn call_method function into an anonimous function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Luciano Wolf --- libpyside/signalmanager.cpp | 6 ++++-- libpyside/signalmanager.h | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 3f0a0a5..c0ce568 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -48,6 +48,8 @@ namespace PySide { +static int callMethod(QObject* object, int id, void** args); + PyObjectWrapper::PyObjectWrapper() :m_me(Py_None) { @@ -412,7 +414,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, break; #endif case QMetaObject::InvokeMetaMethod: - id = call_method(object, id, args); + id = callMethod(object, id, args); break; default: @@ -429,7 +431,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, return id; } -int SignalManager::call_method(QObject* object, int id, void** args) +static int PySide::callMethod(QObject* object, int id, void** args) { const QMetaObject* metaObject = object->metaObject(); QMetaMethod method = metaObject->method(id); diff --git a/libpyside/signalmanager.h b/libpyside/signalmanager.h index 53e5f6e..2fda008 100644 --- a/libpyside/signalmanager.h +++ b/libpyside/signalmanager.h @@ -82,8 +82,6 @@ private: // disable copy SignalManager(const SignalManager&); SignalManager operator=(const SignalManager&); - - static int call_method(QObject* object, int id, void** args); }; } From 42516e6f864c2beb912c593f6198ab394a5a243f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 7 Oct 2010 11:48:39 -0300 Subject: [PATCH 089/913] Version bump. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76d12a2..d88c2a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,9 +66,9 @@ if(AVOID_PROTECTED_HACK OR WIN32) endif() set(BINDING_NAME PySide) -set(BINDING_API_MAJOR_VERSION "0") -set(BINDING_API_MINOR_VERSION "4") -set(BINDING_API_MICRO_VERSION "1") +set(BINDING_API_MAJOR_VERSION "1") +set(BINDING_API_MINOR_VERSION "0") +set(BINDING_API_MICRO_VERSION "0") set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) set(PYSIDE_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" CACHE STRING "Qt version used to compile PySide" FORCE) if(ENABLE_VERSION_SUFFIX) From e75b82fdf6e9903e7264a1bc962ab7ed42c53bcd Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 6 Oct 2010 18:53:39 -0300 Subject: [PATCH 090/913] Created unittest for widgets defined in Python and used during QUiLoader.loader function. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtUiTools/bug_392.py | 23 ++++++++++++-- tests/QtUiTools/customwidget.ui | 51 +++++++++++++++++++++++++++++++ tests/QtUiTools/pycustomwidget.ui | 36 ++++++++++++++++++++++ 3 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 tests/QtUiTools/customwidget.ui create mode 100644 tests/QtUiTools/pycustomwidget.ui diff --git a/tests/QtUiTools/bug_392.py b/tests/QtUiTools/bug_392.py index 5717d45..36b2f10 100644 --- a/tests/QtUiTools/bug_392.py +++ b/tests/QtUiTools/bug_392.py @@ -5,6 +5,13 @@ from helper import UsesQApplication from PySide import QtCore, QtGui, QtDeclarative from PySide.QtUiTools import QUiLoader +class MyWidget(QtGui.QComboBox): + def __init__(self, parent=None): + QtGui.QComboBox.__init__(self, parent) + + def isPython(self): + return True + class BugTest(UsesQApplication): def testCase(self): w = QtGui.QWidget() @@ -12,7 +19,7 @@ class BugTest(UsesQApplication): filePath = os.path.join(os.path.dirname(__file__), 'action.ui') result = loader.load(filePath, w) - self.assertEqual(type(result.statusbar.actionFoo), QtGui.QAction) + self.assert_(isinstance(result.statusbar.actionFoo, QtGui.QAction)) def testCustomWidgets(self): w = QtGui.QWidget() @@ -20,8 +27,18 @@ class BugTest(UsesQApplication): filePath = os.path.join(os.path.dirname(__file__), 'customwidget.ui') result = loader.load(filePath, w) - self.assert_(type(result.declarativeView), QtDeclarative.QDeclarativeView) - self.assert_(type(result.worldTimeClock), QtGui.QWidget) + self.assert_(isinstance(result.declarativeView, QtDeclarative.QDeclarativeView)) + self.assert_(isinstance(result.worldTimeClock, QtGui.QWidget)) + + def testPythonCustomWidgets(self): + w = QtGui.QWidget() + loader = QUiLoader() + loader.registerCustomWidget(MyWidget) + + filePath = os.path.join(os.path.dirname(__file__), 'pycustomwidget.ui') + result = loader.load(filePath, w) + self.assert_(isinstance(result.custom, MyWidget)) + self.assert_(result.custom.isPython()) if __name__ == '__main__': diff --git a/tests/QtUiTools/customwidget.ui b/tests/QtUiTools/customwidget.ui new file mode 100644 index 0000000..181ee60 --- /dev/null +++ b/tests/QtUiTools/customwidget.ui @@ -0,0 +1,51 @@ + + + qwidget + + + + 0 + 0 + 303 + 350 + + + + + + + + + 0 + 150 + 300 + 200 + + + + + + + 190 + 20 + 100 + 100 + + + + + + + QDeclarativeView + QGraphicsView +
QtDeclarative/QDeclarativeView
+
+ + WorldTimeClock + QWidget +
worldtimeclock.h
+
+
+ + +
diff --git a/tests/QtUiTools/pycustomwidget.ui b/tests/QtUiTools/pycustomwidget.ui new file mode 100644 index 0000000..c066153 --- /dev/null +++ b/tests/QtUiTools/pycustomwidget.ui @@ -0,0 +1,36 @@ + + + qwidget + + + + 0 + 0 + 400 + 300 + + + + + + + + + 10 + 10 + 79 + 23 + + + + + + + MyWidget + QComboBox +
customwidget
+
+
+ + +
From 83533ddc5d89feb046863b4dacc86be3967e4a6b Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 6 Oct 2010 18:54:51 -0300 Subject: [PATCH 091/913] Used proxy object in QUiLoader loaded widget to avoid cyclic reference. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtUiTools/glue/uitools_loadui.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PySide/QtUiTools/glue/uitools_loadui.h b/PySide/QtUiTools/glue/uitools_loadui.h index bce1367..5729b5f 100644 --- a/PySide/QtUiTools/glue/uitools_loadui.h +++ b/PySide/QtUiTools/glue/uitools_loadui.h @@ -18,7 +18,7 @@ _populate_parent(PyObject* pyParent, QObject *parent) bool has_attr = PyObject_HasAttrString(pyParent, qPrintable(name)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(child)); if (!has_attr) - PyObject_SetAttrString(pyParent, qPrintable(name), pyChild); + PyObject_SetAttrString(pyParent, qPrintable(name), PyWeakref_NewProxy(pyChild, 0)); Shiboken::setParent(pyParent, pyChild); _populate_parent(pyChild, qobject_cast(child)); @@ -53,14 +53,17 @@ quiloader_load_ui(QUiLoader* self, const QString &ui_file, QWidget *parent) QWidget* w = self->load(&fd, parent); fd.close(); if (w != 0) { - PyObject* pyParent = Shiboken::Converter::toPython(w); + QObject *_parent = parent; + if (!_parent) + _parent = w; + Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(_parent)); if (parent && parent->layout()) parent->layout()->deleteLater(); - _populate_parent(pyParent, w); + _populate_parent(pyParent, _parent); - return pyParent; + return Shiboken::Converter::toPython(w); } } PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file"); From 24cbdd8dfa3cd01184d0dae297c15547d4962293 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 6 Oct 2010 18:55:42 -0300 Subject: [PATCH 092/913] Created uiloader plugin used to register new types before QUiLoader. This is used to register a new python type which can be used in ui description files. Reviewer: Hugo Parente Lima Luciano Wolf --- CMakeLists.txt | 1 + PySide/CMakeLists.txt | 1 + PySide/QtUiTools/CMakeLists.txt | 5 + PySide/QtUiTools/glue/plugins.h | 47 +++++++++ PySide/QtUiTools/typesystem_uitools.xml | 12 +++ plugins/CMakeLists.txt | 29 ++++++ plugins/customwidget.cpp | 131 ++++++++++++++++++++++++ plugins/customwidget.h | 58 +++++++++++ plugins/customwidgets.cpp | 67 ++++++++++++ plugins/customwidgets.h | 50 +++++++++ 10 files changed, 401 insertions(+) create mode 100644 PySide/QtUiTools/glue/plugins.h create mode 100644 plugins/CMakeLists.txt create mode 100644 plugins/customwidget.cpp create mode 100644 plugins/customwidget.h create mode 100644 plugins/customwidgets.cpp create mode 100644 plugins/customwidgets.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 76d12a2..e7091b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,7 @@ set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic enable_testing() add_subdirectory(libpyside) +add_subdirectory(plugins) # project directories add_subdirectory(PySide) add_subdirectory(tests) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 05191e3..4e1f45a 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -172,6 +172,7 @@ if (NOT QT_QTDECLARATIVE_FOUND AND ${QTVERSION} VERSION_GREATER 4.6.0) endif() endif () + HAS_QT_MODULE(QT_QTCORE_FOUND QtCore) HAS_QT_MODULE(QT_QTGUI_FOUND QtGui) HAS_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork) diff --git a/PySide/QtUiTools/CMakeLists.txt b/PySide/QtUiTools/CMakeLists.txt index 9922e9d..4054ffc 100644 --- a/PySide/QtUiTools/CMakeLists.txt +++ b/PySide/QtUiTools/CMakeLists.txt @@ -10,18 +10,22 @@ set(QtUiTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR} + ${QT_QTDESIGNER_INCLUDE_DIR} ${QT_QTUITOOLS_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} ${SHIBOKEN_INCLUDE_DIR} ${libpyside_SOURCE_DIR} + ${plugins_SOURCE_DIR} ${QtCore_BINARY_DIR}/PySide/QtCore/ ${QtXml_BINARY_DIR}/PySide/QtXml/ ${QtGui_BINARY_DIR}/PySide/QtGui/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools) set(QtUiTools_libraries pyside + uiplugin ${PYSIDE_PYTHON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} + ${QT_QTDESIGNER_LIBRARY} ${QT_QTUITOOLS_LIBRARY}) set(QtUiTools_deps QtGui QtXml) create_pyside_module(QtUiTools @@ -31,3 +35,4 @@ create_pyside_module(QtUiTools QtUiTools_typesystem_path QtUiTools_SRC "") + diff --git a/PySide/QtUiTools/glue/plugins.h b/PySide/QtUiTools/glue/plugins.h new file mode 100644 index 0000000..09070bf --- /dev/null +++ b/PySide/QtUiTools/glue/plugins.h @@ -0,0 +1,47 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _PLUGIN_H_ +#define _PLUGIN_H_ + +#include +#include "customwidgets.h" + +inline void registerCustomWidget(PyObject* obj) +{ + static PyCustomWidgets* plugin = 0; + + if (plugin == 0) { + foreach(QObject* o, QPluginLoader::staticInstances()) { + plugin = qobject_cast(o); + if (o) + break; + } + } + + if (!plugin) + qDebug() << "Fail to load uiloader plugin"; + else + plugin->registerWidgetType(obj); +} + +#endif diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml index a188aa3..0abc695 100644 --- a/PySide/QtUiTools/typesystem_uitools.xml +++ b/PySide/QtUiTools/typesystem_uitools.xml @@ -23,6 +23,18 @@ + + + + + Q_IMPORT_PLUGIN(uiplugin); + + + + registerCustomWidget(%PYARG_1); + %CPPSELF.addPluginPath(""); // force reload widgets + + diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt new file mode 100644 index 0000000..a9a1e81 --- /dev/null +++ b/plugins/CMakeLists.txt @@ -0,0 +1,29 @@ +project(plugins) + +set(ui_plugin_src + customwidgets.cpp + customwidget.cpp +) + +set (ui_plugin_moc + customwidget.h + customwidgets.h +) + +QT4_WRAP_CPP(MOC_FILES ${ui_plugin_moc}) +include_directories(${QT_QTDESIGNER_INCLUDE_DIR} + ${SHIBOKEN_INCLUDE_DIR} + ${PYTHON_INCLUDE_DIR}) + +add_library(uiplugin STATIC ${ui_plugin_src} ${MOC_FILES}) +add_definitions(-fPIC) +add_definitions(-DQT_STATICPLUGIN) +target_link_libraries(uiplugin + ${QT_QTDESIGNER_LIBRARY} + ${SHIBOKEN_LIBRARY} + ${PYTHON_LIBRARY}) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_DEBUG_POSTFIX}) +else() + set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_RELEASE_POSTFIX}) +endif() diff --git a/plugins/customwidget.cpp b/plugins/customwidget.cpp new file mode 100644 index 0000000..78e0064 --- /dev/null +++ b/plugins/customwidget.cpp @@ -0,0 +1,131 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "customwidget.h" + +#include + +struct PyCustomWidgetPrivate +{ + PyObject* pyObject; + bool initialized; +}; + +PyCustomWidget::PyCustomWidget(PyObject* objectType) + : m_data(new PyCustomWidgetPrivate()) +{ + m_data->pyObject = objectType; +} + +PyCustomWidget::~PyCustomWidget() +{ +} + +bool PyCustomWidget::isContainer() const +{ + return false; +} + +bool PyCustomWidget::isInitialized() const +{ + return m_data->initialized; +} + +QIcon PyCustomWidget::icon() const +{ + return QIcon(); +} + +QString PyCustomWidget::domXml() const +{ + return QString(); +} + +QString PyCustomWidget::group() const +{ + return QString(); +} + +QString PyCustomWidget::includeFile() const +{ + return QString(); +} + +QString PyCustomWidget::name() const +{ + static QString objectName; + if (objectName.isEmpty()) { + objectName = QString(reinterpret_cast(m_data->pyObject)->tp_name); + } + return objectName; +} + +QString PyCustomWidget::toolTip() const +{ + return QString(); +} + +QString PyCustomWidget::whatsThis() const +{ + return QString(); +} + +QWidget *PyCustomWidget::createWidget(QWidget *parent) +{ + //Create a python instance and return cpp object + PyObject* pyParent; + bool unkowParent = false; + if (parent) { + pyParent = Shiboken::BindingManager::instance().retrieveWrapper(parent); + if (!pyParent) { + pyParent = Shiboken::Converter::toPython(parent); + unkowParent = true; + } + } else { + pyParent = Py_None; + } + + Shiboken::AutoDecRef pyArgs(PyTuple_New(1)); + PyTuple_SET_ITEM(pyArgs, 0, pyParent); //tuple will keep pyParent reference + + //Call python constructor + PyObject* result = PyObject_CallObject(m_data->pyObject, pyArgs); + + QWidget* widget = 0; + if (result) { + if (unkowParent) //if parent does not exists in python, transfer the ownership to cpp + Shiboken::BindingManager::instance().transferOwnershipToCpp(result); + else + Shiboken::setParent(pyParent, result); + + widget = reinterpret_cast(Shiboken::getCppPointer(result, result->ob_type)); + } + + return widget; +} + +void PyCustomWidget::initialize(QDesignerFormEditorInterface *core) +{ + m_data->initialized = true; +} + diff --git a/plugins/customwidget.h b/plugins/customwidget.h new file mode 100644 index 0000000..1c20477 --- /dev/null +++ b/plugins/customwidget.h @@ -0,0 +1,58 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _PY_CUSTOM_WIDGET_H_ +#define _PY_CUSTOM_WIDGET_H_ + +#include +#include +#include + +struct PyCustomWidgetPrivate; + +class PyCustomWidget: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) + +public: + PyCustomWidget(PyObject* objectType); + ~PyCustomWidget(); + + bool isContainer() const; + bool isInitialized() const; + QIcon icon() const; + QString domXml() const; + QString group() const; + QString includeFile() const; + QString name() const; + QString toolTip() const; + QString whatsThis() const; + QWidget *createWidget(QWidget *parent); + void initialize(QDesignerFormEditorInterface *core); + +private: + QScopedPointer m_data; + +}; + +#endif diff --git a/plugins/customwidgets.cpp b/plugins/customwidgets.cpp new file mode 100644 index 0000000..ac948e6 --- /dev/null +++ b/plugins/customwidgets.cpp @@ -0,0 +1,67 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "customwidgets.h" +#include "customwidget.h" + +#include + +struct PyCustomWidgetPrivate +{ + PyObject* pyObject; + bool initialized; +}; + +struct PyCustomWidgetsPrivate +{ + QList widgets; + ~PyCustomWidgetsPrivate(); +}; + + +PyCustomWidgetsPrivate::~PyCustomWidgetsPrivate() +{ + foreach(QDesignerCustomWidgetInterface* iface, widgets) + delete iface; + widgets.clear(); +} + +PyCustomWidgets::PyCustomWidgets(QObject *parent) + : QObject(parent), m_data(new PyCustomWidgetsPrivate) +{ +} + +PyCustomWidgets::~PyCustomWidgets() +{ +} + +void PyCustomWidgets::registerWidgetType(PyObject* widget) +{ + m_data->widgets.append(new PyCustomWidget(widget)); +} + +QList PyCustomWidgets::customWidgets() const +{ + return m_data->widgets; +} + +Q_EXPORT_STATIC_PLUGIN2(uiplugin, PyCustomWidgets) diff --git a/plugins/customwidgets.h b/plugins/customwidgets.h new file mode 100644 index 0000000..9a8428b --- /dev/null +++ b/plugins/customwidgets.h @@ -0,0 +1,50 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _PY_CUSTOM_WIDGETS_H_ +#define _PY_CUSTOM_WIDGETS_H_ + +#include + +#include +#include +#include +#include + +struct PyCustomWidgetsPrivate; + +class PyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) + +public: + PyCustomWidgets(QObject *parent = 0); + ~PyCustomWidgets(); + virtual QList customWidgets() const; + void registerWidgetType(PyObject* widget); + +private: + QScopedPointer m_data; +}; + +#endif From 3c7f55855b45168818ef6fc5e58b30f1c7e4d133 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 7 Oct 2010 12:15:11 -0300 Subject: [PATCH 093/913] Moved cmake macros to a separeted file. Reviewer: Hugo Parente Lima Luciano Wolf --- CMakeLists.txt | 4 +- PySide/CMakeLists.txt | 161 +----------------------- cmake/Macros/FindQt4Extra.cmake | 54 ++++++++ cmake/Macros/PySideModules.cmake | 112 +++++++++++++++++ icecc.cmake => cmake/Macros/icecc.cmake | 0 5 files changed, 170 insertions(+), 161 deletions(-) create mode 100644 cmake/Macros/FindQt4Extra.cmake create mode 100644 cmake/Macros/PySideModules.cmake rename icecc.cmake => cmake/Macros/icecc.cmake (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7091b9..db5ca01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,17 @@ -include(icecc.cmake) # this must be the first line! +include(cmake/Macros/icecc.cmake) # this must be the first line! project(pysidebindings) cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules/ + ${CMAKE_SOURCE_DIR}/cmake/Macros/ ${CMAKE_MODULE_PATH}) find_package(PythonLibs REQUIRED) find_package(PythonInterpWithDebug REQUIRED) find_package(GeneratorRunner 0.6 REQUIRED) find_package(Shiboken 0.5 REQUIRED) find_package(Qt4 4.5.0 REQUIRED) +include(FindQt4Extra) set(XVFB_EXEC "") option(USE_XVFB "Uses xvfb-run with the unit tests to avoid QtGui tests popping windows on the screen." FALSE) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 4e1f45a..c4aaf64 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -2,176 +2,17 @@ project(pyside) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" "${CMAKE_CURRENT_SOURCE_DIR}/private.py" DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}") -macro(create_pyside_module module_name module_include_dir module_libraries module_deps module_typesystem_path module_sources typesystem_name) - string(TOLOWER ${module_name} _module) - string(REGEX REPLACE ^qt "" _module ${_module}) - if (NOT EXISTS ${typesystem_name}) - set(typesystem_path ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${_module}.xml) - else() - set(typesystem_path ${typesystem_name}) - endif() - - add_custom_command(OUTPUT ${${module_sources}} - COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} - ${CMAKE_BINARY_DIR}/PySide/global.h - --include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR} - --typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}} - --output-directory=${CMAKE_CURRENT_BINARY_DIR} - --license-file=${CMAKE_CURRENT_SOURCE_DIR}/../licensecomment.txt - ${typesystem_path} - --api-version=${SUPPORTED_QT_VERSION} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Running generator for ${module_name}...") - - include_directories(${module_name} ${${module_include_dir}} ${pyside_SOURCE_DIR}) - add_library(${module_name} MODULE ${${module_sources}} ${${ARGN}}) - set_target_properties(${module_name} PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${pyside_BINARY_DIR}) - if(WIN32) - set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd") - set(${module_name}_suffix ".pyd") - else() - set(${module_name}_suffix ".so") - endif() - target_link_libraries(${module_name} ${${module_libraries}}) - if(${module_deps}) - add_dependencies(${module_name} ${${module_deps}}) - endif() - - - # install - install(TARGETS ${module_name} LIBRARY DESTINATION ${SITE_PACKAGE}/PySide) - string(TOLOWER ${module_name} lower_module_name) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module_name}/pyside_${lower_module_name}_python.h - DESTINATION include/PySide${pyside_SUFFIX}/${module_name}/) - file(GLOB typesystem_files ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_*.xml ${typesystem_path}) - install(FILES ${typesystem_files} DESTINATION share/PySide${pyside_SUFFIX}/typesystems) -endmacro() - -#macro(check_qt_class_with_namespace module namespace class global_sources [namespace]) -macro(check_qt_class module class global_sources) - if (${ARGC} GREATER 3) - set (namespace ${ARGV3}) - string(TOLOWER ${namespace} _namespace) - else () - set (namespace "") - endif () - if (${ARGC} GREATER 4) - set (include_file ${ARGV4}) - else () - set (include_file ${module}) - endif () - string(TOLOWER ${class} _class) - string(TOUPPER ${module} _module) - if (${namespace}) - set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp) - else () - set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) - endif () - if (DEFINED PYSIDE_${class}) - if (PYSIDE_${class}) - list(APPEND ${global_sources} ${_cppfile}) - endif() - else() - if (NOT ${namespace} STREQUAL "" ) - set (NAMESPACE_USE "using namespace ${namespace};") - else () - set (NAMESPACE_USE "") - endif () - set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx) - file(WRITE ${SRC_FILE} - "#include <${include_file}>\n" - "#include \n" - "${NAMESPACE_USE}\n" - "int main() { typeid(${class}); }\n" - ) - try_compile(Q_WORKS ${CMAKE_BINARY_DIR} - ${SRC_FILE} - CMAKE_FLAGS - "-DLINK_LIBRARIES=${QT_${_module}_LIBRARY}" - "-DLINK_DIRECTORIES=${QT_LIBRARY_DIR}" - "-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${QT_${_module}_INCLUDE_DIR}" - OUTPUT_VARIABLE OUTPUT) - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT}) - - set("PYSIDE_${class}" ${Q_WORKS} CACHE STRING "Has ${class} class been found?") - if(Q_WORKS) - message(STATUS "Checking for ${class} in ${module} -- found") - list(APPEND ${global_sources} ${_cppfile}) - else() - message(STATUS "Checking for ${class} in ${module} -- not found") - endif() - endif() -endmacro() +include(PySideModules) # Configure include based on platform configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY) -# Only add subdirectory if the associated Qt module is found. -macro(HAS_QT_MODULE var name) - if (NOT DISABLE_${name} AND ${var}) - add_subdirectory(${name}) - else() - set("if_${name}" "" PARENT_SCOPE) - endif() -endmacro() - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" "${CMAKE_BINARY_DIR}/PySide/__init__.py") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py" "${CMAKE_BINARY_DIR}/PySide/private.py") -# -# Try to find QtMultimedia -# TODO: Remove this hack when cmake support QtMultimedia module -if (NOT QT_QTMULTIMEDIA_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) - find_path(QT_QTMULTIMEDIA_INCLUDE_DIR QtMultimedia - PATHS ${QT_HEADERS_DIR}/QtMultimedia - ${QT_LIBRARY_DIR}/QtMultimedia.framework/Headers - NO_DEFAULT_PATH) - find_library(QT_QTMULTIMEDIA_LIBRARY QtMultimedia PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - if (QT_QTMULTIMEDIA_INCLUDE_DIR AND QT_QTMULTIMEDIA_LIBRARY) - set(QT_QTMULTIMEDIA_FOUND ON) - else() - set(if_QtMultimedia "" PARENT_SCOPE) - endif() -endif () - -# Try to find QtMaemo5 - it has to be done before QtGui to enable some QtMaemo5 flags -# TODO: Remove this hack when cmake support QtMaemo5 module -if (NOT QT_QTMAEMO5_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) - find_path(QT_QTMAEMO5_INCLUDE_DIR QtMaemo5 - PATHS ${QT_HEADERS_DIR}/QtMaemo5 - ${QT_LIBRARY_DIR}/QtMaemo5.framework/Headers - NO_DEFAULT_PATH) - find_library(QT_QTMAEMO5_LIBRARY QtMaemo5 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - if (QT_QTMAEMO5_INCLUDE_DIR AND QT_QTMAEMO5_LIBRARY) - set(QT_QTMAEMO5_FOUND ON) - set(Q_WS_MAEMO_5 ON) - else() - set(if_Maemo5 "" PARENT_SCOPE) - endif() -endif () - -# Try to find QtDeclarative -# TODO: Remove this hack when cmake support QtDeclarative module -if (NOT QT_QTDECLARATIVE_FOUND AND ${QTVERSION} VERSION_GREATER 4.6.0) - find_path(QT_QTDECLARATIVE_INCLUDE_DIR QtDeclarative - PATHS ${QT_HEADERS_DIR}/QtDeclarative - ${QT_LIBRARY_DIR}/QtDeclarative.framework/Headers - NO_DEFAULT_PATH) - find_library(QT_QTDECLARATIVE_LIBRARY QtDeclarative PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - if (QT_QTDECLARATIVE_INCLUDE_DIR AND QT_QTDECLARATIVE_LIBRARY) - set(QT_QTDECLARATIVE_FOUND ON) - else() - set(if_QtDeclarative "" PARENT_SCOPE) - endif() -endif () - HAS_QT_MODULE(QT_QTCORE_FOUND QtCore) HAS_QT_MODULE(QT_QTGUI_FOUND QtGui) diff --git a/cmake/Macros/FindQt4Extra.cmake b/cmake/Macros/FindQt4Extra.cmake new file mode 100644 index 0000000..dc7e5c4 --- /dev/null +++ b/cmake/Macros/FindQt4Extra.cmake @@ -0,0 +1,54 @@ +# +# Try to find QtMultimedia +# TODO: Remove this hack when cmake support QtMultimedia module +if (NOT QT_QTMULTIMEDIA_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) + find_path(QT_QTMULTIMEDIA_INCLUDE_DIR QtMultimedia + PATHS ${QT_HEADERS_DIR}/QtMultimedia + ${QT_LIBRARY_DIR}/QtMultimedia.framework/Headers + NO_DEFAULT_PATH) + find_library(QT_QTMULTIMEDIA_LIBRARY QtMultimedia PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + if (QT_QTMULTIMEDIA_INCLUDE_DIR AND QT_QTMULTIMEDIA_LIBRARY) + set(QT_QTMULTIMEDIA_FOUND ON) + else() + #Replace this on documentation + set(if_QtMultimedia "") + endif() +endif () + +# Try to find QtMaemo5 - it has to be done before QtGui to enable some QtMaemo5 flags +# TODO: Remove this hack when cmake support QtMaemo5 module +if (NOT QT_QTMAEMO5_FOUND AND ${QTVERSION} VERSION_GREATER 4.5.9) + find_path(QT_QTMAEMO5_INCLUDE_DIR QtMaemo5 + PATHS ${QT_HEADERS_DIR}/QtMaemo5 + ${QT_LIBRARY_DIR}/QtMaemo5.framework/Headers + NO_DEFAULT_PATH) + find_library(QT_QTMAEMO5_LIBRARY QtMaemo5 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + if (QT_QTMAEMO5_INCLUDE_DIR AND QT_QTMAEMO5_LIBRARY) + set(QT_QTMAEMO5_FOUND ON) + set(Q_WS_MAEMO_5 ON) + else() + #Replace this on documentation + set(if_Maemo5 "") + endif() +endif () + +# Try to find QtDeclarative +# TODO: Remove this hack when cmake support QtDeclarative module +if (NOT QT_QTDECLARATIVE_FOUND AND ${QTVERSION} VERSION_GREATER 4.6.0) + find_path(QT_QTDECLARATIVE_INCLUDE_DIR QtDeclarative + PATHS ${QT_HEADERS_DIR}/QtDeclarative + ${QT_LIBRARY_DIR}/QtDeclarative.framework/Headers + NO_DEFAULT_PATH) + find_library(QT_QTDECLARATIVE_LIBRARY QtDeclarative PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + if (QT_QTDECLARATIVE_INCLUDE_DIR AND QT_QTDECLARATIVE_LIBRARY) + set(QT_QTDECLARATIVE_FOUND ON) + else() + #Replace this on documentation + set(if_QtDeclarative "") + endif() +endif () + + diff --git a/cmake/Macros/PySideModules.cmake b/cmake/Macros/PySideModules.cmake new file mode 100644 index 0000000..639a0ab --- /dev/null +++ b/cmake/Macros/PySideModules.cmake @@ -0,0 +1,112 @@ +macro(create_pyside_module module_name module_include_dir module_libraries module_deps module_typesystem_path module_sources typesystem_name) + string(TOLOWER ${module_name} _module) + string(REGEX REPLACE ^qt "" _module ${_module}) + if (NOT EXISTS ${typesystem_name}) + set(typesystem_path ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${_module}.xml) + else() + set(typesystem_path ${typesystem_name}) + endif() + + add_custom_command(OUTPUT ${${module_sources}} + COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} + ${CMAKE_BINARY_DIR}/PySide/global.h + --include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR} + --typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}} + --output-directory=${CMAKE_CURRENT_BINARY_DIR} + --license-file=${CMAKE_CURRENT_SOURCE_DIR}/../licensecomment.txt + ${typesystem_path} + --api-version=${SUPPORTED_QT_VERSION} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Running generator for ${module_name}...") + + include_directories(${module_name} ${${module_include_dir}} ${pyside_SOURCE_DIR}) + add_library(${module_name} MODULE ${${module_sources}} ${${ARGN}}) + set_target_properties(${module_name} PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${pyside_BINARY_DIR}) + if(WIN32) + set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd") + set(${module_name}_suffix ".pyd") + else() + set(${module_name}_suffix ".so") + endif() + target_link_libraries(${module_name} ${${module_libraries}}) + if(${module_deps}) + add_dependencies(${module_name} ${${module_deps}}) + endif() + + + # install + install(TARGETS ${module_name} LIBRARY DESTINATION ${SITE_PACKAGE}/PySide) + string(TOLOWER ${module_name} lower_module_name) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module_name}/pyside_${lower_module_name}_python.h + DESTINATION include/PySide${pyside_SUFFIX}/${module_name}/) + file(GLOB typesystem_files ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_*.xml ${typesystem_path}) + install(FILES ${typesystem_files} DESTINATION share/PySide${pyside_SUFFIX}/typesystems) +endmacro() + +#macro(check_qt_class_with_namespace module namespace class global_sources [namespace]) +macro(check_qt_class module class global_sources) + if (${ARGC} GREATER 3) + set (namespace ${ARGV3}) + string(TOLOWER ${namespace} _namespace) + else () + set (namespace "") + endif () + if (${ARGC} GREATER 4) + set (include_file ${ARGV4}) + else () + set (include_file ${module}) + endif () + string(TOLOWER ${class} _class) + string(TOUPPER ${module} _module) + if (${namespace}) + set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp) + else () + set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) + endif () + if (DEFINED PYSIDE_${class}) + if (PYSIDE_${class}) + list(APPEND ${global_sources} ${_cppfile}) + endif() + else() + if (NOT ${namespace} STREQUAL "" ) + set (NAMESPACE_USE "using namespace ${namespace};") + else () + set (NAMESPACE_USE "") + endif () + set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx) + file(WRITE ${SRC_FILE} + "#include <${include_file}>\n" + "#include \n" + "${NAMESPACE_USE}\n" + "int main() { typeid(${class}); }\n" + ) + try_compile(Q_WORKS ${CMAKE_BINARY_DIR} + ${SRC_FILE} + CMAKE_FLAGS + "-DLINK_LIBRARIES=${QT_${_module}_LIBRARY}" + "-DLINK_DIRECTORIES=${QT_LIBRARY_DIR}" + "-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${QT_${_module}_INCLUDE_DIR}" + OUTPUT_VARIABLE OUTPUT) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT}) + + set("PYSIDE_${class}" ${Q_WORKS} CACHE STRING "Has ${class} class been found?") + if(Q_WORKS) + message(STATUS "Checking for ${class} in ${module} -- found") + list(APPEND ${global_sources} ${_cppfile}) + else() + message(STATUS "Checking for ${class} in ${module} -- not found") + endif() + endif() +endmacro() + + +# Only add subdirectory if the associated Qt module is found. +macro(HAS_QT_MODULE var name) + if (NOT DISABLE_${name} AND ${var}) + add_subdirectory(${name}) + else() + # Used on documentation to skip modules + set("if_${name}" "" PARENT_SCOPE) + endif() +endmacro() diff --git a/icecc.cmake b/cmake/Macros/icecc.cmake similarity index 100% rename from icecc.cmake rename to cmake/Macros/icecc.cmake From 04180e1f1d9e5dc2b8e8e856f6fde0587074284a Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Wed, 6 Oct 2010 19:18:19 -0300 Subject: [PATCH 094/913] Add default name for QObject.findChild(type, name) Plus test. Should return a child of the given type. --- PySide/QtCore/typesystem_core.xml | 3 +++ tests/QtCore/qobject_parent_test.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 37decba..db7777e 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1165,6 +1165,9 @@ + + +
diff --git a/tests/QtCore/qobject_parent_test.py b/tests/QtCore/qobject_parent_test.py index 4699fc6..eb8cae2 100644 --- a/tests/QtCore/qobject_parent_test.py +++ b/tests/QtCore/qobject_parent_test.py @@ -71,6 +71,17 @@ class ParentCase(unittest.TestCase): for i, child in enumerate(children): self.assertEqual(child, parent.findChild(QObject, name % i)) + def testFindChildWithoutName(self): + parent = QObject() + name = 'object%d' + children = [QObject(parent) for i in range(20)] + + for i, child in enumerate(children): + child.setObjectName(name % i) + + child = parent.findChild(QObject) + self.assert_(isinstance(child, QObject)) + def testFindChildren(self): #QObject.findChildren() with all QObject parent = QObject() From 349bdc2bc53c36043c81222f6e83762c72a6c56f Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Thu, 7 Oct 2010 14:36:12 -0300 Subject: [PATCH 095/913] Add more test for operations with QFlags --- tests/QtCore/qflags_test.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/QtCore/qflags_test.py b/tests/QtCore/qflags_test.py index 3ecaa2f..8c088d6 100644 --- a/tests/QtCore/qflags_test.py +++ b/tests/QtCore/qflags_test.py @@ -56,11 +56,31 @@ class QFlagOperatorTest(unittest.TestCase): flag_type = (flags & Qt.WindowType_Mask) self.assertEqual(flag_type, Qt.Window) + def testOperatorBetweenFlags(self): + '''QFlags & QFlags''' + flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable + newflags = Qt.NoItemFlags | Qt.ItemIsUserCheckable + self.assert_(flags & newflags) + + def testOperatorDifferentOrder(self): + '''Different ordering of arguments''' + flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable + self.assertEqual(flags | Qt.ItemIsEnabled, Qt.ItemIsEnabled | flags) + class QFlagsOnQVariant(unittest.TestCase): def testQFlagsOnQVariant(self): o = QObject() o.setProperty("foo", QIODevice.ReadOnly | QIODevice.WriteOnly) self.assertEqual(type(o.property("foo")), int) +class QFlagsWrongType(unittest.TestCase): + def testWrongType(self): + '''Wrong type passed to QFlags binary operators''' + self.assertRaises(TypeError, lambda :Qt.NoItemFlags | '43') + self.assertRaises(TypeError, lambda :Qt.NoItemFlags & '43') + self.assertRaises(TypeError, lambda :'jabba' & Qt.NoItemFlags) + self.assertRaises(TypeError, lambda :'hut' & Qt.NoItemFlags) + self.assertRaises(TypeError, lambda :Qt.NoItemFlags & QObject()) + if __name__ == '__main__': unittest.main() From 8419414b80d9f933c8a3af4ee8fd0ea4aba3820b Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Thu, 7 Oct 2010 14:44:51 -0300 Subject: [PATCH 096/913] Reorder includes to avoid _POSIX_C_SOURCE warnings --- plugins/customwidget.h | 2 +- plugins/customwidgets.cpp | 2 +- plugins/customwidgets.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/customwidget.h b/plugins/customwidget.h index 1c20477..e4eb76d 100644 --- a/plugins/customwidget.h +++ b/plugins/customwidget.h @@ -23,9 +23,9 @@ #ifndef _PY_CUSTOM_WIDGET_H_ #define _PY_CUSTOM_WIDGET_H_ +#include #include #include -#include struct PyCustomWidgetPrivate; diff --git a/plugins/customwidgets.cpp b/plugins/customwidgets.cpp index ac948e6..c92b95c 100644 --- a/plugins/customwidgets.cpp +++ b/plugins/customwidgets.cpp @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "customwidgets.h" #include "customwidget.h" +#include "customwidgets.h" #include diff --git a/plugins/customwidgets.h b/plugins/customwidgets.h index 9a8428b..3cb0d2a 100644 --- a/plugins/customwidgets.h +++ b/plugins/customwidgets.h @@ -23,12 +23,12 @@ #ifndef _PY_CUSTOM_WIDGETS_H_ #define _PY_CUSTOM_WIDGETS_H_ +#include #include #include #include #include -#include struct PyCustomWidgetsPrivate; From 897dd874a34ddfc164ea7dbd4bfd5eaffd02aabd Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Thu, 7 Oct 2010 15:02:34 -0300 Subject: [PATCH 097/913] Replace type() comparison with isinstance. type() comparison won't work due to weakproxy. Reviewer: Luciano Wolf Reviewer: Hugo Lima Reviewer: Renato Filho --- tests/QtUiTools/bug_376.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QtUiTools/bug_376.py b/tests/QtUiTools/bug_376.py index 2bd6b5c..054a020 100644 --- a/tests/QtUiTools/bug_376.py +++ b/tests/QtUiTools/bug_376.py @@ -12,7 +12,7 @@ class BugTest(UsesQApplication): filePath = os.path.join(os.path.dirname(__file__), 'test.ui') result = loader.load(filePath, w) - self.assertEqual(type(result.child_object), QtGui.QFrame) + self.assert_(isinstance(result.child_object, QtGui.QFrame)) if __name__ == '__main__': unittest.main() From e8e8da9efdcb728dd1989d9274cbc22be22ae9c4 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 7 Oct 2010 15:12:57 -0300 Subject: [PATCH 098/913] Only compile QtUiLoader if QTDesigner was found. Reviewer: Hugo Parente Lima Luciano Wolf --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db5ca01..5613f52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,9 @@ set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic enable_testing() add_subdirectory(libpyside) -add_subdirectory(plugins) +if(QT_QTDESIGNER_FOUND) + add_subdirectory(plugins) +endif() # project directories add_subdirectory(PySide) add_subdirectory(tests) From ba54f0956e50c9a667ce160c69592d08ce514382 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Thu, 7 Oct 2010 16:51:12 -0300 Subject: [PATCH 099/913] Fixed python include var used in plugins project. Reviewer: Hugo Parente Lima Luciano Wolf --- plugins/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index a9a1e81..792d055 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -13,7 +13,7 @@ set (ui_plugin_moc QT4_WRAP_CPP(MOC_FILES ${ui_plugin_moc}) include_directories(${QT_QTDESIGNER_INCLUDE_DIR} ${SHIBOKEN_INCLUDE_DIR} - ${PYTHON_INCLUDE_DIR}) + ${PYTHON_INCLUDE_PATH}) add_library(uiplugin STATIC ${ui_plugin_src} ${MOC_FILES}) add_definitions(-fPIC) From 87c67294301eb53c67e949ff50b991afe24d80c0 Mon Sep 17 00:00:00 2001 From: Luciano Wolf Date: Fri, 8 Oct 2010 18:13:17 -0300 Subject: [PATCH 100/913] Updating documentation to reflect adoption of wikipages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo --- doc/_templates/index.html | 24 +--- doc/_themes/pysidedocs/modindex.html | 40 ++++++ doc/contents.rst | 5 - doc/dbus.rst | 30 ---- doc/generatingdocs.rst | 42 ------ doc/howto-build/cmake-primer.rst | 72 ---------- doc/howto-build/index.rst | 19 --- doc/howto-build/setup-apiextractor.rst | 52 ------- doc/howto-build/setup-bindings.rst | 82 ----------- doc/howto-build/setup-generator.rst | 50 ------- doc/howto-build/shiboken.rst | 54 ------- doc/issuesdiff.rst | 14 -- doc/newsigslot.rst | 187 ------------------------- doc/property.rst | 44 ------ 14 files changed, 41 insertions(+), 674 deletions(-) create mode 100644 doc/_themes/pysidedocs/modindex.html delete mode 100644 doc/dbus.rst delete mode 100644 doc/generatingdocs.rst delete mode 100644 doc/howto-build/cmake-primer.rst delete mode 100644 doc/howto-build/index.rst delete mode 100644 doc/howto-build/setup-apiextractor.rst delete mode 100644 doc/howto-build/setup-bindings.rst delete mode 100644 doc/howto-build/setup-generator.rst delete mode 100644 doc/howto-build/shiboken.rst delete mode 100644 doc/issuesdiff.rst delete mode 100644 doc/newsigslot.rst delete mode 100644 doc/property.rst diff --git a/doc/_templates/index.html b/doc/_templates/index.html index 8038bb1..c9d9c59 100644 --- a/doc/_templates/index.html +++ b/doc/_templates/index.html @@ -2,7 +2,7 @@ {% set title = 'Overview' %} {% block body %}
-

PySide {{ version }}

+

PySide {{ version }} Reference

Qt is a cross-platform application framework from Qt Software (owned by Nokia). It features a large number of libraries providing services like network abstraction and XML handling, along with a very rich @@ -11,28 +11,6 @@

PySide is built using the Shiboken binding generator.

-

Documentation

- - - -
- - - - - - - - - -
-

Modules

%*`jZ`yHF8WuCd7@sh#DZq~M24Kg)Muc@}K@W)+a&amoO|<@jG2HU5ouBiZy8%oY-VrDi%8vYwYQTKQ z?cYSn4tYVbuXQ#DHdj--lkGfybn4CA%Kz3oqH z=8Jn%qa(w8+?^MiPwHAKCrWe+`m)Q@nNofvyo()-dPVzA;Udp~N?~Vu#tq%fURXbH&~=UU%=UTczZ%36R*RH|x~y#60zMNEB?uCdfgXGel$@MJ6Om(~ zB|%R9_k2P;mt9O8Os&tDy)&HF<~+xyI3pD!;=(t@euZiO=wFD1HA|0Y0>}IZ9(J|1 zgw%^v%a?^0?&P#*Fs43F#KeKnd`gS@mh4Ts3$lYJL?oz8f|2JagEWKa#n?Yka-x>u zloMMJP-<88_~&%89C{`RXNNl_vk6 zoa_vXOt~(^ub$nG__M)qfpvh}ROppNkz9vLp5}dh29p5GOLo@IjqdEQeZS9veIca? zN7OZpF77-2H6TxLBk&L|0|@*oRtz&1?gFLOM*(m@e{Xj8n@*o?uUQBfKh(?9s8o)V zy(%s$n9F6wQhVxgFtBxdMRtB^qJ3zpN2L8#qk1hj#6n7*e-5=-nO-T<$WhRLziemXYBFP@rY0j1Ut@;HkZ%TH?%jmvFWJyAnN6KiueD~V8Y z^6iw9n|2R%eq(pXQpp6=AJP1+G9i~CffZul`N}E*u~2ur zWA(2Et0~11jXq3ALldUXrV?IKnvcvzrza=F61-xQqAt?@p>RSz#0LCL6a*u||47~B z57cWT}Qv)>2wvxLa4n7}GpWXZAx>>rX0wpILoLBhEMR%kH zl-Sg}b#55-nVncKJG^sU^xW~u@aGGb3Tr@$qE9gIaVhvKKo#U~jesCLH#7|iM6DrY zL-zyk!((BOJvdxo_Fh)PrX+*kT4HJ<3fqze!U*0Iwl`;Fq2vU%e!N&Woiv)&Ki+B6 z((^N}DzB8eFfr$SMr#Tp(KYT1q!1fw5;QMN1ARa*umU1T0~trf(d(oCiHnDnKAmxx zgD(^-FKh|!(i_ki^O$+FG`?=Pn|-9f^qGB+*F)r;RJuZz+H-AvL%QjtRlof= zmqQOlh#{AQ-i7)ii%?YX=H&c>71nYo@Clq4T-6H`l%ffVwI zM1|(iTSOCZ4%{W(pm@?=MXARsBs@q~Ojpdlmd{!;Q*pK~sA;V|xi=D;sCUoHtls=R Ga_~P Date: Thu, 6 Jan 2011 18:45:44 -0300 Subject: [PATCH 303/913] Fixes connecting signal to decorated slot. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decorated methods on classes derived from QObject are not called when connected to Qt signals because they get a name different from the decorated method. To solve this decorated methods are registered as global slots. An unit test was added. Reviewed by Hugo Parente Reviewed by Renato Araújo --- PySide/QtCore/glue/qobject_connect.cpp | 13 ++++++++- tests/pysidetest/CMakeLists.txt | 5 ++-- tests/pysidetest/decoratedslot_test.py | 39 ++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 tests/pysidetest/decoratedslot_test.py diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp index 91c830a..f6b0dce 100644 --- a/PySide/QtCore/glue/qobject_connect.cpp +++ b/PySide/QtCore/glue/qobject_connect.cpp @@ -1,9 +1,20 @@ +static bool isDecorator(PyObject* method, PyObject* self) +{ + Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__")); + if (!PyObject_HasAttr(self, methodName)) + return true; + Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName)); + return otherMethod.object() != method; +} + static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) { + bool forceGlobalReceiver = false; if (PyMethod_Check(callback)) { *self = PyMethod_GET_SELF(callback); if (Shiboken::Converter::checkType(*self)) *receiver = Shiboken::Converter::toCpp(*self); + forceGlobalReceiver = isDecorator(callback, *self); } else if (PyCFunction_Check(callback)) { *self = PyCFunction_GET_SELF(callback); if (*self && Shiboken::Converter::checkType(*self)) @@ -14,7 +25,7 @@ static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) *self = 0; } - bool usingGlobalReceiver = !*receiver; + bool usingGlobalReceiver = !*receiver || forceGlobalReceiver; if (usingGlobalReceiver) { PySide::SignalManager& signalManager = PySide::SignalManager::instance(); *receiver = signalManager.globalReceiver(); diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 4b94a2a..61ee424 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -72,9 +72,10 @@ target_link_libraries(testbinding add_dependencies(testbinding pyside QtCore QtGui libpyside pysidetest) -PYSIDE_TEST(homonymoussignalandmethod_test.py) +PYSIDE_TEST(decoratedslot_test.py) PYSIDE_TEST(delegatecreateseditor_test.py) +PYSIDE_TEST(homonymoussignalandmethod_test.py) +PYSIDE_TEST(list_signal_test.py) PYSIDE_TEST(modelview_test.py) PYSIDE_TEST(version_test.py) -PYSIDE_TEST(list_signal_test.py) diff --git a/tests/pysidetest/decoratedslot_test.py b/tests/pysidetest/decoratedslot_test.py new file mode 100644 index 0000000..63a5be7 --- /dev/null +++ b/tests/pysidetest/decoratedslot_test.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +import unittest +from PySide.QtCore import QObject +from testbinding import TestObject + +class Receiver(QObject): + def __init__(self): + QObject.__init__(self) + self.called = False + + def ReceiverDecorator(func): + def decoratedFunction(self, *args, **kw): + func(self, *args, **kw) + return decoratedFunction + + # This method with the same name of the internal decorated function + # is here to test the binding capabilities. + def decoratedFunction(self): + pass + + @ReceiverDecorator + def slot(self): + self.called = True + + +class DecoratedSlotTest(unittest.TestCase): + + def testCallingOfDecoratedSlot(self): + obj = TestObject(0) + receiver = Receiver() + obj.staticMethodDouble.connect(receiver.slot) + obj.emitStaticMethodDoubleSignal() + self.assert_(receiver.called) + + +if __name__ == '__main__': + unittest.main() + From 36b7f922b2de2bffc80b60e9a8e1536083c2cad6 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 6 Jan 2011 19:30:03 -0200 Subject: [PATCH 304/913] Fix bug#560 - "Lack of QtCore.Signal documentation" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- doc/CMakeLists.txt | 1 + doc/conf.py.in | 4 +- doc/extras/PySide.QtCore.Signal.rst | 144 ++++++++++++++++++++++++++++ doc/extras/PySide.QtCore.Slot.rst | 95 ++++++++++++++++++ 4 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 doc/extras/PySide.QtCore.Signal.rst create mode 100644 doc/extras/PySide.QtCore.Slot.rst diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 7f72f41..c460543 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -28,6 +28,7 @@ add_custom_target("docrsts" --documentation-data-dir=${DOC_DATA_DIR} --output-directory=${CMAKE_CURRENT_BINARY_DIR}/rst --documentation-code-snippets-dir=${CMAKE_CURRENT_SOURCE_DIR}/codesnippets + --documentation-extra-sections-dir=${CMAKE_CURRENT_SOURCE_DIR}/extras ${CMAKE_CURRENT_BINARY_DIR}/typesystem_doc.xml WORKING_DIRECTORY ${${module}_SOURCE_DIR} COMMENT "Running generator to generate documentation..." diff --git a/doc/conf.py.in b/doc/conf.py.in index d2d7408..b984126 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -42,7 +42,7 @@ master_doc = 'contents' # General information about the project. project = u'PySide' -copyright = u'2009-2010, Nokia Corporation' +copyright = u'2009-2011, Nokia Corporation' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -68,7 +68,7 @@ release = '@BINDING_API_VERSION_FULL@' # List of directories, relative to source directory, that shouldn't be searched # for source files. -exclude_trees = ['_build'] +exclude_trees = ['_build', 'extras'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None diff --git a/doc/extras/PySide.QtCore.Signal.rst b/doc/extras/PySide.QtCore.Signal.rst new file mode 100644 index 0000000..441473e --- /dev/null +++ b/doc/extras/PySide.QtCore.Signal.rst @@ -0,0 +1,144 @@ +.. module:: PySide.QtCore +.. _Signal: + +Signal +****** + +Synopsis +-------- + +Functions +^^^^^^^^^ + ++---------------------------------------------------------------------------------------------+ +|def :meth:`connect` (receiver) | ++---------------------------------------------------------------------------------------------+ +|def :meth:`disconnect` (receiver) | ++---------------------------------------------------------------------------------------------+ +|def :meth:`emit` (\*args) | ++---------------------------------------------------------------------------------------------+ + +Detailed Description +-------------------- + + The :class:`~.Signal` class provides a way to declare and connect Qt signals in a pythonic way. + + PySide adopt PyQt's new signal and slot syntax as-is. The PySide implementation is functionally compatible with the PyQt 4.5 one, with the exceptions listed bellow. + + .. note:: Parts of the documentation bellow are from the `PyQt4 documentation `_ public available on the internet Copyright (c) 2010 Riverbank Computing Limited just modified to fit the PySide implementation. + + +Defining New Signals with QtCore.Signal() +----------------------------------------- + + PySide automatically defines signals for all Qt's built-in signals. New signals can be defined as class attributes using the QtCore.Signal() factory. + + QtCore.Signal() takes a number of type arguments that corresponds to the signature of the signal. Each type may be a Python type object or a string that is the name of a C++ type. Alternatively each argument could be a sequence of type arguments. In this case each sequence defines the signature of a different signal overload. The first overload will be the default. + + QtCore.Signal() takes an optional name keyword argument that is the name of the signal. If it is omitted then the name of the class attribute is used. + + The following example shows the definition of a number of new signals: + + :: + + from PySide import QtCore + + class Foo(QtCore.QObject): + + # This defines a signal called 'closed' that takes no arguments. + closed = QtCore.Signal() + + # This defines a signal called 'rangeChanged' that takes two + # integer arguments. + range_changed = QtCore.Signal(int, int, name='rangeChanged') + + # This defines a signal called 'valueChanged' that has two overloads, + # one that takes an integer argument and one that takes a QString + # argument. + valueChanged = QtCore.Signal((int, ), (unicode, )) + + # The following will create exactly the same overloaded signal as + # above and demonstrates the use of C++ type names instead of Python + # type objects, and lists instead of tuples. + valueChanged = QtCore.pyqtSignal(['int'], ['unicode']) + + New signals should only be defined in sub-classes of QObject. + + New signals defined in this way will be automatically added to the class's QMetaObject. This means that they will appear in Qt Designer and can be introspected using the QMetaObject API. + +Connecting, Disconnecting and Emitting Signals +---------------------------------------------- + + Signals are connected and disconnected to slots using the :meth:`Signal.connect` and :meth:`Signal.disconnect` methods of a bound signal and emitted using the :meth:`Signal.emit` method. + + The following code demonstrates the definition, connection and emit of a signal without arguments: + + :: + + from PySide import QtCore + + class Foo(QtCore.QObject): + # Define a new signal called 'trigger' that has no arguments. + trigger = QtCore.pyqtSignal() + + def connect_and_emit_trigger(self): + # Connect the trigger signal to a slot. + self.trigger.connect(self.handle_trigger) + + # Emit the signal. + self.trigger.emit() + + def handle_trigger(self): + # Show that the slot has been called. + print "trigger signal received" + + The following code demonstrates the connection of overloaded signals: + + :: + + from PySide import QtGui + + class Bar(QtGui.QComboBox): + + def connect_activated(self): + # The PyQt documentation will define what the default overload is. + # In this case it is the overload with the single integer argument. + self.activated.connect(self.handle_int) + + # For non-default overloads we have to specify which we want to + # connect. In this case the one with the single string argument. + # (Note that we could also explicitly specify the default if we + # wanted to.) + self.activated[str].connect(self.handle_string) + + def handle_int(self, index): + print "activated signal passed integer", index + + def handle_string(self, text): + print "activated signal passed string", text + +Connecting Signals Using Keyword Arguments +------------------------------------------ + + It is also possible to connect signals by passing a slot as a keyword argument corresponding to the name of the signal when creating an object. For example the following three fragments are equivalent: + + :: + + act = QtGui.QAction("Action", self) + act.triggered.connect(self.on_triggered) + + act = QtGui.QAction("Action", self, triggered=self.on_triggered) + + +.. method:: Signal.connect(receiver[, type=Qt.AutoConnection]) + + Create a connection between this signal and a `receiver`, the `receiver` can be a Python callable, a :class:`Slot` or a :class:`Signal`. + +.. method:: Signal.disconnect(receiver) + + Disconnect this signal from a `receiver`, the `receiver` can be a Python callable, a :class:`Slot` or a :class:`Signal`. + +.. method:: Signal.emit(*args) + + `args` is the optional sequence of arguments to pass to any connected slots. + diff --git a/doc/extras/PySide.QtCore.Slot.rst b/doc/extras/PySide.QtCore.Slot.rst new file mode 100644 index 0000000..27791d0 --- /dev/null +++ b/doc/extras/PySide.QtCore.Slot.rst @@ -0,0 +1,95 @@ +.. module:: PySide.QtCore +.. _Slot: + +Slot +**** + +Detailed Description +-------------------- + + PySide adopt PyQt's new signal and slot syntax as-is. The PySide implementation is functionally compatible with the PyQt 4.5 one, with the exceptions listed bellow. + + .. note:: Parts of the documentation bellow are from the `PyQt4 documentation `_ public available on the internet Copyright (c) 2010 Riverbank Computing Limited just modified to fit the PySide implementation. + + Although PySide allows any Python callable to be used as a slot when connecting signals, it is sometimes necessary to explicitly mark a Python method as being a Qt slot and to provide a C++ signature for it. PySide provides the QtCore.Slot() function decorator to do this. + + All of the non-keyword arguments to the decorator are interpreted as the types of the corresponding C++ arguments. A type is either a Python type object or a string that specifies a C++ type. The decorator also takes two optional keywords arguments: name and result. name is the name of the slot that will be seen by C++. If ommitted the name of the Python method being decorated will be used. result is the type of the result and may also be a Python type object or a string that specifies a C++ type. + + For example: + + :: + + @QtCore.Slot() + def foo(self): + """ C++: void foo() """ + + @QtCore.Slot(int, unicode) + def foo(self, arg1, arg2): + """ C++: void foo(int, QString) """ + + @QtCore.Slot(int, name='bar') + def foo(self, arg1): + """ C++: void bar(int) """ + + @QtCore.Slot(int, result=int) + def foo(self, arg1): + """ C++: int foo(int) """ + + @QtCore.Slot(int, QtGui.QWidget) + def foo(self, arg1): + """ C++: int foo(int, QWidget*) """ + + It is also possible to chain the decorators in order to define a Python method several times with different signatures. + + For example: + + :: + + @QtCore.Slot(int) + @QtCore.Slot('QString') + def valueChanged(self, value): + """ Two slots will be defined in the QMetaObject. """ + +Connecting Slots By Name +------------------------ + + PySide supports the QtCore.QMetaObject.connectSlotsByName() function that is most commonly used by pyside-uic generated Python code to automatically connect signals to slots that conform to a simple naming convention besides the QtCore.Slot decoration. + + For example the :class:`PySide.QtGui.QSpinBox` class has the following signals: + + :: + + void valueChanged(int i); + void valueChanged(const QString& text); + + For example, if you were interested in the integer variant of the signal then your slot definition would look like the following: + + :: + + @QtCore.Slot(int) + def on_spinbox_valueChanged(self, i): + # i will be an integer. + pass + + If you wanted to handle both variants of the signal, but with different Python methods, then your slot definitions might look like the following: + + :: + + @QtCore.Slot(int, name='on_spinbox_valueChanged') + def spinbox_int_value(self, i): + # i will be an integer. + pass + + @QtCore.Slot(unicode, name='on_spinbox_valueChanged') + def spinbox_qstring_value(self, s): + # s will be a Python unicode object. + pass + + The following shows an example using a button when you are not interested in the optional argument: + + :: + + @QtCore.Slot() + def on_button_clicked(self): + pass + From 4c79d1e8cd54b3bf7dc0d2ea3d5f5b000a862fc7 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 6 Jan 2011 20:56:14 -0300 Subject: [PATCH 305/913] Fixes the fix in the commit a1cf8f03. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by Hugo Parente Reviewed by Renato Araújo --- PySide/QtCore/glue/qobject_connect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp index f6b0dce..91a272c 100644 --- a/PySide/QtCore/glue/qobject_connect.cpp +++ b/PySide/QtCore/glue/qobject_connect.cpp @@ -4,7 +4,8 @@ static bool isDecorator(PyObject* method, PyObject* self) if (!PyObject_HasAttr(self, methodName)) return true; Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName)); - return otherMethod.object() != method; + return reinterpret_cast(otherMethod.object())->im_func != \ + reinterpret_cast(method)->im_func; } static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) From f4f48519ec2dade5a016b87bc089e90a0caf71a4 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 7 Jan 2011 18:58:15 -0300 Subject: [PATCH 306/913] Fix Qvariant to Cpp conversion. Fixes bug #589 Reviewer: Hugo Parente Lima Marcelo Lira --- PySide/QtCore/qvariant_conversions.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 0b89534..283cf4f 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -19,6 +19,8 @@ struct Converter if (PyObject_TypeCheck(type, &SbkObjectType_Type)) { SbkObjectType* sbkType = reinterpret_cast(type); const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType); + if (!typeName) + return 0; bool valueType = '*' != typeName[qstrlen(typeName) - 1]; // Do not convert user type of value From 1caaffba59c8a6897d58e7682842f4b4a86405f2 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 7 Jan 2011 18:58:40 -0300 Subject: [PATCH 307/913] Created unit test for bug 589. Reviewer: Hugo Parente Lima Marcelo Lira --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_589.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/QtGui/bug_589.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 6032808..e8d4804 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -28,6 +28,7 @@ PYSIDE_TEST(bug_549.py) PYSIDE_TEST(bug_569.py) PYSIDE_TEST(bug_576.py) PYSIDE_TEST(bug_585.py) +PYSIDE_TEST(bug_589.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_589.py b/tests/QtGui/bug_589.py new file mode 100644 index 0000000..0c7cdec --- /dev/null +++ b/tests/QtGui/bug_589.py @@ -0,0 +1,19 @@ +# trimmed down diagramscene.py to demonstrate crash in sizeHint() + +import sys +from PySide import QtCore, QtGui +import unittest + +class CustomWidget(QtGui.QGraphicsProxyWidget): + def itemChange(self, eventType, value): + QtGui.QGraphicsProxyWidget.itemChange(self, eventType, value) + +class Bug589(unittest.TestCase): + def testCase(self): + widget = QtGui.QGraphicsProxyWidget() + custom = CustomWidget() + custom.setParentItem(widget) + +if __name__ == "__main__": + app = QtGui.QApplication(sys.argv) + unittest.main() From 64a35df0c16663bea2693701f576005e2f8ebb4c Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 10 Jan 2011 15:26:54 -0300 Subject: [PATCH 308/913] Added condition for a phonon test that fails on Win32 with Qt 4.7.1. This is due to a bug on Phonon::createPath that happens with the specific combination of Win32 platform and Qt 4.7.1. The bug is reported as fixed for Qt 4.7.2, but it wasn't released yet. For more details on the bug: http://bugreports.qt.nokia.com/browse/QTBUG-13062 Reviewed by Hugo Parente Reviewed by Lauro Moura --- tests/phonon/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/phonon/CMakeLists.txt b/tests/phonon/CMakeLists.txt index c2b939e..ee94c0b 100644 --- a/tests/phonon/CMakeLists.txt +++ b/tests/phonon/CMakeLists.txt @@ -1,3 +1,7 @@ -PYSIDE_TEST(basic_playing_test.py) +if (NOT WIN32 OR NOT ${QTVERSION} VERSION_EQUAL 4.7.1) + # Any usage of Phonon::createPath will fail on Win32 and Qt 4.7.1. + # Check: http://bugreports.qt.nokia.com/browse/QTBUG-13062 + PYSIDE_TEST(basic_playing_test.py) +endif() PYSIDE_TEST(bug_328.py) PYSIDE_TEST(capabilities_test.py) From 99cbdef40cda9379651951d0f187fbba6e829ae1 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 11 Jan 2011 18:53:06 -0300 Subject: [PATCH 309/913] Added test for QPainter.setPen() method. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calls it with enum, to call the setPen(Qt.PenStyle) signature, and with an integer, to call the setPen(QColor) signature (QColor is implicitly built from an unsigned int in C++). For more details see Bug #511: http://bugs.openbossa.org/show_bug.cgi?id=511 Reviewed by Luciano Wolf Reviewed by Renato Araújo --- tests/QtGui/qpen_test.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/QtGui/qpen_test.py b/tests/QtGui/qpen_test.py index f9e9b18..b1e0b7a 100644 --- a/tests/QtGui/qpen_test.py +++ b/tests/QtGui/qpen_test.py @@ -1,10 +1,25 @@ import unittest +from helper import UsesQApplication -from PySide.QtCore import Qt -from PySide.QtGui import QPen +from PySide.QtCore import Qt, QTimer +from PySide.QtGui import QPen, QPainter, QWidget -class QPenTest(unittest.TestCase): +class Painting(QWidget): + def __init__(self): + QWidget.__init__(self) + self.penFromEnum = None + self.penFromInteger = None + + def paintEvent(self, event): + painter = QPainter(self) + painter.setPen(Qt.NoPen) + self.penFromEnum = painter.pen() + painter.setPen(int(Qt.NoPen)) + self.penFromInteger = painter.pen() + + +class QPenTest(UsesQApplication): def testCtorWithCreatedEnums(self): '''A simple case of QPen creation using created enums.''' @@ -14,6 +29,15 @@ class QPenTest(unittest.TestCase): join = Qt.PenJoinStyle(0) pen = QPen(Qt.blue, width, style, cap, join) + def testSetPenWithPenStyleEnum(self): + '''Calls QPainter.setPen with both enum and integer. Bug #511.''' + w = Painting() + w.show() + QTimer.singleShot(1000, self.app.quit) + self.app.exec_() + self.assertEqual(w.penFromEnum.style(), Qt.NoPen) + self.assertEqual(w.penFromInteger.style(), Qt.SolidLine) + if __name__ == '__main__': unittest.main() From 7e667036d58a0549dd08a152149e1ba1f410bfb7 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 11 Jan 2011 17:58:52 -0300 Subject: [PATCH 310/913] Use python base name as library prefix. Use the same CMAKE_BUILD_TYPE as shiboken if none was specified. Append SHIBOKEN_PYTHON_BASENAME in the library suffix. Fix bug #509. Reviewer: Marcelo Lira Lauro Moura --- CMakeLists.txt | 2 +- libpyside/CMakeLists.txt | 5 ++++- libpyside/PySideConfig-spec.cmake.in | 9 +++++++++ libpyside/PySideConfig.cmake.in | 14 +++++--------- 4 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 libpyside/PySideConfig-spec.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 33eda53..856ed6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ else() endif() if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) + set(CMAKE_BUILD_TYPE ${SHIBOKEN_BUILD_TYPE}) endif() set(BINDING_NAME PySide) diff --git a/libpyside/CMakeLists.txt b/libpyside/CMakeLists.txt index 04bf0a7..6450045 100644 --- a/libpyside/CMakeLists.txt +++ b/libpyside/CMakeLists.txt @@ -24,7 +24,7 @@ target_link_libraries(pyside set_target_properties(pyside PROPERTIES VERSION ${BINDING_API_VERSION} SOVERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}" - OUTPUT_NAME "pyside${pyside_SUFFIX}" + OUTPUT_NAME "pyside${pyside_SUFFIX}-${SHIBOKEN_PYTHON_BASENAME}" DEFINE_SYMBOL PYSIDE_EXPORTS) # @@ -54,6 +54,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pyside.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" @ONLY) # create cmake-config files configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake" @ONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig-spec.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig-${SHIBOKEN_PYTHON_BASENAME}.cmake" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfigVersion.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake" @ONLY) install(FILES ${libpyside_HEADERS} @@ -65,5 +66,7 @@ install(TARGETS pyside EXPORT pyside install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig-${SHIBOKEN_PYTHON_BASENAME}.cmake" + DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") diff --git a/libpyside/PySideConfig-spec.cmake.in b/libpyside/PySideConfig-spec.cmake.in new file mode 100644 index 0000000..b5b73dc --- /dev/null +++ b/libpyside/PySideConfig-spec.cmake.in @@ -0,0 +1,9 @@ +# PYSIDE_INCLUDE_DIR - Directories to include to use PySide +# PYSIDE_LIBRARY - Files to link against to use PySide +# PYSIDE_PYTHONPATH - Path to where the PySide Python module files could be found +# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide + +SET(PYSIDE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PySide@pyside_SUFFIX@") +SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") +SET(PYSIDE_PYTHONPATH "@SITE_PACKAGE@") +SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFFIX@/typesystems") diff --git a/libpyside/PySideConfig.cmake.in b/libpyside/PySideConfig.cmake.in index b5b73dc..28203da 100644 --- a/libpyside/PySideConfig.cmake.in +++ b/libpyside/PySideConfig.cmake.in @@ -1,9 +1,5 @@ -# PYSIDE_INCLUDE_DIR - Directories to include to use PySide -# PYSIDE_LIBRARY - Files to link against to use PySide -# PYSIDE_PYTHONPATH - Path to where the PySide Python module files could be found -# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide - -SET(PYSIDE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PySide@pyside_SUFFIX@") -SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") -SET(PYSIDE_PYTHONPATH "@SITE_PACKAGE@") -SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFFIX@/typesystems") +if (NOT PYTHON_BASENAME) + message(STATUS "Using default python: @PYTHON_BASENAME@") + SET(PYTHON_BASENAME @PYTHON_BASENAME@) +endif() +include(@LIB_INSTALL_DIR@/cmake/PySide-@pyside_VERSION@/PySideConfig-${PYTHON_BASENAME}.cmake) From 3ac4080bfe3052b8ee805a0a983a68cf142241b2 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 12 Jan 2011 19:26:27 -0300 Subject: [PATCH 311/913] Create a new parent test. Check if the parent does not increase the reference if you set the parent twice. --- tests/QtCore/qobject_parent_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/QtCore/qobject_parent_test.py b/tests/QtCore/qobject_parent_test.py index eb8cae2..df81216 100644 --- a/tests/QtCore/qobject_parent_test.py +++ b/tests/QtCore/qobject_parent_test.py @@ -25,6 +25,13 @@ class ParentRefCountCase(unittest.TestCase): self.child.setParent(self.parent) self.assertEqual(getrefcount(self.child), 3) + def testSetParentTwice(self): + self.assertEqual(getrefcount(self.child), 2) + self.child.setParent(self.parent) + self.assertEqual(getrefcount(self.child), 3) + self.child.setParent(self.parent) + self.assertEqual(getrefcount(self.child), 3) + def testConstructor(self): #QObject(QObject) refcount changes child = QObject(self.parent) From f98566eebd41613236ad88b7aba676d4b081bb12 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 13 Jan 2011 10:29:49 -0300 Subject: [PATCH 312/913] Fixed path to include file used on cmake files. Reviewer: Bruno Araujo --- libpyside/PySideConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpyside/PySideConfig.cmake.in b/libpyside/PySideConfig.cmake.in index 28203da..f25487c 100644 --- a/libpyside/PySideConfig.cmake.in +++ b/libpyside/PySideConfig.cmake.in @@ -2,4 +2,4 @@ if (NOT PYTHON_BASENAME) message(STATUS "Using default python: @PYTHON_BASENAME@") SET(PYTHON_BASENAME @PYTHON_BASENAME@) endif() -include(@LIB_INSTALL_DIR@/cmake/PySide-@pyside_VERSION@/PySideConfig-${PYTHON_BASENAME}.cmake) +include(@LIB_INSTALL_DIR@/cmake/PySide-@BINDING_API_VERSION@/PySideConfig-${PYTHON_BASENAME}.cmake) From 67f0db5a2b6ad96d41bda2b96112bba3cba55862 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 10 Jan 2011 17:52:37 -0200 Subject: [PATCH 313/913] Add polymorphic-id-expression to QGraphicsObject and QDeclarativeItem. --- PySide/QtDeclarative/typesystem_declarative.xml | 2 +- PySide/QtGui/typesystem_gui_common.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index 5649bf2..e754006 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -97,7 +97,7 @@ - + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 676829e..1d1ea01 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -5584,7 +5584,7 @@ --> - + From a24e8ed2811a9d4f116d3c2e05721a4e47b7a09f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 11 Jan 2011 15:17:56 -0200 Subject: [PATCH 314/913] Don't crash when a unknown type is given as a meta call argument. --- libpyside/signalmanager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 75a0d19..2581d71 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -324,8 +324,14 @@ static int PySide::callMethod(QObject* object, int id, void** args) void* data = args[i+1]; const char* dataType = paramTypes[i].constData(); - PyObject* arg = Shiboken::TypeResolver::get(dataType)->toPython(data); - PyTuple_SET_ITEM(preparedArgs, i, arg); + Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(dataType); + if (tr) { + PyObject* arg = tr->toPython(data); + PyTuple_SET_ITEM(preparedArgs, i, arg); + } else { + PyErr_Format(PyExc_TypeError, "Can't call meta function because I have no idea how to handle %s", dataType); + return -1; + } } QString methodName = method.signature(); From bcad6d0392ace27a9a4acb0097f2e170cb5f6e21 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 12 Jan 2011 12:31:59 -0200 Subject: [PATCH 315/913] Fix documentation for QWidget.winId() --- PySide/QtGui/typesystem_gui_common.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 1d1ea01..37ffb89 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3475,6 +3475,19 @@ + + + Returns the window system identifier of the widget. + + Portable in principle, but if you use it you are probably about to do something non-portable. Be careful. + + If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. + + On X11 the type returned is long, on other platforms it's a PyCObject. + + This value may change at run-time. An event with type PySide.QtCore.QEvent.WinIdChange will be sent to the widget following a change in window system identifier. + + From 4587eec6cb142f4fd3d6f302b4ee840c3cc77886 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 12 Jan 2011 14:56:56 -0200 Subject: [PATCH 316/913] Remove protected fields of event classes. Event classes have a lot of non-documented protected fields, those fields are removed from PySide because they are Qt implementation details, besides the fact they are accessible by ordinary event methods. --- PySide/QtGui/typesystem_gui_common.xml | 78 +++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 37ffb89..61bf68d 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -71,11 +71,86 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -144,7 +219,6 @@ - From 776b41613d765bbeae21ff8626ebbccfbd1e35d3 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 12 Jan 2011 15:45:35 -0200 Subject: [PATCH 317/913] Removed useless rejections Reviewer: Marcelo Lira Lauro Moura --- PySide/QtCore/typesystem_core.xml | 287 +------------------------ PySide/QtGui/typesystem_gui_common.xml | 66 +----- 2 files changed, 11 insertions(+), 342 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index f41acd5..031244b 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -56,17 +56,6 @@ - - - - - - - - - - - @@ -88,9 +77,11 @@ + + @@ -182,26 +173,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -256,239 +227,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -506,7 +244,6 @@ - @@ -1369,12 +1106,6 @@ %PYARG_0 = %CONVERTTOPYTHON[bool](retval); - - - - @@ -2297,6 +2028,7 @@ + @@ -2608,6 +2340,7 @@ + @@ -2651,6 +2384,7 @@ + @@ -2759,8 +2493,6 @@ - - @@ -2801,8 +2533,6 @@ - - @@ -2997,10 +2727,6 @@ - - - - @@ -3016,8 +2742,6 @@ - - @@ -3025,6 +2749,7 @@ + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 61bf68d..e6dabc4 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -151,53 +151,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -561,7 +514,7 @@ - + @@ -570,7 +523,7 @@ - + @@ -2136,8 +2089,6 @@ - - @@ -3159,8 +3110,6 @@ - - @@ -3198,8 +3147,6 @@ - - @@ -3336,9 +3283,6 @@ - - - @@ -5760,11 +5704,11 @@ - - - + + + From d9940e55a41b83d30ce41e8002f614bfe16d54bf Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 13 Jan 2011 13:51:51 -0300 Subject: [PATCH 318/913] Fix typo on Cmake files. Reviewer: Bruno Araujo --- libpyside/PySideConfig-spec.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpyside/PySideConfig-spec.cmake.in b/libpyside/PySideConfig-spec.cmake.in index b5b73dc..b017b9e 100644 --- a/libpyside/PySideConfig-spec.cmake.in +++ b/libpyside/PySideConfig-spec.cmake.in @@ -4,6 +4,6 @@ # PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide SET(PYSIDE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PySide@pyside_SUFFIX@") -SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") +SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@-@SHIBOKEN_PYTHON_BASENAME@@CMAKE_SHARED_LIBRARY_SUFFIX@") SET(PYSIDE_PYTHONPATH "@SITE_PACKAGE@") -SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFFIX@/typesystems") +SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFIX@/typesystems") From b57192c596230ef8fb6a9cb1fe51d3a72e719e4f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 13 Jan 2011 17:51:14 -0200 Subject: [PATCH 319/913] Fix bug#584 - "python pickle module can't treat QByteArray object of PySide" Reviewer: Luciano Wolf Lauro Moura --- PySide/QtCore/typesystem_core.xml | 36 +++++++++++++------------- PySide/QtGui/typesystem_gui_common.xml | 6 ++--- PySide/typesystem_templates.xml | 5 +--- tests/QtCore/qbytearray_test.py | 11 ++++++++ 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 031244b..24ce91f 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -433,7 +433,7 @@ - + @@ -451,7 +451,7 @@ - + @@ -504,7 +504,7 @@ - + @@ -562,7 +562,7 @@ - + @@ -574,7 +574,7 @@ - + @@ -586,7 +586,7 @@ - + @@ -605,7 +605,7 @@ - + @@ -617,7 +617,7 @@ - + @@ -682,7 +682,7 @@ - + @@ -736,7 +736,7 @@ - + @@ -755,7 +755,7 @@ - + @@ -768,7 +768,7 @@ - + @@ -788,7 +788,7 @@ - + @@ -1217,7 +1217,7 @@ - + @@ -1232,7 +1232,7 @@ - + @@ -1281,7 +1281,7 @@ - + @@ -1294,8 +1294,8 @@ - - + + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index e6dabc4..50247c3 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -499,14 +499,14 @@ - PyObject *points = PyList_New(%CPPSELF.count()); - for (int i = 0; i < %CPPSELF.count(); ++i){ + PyObject* points = PyList_New(%CPPSELF.count()); + for (int i = 0, max = %CPPSELF.count(); i < max; ++i){ int x, y; %CPPSELF.point(i, &x, &y); PyList_SET_ITEM(points, i, %CONVERTTOPYTHON[QPoint](QPoint(x, y))); } - + diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 4604fda..dd07459 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -188,10 +188,7 @@ +
diff --git a/doc/_themes/pysidedocs/modindex.html b/doc/_themes/pysidedocs/modindex.html new file mode 100644 index 0000000..b00a440 --- /dev/null +++ b/doc/_themes/pysidedocs/modindex.html @@ -0,0 +1,40 @@ +{% extends "layout.html" %} +{% set title = _('Global Module Index') %} +{% block extrahead %} +{{ super() }} +{% if not embedded and collapse_modindex %} + +{% endif %} +{% endblock %} +{% block body %} +
+

{{ _('Global Module Index') }}

+ + {%- for letter in letters %} + {{ letter }} {% if not loop.last %}| {% endif %} + {%- endfor %} +
+ + + {%- for modname, collapse, cgroup, indent, fname, synops, pform, dep, stripped in modindexentries %} + {%- if not modname -%} + {%- else -%} + + + + {%- endif -%} + {% endfor %} +
{% if collapse -%} + + {%- endif %}{% if indent %}   {% endif %} + {% if fname %}{% endif -%} + {{ stripped|e }}{{ modname|e }} + {%- if fname %}{% endif %} + {%- if pform and pform[0] %} ({{ pform|join(', ') }}){% endif -%} + {% if dep %}{{ _('Deprecated')}}:{% endif %} + {{ synops|e }}
+ +{% endblock %} diff --git a/doc/contents.rst b/doc/contents.rst index aa2b645..9ff4fb3 100644 --- a/doc/contents.rst +++ b/doc/contents.rst @@ -4,11 +4,6 @@ PySide Documentation contents .. toctree:: :maxdepth: 2 - howto-build/index.rst - generatingdocs.rst - issuesdiff.rst - dbus.rst - modules.rst Indices and tables diff --git a/doc/dbus.rst b/doc/dbus.rst deleted file mode 100644 index 0e57d0b..0000000 --- a/doc/dbus.rst +++ /dev/null @@ -1,30 +0,0 @@ -DBUS integration -**************** - -To get PySide and DBus working toghether you can use the glib mainloop integration already done in pydbus. - -The example above show how to export Qt objects to python and emit an DBus signal when a Qt signal is emited. The code comments explains what you need to know about PySide and dbus, any doubts, see the python-dbus help. - -DBUS Client ------------ - -.. literalinclude:: codesnippets/examples/dbus/example-client.py - - -DBUS Server ------------ - -.. literalinclude:: codesnippets/examples/dbus/example-server.py - - -Running the example -------------------- - -Copy the client code to a file called ``example-client.py`` and the server to a file called ``example-server.py`` and type: - -:: - - $ python example-server.py & - $ python example-client.py - -A litle window should appear on screen. Click on the button to emit a Qt signal, this signal will be converted to a DBus signal that will be caught by our dbus client. That's all. diff --git a/doc/generatingdocs.rst b/doc/generatingdocs.rst deleted file mode 100644 index 666df81..0000000 --- a/doc/generatingdocs.rst +++ /dev/null @@ -1,42 +0,0 @@ -How to generate this documentation -********************************** - -Pre-requisites --------------- - -You will need: - -1. Qt4 source code (for API documentation). -2. Generator runner with shiboken plugin -3. PySide source code -4. cmake -5. sphinx -6. graphviz - -Extracting documentation from Qt4 ---------------------------------- - -The API documentation is generated from source code comments (for now, just -``qdoc3`` tool is supported, ``doxygen`` support will be added soon). - -``qdoc3`` is the tool used to generate the oficial Qt4 documentation, you will -use it to generate a bunch of XML files that will be used by the generator -to create the documentation. - -You need to tell PySide where it can find the Qt source code, to do this, when running cmake add the following parameters: - -:: - - $ mkdir build - $ cmake -DQT_SRC_DIR=PATH_TO_QT_SOURCE_DIR .. - $ make apidoc - $ make apidocinstall - -Where: - * *PATH_TO_QT_SOURCE_DIR* is the path to the Qt sources. - -The documentation will be installed at ``/share/doc/pyside/index.html``, change -the *CMAKE_INSTALL_PREFIX* value if you want to install the documentation in another -directory. - -If you want to have inheritance graphs on the generated documentation, make sure you have the bindings installed before generate the documentation. diff --git a/doc/howto-build/cmake-primer.rst b/doc/howto-build/cmake-primer.rst deleted file mode 100644 index 6d9224c..0000000 --- a/doc/howto-build/cmake-primer.rst +++ /dev/null @@ -1,72 +0,0 @@ - -.. _cmake-primer: - -************ -CMake primer -************ - -This chapter is a basic introduction to CMake, the build system used by PySide -and the bindings generator. - -The practical steps will focus on how to use CMake on a Unix-like (GNU/Linux) -environment. - - -Configuring -=========== - -Project file - CMakeLists.txt ------------------------------ - -CMake parses the file CMakeLists.txt for information about the project, -like project name, dependencies, what should be compiled, what should be -shipped, and so on. - - -CMake variables ---------------- - -CMake can have its default behavior modified by providing some options in the command line: - -* ``CMAKE_INSTALL_PREFIX=`` sets the install prefix to - the specified path. -* ``CMAKE_MODULE_PATH=`` sets the extra directories - where CMake will try to find its modules. -* ``CMAKE_TOOLCHAIN_FILE=`` sets the path to the file that - describes the toolchain used to compile this project. It is very useful - when using CMake with `Icecream `_ to speed up compilation. - -You can define a variable using the ``-D`` switch like the example -below. - -* ``-DCMAKE_BUILD_TYPE=Release|Debug`` sets the building behavior. Default - value is Release. - -Invoking CMake --------------- - -After writing the CMakeLists.txt and deciding which flags will be used, -you can invoke CMake using:: - - cmake - -For example, if you use the ``build/`` folder to build the project and -want it to be installed into ``/opt/sandbox/``, use the following lines:: - - cd build/ - cmake -DCMAKE_INSTALL_PREFIX=/opt/sandbox .. - -CMake will process the project file and write the output files in the -current directory. - -Building -======== - -After the configuration process, the Makefiles are written and you can build -the project using :program:`make`. - -Installing -========== - -As in the building process, :program:`make install` will install the files into -the target directory. diff --git a/doc/howto-build/index.rst b/doc/howto-build/index.rst deleted file mode 100644 index e8d1cd1..0000000 --- a/doc/howto-build/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. PySide documentation master file, created by sphinx-quickstart on Fri Mar 6 11:45:08 2009. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Getting started with PySide -=========================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - cmake-primer - setup-apiextractor - setup-generator - shiboken - setup-bindings - - diff --git a/doc/howto-build/setup-apiextractor.rst b/doc/howto-build/setup-apiextractor.rst deleted file mode 100644 index 18f5d4d..0000000 --- a/doc/howto-build/setup-apiextractor.rst +++ /dev/null @@ -1,52 +0,0 @@ - -.. _api-extractor: - -************** -API Extractor -************** - -Overview -======== - -The **API Extractor** library is used by the bindings generator to -parse the header and typesystem files to create an internal -representation of the API. It is based on the -`QtScriptGenerator `_ -codebase. - -Getting the sources -=================== - -* Download URL: http://www.pyside.org/downloads/ - -Build requirements -================== - -+ CMake >= 2.6.0 -+ Qt4.5 libraries and development headers >= 4.5 -+ libxml2 libraries and development headers >= 2.6.32 -+ libxslt libraries and development headers >= 1.1.19 - -Building and installing -======================= - -To build and install just follow the generic CMake instructions in section -:ref:`cmake-primer`. - -Debian packaging -================ - -In order to compile this package in a Debian environment, make sure the -following packages are installed: - -* debhelper (>= 7) -* cmake (>= 2.6.0) -* libqt4-dev (>= 4.5) -* libxml2-dev -* libxslt1-dev -* pkg-config -* python-sphinx - -And then you can build the package using:: - - $ dpkg-buildpackage -rfakeroot diff --git a/doc/howto-build/setup-bindings.rst b/doc/howto-build/setup-bindings.rst deleted file mode 100644 index 87feec9..0000000 --- a/doc/howto-build/setup-bindings.rst +++ /dev/null @@ -1,82 +0,0 @@ -*************** -Qt 4.6 Bindings -*************** - -Overview -======== - -These bindings allow access of Qt 4.6 libraries as Python modules, -making them available just using the ``import`` command. - -The build process is comprised of two stages: in a first moment the -bindings source code are created from the Qt 4.6 headers by calling -the :ref:`generator-runner` with apropriate parameters; the -generated files are then compiled and linked together to form the -bindings libraries. - -The bindings available at the moment are listed below: - - + QtCore - + QtGui - + QtHelp - + QtMultimedia - + QtNetwork - + QtOpenGL - + QtScript - + QtScriptTools - + QtSql - + QtSvg - + QtUiTools - + QtWebKit - + QtXml - + QtXmlPatterns - + Phonon - -Getting the sources -=================== - -* Download URL: http://www.pyside.org/downloads/ - -Build requirements -================== - - + CMake (>= 2.6.0) - + Qt4.6 libraries and development headers - + Python dev libraries - + Shiboken libraries - + :ref:`generator-runner` - - -Building and installing -======================= - -To build and install just follow the generic cmake instructions in -section :ref:`cmake-primer`. - -Be advised that the build process can be rather lenghty because of the -number of source files that will be compiled. - -Debian packaging -================ - -.. note:: Qt 4.6 is available for Debian in the testing branch (squeeze), Ubuntu 10.04 (Lucid Lynx), and in Maemo 5 (Fremantle) in the upcoming PR 1.2 update. - -In order to compile this package in a Debian environment, make sure the -following packages are installed: - -* debhelper (>= 7) -* cmake (>= 2.6.0) -* python-all-dev -* python-all-dbg -* python-support (>= 0.3.9) -* libqt4-dev -* libphonon-dev -* libqt4-opengl-dev -* shiboken (>= 0.3.0) -* generatorrunner (>= 0.4.1) -* libshiboken-dev (>= 0.3.0) - - -And then you can build the package using:: - - $ dpkg-buildpackage -rfakeroot diff --git a/doc/howto-build/setup-generator.rst b/doc/howto-build/setup-generator.rst deleted file mode 100644 index 6c231cc..0000000 --- a/doc/howto-build/setup-generator.rst +++ /dev/null @@ -1,50 +0,0 @@ - -.. _generator-runner: - -**************** -Generator Runner -**************** - -Overview -========================================= - -The **Generator Runner** (A.K.A. :program:`generatorrunner`) is the -program that controls the bindings generation process according to the -rules given by the user through headers, typesystem files and generator -front-ends (such as :ref:`shiboken-generator`). It depends on -:ref:`api-extractor` library. - - -Getting the sources -=================== - -* Download URL: http://www.pyside.org/downloads/ - -Build requirements -================== - -+ CMake >= 2.6.0 -+ Qt4.5 libraries and development headers >= 4.5.0 -+ :ref:`api-extractor` + development headers - -Building and installing -======================= - -To build and install just follow the generic CMake instructions in -section :ref:`cmake-primer`. - -Debian packaging -================ - -In order to compile this package in a Debian environment, make sure the -following packages are installed: - -* debhelper (>= 7) -* cmake (>= 2.6.0) -* libqt4-dev (>= 4.5) -* libapiextractor-dev (>= 0.5.0) -* libxlst-dev - -And then you can build the package using:: - - $ dpkg-buildpackage -rfakeroot diff --git a/doc/howto-build/shiboken.rst b/doc/howto-build/shiboken.rst deleted file mode 100644 index d5c19de..0000000 --- a/doc/howto-build/shiboken.rst +++ /dev/null @@ -1,54 +0,0 @@ - -.. _shiboken-generator: - -****************** -Shiboken Generator -****************** - -Overview -========================================= - -The **Shiboken Generator** (A.K.A. :program:`shiboken`) is -the plugin that creates the PySide bindings source files from Qt headers -and auxiliary files (typesystems, ``global.h`` and glue files). It depends on -:ref:`generator-runner` and :ref:`api-extractor` library. - - -Getting the sources -=================== - -* Download URL: http://www.pyside.org/downloads/ - -Build requirements -================== - -+ CMake >= 2.6.0 -+ Qt libraries and development headers >= 4.5.0 -+ Python development headers >= 2.5 -+ :ref:`api-extractor` + development headers -+ :ref:`generator-runner` + development headers - -Building and installing -======================= - -To build and install just follow the generic CMake instructions in -section :ref:`cmake-primer`. - -Debian packaging -================ - -In order to compile this package in a debian environment, make sure the -following packages are installed: - -* debhelper (>= 7) -* cmake (>= 2.6.0) -* libqt4-dev (>= 4.5) -* libapiextractor-dev (>= 0.5.0) -* libgenrunner-dev (>= 0.4.1) -* generatorrunner (>= 0.4.1) -* python-all-dev -* python-all-dbg - -And then you can build the package using:: - - $ dpkg-buildpackage -rfakeroot diff --git a/doc/issuesdiff.rst b/doc/issuesdiff.rst deleted file mode 100644 index 4c472ae..0000000 --- a/doc/issuesdiff.rst +++ /dev/null @@ -1,14 +0,0 @@ -PySide issues and specificities -******************************* - -This document shows some points not supported by PySide. - -Deprecated Methods ------------------- - -The deprecated methods before Qt 4.4 is not supported by PySide, -e.g.: `QColor.dark()` and `QColor.light()`. - -**How to solve:** update the methods with new ones like `QColor.darker()` -and `QColor.lighter()`. - diff --git a/doc/newsigslot.rst b/doc/newsigslot.rst deleted file mode 100644 index 99db7e0..0000000 --- a/doc/newsigslot.rst +++ /dev/null @@ -1,187 +0,0 @@ -New-style signal/slot -********************* -The new-style signal/slot was introduced by Riverbank on its PyQt v4.5. The main goal of this new-style is to provide a more pythonic syntax to the Python programmers. PySide uses `PSEP100 `_ as its implementation guideline. - -Old way: SIGNAL() and SLOT() ----------------------------- -Both QtCore.SIGNAL(...) and QtCore.SLOT(...) macros allow Python to interface with Qt mechanisms. This is the old way of using signals/slots. - -The example below uses the well known *clicked* signal from a *QPushButton*. The *connect* method has a non python-friendly syntax. It is necessary to inform the object, its signal (via macro) and a slot to be connected to. - -:: - - ... - - def someFunc(): - print "someFunc has been called!" - - ... - - button = QtGui.QPushButton("Call someFunc") - QtCore.QObject.connect(button, QtCore.SIGNAL('clicked()'), someFunc) - - ... - - -Next section shows how everything has changed to become more pythonic. - -New way: Signal() and Slot() ----------------------------- -The new-style uses a different syntax to create and to connect signals/slots. The previous example could be rewritten as: - -:: - - ... - - def someFunc(): - print "someFunc has been called!" - - button = QtGui.QPushButton("Call someFunc") - button.clicked.connect(someFunc) - - ... - - -Using QtCore.Signal() ---------------------- -Signals can be defined using the *QtCore.Signal()* class. Python types and C types can be passed as parameters to it. If you need to overload it just pass the types as tuples or lists. - -Besides that it can receive also a named argument *name* that defines the signal name. If nothing is passed as *name* then the new signal will have the same name as the variable that it is being assigned to. - -The section `Putting everything together`_ has a collection of examples that shows a bunch of situation using the *Signal()* class. - -**Note**: Signals should be defined only inside classes inheriting from QObject. This way the signal information is added to the class QMetaObject structure. - - -Using QtCore.Slot() -------------------- -Slots are assigned and overloaded using the decorator *QtCore.Slot()*. Again, to define a signature just pass the types like the *QtCore.Signal()* class. Unlike the *Signal()* class, to overload a function you don't pass every variation as tuple or list. Instead of that you have to define a new decorator for every different signature. The examples section below will make it clearer. - -Another difference is about its keywords. *Slot()* accepts a *name* and a *result*. The *result* keyword defines the type that will be returned and can be a C or Python type. The *name* behaves the same way as in *Signal()*. If nothing is passed as *name* then the new slot will have the same name as the function that is being decorated. - -Putting everything together ---------------------------- -Nothing better than examples to show how to use the new-style. Here you can find some code covering a good range of cases, from basic connections to more complex situations. - -- **Hello World example**: the basic example, showing how to connect a signal to a slot without any parameters. - -:: - - import sys - from PySide import QtCore, QtGui - - # define a function that will be used as a slot - def sayHello(): - print 'Hello world!' - - app = QtGui.QApplication(sys.argv) - - button = QtGui.QPushButton('Say hello!') - - # connect the clicked signal to the sayHello slot - button.clicked.connect(sayHello) - button.show() - - sys.exit(app.exec_()) - -- **Lets add some arguments**: this is a modified *Hello World* version. It adds some arguments to the slot and creates a new signal. - -:: - - import sys - from PySide import QtCore - - # define a new slot that receives a string and has - # 'saySomeWords' as its name - @QtCore.Slot(str) - def saySomeWords(words): - print words - - class Communicate(QtCore.QObject): - # create a new signal on the fly and name it 'speak' - speak = QtCore.Signal(str) - - someone = Communicate() - # connect signal and slot - someone.speak.connect(saySomeWords) - # emit 'speak' signal - someone.speak.emit("Hello everybody!") - -- **Lets add some overloads**: a little more modification on the previous example now including overloads. - -:: - - import sys - from PySide import QtCore - - # define a new slot that receives a C 'int' or a 'str' - # and has 'saySomething' as its name - @QtCore.Slot(int) - @QtCore.Slot(str) - def saySomething(stuff): - print stuff - - class Communicate(QtCore.QObject): - # create two new signals on the fly: one will handle - # int type, the other will handle strings - speakNumber = QtCore.Signal(int) - speakWord = QtCore.Signal(str) - - someone = Communicate() - # connect signal and slot properly - someone.speakNumber.connect(saySomething) - someone.speakWord.connect(saySomething) - # emit each 'speak' signal - someone.speakNumber.emit(10) - someone.speakWord.emit("Hello everybody!") - - -- **Lets complicate even more**: now with overloads and complicated connections and emissions. - -:: - - import sys - from PySide import QtCore - - # define a new slot that receives an C 'int' or a 'str' - # and has 'saySomething' as its name - @QtCore.Slot(int) - @QtCore.Slot(str) - def saySomething(stuff): - print stuff - - class Communicate(QtCore.QObject): - # create two new signals on the fly: one will handle - # int type, the other will handle strings - speak = QtCore.Signal((int,), (str,)) - - someone = Communicate() - # connect signal and slot. As 'int' is the default - # we have to specify the str when connecting the - # second signal - someone.speak.connect(saySomething) - someone.speak[str].connect(saySomething) - - # emit 'speak' signal with different arguments. - # we have to specify the str as int is the default - someone.speak.emit(10) - someone.speak[str].emit("Hello everybody!") - - -PyQt compatibility ------------------- -PyQt uses a different naming convention to its new signal/slot functions. In order to convert any PyQt script that uses this new-style to run with PySide just use one the proposed modifications below: - -:: - - from PySide.QtCore import Signal as pyqtSignal - from PySide.QtCore import Slot as pyqtSlot - -or - -:: - - QtCore.pyqtSignal = QtCore.Signal - QtCore.pyqtSlot = QtCore.Slot - -This way any call to *pyqtSignal* or *pyqtSlot* will be translated to a *Signal* or *Slot* call. diff --git a/doc/property.rst b/doc/property.rst deleted file mode 100644 index 88db8d6..0000000 --- a/doc/property.rst +++ /dev/null @@ -1,44 +0,0 @@ -Use of QProperty in PySide -************************** - -PySide implements the function 'QProperty' which allows to declare properties compatible with QMetaProperties. - - -Using PySide.QProperty() ------------------------- - -The QProperty works like Q_PROPERTY macro, and uses the same arguments. - -QProperty(getFunction, [setFunction], [resetFunction], [Designable], [Scriptable], [Stored], [User]) - - -The example below uses QProperty function to export a property in QMetaObject data. - -:: - - ... - clas MyObject(QObject): - def getX(self): - ... - - def setX(self, value): - ... - - def resetX(self): - ... - - X = QProperty(getX, setX, resetX, True, True, True, True) - - ... - - -The exported property works like native python property on python side. See the example below. - -:: - - ... - o = MyObject() - o.X = 10 - print o.X - ... - From 4b3b56acd7caaa7ff0d9c7b913cfe73db12afd4a Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 5 Oct 2010 16:10:50 -0300 Subject: [PATCH 101/913] Added a PySide derived test library. The test library is intended to provide specific test cases in a way that problems could be isolated easier than using the ones provided by the Qt library. Cases commons to all Python bindings must go into the Shiboken test libraries, the one added here is intended to test Qt specifics (e.g. signals). A Python unit test was added for the case when a method and a signal have the same name. --- tests/CMakeLists.txt | 11 +- tests/pysidetest/CMakeLists.txt | 71 + tests/pysidetest/global.h | 2 + .../homonimoussignalandmethod_test.py | 53 + tests/pysidetest/pyside_global.h | 1507 +++++++++++++++++ tests/pysidetest/symbols.filter | 7 + tests/pysidetest/testobject.cpp | 14 + tests/pysidetest/testobject.h | 28 + tests/pysidetest/typesystem_pysidetest.xml | 6 + 9 files changed, 1694 insertions(+), 5 deletions(-) create mode 100644 tests/pysidetest/CMakeLists.txt create mode 100644 tests/pysidetest/global.h create mode 100644 tests/pysidetest/homonimoussignalandmethod_test.py create mode 100644 tests/pysidetest/pyside_global.h create mode 100644 tests/pysidetest/symbols.filter create mode 100644 tests/pysidetest/testobject.cpp create mode 100644 tests/pysidetest/testobject.h create mode 100644 tests/pysidetest/typesystem_pysidetest.xml diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4cacd14..83a5d21 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,8 +6,8 @@ else() endif() if(WIN32) - set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util") - set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};$ENV{PATH}") + set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util;${testbinding_BINARY_DIR}") + set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};${pysidetest_BINARY_DIR};$ENV{PATH}") set(LIBRARY_PATH_VAR "PATH") string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}") string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}") @@ -15,8 +15,8 @@ else() string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}") string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}") else() - set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util") - set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR}:$ENV{LD_LIBRARY_PATH}") + set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}:${CMAKE_SOURCE_DIR}/tests/util:${testbinding_BINARY_DIR}") + set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR}:${pysidetest_BINARY_DIR}:$ENV{LD_LIBRARY_PATH}") set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH") endif() @@ -35,7 +35,7 @@ else() elseif(${ARGC} EQUAL 2) set(EXPECT_TO_FAIL ${ARGV1}) else() - message(WARNING "Ivalid call of macro PYSIDE_TEST") + message(WARNING "Invalid call of macro PYSIDE_TEST") endif() set(TEST_CMD ${XVFB_EXEC} ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}") add_test(${TEST_NAME} ${TEST_CMD}) @@ -59,6 +59,7 @@ else() endif () add_subdirectory(signals) + add_subdirectory(pysidetest) TEST_QT_MODULE(QT_QTCORE_FOUND QtCore) TEST_QT_MODULE(QT_QTGUI_FOUND QtGui) TEST_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork) diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt new file mode 100644 index 0000000..86d232f --- /dev/null +++ b/tests/pysidetest/CMakeLists.txt @@ -0,0 +1,71 @@ +project(pysidetest) +project(testbinding) + +cmake_minimum_required(VERSION 2.6) +find_package(Qt4 4.5.0 REQUIRED) +find_package(PythonLibs REQUIRED) +find_package(PythonInterpWithDebug REQUIRED) +find_package(GeneratorRunner 0.6 REQUIRED) +find_package(Shiboken 0.5 REQUIRED) + + +set(QT_USE_QTCORE 1) +include(${QT_USE_FILE}) +add_definitions(${QT_DEFINITIONS}) +add_definitions(-DQT_SHARED) +add_definitions(-DRXX_ALLOCATOR_INIT_0) + +set(pysidetest_SRC +testobject.cpp +) + +set(pysidetest_MOC_HEADERS +testobject.h +) + +qt4_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS}) + +set(testbinding_SRC +${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp +) + +set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic) +add_custom_command(OUTPUT ${testbinding_SRC} +COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} + ${CMAKE_CURRENT_SOURCE_DIR}/global.h + --include-paths=${CMAKE_CURRENT_SOURCE_DIR}:${QT_INCLUDE_DIR}:${QT_QTCORE_INCLUDE_DIR} + --typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}:${pyside_SOURCE_DIR}:${QtCore_SOURCE_DIR} + --output-directory=${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml +WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +COMMENT "Running generator for test binding..." +) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${QT_INCLUDE_DIR} + ${QT_QTCORE_INCLUDE_DIR} + ${SHIBOKEN_INCLUDE_DIR} + ${QtCore_BINARY_DIR}/PySide/QtCore + ${libpyside_SOURCE_DIR} + ${PYTHON_INCLUDE_PATH}) + +add_library(pysidetest SHARED ${pysidetest_SRC} ${pysidetest_MOC_SRC}) +target_link_libraries(pysidetest ${QT_QTCORE_LIBRARY}) + +add_library(testbinding MODULE ${testbinding_SRC}) +set_property(TARGET testbinding PROPERTY PREFIX "") +target_link_libraries(testbinding + pysidetest + pyside + ${PYTHON_LIBRARIES} + ${SHIBOKEN_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${SBK_PYTHON_LIBRARIES}) + +add_dependencies(testbinding pyside QtCore libpyside pysidetest) + + +PYSIDE_TEST(homonimoussignalandmethod_test.py) + diff --git a/tests/pysidetest/global.h b/tests/pysidetest/global.h new file mode 100644 index 0000000..22d3375 --- /dev/null +++ b/tests/pysidetest/global.h @@ -0,0 +1,2 @@ +#include "pyside_global.h" +#include "testobject.h" diff --git a/tests/pysidetest/homonimoussignalandmethod_test.py b/tests/pysidetest/homonimoussignalandmethod_test.py new file mode 100644 index 0000000..50f14a8 --- /dev/null +++ b/tests/pysidetest/homonimoussignalandmethod_test.py @@ -0,0 +1,53 @@ +#!/usr/bin/python + +import unittest +from testbinding import TestObject + +'''Tests the behaviour of homonimous signals and slots.''' + +class HomonimousSignalAndMethodTest(unittest.TestCase): + + def setUp(self): + self.value = 123 + self.called = False + self.obj = TestObject(self.value) + + def tearDown(self): + del self.value + del self.called + del self.obj + + def testIdValueSignalEmission(self): + def callback(idValue): + self.assertEqual(idValue, self.value) + self.obj.idValue.connect(callback) + self.obj.emitIdValueSignal() + + def testStaticMethodDoubleSignalEmission(self): + def callback(): + self.called = True + self.obj.staticMethodDouble.connect(callback) + self.obj.emitStaticMethodDoubleSignal() + self.assert_(self.called) + + def testSignalNotCallable(self): + self.assertRaises(TypeError, self.obj.justASignal) + + def testCallingInstanceMethodWithArguments(self): + self.assertRaises(TypeError, TestObject.idValue, 1) + + def testCallingInstanceMethodWithoutArguments(self): + self.assertRaises(TypeError, TestObject.idValue) + + def testHomonimousSignalAndMethod(self): + self.assertEqual(self.obj.idValue(), self.value) + + def testHomonimousSignalAndStaticMethod(self): + self.assertEqual(TestObject.staticMethodDouble(3), 6) + + def testHomonimousSignalAndStaticMethodFromInstance(self): + self.assertEqual(self.obj.staticMethodDouble(4), 8) + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/pysidetest/pyside_global.h b/tests/pysidetest/pyside_global.h new file mode 100644 index 0000000..660d9fb --- /dev/null +++ b/tests/pysidetest/pyside_global.h @@ -0,0 +1,1507 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +** +** This file is part of the QtCore module of the Qt Toolkit, plus some +** modifications by PySide team. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +#undef QT_NO_STL +#undef QT_NO_STL_WCHAR + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QByteArray; + +class QString; + +#ifndef Q_MOC_OUTPUT_REVISION +#define Q_MOC_OUTPUT_REVISION 61 +#endif + +// macro for onaming members +#ifdef METHOD +#undef METHOD +#endif +#ifdef SLOT +#undef SLOT +#endif +#ifdef SIGNAL +#undef SIGNAL +#endif + +Q_CORE_EXPORT const char *qFlagLocation(const char *method); + +#define QTOSTRING_HELPER(s) #s +#define QTOSTRING(s) QTOSTRING_HELPER(s) +#ifndef QT_NO_DEBUG +# define QLOCATION "\0"__FILE__":"QTOSTRING(__LINE__) +# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# define SLOT(a) qFlagLocation("1"#a QLOCATION) +# define SIGNAL(a) qFlagLocation("2"#a QLOCATION) +#else +# define METHOD(a) "0"#a +# define SLOT(a) "1"#a +# define SIGNAL(a) "2"#a +#endif + +#ifdef QT3_SUPPORT +#define METHOD_CODE 0 // member type codes +#define SLOT_CODE 1 +#define SIGNAL_CODE 2 +#endif + +#define QMETHOD_CODE 0 // member type codes +#define QSLOT_CODE 1 +#define QSIGNAL_CODE 2 + +#define Q_ARG(type, data) QArgument(#type, data) +#define Q_RETURN_ARG(type, data) QReturnArgument(#type, data) + +class QObject; +class QMetaMethod; +class QMetaEnum; +class QMetaProperty; +class QMetaClassInfo; + + +class Q_CORE_EXPORT QGenericArgument +{ +public: + inline QGenericArgument(const char *aName = 0, const void *aData = 0) + : _data(aData), _name(aName) {} + inline void *data() const { return const_cast(_data); } + inline const char *name() const { return _name; } + +private: + const void *_data; + const char *_name; +}; + +class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument +{ +public: + inline QGenericReturnArgument(const char *aName = 0, void *aData = 0) + : QGenericArgument(aName, aData) + {} +}; + +template +class QArgument: public QGenericArgument +{ +public: + inline QArgument(const char *aName, const T &aData) + : QGenericArgument(aName, static_cast(&aData)) + {} +}; + + +template +class QReturnArgument: public QGenericReturnArgument +{ +public: + inline QReturnArgument(const char *aName, T &aData) + : QGenericReturnArgument(aName, static_cast(&aData)) + {} +}; + +struct Q_CORE_EXPORT QMetaObject +{ + const char *className() const; + const QMetaObject *superClass() const; + + QObject *cast(QObject *obj) const; + +#ifndef QT_NO_TRANSLATION + // ### Qt 4: Merge overloads + QString tr(const char *s, const char *c) const; + QString trUtf8(const char *s, const char *c) const; + QString tr(const char *s, const char *c, int n) const; + QString trUtf8(const char *s, const char *c, int n) const; +#endif // QT_NO_TRANSLATION + + int methodOffset() const; + int enumeratorOffset() const; + int propertyOffset() const; + int classInfoOffset() const; + + int constructorCount() const; + int methodCount() const; + int enumeratorCount() const; + int propertyCount() const; + int classInfoCount() const; + + int indexOfConstructor(const char *constructor) const; + int indexOfMethod(const char *method) const; + int indexOfSignal(const char *signal) const; + int indexOfSlot(const char *slot) const; + int indexOfEnumerator(const char *name) const; + int indexOfProperty(const char *name) const; + int indexOfClassInfo(const char *name) const; + + QMetaMethod constructor(int index) const; + QMetaMethod method(int index) const; + QMetaEnum enumerator(int index) const; + QMetaProperty property(int index) const; + QMetaClassInfo classInfo(int index) const; + QMetaProperty userProperty() const; + + static bool checkConnectArgs(const char *signal, const char *method); + static QByteArray normalizedSignature(const char *method); + static QByteArray normalizedType(const char *type); + + // internal index-based connect + static bool connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type = 0, int *types = 0); + // internal index-based disconnect + static bool disconnect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); + // internal slot-name based connect + static void connectSlotsByName(QObject *o); + + // internal index-based signal activation + static void activate(QObject *sender, int signal_index, void **argv); + static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv); + static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv); + static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv); + // internal guarded pointers + static void addGuard(QObject **ptr); + static void removeGuard(QObject **ptr); + static void changeGuard(QObject **ptr, QObject *o); + + static bool invokeMethod(QObject *obj, const char *member, + Qt::ConnectionType, + QGenericReturnArgument ret, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()); + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericReturnArgument ret, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3, + val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + Qt::ConnectionType type, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2, + val3, val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0, + val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + + QObject *newInstance(QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + + enum Call { + InvokeMetaMethod, + ReadProperty, + WriteProperty, + ResetProperty, + QueryPropertyDesignable, + QueryPropertyScriptable, + QueryPropertyStored, + QueryPropertyEditable, + QueryPropertyUser, + CreateInstance + }; + + int static_metacall(Call, int, void **) const; + +#ifdef QT3_SUPPORT + QT3_SUPPORT const char *superClassName() const; +#endif + + struct { // private data + const QMetaObject *superdata; + const char *stringdata; + const uint *data; + const void *extradata; + } d; +}; + +struct QMetaObjectExtraData +{ + const QMetaObject **objects; + int (*static_metacall)(QMetaObject::Call, int, void **); +}; + +inline const char *QMetaObject::className() const +{ return d.stringdata; } + +inline const QMetaObject *QMetaObject::superClass() const +{ return d.superdata; } + +#ifdef QT3_SUPPORT +inline const char *QMetaObject::superClassName() const +{ return d.superdata ? d.superdata->className() : 0; } +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#define qdoc + +#if 1 + #define Q_WS_X11 +#elif 0 + #define Q_WS_MAC +#elif 0 + #define Q_WS_WIN +#endif + +// There are symbols in Qt that exist in Debug but +// not in release +#define QT_NO_DEBUG + +#include +#if 0 + #undef qdoc +#endif +#include +#if 1 + #include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +// QT_GUI_LIB must be defined to QSqlRelationalDelegate become visible +#define QT_GUI_LIB +#undef Q_DECLARE_INTERFACE +#include +#include + +#ifndef QT_NO_XMLPATTERNS +# include +#endif + +#ifndef QT_NO_WEBKIT +# include +#endif + +#ifndef QT_NO_TEST +# include +#endif + +// Phonon +#include "phonon/pyside_phonon.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//QtHelp need be included after QtSql +#include + +#ifndef QT_NO_OPENGL +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* AttribMask */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000fffff + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* Boolean */ +#define GL_TRUE 1 +#define GL_FALSE 0 + +/* ClearBufferMask */ +/* GL_COLOR_BUFFER_BIT */ +/* GL_ACCUM_BUFFER_BIT */ +/* GL_STENCIL_BUFFER_BIT */ +/* GL_DEPTH_BUFFER_BIT */ + +/* ClientArrayType */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ +/* GL_EMISSION */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* CullFaceMode */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* DrawBufferMode */ +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C + +/* Enable */ +/* GL_FOG */ +/* GL_LIGHTING */ +/* GL_TEXTURE_1D */ +/* GL_TEXTURE_2D */ +/* GL_LINE_STIPPLE */ +/* GL_POLYGON_STIPPLE */ +/* GL_CULL_FACE */ +/* GL_ALPHA_TEST */ +/* GL_BLEND */ +/* GL_INDEX_LOGIC_OP */ +/* GL_COLOR_LOGIC_OP */ +/* GL_DITHER */ +/* GL_STENCIL_TEST */ +/* GL_DEPTH_TEST */ +/* GL_CLIP_PLANE0 */ +/* GL_CLIP_PLANE1 */ +/* GL_CLIP_PLANE2 */ +/* GL_CLIP_PLANE3 */ +/* GL_CLIP_PLANE4 */ +/* GL_CLIP_PLANE5 */ +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +/* GL_TEXTURE_GEN_S */ +/* GL_TEXTURE_GEN_T */ +/* GL_TEXTURE_GEN_R */ +/* GL_TEXTURE_GEN_Q */ +/* GL_MAP1_VERTEX_3 */ +/* GL_MAP1_VERTEX_4 */ +/* GL_MAP1_COLOR_4 */ +/* GL_MAP1_INDEX */ +/* GL_MAP1_NORMAL */ +/* GL_MAP1_TEXTURE_COORD_1 */ +/* GL_MAP1_TEXTURE_COORD_2 */ +/* GL_MAP1_TEXTURE_COORD_3 */ +/* GL_MAP1_TEXTURE_COORD_4 */ +/* GL_MAP2_VERTEX_3 */ +/* GL_MAP2_VERTEX_4 */ +/* GL_MAP2_COLOR_4 */ +/* GL_MAP2_INDEX */ +/* GL_MAP2_NORMAL */ +/* GL_MAP2_TEXTURE_COORD_1 */ +/* GL_MAP2_TEXTURE_COORD_2 */ +/* GL_MAP2_TEXTURE_COORD_3 */ +/* GL_MAP2_TEXTURE_COORD_4 */ +/* GL_POINT_SMOOTH */ +/* GL_LINE_SMOOTH */ +/* GL_POLYGON_SMOOTH */ +/* GL_SCISSOR_TEST */ +/* GL_COLOR_MATERIAL */ +/* GL_NORMALIZE */ +/* GL_AUTO_NORMAL */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ +/* GL_POLYGON_OFFSET_POINT */ +/* GL_POLYGON_OFFSET_LINE */ +/* GL_POLYGON_OFFSET_FILL */ + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FeedBackMode */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 + +/* FeedBackToken */ +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + + +/* FogParameter */ +/* GL_FOG_COLOR */ +/* GL_FOG_DENSITY */ +/* GL_FOG_END */ +/* GL_FOG_INDEX */ +/* GL_FOG_MODE */ +/* GL_FOG_START */ + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetMapTarget */ +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 + +/* GetPixelMap */ +/* GL_PIXEL_MAP_I_TO_I */ +/* GL_PIXEL_MAP_S_TO_S */ +/* GL_PIXEL_MAP_I_TO_R */ +/* GL_PIXEL_MAP_I_TO_G */ +/* GL_PIXEL_MAP_I_TO_B */ +/* GL_PIXEL_MAP_I_TO_A */ +/* GL_PIXEL_MAP_R_TO_R */ +/* GL_PIXEL_MAP_G_TO_G */ +/* GL_PIXEL_MAP_B_TO_B */ +/* GL_PIXEL_MAP_A_TO_A */ + +/* GetPointerTarget */ +/* GL_VERTEX_ARRAY_POINTER */ +/* GL_NORMAL_ARRAY_POINTER */ +/* GL_COLOR_ARRAY_POINTER */ +/* GL_INDEX_ARRAY_POINTER */ +/* GL_TEXTURE_COORD_ARRAY_POINTER */ +/* GL_EDGE_FLAG_ARRAY_POINTER */ + +/* GetTarget */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +/* GL_TEXTURE_BINDING_1D */ +/* GL_TEXTURE_BINDING_2D */ +/* GL_VERTEX_ARRAY */ +/* GL_NORMAL_ARRAY */ +/* GL_COLOR_ARRAY */ +/* GL_INDEX_ARRAY */ +/* GL_TEXTURE_COORD_ARRAY */ +/* GL_EDGE_FLAG_ARRAY */ +/* GL_VERTEX_ARRAY_SIZE */ +/* GL_VERTEX_ARRAY_TYPE */ +/* GL_VERTEX_ARRAY_STRIDE */ +/* GL_NORMAL_ARRAY_TYPE */ +/* GL_NORMAL_ARRAY_STRIDE */ +/* GL_COLOR_ARRAY_SIZE */ +/* GL_COLOR_ARRAY_TYPE */ +/* GL_COLOR_ARRAY_STRIDE */ +/* GL_INDEX_ARRAY_TYPE */ +/* GL_INDEX_ARRAY_STRIDE */ +/* GL_TEXTURE_COORD_ARRAY_SIZE */ +/* GL_TEXTURE_COORD_ARRAY_TYPE */ +/* GL_TEXTURE_COORD_ARRAY_STRIDE */ +/* GL_EDGE_FLAG_ARRAY_STRIDE */ +/* GL_POLYGON_OFFSET_FACTOR */ +/* GL_POLYGON_OFFSET_UNITS */ + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_BORDER 0x1005 +/* GL_TEXTURE_RED_SIZE */ +/* GL_TEXTURE_GREEN_SIZE */ +/* GL_TEXTURE_BLUE_SIZE */ +/* GL_TEXTURE_ALPHA_SIZE */ +/* GL_TEXTURE_LUMINANCE_SIZE */ +/* GL_TEXTURE_INTENSITY_SIZE */ +/* GL_TEXTURE_PRIORITY */ +/* GL_TEXTURE_RESIDENT */ + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +/* GL_PERSPECTIVE_CORRECTION_HINT */ +/* GL_POINT_SMOOTH_HINT */ +/* GL_LINE_SMOOTH_HINT */ +/* GL_POLYGON_SMOOTH_HINT */ +/* GL_FOG_HINT */ +/* GL_PHONG_HINT */ + +/* IndexPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* LightModelParameter */ +/* GL_LIGHT_MODEL_AMBIENT */ +/* GL_LIGHT_MODEL_LOCAL_VIEWER */ +/* GL_LIGHT_MODEL_TWO_SIDE */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* InterleavedArrays */ +/* GL_V2F */ +/* GL_V3F */ +/* GL_C4UB_V2F */ +/* GL_C4UB_V3F */ +/* GL_C3F_V3F */ +/* GL_N3F_V3F */ +/* GL_C4F_N3F_V3F */ +/* GL_T2F_V3F */ +/* GL_T4F_V4F */ +/* GL_T2F_C4UB_V3F */ +/* GL_T2F_C3F_V3F */ +/* GL_T2F_N3F_V3F */ +/* GL_T2F_C4F_N3F_V3F */ +/* GL_T4F_C4F_N3F_V4F */ + +/* ListMode */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 + +/* ListNameType */ +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ +/* GL_2_BYTES */ +/* GL_3_BYTES */ +/* GL_4_BYTES */ + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MapTarget */ +/* GL_MAP1_COLOR_4 */ +/* GL_MAP1_INDEX */ +/* GL_MAP1_NORMAL */ +/* GL_MAP1_TEXTURE_COORD_1 */ +/* GL_MAP1_TEXTURE_COORD_2 */ +/* GL_MAP1_TEXTURE_COORD_3 */ +/* GL_MAP1_TEXTURE_COORD_4 */ +/* GL_MAP1_VERTEX_3 */ +/* GL_MAP1_VERTEX_4 */ +/* GL_MAP2_COLOR_4 */ +/* GL_MAP2_INDEX */ +/* GL_MAP2_NORMAL */ +/* GL_MAP2_TEXTURE_COORD_1 */ +/* GL_MAP2_TEXTURE_COORD_2 */ +/* GL_MAP2_TEXTURE_COORD_3 */ +/* GL_MAP2_TEXTURE_COORD_4 */ +/* GL_MAP2_VERTEX_3 */ +/* GL_MAP2_VERTEX_4 */ + +/* MaterialFace */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* MeshMode1 */ +/* GL_POINT */ +/* GL_LINE */ + +/* MeshMode2 */ +/* GL_POINT */ +/* GL_LINE */ +/* GL_FILL */ + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* PixelCopyType */ +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 + +/* PixelFormat */ +#define GL_COLOR_INDEX 0x1900 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelMap */ +/* GL_PIXEL_MAP_I_TO_I */ +/* GL_PIXEL_MAP_S_TO_S */ +/* GL_PIXEL_MAP_I_TO_R */ +/* GL_PIXEL_MAP_I_TO_G */ +/* GL_PIXEL_MAP_I_TO_B */ +/* GL_PIXEL_MAP_I_TO_A */ +/* GL_PIXEL_MAP_R_TO_R */ +/* GL_PIXEL_MAP_G_TO_G */ +/* GL_PIXEL_MAP_B_TO_B */ +/* GL_PIXEL_MAP_A_TO_A */ + +/* PixelStore */ +/* GL_UNPACK_SWAP_BYTES */ +/* GL_UNPACK_LSB_FIRST */ +/* GL_UNPACK_ROW_LENGTH */ +/* GL_UNPACK_SKIP_ROWS */ +/* GL_UNPACK_SKIP_PIXELS */ +/* GL_UNPACK_ALIGNMENT */ +/* GL_PACK_SWAP_BYTES */ +/* GL_PACK_LSB_FIRST */ +/* GL_PACK_ROW_LENGTH */ +/* GL_PACK_SKIP_ROWS */ +/* GL_PACK_SKIP_PIXELS */ +/* GL_PACK_ALIGNMENT */ + +/* PixelTransfer */ +/* GL_MAP_COLOR */ +/* GL_MAP_STENCIL */ +/* GL_INDEX_SHIFT */ +/* GL_INDEX_OFFSET */ +/* GL_RED_SCALE */ +/* GL_RED_BIAS */ +/* GL_GREEN_SCALE */ +/* GL_GREEN_BIAS */ +/* GL_BLUE_SCALE */ +/* GL_BLUE_BIAS */ +/* GL_ALPHA_SCALE */ +/* GL_ALPHA_BIAS */ +/* GL_DEPTH_SCALE */ +/* GL_DEPTH_BIAS */ + +/* PixelType */ +#define GL_BITMAP 0x1A00 +/* GL_BYTE */ +/* GL_UNSIGNED_BYTE */ +/* GL_SHORT */ +/* GL_UNSIGNED_SHORT */ +/* GL_INT */ +/* GL_UNSIGNED_INT */ +/* GL_FLOAT */ + +/* PolygonMode */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 + +/* ReadBufferMode */ +/* GL_FRONT_LEFT */ +/* GL_FRONT_RIGHT */ +/* GL_BACK_LEFT */ +/* GL_BACK_RIGHT */ +/* GL_FRONT */ +/* GL_BACK */ +/* GL_LEFT */ +/* GL_RIGHT */ +/* GL_AUX0 */ +/* GL_AUX1 */ +/* GL_AUX2 */ +/* GL_AUX3 */ + +/* RenderingMode */ +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureCoordName */ +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* TextureGenMode */ +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 + +/* TextureGenParameter */ +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +/* GL_TEXTURE_BORDER_COLOR */ +/* GL_TEXTURE_PRIORITY */ + +/* TextureTarget */ +/* GL_TEXTURE_1D */ +/* GL_TEXTURE_2D */ +/* GL_PROXY_TEXTURE_1D */ +/* GL_PROXY_TEXTURE_2D */ + +/* TextureWrapMode */ +#define GL_CLAMP 0x2900 +#define GL_REPEAT 0x2901 + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_INT */ +/* GL_FLOAT */ +/* GL_DOUBLE */ + +/* ClientAttribMask */ +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff + +/* polygon_offset */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* texture */ +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 + +/* texture_object */ +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 + +/* vertex_array */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Extensions */ +#define GL_EXT_vertex_array 1 +#define GL_EXT_bgra 1 +#define GL_EXT_paletted_texture 1 +#define GL_WIN_swap_hint 1 +#define GL_WIN_draw_range_elements 1 +// #define GL_WIN_phong_shading 1 +// #define GL_WIN_specular_fog 1 + +/* EXT_vertex_array */ +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#define GL_DOUBLE_EXT GL_DOUBLE + +/* EXT_bgra */ +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 + +/* EXT_paletted_texture */ + +/* These must match the GL_COLOR_TABLE_*_SGI enumerants */ +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF + +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 + +/* WIN_draw_range_elements */ +#define GL_MAX_ELEMENTS_VERTICES_WIN 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_WIN 0x80E9 + +/* WIN_phong_shading */ +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB + +/* WIN_specular_fog */ +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC + +/* For compatibility with OpenGL v1.0 */ +#define GL_LOGIC_OP GL_INDEX_LOGIC_OP +#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT +#include +#endif // QT_NO_OPENGL + diff --git a/tests/pysidetest/symbols.filter b/tests/pysidetest/symbols.filter new file mode 100644 index 0000000..af6c744 --- /dev/null +++ b/tests/pysidetest/symbols.filter @@ -0,0 +1,7 @@ +{ +local: +_ZSt*; +_ZNSt*; +_ZNSs*; +_ZNKSt*; +}; diff --git a/tests/pysidetest/testobject.cpp b/tests/pysidetest/testobject.cpp new file mode 100644 index 0000000..717c4e3 --- /dev/null +++ b/tests/pysidetest/testobject.cpp @@ -0,0 +1,14 @@ +#include "testobject.h" + +void +TestObject::emitIdValueSignal() +{ + emit idValue(m_idValue); +} + +void +TestObject::emitStaticMethodDoubleSignal() +{ + emit staticMethodDouble(); +} + diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h new file mode 100644 index 0000000..ef02661 --- /dev/null +++ b/tests/pysidetest/testobject.h @@ -0,0 +1,28 @@ +#ifndef TESTOBJECT_H +#define TESTOBJECT_H + +#include +#include "pysidemacros.h" + +class PYSIDE_API TestObject : public QObject +{ + Q_OBJECT +public: + TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {} + int idValue() const { return m_idValue; } + static int staticMethodDouble(int value) { return value * 2; } + + void emitIdValueSignal(); + void emitStaticMethodDoubleSignal(); + +signals: + void idValue(int newValue); + void justASignal(); + void staticMethodDouble(); + +private: + int m_idValue; +}; + +#endif // TESTOBJECT_H + diff --git a/tests/pysidetest/typesystem_pysidetest.xml b/tests/pysidetest/typesystem_pysidetest.xml new file mode 100644 index 0000000..a966362 --- /dev/null +++ b/tests/pysidetest/typesystem_pysidetest.xml @@ -0,0 +1,6 @@ + + + + + + From 7fab5c03a94a24f6496ad129485244f7d6f4f994 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 7 Oct 2010 17:25:56 -0300 Subject: [PATCH 102/913] Signal objects redirect calls for homonymous methods. --- libpyside/qsignal.cpp | 242 +++++++++++------- libpyside/qsignal.h | 7 + tests/pysidetest/CMakeLists.txt | 2 +- ...t.py => homonymoussignalandmethod_test.py} | 10 +- 4 files changed, 162 insertions(+), 99 deletions(-) rename tests/pysidetest/{homonimoussignalandmethod_test.py => homonymoussignalandmethod_test.py} (82%) diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp index 46cb1b6..a3e1c94 100644 --- a/libpyside/qsignal.cpp +++ b/libpyside/qsignal.cpp @@ -52,6 +52,7 @@ struct SignalData { char* signalName; char** signatures; int signaturesSize; + PyObject* homonymousMethod; }; static int signalTpInit(PyObject*, PyObject*, PyObject*); @@ -64,54 +65,57 @@ static PyObject* signalInstanceDisconnect(PyObject*, PyObject*); static PyObject* signalInstanceEmit(PyObject*, PyObject*); static PyObject* signalInstanceGetItem(PyObject*, PyObject*); +static PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw); +static PyObject* signalCall(PyObject*, PyObject*, PyObject*); + PyTypeObject PySideSignalType = { PyObject_HEAD_INIT(0) - 0, /*ob_size*/ - "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ - sizeof(SignalData), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - SIGNAL_CLASS_NAME, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - 0, /*tp_iter */ - 0, /*tp_iternext */ - 0, /*tp_methods */ - 0, /*tp_members */ - 0, /*tp_getset */ - 0, /*tp_base */ - 0, /*tp_dict */ - 0, /*tp_descr_get */ - 0, /*tp_descr_set */ - 0, /*tp_dictoffset */ - signalTpInit, /*tp_init */ - 0, /*tp_alloc */ - PyType_GenericNew, /*tp_new */ - signalFree, /*tp_free */ - 0, /*tp_is_gc */ - 0, /*tp_bases */ - 0, /*tp_mro */ - 0, /*tp_cache */ - 0, /*tp_subclasses */ - 0, /*tp_weaklist */ - 0, /*tp_del */ + /*ob_size*/ 0, + /*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME, + /*tp_basicsize*/ sizeof(SignalData), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ &Shiboken::deallocWrapper, + /*tp_print*/ 0, + /*tp_getattr*/ 0, + /*tp_setattr*/ 0, + /*tp_compare*/ 0, + /*tp_repr*/ 0, + /*tp_as_number*/ 0, + /*tp_as_sequence*/ 0, + /*tp_as_mapping*/ 0, + /*tp_hash*/ 0, + /*tp_call*/ signalCall, + /*tp_str*/ 0, + /*tp_getattro*/ 0, + /*tp_setattro*/ 0, + /*tp_as_buffer*/ 0, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ SIGNAL_CLASS_NAME, + /*tp_traverse*/ 0, + /*tp_clear*/ 0, + /*tp_richcompare*/ 0, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ 0, + /*tp_iternext*/ 0, + /*tp_methods*/ 0, + /*tp_members*/ 0, + /*tp_getset*/ 0, + /*tp_base*/ 0, + /*tp_dict*/ 0, + /*tp_descr_get*/ 0, + /*tp_descr_set*/ 0, + /*tp_dictoffset*/ 0, + /*tp_init*/ signalTpInit, + /*tp_alloc*/ 0, + /*tp_new*/ PyType_GenericNew, + /*tp_free*/ signalFree, + /*tp_is_gc*/ 0, + /*tp_bases*/ 0, + /*tp_mro*/ 0, + /*tp_cache*/ 0, + /*tp_subclasses*/ 0, + /*tp_weaklist*/ 0, + /*tp_del*/ 0, }; static PyMethodDef SignalInstance_methods[] = { @@ -129,52 +133,52 @@ static PyMappingMethods SignalInstance_as_mapping = { PyTypeObject PySideSignalInstanceType = { PyObject_HEAD_INIT(0) - 0, /*ob_size*/ - "PySide.QtCore."SIGNAL_CLASS_NAME, /*tp_name*/ - sizeof(PySideSignalInstanceData),/*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - &SignalInstance_as_mapping,/*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - SIGNAL_CLASS_NAME, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - 0, /*tp_iter */ - 0, /*tp_iternext */ - SignalInstance_methods, /*tp_methods */ - 0, /*tp_members */ - 0, /*tp_getset */ - 0, /*tp_base */ - 0, /*tp_dict */ - 0, /*tp_descr_get */ - 0, /*tp_descr_set */ - 0, /*tp_dictoffset */ - 0, /*tp_init */ - 0, /*tp_alloc */ - PyType_GenericNew, /*tp_new */ - signalInstanceFree, /*tp_free */ - 0, /*tp_is_gc */ - 0, /*tp_bases */ - 0, /*tp_mro */ - 0, /*tp_cache */ - 0, /*tp_subclasses */ - 0, /*tp_weaklist */ - 0, /*tp_del */ + /*ob_size*/ 0, + /*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME, + /*tp_basicsize*/ sizeof(PySideSignalInstanceData), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ 0, + /*tp_print*/ 0, + /*tp_getattr*/ 0, + /*tp_setattr*/ 0, + /*tp_compare*/ 0, + /*tp_repr*/ 0, + /*tp_as_number*/ 0, + /*tp_as_sequence*/ 0, + /*tp_as_mapping*/ &SignalInstance_as_mapping, + /*tp_hash*/ 0, + /*tp_call*/ signalInstanceCall, + /*tp_str*/ 0, + /*tp_getattro*/ 0, + /*tp_setattro*/ 0, + /*tp_as_buffer*/ 0, + /*tp_flags*/ Py_TPFLAGS_DEFAULT, + /*tp_doc*/ SIGNAL_CLASS_NAME, + /*tp_traverse*/ 0, + /*tp_clear*/ 0, + /*tp_richcompare*/ 0, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ 0, + /*tp_iternext*/ 0, + /*tp_methods*/ SignalInstance_methods, + /*tp_members*/ 0, + /*tp_getset*/ 0, + /*tp_base*/ 0, + /*tp_dict*/ 0, + /*tp_descr_get*/ 0, + /*tp_descr_set*/ 0, + /*tp_dictoffset*/ 0, + /*tp_init*/ 0, + /*tp_alloc*/ 0, + /*tp_new*/ PyType_GenericNew, + /*tp_free*/ signalInstanceFree, + /*tp_is_gc*/ 0, + /*tp_bases*/ 0, + /*tp_mro*/ 0, + /*tp_cache*/ 0, + /*tp_subclasses*/ 0, + /*tp_weaklist*/ 0, + /*tp_del*/ 0, }; int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds) @@ -224,6 +228,8 @@ void signalFree(void *self) free(data->signalName); data->initialized = 0; data->signaturesSize = 0; + Py_XDECREF(data->homonymousMethod); + data->homonymousMethod = 0; pySelf->ob_type->tp_base->tp_free(self); } @@ -236,8 +242,10 @@ void signalInstanceFree(void* self) free(data->signalName); free(data->signature); + Py_XDECREF(data->homonymousMethod); + if (data->next) { - Py_XDECREF(data->next); + Py_DECREF(data->next); data->next = 0; } pySelf->ob_type->tp_base->tp_free(self); @@ -385,6 +393,38 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args) return 0; } +PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw) +{ + SignalData* signalData = reinterpret_cast(self); + + if (!signalData->homonymousMethod) { + PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable"); + return 0; + } + + descrgetfunc getDescriptor = signalData->homonymousMethod->ob_type->tp_descr_get; + Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->homonymousMethod, 0, 0)); + + if (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC) + return PyCFunction_Call(homonymousMethod, args, kw); + + ternaryfunc callFunc = signalData->homonymousMethod->ob_type->tp_call; + return callFunc(homonymousMethod, args, kw); +} + +PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw) +{ + PySideSignalInstanceData* signalData = reinterpret_cast(self); + if (!signalData->homonymousMethod) { + PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable"); + return 0; + } + + descrgetfunc getDescriptor = signalData->homonymousMethod->ob_type->tp_descr_get; + Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->homonymousMethod, signalData->source, 0)); + return PyCFunction_Call(homonymousMethod, args, kw); +} + } // extern "C" namespace PySide @@ -503,6 +543,11 @@ void signalInstanceInitialize(PyObject* instance, PyObject* name, SignalData* da self->source = source; self->signature = signalBuildSignature(self->signalName, data->signatures[index]); + self->homonymousMethod = 0; + if (data->homonymousMethod) { + self->homonymousMethod = data->homonymousMethod; + Py_INCREF(self->homonymousMethod); + } index++; if (index < data->signaturesSize) { @@ -531,6 +576,7 @@ PyObject* signalNew(const char* name, ...) self->signaturesSize = 0; self->signatures = 0; self->initialized = 0; + self->homonymousMethod = 0; va_start(listSignatures, name); sig = va_arg(listSignatures, char*); @@ -556,5 +602,15 @@ PyObject* signalBuildQtCompatible(const char* signature) return ret; } +void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal) +{ + PyObject* typeDict = wrapperType->super.ht_type.tp_dict; + PyObject* homonymousMethod; + if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) { + Py_INCREF(homonymousMethod); + reinterpret_cast(signal)->homonymousMethod = homonymousMethod; + } + PyDict_SetItemString(typeDict, signalName, signal); +} } //namespace PySide diff --git a/libpyside/qsignal.h b/libpyside/qsignal.h index 6177496..7a8a349 100644 --- a/libpyside/qsignal.h +++ b/libpyside/qsignal.h @@ -27,6 +27,11 @@ #include #include +namespace Shiboken +{ + struct SbkBaseWrapperType; +} + extern "C" { extern PYSIDE_API PyTypeObject PySideSignalInstanceType; @@ -37,6 +42,7 @@ extern "C" char* signalName; char* signature; PyObject* source; + PyObject* homonymousMethod; PyObject* next; }; }; //extern "C" @@ -46,6 +52,7 @@ namespace PySide PYSIDE_API PyObject* signalNew(const char* name, ...); PYSIDE_API void signalUpdateSource(PyObject* source); +PYSIDE_API void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal); } //namespace PySide diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 86d232f..887a2d5 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -67,5 +67,5 @@ target_link_libraries(testbinding add_dependencies(testbinding pyside QtCore libpyside pysidetest) -PYSIDE_TEST(homonimoussignalandmethod_test.py) +PYSIDE_TEST(homonymoussignalandmethod_test.py) diff --git a/tests/pysidetest/homonimoussignalandmethod_test.py b/tests/pysidetest/homonymoussignalandmethod_test.py similarity index 82% rename from tests/pysidetest/homonimoussignalandmethod_test.py rename to tests/pysidetest/homonymoussignalandmethod_test.py index 50f14a8..4850c5b 100644 --- a/tests/pysidetest/homonimoussignalandmethod_test.py +++ b/tests/pysidetest/homonymoussignalandmethod_test.py @@ -3,9 +3,9 @@ import unittest from testbinding import TestObject -'''Tests the behaviour of homonimous signals and slots.''' +'''Tests the behaviour of homonymous signals and slots.''' -class HomonimousSignalAndMethodTest(unittest.TestCase): +class HomonymousSignalAndMethodTest(unittest.TestCase): def setUp(self): self.value = 123 @@ -39,13 +39,13 @@ class HomonimousSignalAndMethodTest(unittest.TestCase): def testCallingInstanceMethodWithoutArguments(self): self.assertRaises(TypeError, TestObject.idValue) - def testHomonimousSignalAndMethod(self): + def testHomonymousSignalAndMethod(self): self.assertEqual(self.obj.idValue(), self.value) - def testHomonimousSignalAndStaticMethod(self): + def testHomonymousSignalAndStaticMethod(self): self.assertEqual(TestObject.staticMethodDouble(3), 6) - def testHomonimousSignalAndStaticMethodFromInstance(self): + def testHomonymousSignalAndStaticMethodFromInstance(self): self.assertEqual(self.obj.staticMethodDouble(4), 8) if __name__ == '__main__': From 9a3db9de9c67f1b38348ef64bcb730eec1d1e763 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 13 Oct 2010 10:00:50 -0300 Subject: [PATCH 103/913] Updated version to 0.4.2. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5613f52..71aee4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ endif() set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "0") set(BINDING_API_MINOR_VERSION "4") -set(BINDING_API_MICRO_VERSION "1") +set(BINDING_API_MICRO_VERSION "2") set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) set(PYSIDE_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" CACHE STRING "Qt version used to compile PySide" FORCE) if(ENABLE_VERSION_SUFFIX) From 646850ee7b92b4c6d25de04583bcc52a4f122e1e Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Thu, 15 Jul 2010 09:38:40 -0300 Subject: [PATCH 104/913] Adding QColor copy test Reviewer: Luciano Wolf Renato Filho --- tests/QtGui/qcolor_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/QtGui/qcolor_test.py b/tests/QtGui/qcolor_test.py index 3c2f11b..a636ad6 100644 --- a/tests/QtGui/qcolor_test.py +++ b/tests/QtGui/qcolor_test.py @@ -64,5 +64,20 @@ class QColorEqualGlobalColor(unittest.TestCase): self.assertEqual(QColor(255, 0, 0), Qt.red) +class QColorCopy(unittest.TestCase): + + def testDeepCopy(self): + '''QColor deepcopy''' + + from copy import deepcopy + + original = QColor(0, 0, 255) + copy = deepcopy([original])[0] + + self.assert_(original is not copy) + self.assertEqual(original, copy) + del original + self.assertEqual(copy, QColor(0, 0, 255)) + if __name__ == '__main__': unittest.main() From 24fcb55072c9e9db0215e0268202e4e14f55195f Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Mon, 9 Aug 2010 14:23:35 -0300 Subject: [PATCH 105/913] Add templates for __reduce__ functions. Reviewer: Luciano Wolf Renato Filho --- PySide/typesystem_templates.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 959fe7e..e9db328 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -181,11 +181,18 @@ %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5); %PYARG_0 = Shiboken::makeTuple(retval_, %4); - + + + From 51dd97bebcf49c36402bd3401e5f8b1bf0d1de31 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Mon, 9 Aug 2010 17:55:05 -0300 Subject: [PATCH 106/913] Adding several __reduce__ methods in QtCore Add QColor.__reduce__ Adding QByteArray __reduce__ Reviewer: Luciano Wolf Renato Filho --- PySide/QtCore/typesystem_core.xml | 84 +++++++++++++++++++++++++- PySide/QtGui/typesystem_gui_common.xml | 8 +++ 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index db7777e..cd46325 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -727,6 +727,14 @@ + + + + args = Py_BuildValue("(iii)", %CPPSELF.year(), %CPPSELF.month(), + %CPPSELF.day()); + + + @@ -760,14 +768,35 @@ - + + + + + + + QDate date(%1, %2, %3); + QTime time(%4, %5, %6, %7); + %0 = new %TYPE(date, time, Qt::TimeSpec(%8)); + + + + + + QDate date = %CPPSELF.date(); + QTime time = %CPPSELF.time(); + args = Py_BuildValue("(iiiiiiii)", date.year(), date.month(), + date.day(), time.hour(), + time.minute(), time.second(), + time.msec(), (int)%CPPSELF.timeSpec()); + + + - @@ -803,6 +832,14 @@ + + + + args = Py_BuildValue("(iiii)", %CPPSELF.x(), %CPPSELF.y(), + %CPPSELF.width(), %CPPSELF.height()); + + + @@ -811,6 +848,16 @@ + + + + // FIXME These functions return qreal. Will convert to double (format + // string) mess things up in other architectures? + args = Py_BuildValue("(dddd)", %CPPSELF.x(), %CPPSELF.y(), + %CPPSELF.width(), %CPPSELF.height()); + + + @@ -823,10 +870,26 @@ + + + + args = Py_BuildValue("(ii)", %CPPSELF.width(), %CPPSELF.height()); + + + + + + + // FIXME These functions return qreal. Will convert to double (format + // string) mess things up in other architectures? + args = Py_BuildValue("(dd)", %CPPSELF.width(), %CPPSELF.height()); + + + @@ -834,6 +897,14 @@ + + + + args = Py_BuildValue("(iiii)", %CPPSELF.hour(), %CPPSELF.minute(), + %CPPSELF.second(), %CPPSELF.msec()); + + + @@ -1298,6 +1369,15 @@ Shiboken::SbkType<QByteArray>()->tp_flags |= Py_TPFLAGS_HAVE_GETCHARBUFFER; #endif + + + + + args = Py_BuildValue("(s)", %CPPSELF.constData()); + + + + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 68d5c0d..090778f 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -678,6 +678,14 @@ PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QColor"); + + + + args = Py_BuildValue("(iiii)", %CPPSELF.red(), %CPPSELF.green(), + %CPPSELF.blue(), %CPPSELF.alpha()); + + + From a3b0314c58720194613a87623461abc93469a978 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Mon, 9 Aug 2010 18:03:24 -0300 Subject: [PATCH 107/913] Adding deepcopy test for QtCore classes. Reviewer: Luciano Wolf Renato Filho --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/deepcopy_test.py | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/QtCore/deepcopy_test.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 30f3ff6..7225da0 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -2,6 +2,7 @@ PYSIDE_TEST(bug_278_test.py) PYSIDE_TEST(bug_332.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) +PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(deletelater_test.py) PYSIDE_TEST(duck_punching_test.py) PYSIDE_TEST(hash_test.py) diff --git a/tests/QtCore/deepcopy_test.py b/tests/QtCore/deepcopy_test.py new file mode 100644 index 0000000..9c14272 --- /dev/null +++ b/tests/QtCore/deepcopy_test.py @@ -0,0 +1,56 @@ + +import unittest +from copy import deepcopy + +from PySide.QtCore import QByteArray, QDate, QDateTime, QTime +from PySide.QtCore import Qt, QSize, QSizeF, QRect, QRectF + +class DeepCopyHelper: + + def testCopy(self): + copy = deepcopy([self.original])[0] + self.assert_(copy is not self.original) + self.assertEqual(copy, self.original) + +class QByteArrayDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QByteArray('the quick brown fox jumps over the lazy dog') + + +class QDateDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QDate(2010, 11, 22) + + +class QTimeDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QTime(11, 37, 55, 692) + + +class QDateTimeDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QDateTime(2010, 5, 18, 10, 24, 45, 223, Qt.LocalTime) + + +class QSizeDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QSize(42, 190) + + +class QSizeFDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QSizeF(42.7, 190.2) + + +class QRectDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QRect(100, 200, 300, 400) + + +class QRectFDeepCopy(DeepCopyHelper, unittest.TestCase): + def setUp(self): + self.original = QRectF(100.33, 200.254, 300.321, 400.123) + + +if __name__ == '__main__': + unittest.main() From eb9b436390a71327104a884afe09b566b0dc5fbd Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Wed, 6 Oct 2010 09:26:28 -0300 Subject: [PATCH 108/913] Adding extra check for QPoint as a dict key Reviewer: Luciano Wolf Renato Filho --- tests/QtCore/hash_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/QtCore/hash_test.py b/tests/QtCore/hash_test.py index 6ff24f3..bf02176 100644 --- a/tests/QtCore/hash_test.py +++ b/tests/QtCore/hash_test.py @@ -10,16 +10,19 @@ class HashTest(unittest.TestCase): qdatetime = QDateTime.currentDateTime() qtime = QTime.currentTime() qurl = QUrl("http://www.pyside.org") + qpoint = QPoint(12, 42) myHash[qdate] = "QDate" myHash[qdatetime] = "QDateTime" myHash[qtime] = "QTime" myHash[qurl] = "QUrl" + myHash[qpoint] = "QPoint" self.assertEqual(myHash[qdate], "QDate") self.assertEqual(myHash[qdatetime], "QDateTime") self.assertEqual(myHash[qtime], "QTime") self.assertEqual(myHash[qurl], "QUrl") + self.assertEqual(myHash[qpoint], "QPoint") def testQPointHash(self): p1 = QPoint(12, 34) From ce09bd623b678eefddbe848b5cb44533cc648ae9 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Wed, 13 Oct 2010 12:53:10 -0300 Subject: [PATCH 109/913] Implemented support to deep copy on QtCore. Reviewer: Luciano Wolf Lauro Neto --- PySide/QtCore/typesystem_core.xml | 195 ++++++++++++++++++++---------- PySide/typesystem_templates.xml | 50 +++++++- tests/QtCore/deepcopy_test.py | 29 ++++- 3 files changed, 203 insertions(+), 71 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index cd46325..a72abce 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -671,6 +671,14 @@ + + + + + + + + namespace PySide { template<> inline uint hash(const QLine& v) { @@ -681,6 +689,14 @@ + + + + + + + + @@ -726,13 +742,12 @@ - - - args = Py_BuildValue("(iii)", %CPPSELF.year(), %CPPSELF.month(), - %CPPSELF.day()); - + + + + @@ -767,6 +782,7 @@ %PYARG_0 = Shiboken::makeTuple(week, yearNumber); + @@ -786,24 +802,36 @@ - - QDate date = %CPPSELF.date(); - QTime time = %CPPSELF.time(); - args = Py_BuildValue("(iiiiiiii)", date.year(), date.month(), - date.day(), time.hour(), - time.minute(), time.second(), - time.msec(), (int)%CPPSELF.timeSpec()); - + + + + + + + + + + + + + + + + + + + + namespace PySide { template<> inline uint hash(const QPoint& v) { @@ -815,10 +843,26 @@ + + + + + + + + + + + + + + + + namespace PySide { template<> inline uint hash(const QRect& v) { @@ -832,35 +876,32 @@ - - - - args = Py_BuildValue("(iiii)", %CPPSELF.x(), %CPPSELF.y(), - %CPPSELF.width(), %CPPSELF.height()); - - - - - - - - - + - - // FIXME These functions return qreal. Will convert to double (format - // string) mess things up in other architectures? - args = Py_BuildValue("(dddd)", %CPPSELF.x(), %CPPSELF.y(), - %CPPSELF.width(), %CPPSELF.height()); - + + + + + + - + + + + + + + + namespace PySide { template<> inline uint hash(const QSize& v) { @@ -870,41 +911,33 @@ - - - - args = Py_BuildValue("(ii)", %CPPSELF.width(), %CPPSELF.height()); - - - - - - - // FIXME These functions return qreal. Will convert to double (format - // string) mess things up in other architectures? - args = Py_BuildValue("(dd)", %CPPSELF.width(), %CPPSELF.height()); - + + + + + + + + + + + + + + - - - - args = Py_BuildValue("(iiii)", %CPPSELF.hour(), %CPPSELF.minute(), - %CPPSELF.second(), %CPPSELF.msec()); - - - @@ -913,6 +946,14 @@ + + + + + + + + @@ -1008,7 +1049,7 @@ - + return %CPPSELF.size(); @@ -1336,6 +1377,14 @@ + + + + + + + + @@ -1343,17 +1392,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -1370,14 +1443,6 @@ #endif - - - - args = Py_BuildValue("(s)", %CPPSELF.constData()); - - - - diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index e9db328..5763434 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -187,12 +187,56 @@ Shiboken::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0); - From 2a4ee1675dd798d5a50363fb073e6801d45a8d17 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 10 Nov 2010 21:18:47 -0300 Subject: [PATCH 178/913] Removed unnecessary find_package statements from pysidetest's CMakeLists.txt Reviewed by Lauro Moura Reviewed by Luciano Wolf --- tests/pysidetest/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 875ff0c..176c8cd 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -2,11 +2,7 @@ project(pysidetest) project(testbinding) cmake_minimum_required(VERSION 2.6) -find_package(Qt4 4.5.0 REQUIRED) find_package(PythonLibs REQUIRED) -find_package(GeneratorRunner 0.6 REQUIRED) -find_package(Shiboken 0.5 REQUIRED) - set(QT_USE_QTCORE 1) include(${QT_USE_FILE}) From 7013bd760e1ad46b31c019e0a11df504d6e2563e Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 11 Nov 2010 14:04:06 -0200 Subject: [PATCH 179/913] Fix bug#455 - "QByteArray.data() cuts data to first '\x00' char" Reviewer: Marcelo Lira Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 6 ++++++ tests/QtCore/qbytearray_test.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index f521607..e542ea6 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1437,6 +1437,12 @@ #endif + + + %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size()); + + + diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py index 1c425b8..2c0ee87 100644 --- a/tests/QtCore/qbytearray_test.py +++ b/tests/QtCore/qbytearray_test.py @@ -42,6 +42,12 @@ class QByteArrayData(unittest.TestCase): url = QByteArray("http://web.openbossa.org/") self.assertEqual(url.data(), "http://web.openbossa.org/") + def testDataWithZeros(self): + s1 = "123\000321" + ba = QByteArray(s1) + s2 = ba.data() + self.assertEqual(s1, s2) + class QByteArrayOperatorAtSetter(unittest.TestCase): '''Test case for operator QByteArray[] - __setitem__''' From 655219636b1500e82d543914045f4cc7ba7db95f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 11 Nov 2010 17:45:16 -0200 Subject: [PATCH 180/913] Fix bug#436 - "Using a custom QValidator generates a segfault" Reviewer: Marcelo Lira Luciano Wolf --- PySide/QtGui/typesystem_gui_common.xml | 57 +++++++++++------ tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/qvalidator_test.py | 85 ++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 tests/QtGui/qvalidator_test.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 7dd9aae..59b8aa1 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1588,16 +1588,7 @@ - - - - - - - - - - + @@ -1938,16 +1929,7 @@ - - - - - - - - - - + @@ -2287,6 +2269,41 @@ + + QValidator::State %out; + + if (PySequence_Check(%PYARG_0)) { + Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_0, 0)); + int size = PySequence_Fast_GET_SIZE(seq.object()); + + if (size > 1) { + if (Shiboken::Converter<QString>::isConvertible(PySequence_Fast_GET_ITEM(seq.object(), 1))) + %1 = %CONVERTTOCPP[QString](PySequence_Fast_GET_ITEM(seq.object(), 1)); + else + qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to unicode."); + } + + if (size > 2) { + if (Shiboken::Converter<int>::isConvertible(PySequence_Fast_GET_ITEM(seq.object(), 2))) + %2 = %CONVERTTOCPP[int](PySequence_Fast_GET_ITEM(seq.object(), 2)); + else + qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to int."); + } + %PYARG_0 = PySequence_Fast_GET_ITEM(seq.object(), 0); + Py_INCREF(%PYARG_0); // we need to incref, because "%PYARG_0 = ..." will decref the tuple and the tuple will be decrefed again at the end of this scope. + } + + // check retrun value + if (Shiboken::Converter<QValidator::State>::isConvertible(%PYARG_0)) { + %out = %CONVERTTOCPP[QValidator::State](%PYARG_0); + } else { + PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.", + "QValidator.validate", + "PySide.QtGui.QValidator.State, (PySide.QtGui.QValidator.State,), (PySide.QtGui.QValidator.State, unicode) or (PySide.QtGui.QValidator.State, unicode, int)", + pyResult->ob_type->tp_name); + return QValidator::State(); + } + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 7ff2f7e..9086829 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -71,6 +71,7 @@ PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) PYSIDE_TEST(qvariant_test.py) +PYSIDE_TEST(qvalidator_test.py) PYSIDE_TEST(qwidget_setlayout_test.py) PYSIDE_TEST(qwidget_test.py) PYSIDE_TEST(reference_count_test.py) diff --git a/tests/QtGui/qvalidator_test.py b/tests/QtGui/qvalidator_test.py new file mode 100644 index 0000000..52dbc8b --- /dev/null +++ b/tests/QtGui/qvalidator_test.py @@ -0,0 +1,85 @@ +from PySide.QtCore import * +from PySide.QtGui import * + +import unittest +from helper import UsesQApplication + +class MyValidator1(QValidator): + def fixUp(self, input): + return "fixed" + + def validate(self, input, pos): + return (QValidator.Acceptable, "fixed", 1) + +class MyValidator2(QValidator): + def fixUp(self, input): + return "fixed" + + def validate(self, input, pos): + return (QValidator.Acceptable, "fixed") + +class MyValidator3(QValidator): + def fixUp(self, input): + return "fixed" + + def validate(self, input, pos): + return (QValidator.Acceptable,) + +class MyValidator4(QValidator): + def fixUp(self, input): + return "fixed" + + def validate(self, input, pos): + return QValidator.Acceptable + +class QValidatorTest(UsesQApplication): + def testValidator1(self): + line = QLineEdit() + line.setValidator(MyValidator1()) + line.show() + line.setText("foo") + + QTimer.singleShot(0, line.close) + self.app.exec_() + + self.assertEqual(line.text(), "fixed") + self.assertEqual(line.cursorPosition(), 1) + + def testValidator2(self): + line = QLineEdit() + line.setValidator(MyValidator2()) + line.show() + line.setText("foo") + + QTimer.singleShot(0, line.close) + self.app.exec_() + + self.assertEqual(line.text(), "fixed") + self.assertEqual(line.cursorPosition(), 3) + + def testValidator3(self): + line = QLineEdit() + line.setValidator(MyValidator3()) + line.show() + line.setText("foo") + + QTimer.singleShot(0, line.close) + self.app.exec_() + + self.assertEqual(line.text(), "foo") + self.assertEqual(line.cursorPosition(), 3) + + def testValidator4(self): + line = QLineEdit() + line.setValidator(MyValidator4()) + line.show() + line.setText("foo") + + QTimer.singleShot(0, line.close) + self.app.exec_() + + self.assertEqual(line.text(), "foo") + self.assertEqual(line.cursorPosition(), 3) + +if __name__ == '__main__': + unittest.main() From 178f81aa70711876fe492431ae32afa3538cf460 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 12 Nov 2010 08:52:09 -0300 Subject: [PATCH 181/913] Added PySide attributes to specify current version, and Qt version. Fixes bug: #454 Reviewer: Marcelo Lira Luciano Wolf --- PySide/CMakeLists.txt | 4 ++-- PySide/QtCore/glue/qt_version.cpp | 5 +++++ PySide/QtCore/typesystem_core.xml | 5 +---- PySide/__init__.py | 2 -- PySide/__init__.py.in | 5 +++++ tests/pysidetest/CMakeLists.txt | 1 + tests/pysidetest/version_test.py | 17 +++++++++++++++++ 7 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 PySide/QtCore/glue/qt_version.cpp delete mode 100644 PySide/__init__.py create mode 100644 PySide/__init__.py.in create mode 100644 tests/pysidetest/version_test.py diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index c4aaf64..d7030d8 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -8,8 +8,8 @@ include(PySideModules) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" - "${CMAKE_BINARY_DIR}/PySide/__init__.py") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" + "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py" "${CMAKE_BINARY_DIR}/PySide/private.py") diff --git a/PySide/QtCore/glue/qt_version.cpp b/PySide/QtCore/glue/qt_version.cpp new file mode 100644 index 0000000..66f8c00 --- /dev/null +++ b/PySide/QtCore/glue/qt_version.cpp @@ -0,0 +1,5 @@ +QList version = QByteArray(qVersion()).split('.'); +PyObject *pyQtVersion = Shiboken::makeTuple(version[0].toInt(), version[1].toInt(), version[2].toInt()); + +PyModule_AddStringConstant(module, "__version__", qVersion()); +PyModule_AddObject(module, "__version_info__", pyQtVersion); diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index e542ea6..c5d3ac5 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -596,10 +596,7 @@ - - PyModule_AddIntConstant(module, "QT_VERSION", QT_VERSION); - PyModule_AddStringConstant(module, "QT_VERSION_STR", QT_VERSION_STR); - + diff --git a/PySide/__init__.py b/PySide/__init__.py deleted file mode 100644 index c93c5df..0000000 --- a/PySide/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] -import private diff --git a/PySide/__init__.py.in b/PySide/__init__.py.in new file mode 100644 index 0000000..f931fad --- /dev/null +++ b/PySide/__init__.py.in @@ -0,0 +1,5 @@ +__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] +import private + +__version__ = "@BINDING_API_VERSION@" +__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@) diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 176c8cd..d983ef8 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -63,4 +63,5 @@ add_dependencies(testbinding pyside QtCore libpyside pysidetest) PYSIDE_TEST(homonymoussignalandmethod_test.py) +PYSIDE_TEST(version_test.py) diff --git a/tests/pysidetest/version_test.py b/tests/pysidetest/version_test.py new file mode 100644 index 0000000..cb2b399 --- /dev/null +++ b/tests/pysidetest/version_test.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import unittest +from PySide import __version_info__, __version__, QtCore + +class CheckForVariablesTest(unittest.TestCase): + def testVesions(self): + self.assert_(__version_info__ >= (1, 0, 0)) + self.assert_(__version_info__ < (99, 99, 99)) + self.assert_(__version__) + + self.assert_(QtCore.__version_info__ >= (4, 5, 0)) + self.assert_(QtCore.__version__) + +if __name__ == '__main__': + unittest.main() + From 968d376c5dde8e93d59867070fb7fd250c59aad3 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Fri, 12 Nov 2010 18:50:40 -0300 Subject: [PATCH 182/913] Fix __init__.py and private.py install command. Reviewer: Luciano Wolf Reviewer: Renato Filho --- PySide/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index d7030d8..3b85e3d 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -1,5 +1,5 @@ project(pyside) -install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" "${CMAKE_CURRENT_SOURCE_DIR}/private.py" +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/private.py" DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}") include(PySideModules) From d2e204f3df1c80112cf42bb117db81299f93f8cf Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 12 Nov 2010 19:09:44 -0300 Subject: [PATCH 183/913] Removed invalid test. --- tests/QtCore/CMakeLists.txt | 1 - tests/QtCore/qqtversion_test.py | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 tests/QtCore/qqtversion_test.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index f4f38a6..53388d1 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -47,7 +47,6 @@ PYSIDE_TEST(qobject_timer_event_test.py) PYSIDE_TEST(qobject_tr_as_instance_test.py) PYSIDE_TEST(qpoint_test.py) PYSIDE_TEST(qprocess_test.py) -PYSIDE_TEST(qqtversion_test.py) PYSIDE_TEST(qrect_test.py) PYSIDE_TEST(qresource_test.py) PYSIDE_TEST(qsize_test.py) diff --git a/tests/QtCore/qqtversion_test.py b/tests/QtCore/qqtversion_test.py deleted file mode 100644 index 344de69..0000000 --- a/tests/QtCore/qqtversion_test.py +++ /dev/null @@ -1,18 +0,0 @@ - -import unittest - -from PySide import QtCore - - -class QQtVersionTest(unittest.TestCase): - '''Tests for QtCore.QT_VERSION and QT_VERSION_STR''' - - def testVersion(self): - self.assert_(hex(QtCore.QT_VERSION) > 0x40500) - - def testVersionStr(self): - self.assert_(QtCore.QT_VERSION_STR) - - -if __name__ == '__main__': - unittest.main() From bd3efd2a0f39c7f0ec7be88672e30c332ac1d1fe Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 16 Nov 2010 13:12:21 -0200 Subject: [PATCH 184/913] Fix bug#471 - "QtCore.QObject is missing 'thread' method" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Luciano Wolf Renato Araújo --- PySide/QtCore/typesystem_core.xml | 1 - tests/QtCore/qthread_test.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index c5d3ac5..b5243c6 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1167,7 +1167,6 @@ - diff --git a/tests/QtCore/qthread_test.py b/tests/QtCore/qthread_test.py index 410afb9..dc99c8e 100644 --- a/tests/QtCore/qthread_test.py +++ b/tests/QtCore/qthread_test.py @@ -17,6 +17,7 @@ class Dummy(QThread): def run(self): #Start-quit sequence + self.qobj = QObject() mutex.lock() self.called = True mutex.unlock() @@ -70,6 +71,7 @@ class QThreadSimpleCase(UsesQCoreApplication): QTimer.singleShot(1000, self.abort_application) self.app.exec_() + self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method self.assert_(self.called) if __name__ == '__main__': From 5a8efeb9df4271b0e1ec47bf231d2f23141d2375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl?= Date: Tue, 16 Nov 2010 15:06:43 -0200 Subject: [PATCH 185/913] Fix bug#470 - "Object::connect: No such signal QTimer::"timeout()" when using QTimer::singleShot" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Hugo Parente Renato Araújo --- PySide/QtCore/typesystem_core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index b5243c6..b048bf0 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1944,7 +1944,7 @@ // invalidate to avoid use of python object Shiboken::BindingManager::instance().destroyWrapper((SbkObject*)pyTimer); timer->setSingleShot(true); - timer->connect(timer, SIGNAL("timeout()"), timer, SLOT("deleteLater()")); + timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->start(%1); From 16913eedcec8c71b129dfcb029e0eb0fc50bb2a1 Mon Sep 17 00:00:00 2001 From: Luciano Wolf Date: Wed, 17 Nov 2010 18:58:39 -0300 Subject: [PATCH 186/913] Fix setLayout method that was causing segfault when itemAt wasn't implemented. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Hugo Parente Renato Araújo --- PySide/QtGui/glue/qlayout_help_functions.h | 8 ++++++-- PySide/QtGui/glue/qwidget_glue.h | 22 +++++++++++--------- PySide/QtGui/typesystem_gui_common.xml | 1 + tests/QtGui/qlayout_test.py | 24 ++++++++++++++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h index 0a6dd0e..452dbc1 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.h @@ -28,7 +28,7 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget) inline void addLayoutOwnership(QLayout* layout, QLayout* other) { - //transfer all children widgetes from other to layout parent widget + //transfer all children widgets from other to layout parent widget QWidget* parent = layout->parentWidget(); if (!parent) { //keep the reference while the layout is orphan @@ -39,7 +39,11 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other) } for (int i=0, i_max=other->count(); i < i_max; i++) { - addLayoutOwnership(layout, other->itemAt(i)); + QLayoutItem* item = layout->itemAt(i); + if (PyErr_Occurred()) + return; + + addLayoutOwnership(layout, item); } Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(layout)); diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h index 0339e89..d067d9f 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.h @@ -12,21 +12,20 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) { Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(parent)); - for (int i=0; i < layout->count(); i++) - { - QLayoutItem *item = layout->itemAt(i); - QWidget *w = item->widget(); - if (w) - { + for (int i=0; i < layout->count(); i++) { + QLayoutItem* item = layout->itemAt(i); + if (PyErr_Occurred()) + return; + + QWidget* w = item->widget(); + if (w) { QWidget* pw = w->parentWidget(); if (pw != parent) { Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(w)); Shiboken::setParent(pyParent, pyChild); } - } - else - { - QLayout *l = item->layout(); + } else { + QLayout* l = item->layout(); if (l) qwidgetReparentLayout(parent, l); } @@ -58,6 +57,9 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) if (oldParent != self) { qwidgetReparentLayout(self, layout); + if (PyErr_Occurred()) + return; + self->setLayout(layout); } } diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 59b8aa1..04ad22a 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3371,6 +3371,7 @@ qwidgetSetLayout(%CPPSELF, %1); + // %FUNCTION_NAME() - disable generation of function call. diff --git a/tests/QtGui/qlayout_test.py b/tests/QtGui/qlayout_test.py index 88c37aa..72c6d17 100644 --- a/tests/QtGui/qlayout_test.py +++ b/tests/QtGui/qlayout_test.py @@ -27,7 +27,22 @@ class MyLayout(QLayout): def add(self, item): self._list.append(item) +class MissingItemAtLayout(QLayout): + def __init__(self, parent=None): + QLayout.__init__(self, parent) + self._list = [] + def addItem(self, item): + self.add(item) + + def addWidget(self, widget): + self.add(QWidgetItem(widget)) + + def count(self): + return len(self._list) + + def add(self, item): + self._list.append(item) #Test if a layout implemented in python, the QWidget.setLayout works #fine because this implement som layout functions used in glue code of @@ -71,5 +86,14 @@ class QLayoutTest(UsesQApplication): self.assertEqual(sys.getrefcount(b), 2) + def testMissingFunctions(self): + w = QWidget() + b = QPushButton("test") + l = MissingItemAtLayout() + + l.addWidget(b) + + self.assertRaises(RuntimeError, w.setLayout, l) + if __name__ == '__main__': unittest.main() From 090e4a6525c5469b2f257eb978ae74b1b8df5ffc Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 18 Nov 2010 17:38:43 -0200 Subject: [PATCH 187/913] Remove function deleteDynamicQMetaObject, use Shiboken::callCppDestructor instead. --- libpyside/dynamicqmetaobject.cpp | 5 ----- libpyside/dynamicqmetaobject.h | 2 -- 2 files changed, 7 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index e9a162d..adb05d7 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -578,8 +578,3 @@ void DynamicQMetaObject::DynamicQMetaObjectPrivate::updateMetaObject(QMetaObject metaObj->d.data = data; metaObj->d.stringdata = stringData; } - -void PySide::deleteDynamicQMetaObject(void* data) -{ - delete reinterpret_cast(data); -} diff --git a/libpyside/dynamicqmetaobject.h b/libpyside/dynamicqmetaobject.h index d61ecad..8bd0282 100644 --- a/libpyside/dynamicqmetaobject.h +++ b/libpyside/dynamicqmetaobject.h @@ -52,7 +52,5 @@ private: DynamicQMetaObjectPrivate* m_d; }; -PYSIDE_API void deleteDynamicQMetaObject(void* data); - } #endif From 71d279c0406030faa97927f510e2b2f802daf794 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 18 Nov 2010 17:42:00 -0200 Subject: [PATCH 188/913] Uses QByteArray instead of QString to avoid data copy. Reviewer: Luciano Wolf Lauro Moura --- libpyside/dynamicqmetaobject.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index adb05d7..14fbe86 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -136,20 +136,14 @@ static bool isQRealType(const char *type) /* * Avoid API break keep this on cpp */ -static int maxSlotsCount(const QString& className) +static int maxSlotsCount(const QByteArray& className) { - int maxSlots = MAX_SLOTS_COUNT; - if (className == GLOBAL_RECEIVER_CLASS_NAME) - maxSlots = MAX_GLOBAL_SIGNALS_COUNT; - return maxSlots; + return className == GLOBAL_RECEIVER_CLASS_NAME ? MAX_GLOBAL_SIGNALS_COUNT : MAX_SLOTS_COUNT; } -static int maxSignalsCount(const QString& className) +static int maxSignalsCount(const QByteArray& className) { - int maxSignals = MAX_SIGNALS_COUNT; - if (className == GLOBAL_RECEIVER_CLASS_NAME) - maxSignals = MAX_GLOBAL_SIGNALS_COUNT; - return maxSignals; + return className == GLOBAL_RECEIVER_CLASS_NAME ? MAX_GLOBAL_SIGNALS_COUNT : MAX_SIGNALS_COUNT; } uint PropertyData::flags() const @@ -296,7 +290,7 @@ DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* d.stringdata = 0; d.data = 0; d.extradata = 0; - m_d->m_className = QByteArray(className); + m_d->m_className = className; m_d->updateMetaObject(this); } From dd8b0fcfe41222be0141e2b717bb6f6b4c6f7107 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Sun, 14 Nov 2010 21:02:34 -0300 Subject: [PATCH 189/913] Created unit test for bug 462. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_462.py | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/QtCore/bug_462.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 53388d1..b73a1ba 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -2,6 +2,7 @@ PYSIDE_TEST(bug_278_test.py) PYSIDE_TEST(bug_332.py) PYSIDE_TEST(bug_408.py) PYSIDE_TEST(bug_428.py) +PYSIDE_TEST(bug_462.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) PYSIDE_TEST(deepcopy_test.py) diff --git a/tests/QtCore/bug_462.py b/tests/QtCore/bug_462.py new file mode 100644 index 0000000..feb75c7 --- /dev/null +++ b/tests/QtCore/bug_462.py @@ -0,0 +1,43 @@ +import unittest +import sys + +from PySide.QtCore import QObject, QCoreApplication, QEvent, QThread + +class MyEvent(QEvent): + def __init__(self,i): + super(MyEvent,self).__init__(QEvent.Type(QEvent.User + 100 )) + self.i = i + +class MyThread (QThread): + def __init__(self,owner): + super(MyThread,self).__init__() + self.owner=owner; + + def run(self): + for i in xrange(3): + e=MyEvent(i); + QCoreApplication.postEvent(self.owner,e) + +class MyBaseObject(QObject): + def __init__(self): + QObject.__init__(self) + self.events = [] + self.t = MyThread(self) + self.t.start() + + def customEvent(self, event): + self.events.append(event) + if len(self.events) == 3: + self.app.quit() + + +class CheckForEventsTypes(unittest.TestCase): + def testTypes(self): + o = MyBaseObject() + o.app = QCoreApplication(sys.argv) + o.app.exec_() + for e in o.events: + self.assert_(isinstance(e, MyEvent)) + +if __name__ == '__main__': + unittest.main() From 43e499a4faf7c7cacdba026bc87eda24a7d02e23 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 17 Nov 2010 19:43:33 -0300 Subject: [PATCH 190/913] Fixed unit test to avoid exit with thread running. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtCore/bug_462.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/QtCore/bug_462.py b/tests/QtCore/bug_462.py index feb75c7..44048bb 100644 --- a/tests/QtCore/bug_462.py +++ b/tests/QtCore/bug_462.py @@ -28,6 +28,7 @@ class MyBaseObject(QObject): def customEvent(self, event): self.events.append(event) if len(self.events) == 3: + self.t.wait() self.app.quit() @@ -38,6 +39,7 @@ class CheckForEventsTypes(unittest.TestCase): o.app.exec_() for e in o.events: self.assert_(isinstance(e, MyEvent)) + o.app = None if __name__ == '__main__': unittest.main() From 098946263932e115bdbca17eb51c3a27848435e2 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 17 Nov 2010 19:55:43 -0300 Subject: [PATCH 191/913] Fixed recursive call on duck punching test. Reviewer: Hugo Parente Lima Luciano Wolf --- tests/QtCore/duck_punching_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/QtCore/duck_punching_test.py b/tests/QtCore/duck_punching_test.py index 880a8e4..e1b9f7f 100644 --- a/tests/QtCore/duck_punching_test.py +++ b/tests/QtCore/duck_punching_test.py @@ -32,7 +32,6 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication): parent = QObject() def childEvent(obj, event): self.duck_childEvent_called = True - QObject.childEvent(obj, event) parent.childEvent = types.MethodType(childEvent, parent, QObject) child = QObject() child.setParent(parent) From 5e0550446c3546beb4a7076a80a7475b394567f4 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 18 Nov 2010 11:02:03 -0300 Subject: [PATCH 192/913] Updated to new shiboken API. Reviewer: Hugo Parente Lima Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 15 ++++++------- PySide/QtGui/glue/qlayout_help_functions.h | 6 ++--- PySide/QtGui/glue/qwidget_glue.h | 6 ++--- PySide/QtGui/typesystem_gui_common.xml | 26 +++++++++++----------- PySide/QtUiTools/glue/uitools_loadui.h | 2 +- PySide/QtWebKit/typesystem_webkit.xml | 2 +- PySide/typesystem_templates.xml | 6 ++--- libpyside/pyside.cpp | 4 +--- plugins/customwidget.cpp | 4 ++-- 9 files changed, 34 insertions(+), 37 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index b048bf0..83fd2ed 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1129,7 +1129,7 @@ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME()); - + @@ -1941,8 +1941,7 @@ %PYARG_2, %3) ); - // invalidate to avoid use of python object - Shiboken::BindingManager::instance().destroyWrapper((SbkObject*)pyTimer); + Shiboken::Wrapper::invalidate((SbkObject*)pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->start(%1); @@ -1952,7 +1951,7 @@ // %FUNCTION_NAME() - disable generation of c++ function call Shiboken::AutoDecRef emptyTuple(PyTuple_New(0)); - PyObject* pyTimer = Shiboken::SbkType<QTimer>()->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0); + PyObject *pyTimer = Shiboken::SbkType<QTimer>()->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0); Shiboken::SbkType<QTimer>()->tp_init(pyTimer, emptyTuple, 0); QTimer* timer = Converter<QTimer*>::toCpp(pyTimer); timer->setSingleShot(true); @@ -1980,7 +1979,7 @@ pyargs[1]) ); } - Shiboken::BindingManager::instance().destroyWrapper((SbkObject*)pyTimer); + Shiboken::Wrapper::invalidate((SbkObject*)pyTimer); timer->start(%1); @@ -2568,7 +2567,7 @@ for(int counter = 0; counter < %CPPSELF.animationCount(); ++counter ) { PyObject* obj = %CONVERTTOPYTHON[QAbstractAnimation*](%CPPSELF.animationAt(counter)); - Shiboken::setParent(NULL, obj); + Shiboken::Wrapper::setParent(NULL, obj); Py_DECREF(obj); } %CPPSELF.clear(); @@ -2722,7 +2721,7 @@ %PYARG_0 = PySet_New(0); foreach(QAbstractState* abs_state, %CPPSELF.configuration()) { Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state)); - Shiboken::setParent(self, obj); + Shiboken::Wrapper::setParent(self, obj); PySet_Add(%PYARG_0, obj); } @@ -2733,7 +2732,7 @@ %PYARG_0 = PyList_New(0); foreach(QAbstractAnimation* abs_anim, %CPPSELF.defaultAnimations()) { Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim)); - Shiboken::setParent(self, obj); + Shiboken::Wrapper::setParent(self, obj); PyList_Append(%PYARG_0, obj); } diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h index 452dbc1..8d899ea 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.h @@ -22,7 +22,7 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget) } else { Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(parent)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(widget)); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); } } @@ -48,7 +48,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other) Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(layout)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(other)); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); } @@ -65,7 +65,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item) Shiboken::AutoDecRef pyParent(Shiboken::Converter::toPython(layout)); Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(item)); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); } #endif diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h index d067d9f..33e8a7f 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.h @@ -22,7 +22,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) QWidget* pw = w->parentWidget(); if (pw != parent) { Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(w)); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); } } else { QLayout* l = item->layout(); @@ -32,7 +32,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) } Shiboken::AutoDecRef pyChild(Shiboken::Converter::toPython(layout)); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); //remove previous references Shiboken::keepReference(reinterpret_cast(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None); } @@ -47,7 +47,7 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) if (oldParent->isWidgetType()) { // remove old parent policy Shiboken::AutoDecRef pyLayout(Shiboken::Converter::toPython(layout)); - Shiboken::setParent(Py_None, pyLayout); + Shiboken::Wrapper::setParent(Py_None, pyLayout); } else { PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent", qPrintable(layout->objectName()), self->metaObject()->className(), qPrintable(self->objectName())); diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 04ad22a..ca7bc27 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1621,7 +1621,7 @@ - BindingManager::instance().transferOwnershipToCpp(%PYARG_2); + Shiboken::Wrapper::releaseOwnership(%PYARG_2); @@ -1955,7 +1955,7 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, "connect", "OsO", %PYSELF, SIGNAL(activated()), %PYARG_3)); if (!result.isNull()) - Shiboken::setParent(%PYARG_2, %PYSELF); + Shiboken::Wrapper::setParent(%PYARG_2, %PYSELF); @@ -2018,7 +2018,7 @@ QStandardItem* _i = %CPPSELF->child(%1, %2); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); - Shiboken::setParent(0, _pyI); + Shiboken::Wrapper::setParent(0, _pyI); } @@ -2031,7 +2031,7 @@ QStandardItem* _i = %CPPSELF->child(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); - Shiboken::setParent(0, _pyI); + Shiboken::Wrapper::setParent(0, _pyI); } @@ -2170,7 +2170,7 @@ QWidget *_widget = %CPPSELF.widget(%1); if (_widget) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget)); - Shiboken::setParent(0, pyWidget); + Shiboken::Wrapper::setParent(0, pyWidget); } @@ -3328,7 +3328,7 @@ QStyle *appStyle = qApp->style(); if (appStyle == myStyle) { Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp)); - Shiboken::setParent(pyApp, %PYARG_0); + Shiboken::Wrapper::setParent(pyApp, %PYARG_0); Shiboken::Wrapper::releaseOwnership(%PYARG_0); } else { Shiboken::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_0); @@ -3586,7 +3586,7 @@ QWidget* tab = %CPPSELF.widget(%1); if (tab) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); - Shiboken::setParent(0, pyWidget); + Shiboken::Wrapper::setParent(0, pyWidget); %CPPSELF.%FUNCTION_NAME(%1); } @@ -3595,7 +3595,7 @@ for (int i=0; i < %CPPSELF.count(); i++) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](%CPPSELF.widget(i))); - Shiboken::setParent(0, pyWidget); + Shiboken::Wrapper::setParent(0, pyWidget); } %CPPSELF.%FUNCTION_NAME(); @@ -3853,7 +3853,7 @@ QStandardItem* _i = %CPPSELF->item(%1, %2); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); - Shiboken::setParent(0, _pyI); + Shiboken::Wrapper::setParent(0, _pyI); } @@ -3866,7 +3866,7 @@ QStandardItem* _i = %CPPSELF->item(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); - Shiboken::setParent(0, _pyI); + Shiboken::Wrapper::setParent(0, _pyI); } @@ -3885,7 +3885,7 @@ QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1); if (_i) { PyObject* _pyI = %CONVERTTOPYTHON[QStandardItem*](_i); - Shiboken::setParent(0, _pyI); + Shiboken::Wrapper::setParent(0, _pyI); } @@ -3935,7 +3935,7 @@ QList<QStandardItem *> ri = %CPPSELF.takeRow(0); PyObject *pyResult = %CONVERTTOPYTHON[QList<QStandardItem * >](ri); - Shiboken::setParent(Py_None, pyResult); + Shiboken::Wrapper::setParent(Py_None, pyResult); Py_XDECREF(pyResult); } @@ -4554,7 +4554,7 @@ - Shiboken::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_1); + Shiboken::Wrapper::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_1); diff --git a/PySide/QtUiTools/glue/uitools_loadui.h b/PySide/QtUiTools/glue/uitools_loadui.h index 8f6df63..302c3e7 100644 --- a/PySide/QtUiTools/glue/uitools_loadui.h +++ b/PySide/QtUiTools/glue/uitools_loadui.h @@ -20,7 +20,7 @@ _populate_parent(PyObject* pyParent, QObject *parent) if (!has_attr) PyObject_SetAttrString(pyParent, qPrintable(name), pyChild); - Shiboken::setParent(pyParent, pyChild); + Shiboken::Wrapper::setParent(pyParent, pyChild); _populate_parent(pyChild, qobject_cast(child)); } } diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index b56a909..9ec7c75 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -41,7 +41,7 @@ SbkObject* _pyReturn = reinterpret_cast<SbkObject*>(%PYARG_0); if (!Shiboken::Wrapper::hasParentInfo(_pyReturn)) - Shiboken::setParent(%PYSELF, %PYARG_0); + Shiboken::Wrapper::setParent(%PYSELF, %PYARG_0); diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 968195f..6bc814d 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -23,9 +23,9 @@ $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD(); if (oldChild) { Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild)); - Shiboken::setParent(NULL, pyChild); + Shiboken::Wrapper::setParent(NULL, pyChild); } - Shiboken::setParent(%PYSELF, $PYARG); + Shiboken::Wrapper::setParent(%PYSELF, $PYARG); @@ -184,7 +184,7 @@ @@ -155,8 +155,8 @@ @@ -183,8 +183,8 @@ + + + diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index b5bffe7..8ec3cdd 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -71,6 +71,7 @@ PYSIDE_TEST(setprop_on_ctor_test.py) PYSIDE_TEST(static_method_test.py) PYSIDE_TEST(static_protected_methods_test.py) PYSIDE_TEST(thread_signals_test.py) +PYSIDE_TEST(tr_noop_test.py) PYSIDE_TEST(translation_test.py) PYSIDE_TEST(unaryoperator_test.py) PYSIDE_TEST(unicode_test.py) diff --git a/tests/QtCore/tr_noop_test.py b/tests/QtCore/tr_noop_test.py new file mode 100644 index 0000000..92029e0 --- /dev/null +++ b/tests/QtCore/tr_noop_test.py @@ -0,0 +1,48 @@ +import unittest + +import sys +from PySide.QtCore import QT_TR_NOOP, QT_TR_NOOP_UTF8 +from PySide.QtCore import QT_TRANSLATE_NOOP, QT_TRANSLATE_NOOP3, QT_TRANSLATE_NOOP_UTF8 + +class QtTrNoopTest(unittest.TestCase): + + def setUp(self): + self.txt = 'Cthulhu fhtag!' + + def tearDown(self): + del self.txt + + def testQtTrNoop(self): + refcnt = sys.getrefcount(self.txt) + result = QT_TR_NOOP(self.txt) + self.assertEqual(result, self.txt) + self.assertEqual(sys.getrefcount(result), refcnt + 1) + + def testQtTrNoopUtf8(self): + refcnt = sys.getrefcount(self.txt) + result = QT_TR_NOOP_UTF8(self.txt) + self.assertEqual(result, self.txt) + self.assertEqual(sys.getrefcount(result), refcnt + 1) + + def testQtTranslateNoop(self): + refcnt = sys.getrefcount(self.txt) + result = QT_TRANSLATE_NOOP(None, self.txt) + self.assertEqual(result, self.txt) + self.assertEqual(sys.getrefcount(result), refcnt + 1) + + def testQtTranslateNoopUtf8(self): + refcnt = sys.getrefcount(self.txt) + result = QT_TRANSLATE_NOOP_UTF8(self.txt) + self.assertEqual(result, self.txt) + self.assertEqual(sys.getrefcount(result), refcnt + 1) + + def testQtTranslateNoop3(self): + refcnt = sys.getrefcount(self.txt) + result = QT_TRANSLATE_NOOP3(None, self.txt, None) + self.assertEqual(result, self.txt) + self.assertEqual(sys.getrefcount(result), refcnt + 1) + + +if __name__ == '__main__': + unittest.main() + From 3e66025bbb698ddd491d502bbb9f9483b17d82a0 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 20 Dec 2010 17:49:54 -0300 Subject: [PATCH 259/913] Fixed indentation mistakes. Reviewer: Marcelo Lira Hugo Parente Lima --- cmake/Macros/PySideModules.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Macros/PySideModules.cmake b/cmake/Macros/PySideModules.cmake index 639a0ab..060f4a6 100644 --- a/cmake/Macros/PySideModules.cmake +++ b/cmake/Macros/PySideModules.cmake @@ -77,7 +77,7 @@ macro(check_qt_class module class global_sources) file(WRITE ${SRC_FILE} "#include <${include_file}>\n" "#include \n" - "${NAMESPACE_USE}\n" + "${NAMESPACE_USE}\n" "int main() { typeid(${class}); }\n" ) try_compile(Q_WORKS ${CMAKE_BINARY_DIR} From 0d0cb0753edea1e209742c5777ca024b7a58b83a Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 20 Dec 2010 17:50:43 -0300 Subject: [PATCH 260/913] Added QSslCertificate to QtNetwork module. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtNetwork/CMakeLists.txt | 1 + PySide/QtNetwork/typesystem_network.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PySide/QtNetwork/CMakeLists.txt b/PySide/QtNetwork/CMakeLists.txt index 3afa0cf..0656c31 100644 --- a/PySide/QtNetwork/CMakeLists.txt +++ b/PySide/QtNetwork/CMakeLists.txt @@ -44,6 +44,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qurlinfo_wrapper.cpp ${QtNetwork_47_SRC} ) +check_qt_class(QtNetwork QSslCertificate QtNetwork_SRC) check_qt_class(QtNetwork QSslCipher QtNetwork_SRC) check_qt_class(QtNetwork QSslConfiguration QtNetwork_SRC) check_qt_class(QtNetwork QSslError QtNetwork_SRC) diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index e608786..69d1787 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -33,8 +33,8 @@ - + From ed10989ff23d95d20f361944a6deffbeced63a0d Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 20 Dec 2010 18:55:02 -0300 Subject: [PATCH 261/913] Fixed QtUiTools plugin. Removed use of static QString to store the class name. Fix bug #533. Reviewer: Marcelo Lira Hugo Parente Lima --- plugins/customwidget.cpp | 7 ++----- plugins/customwidget.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/customwidget.cpp b/plugins/customwidget.cpp index 74b07dc..9a3e6f2 100644 --- a/plugins/customwidget.cpp +++ b/plugins/customwidget.cpp @@ -35,6 +35,7 @@ PyCustomWidget::PyCustomWidget(PyObject* objectType) : m_data(new PyCustomWidgetPrivate()) { m_data->pyObject = objectType; + m_name = QString(reinterpret_cast(objectType)->tp_name); } PyCustomWidget::~PyCustomWidget() @@ -73,11 +74,7 @@ QString PyCustomWidget::includeFile() const QString PyCustomWidget::name() const { - static QString objectName; - if (objectName.isEmpty()) { - objectName = QString(reinterpret_cast(m_data->pyObject)->tp_name); - } - return objectName; + return m_name; } QString PyCustomWidget::toolTip() const diff --git a/plugins/customwidget.h b/plugins/customwidget.h index e4eb76d..00393a1 100644 --- a/plugins/customwidget.h +++ b/plugins/customwidget.h @@ -52,7 +52,7 @@ public: private: QScopedPointer m_data; - + QString m_name; }; #endif From 45edcc54a6215e161cc0c176daf5e3b4dc3aeaff Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 21 Dec 2010 17:26:50 -0300 Subject: [PATCH 262/913] Used argument '-a' during the call of xvfb command. This argument allow the xvfb to find a free server number during the execution. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db2bb3a..5209bab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ option(USE_XVFB "Uses xvfb-run with the unit tests to avoid QtGui tests popping if(USE_XVFB) find_program(XVFB_RUN NAMES xvfb-run) if (NOT ${XVFB_RUN} MATCHES "XVFB_RUN-NOTFOUND") - set(XVFB_EXEC ${XVFB_RUN}) + set(XVFB_EXEC ${XVFB_RUN} -a) message(STATUS "Using xvfb-run to perform QtGui tests.") endif() endif() From cebdd1f4dcb057436878b60295684c24cb09f1d9 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 22 Dec 2010 10:17:21 -0300 Subject: [PATCH 263/913] Avoid QMatrix test while gcc is broken. --- tests/QtGui/deepcopy_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/QtGui/deepcopy_test.py b/tests/QtGui/deepcopy_test.py index 2f8f7de..3e9f0f8 100644 --- a/tests/QtGui/deepcopy_test.py +++ b/tests/QtGui/deepcopy_test.py @@ -53,6 +53,10 @@ class QMatrixDeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): self.original = QMatrix(1, 2, 3, 4, 5, 6) + +# Avoid these tests until get gcc fixed +# Related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247 +""" class QMatrix2x2DeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): self.original = QMatrix2x2([1, 2, 3, 4]) @@ -88,6 +92,7 @@ class QMatrix4x3DeepCopy(DeepCopyHelper, unittest.TestCase): class QMatrix4x4DeepCopy(DeepCopyHelper, unittest.TestCase): def setUp(self): self.original = QMatrix4x4([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) +""" if __name__ == '__main__': unittest.main() From d3b630e1682c89ee427964d81c32219c14863b1d Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 22 Dec 2010 10:25:32 -0300 Subject: [PATCH 264/913] Fix the QtMultimedia/audio_test.py to accept computers with only null device. --- tests/QtMultimedia/audio_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/QtMultimedia/audio_test.py b/tests/QtMultimedia/audio_test.py index f3aa680..773524e 100644 --- a/tests/QtMultimedia/audio_test.py +++ b/tests/QtMultimedia/audio_test.py @@ -9,13 +9,19 @@ from PySide.QtMultimedia import * class testAudioDevices(unittest.TestCase): def testListDevices(self): + valid = False devices = QAudioDeviceInfo.availableDevices(QAudio.AudioOutput) if not len(devices): return + valid = True for devInfo in devices: if devInfo.deviceName() == 'null': - continue + # skip the test if the only device found is a invalid device + if len(devices) == 1: + return + else: + continue fmt = QAudioFormat() for codec in devInfo.supportedCodecs(): fmt.setCodec(codec) From 2734efb6b704c53bab64168be49ce06d6b5a03da Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 22 Dec 2010 16:14:47 -0300 Subject: [PATCH 265/913] Moved list_signal_test to pysidetest library. This isolate the test case, and avoid other problems with X during the buildbot compilation. Reviewer: Lauro Moura Hugo Parente Lima --- tests/pysidetest/CMakeLists.txt | 1 + tests/pysidetest/list_signal_test.py | 23 ++++++++++++++++++ tests/pysidetest/testobject.h | 3 +++ tests/signals/CMakeLists.txt | 1 - tests/signals/list_signal_test.py | 35 ---------------------------- 5 files changed, 27 insertions(+), 36 deletions(-) create mode 100644 tests/pysidetest/list_signal_test.py delete mode 100644 tests/signals/list_signal_test.py diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 4a4c27a..b3215bc 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -76,4 +76,5 @@ PYSIDE_TEST(homonymoussignalandmethod_test.py) PYSIDE_TEST(delegatecreateseditor_test.py) PYSIDE_TEST(modelview_test.py) PYSIDE_TEST(version_test.py) +PYSIDE_TEST(list_signal_test.py) diff --git a/tests/pysidetest/list_signal_test.py b/tests/pysidetest/list_signal_test.py new file mode 100644 index 0000000..36d3c21 --- /dev/null +++ b/tests/pysidetest/list_signal_test.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import unittest +from testbinding import TestObject +from PySide.QtCore import QObject + +class ListConnectionTest(unittest.TestCase): + + def childrenChanged(self, children): + self._child = children[0] + + def testConnection(self): + o = TestObject(0) + c = QObject() + c.setObjectName("child") + self._child = None + o.childrenChanged.connect(self.childrenChanged) + o.addChild(c) + self.assertEquals(self._child.objectName(), "child") + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h index 9012359..d882870 100644 --- a/tests/pysidetest/testobject.h +++ b/tests/pysidetest/testobject.h @@ -14,6 +14,7 @@ public: TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {} int idValue() const { return m_idValue; } static int staticMethodDouble(int value) { return value * 2; } + void addChild(QObject* c) { m_children.append(c); emit childrenChanged(m_children); } void emitIdValueSignal(); void emitStaticMethodDoubleSignal(); @@ -22,9 +23,11 @@ signals: void idValue(int newValue); void justASignal(); void staticMethodDouble(); + void childrenChanged(const QList); private: int m_idValue; + QList m_children; }; #endif // TESTOBJECT_H diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt index cad84f1..c9ef33e 100644 --- a/tests/signals/CMakeLists.txt +++ b/tests/signals/CMakeLists.txt @@ -6,7 +6,6 @@ PYSIDE_TEST(decorators_test.py) PYSIDE_TEST(invalid_callback_test.py) PYSIDE_TEST(lambda_gui_test.py) PYSIDE_TEST(lambda_test.py) -PYSIDE_TEST(list_signal_test.py) PYSIDE_TEST(leaking_signal_test.py) PYSIDE_TEST(multiple_connections_gui_test.py) PYSIDE_TEST(multiple_connections_test.py) diff --git a/tests/signals/list_signal_test.py b/tests/signals/list_signal_test.py deleted file mode 100644 index c65eb11..0000000 --- a/tests/signals/list_signal_test.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -import unittest - -from PySide.QtCore import * -from PySide.QtGui import * - -class ListConnectionTest(unittest.TestCase): - - def modifyScene(self): - self.scene.addLine(0, 0, 10, 10) - - def sceneChanged(self, rects): - # Qt isn't so cute and sends this signal with empty lists and null rects sometimes. - if len(rects) > 0 and not rects[0].isNull(): - self.rects = rects - QApplication.quit() - - def testConnection(self): - app = QApplication([]) - - self.scene = QGraphicsScene() - QTimer.singleShot(0, self.modifyScene) - self.scene.changed.connect(self.sceneChanged) - - app.exec_() - self.assertEquals(len(self.rects), 1) - self.assertEquals(self.rects[0].x(), 0) - self.assertEquals(self.rects[0].y(), 0) - self.assertEquals(self.rects[0].width(), 10) - self.assertEquals(self.rects[0].height(), 10) - -if __name__ == '__main__': - unittest.main() - From af6514a1e81cadbad1ac754ea362ec24e107efb9 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Wed, 22 Dec 2010 18:11:26 -0300 Subject: [PATCH 266/913] Fix testbinding dependency Reviewer: Marcelo Lira Reviewer: Renato Araujo --- tests/pysidetest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index b3215bc..83e9202 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -69,7 +69,7 @@ target_link_libraries(testbinding ${QT_QTGUI_LIBRARY} ${SBK_PYTHON_LIBRARIES}) -add_dependencies(testbinding pyside QtCore libpyside pysidetest) +add_dependencies(testbinding pyside QtCore QtGui libpyside pysidetest) PYSIDE_TEST(homonymoussignalandmethod_test.py) From 3468d8f78e1b0b54124adbe9d21d097c064bb85e Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 22 Dec 2010 19:12:42 -0300 Subject: [PATCH 267/913] Fixed variable scope. This keep the QByteArray live during the use of your content. Reviewer: Lauro Moura Hugo Parente Lima --- libpyside/pysidesignal.h | 1 + libpyside/signalmanager.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libpyside/pysidesignal.h b/libpyside/pysidesignal.h index fb7c8f9..443572c 100644 --- a/libpyside/pysidesignal.h +++ b/libpyside/pysidesignal.h @@ -138,6 +138,7 @@ PYSIDE_API QString getCallbackSignature(const char* signal, QObject* receiver, P * @param signature The signal signature * @param isShortCircuit If this is a shortCircuit(python<->python) signal * @return Return true if this is a Qt Signal of false if not + * @todo replace return type to QList **/ QStringList getArgsFromSignature(const char* signature, bool* isShortCircuit = 0); diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 31621a7..6cdc3e1 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -199,7 +199,7 @@ static bool emitNormalSignal(QObject* source, int signalIndex, const char* signa int i; for (i = 0; i < argsGiven; ++i) { - const char* typeName = argTypes[i].toAscii().constData(); + QByteArray typeName = argTypes[i].toAscii(); Shiboken::TypeResolver* typeResolver = Shiboken::TypeResolver::get(typeName); if (typeResolver) { int typeId = QMetaType::type(typeName); From 09840da111e373ebde987cc5f34b89aa49ae3a55 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 23 Dec 2010 15:46:39 -0300 Subject: [PATCH 268/913] Used more common signature on function test to QList objects. Replaced "const QList" signature to "const QList&", more used on Qt code. --- tests/pysidetest/testobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h index d882870..65506b9 100644 --- a/tests/pysidetest/testobject.h +++ b/tests/pysidetest/testobject.h @@ -23,7 +23,7 @@ signals: void idValue(int newValue); void justASignal(); void staticMethodDouble(); - void childrenChanged(const QList); + void childrenChanged(const QList&); private: int m_idValue; From 85715f3fc3de87bfa4ac07f4d76f1b69bb012109 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 23 Dec 2010 16:59:33 -0200 Subject: [PATCH 269/913] Fix bug#549 - "QGraphicsWidget::getContentsMargins() and QGraphicsWidget::getWindowFrameMargins() not available" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 46 +++++++++++++++++++++++--- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_549.py | 16 +++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 tests/QtGui/bug_549.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 940f730..0994331 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -4834,10 +4834,48 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 7cde60f..fe62e8e 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -21,6 +21,7 @@ PYSIDE_TEST(bug_480.py) PYSIDE_TEST(bug_500.py) PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) +PYSIDE_TEST(bug_549.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_549.py b/tests/QtGui/bug_549.py new file mode 100644 index 0000000..6d07899 --- /dev/null +++ b/tests/QtGui/bug_549.py @@ -0,0 +1,16 @@ +import unittest + +from PySide.QtGui import * + +class TestBug549(unittest.TestCase): + def testBug(self): + app = QApplication([]) + w = QGraphicsWidget() + w.setContentsMargins(1, 2, 3, 4) + self.assertEquals(w.getContentsMargins(), (1, 2, 3, 4)) + w.setWindowFrameMargins(5, 6, 7, 8) + self.assertEquals(w.getWindowFrameMargins(), (5, 6, 7, 8)) + +if __name__ == '__main__': + unittest.main() + From 949f6b52558e150f8727c1496167d67c1c0799ef Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 27 Dec 2010 13:20:43 -0300 Subject: [PATCH 270/913] Removed some float comparisons from QColor test to avoid armel problems. Reviewed by Hugo Parente --- tests/QtGui/qcolor_test.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tests/QtGui/qcolor_test.py b/tests/QtGui/qcolor_test.py index a636ad6..1a94728 100644 --- a/tests/QtGui/qcolor_test.py +++ b/tests/QtGui/qcolor_test.py @@ -2,7 +2,7 @@ import unittest import colorsys -from PySide.QtCore import Qt +from PySide.QtCore import Qt, qFuzzyCompare from PySide.QtGui import QColor @@ -14,12 +14,6 @@ class QColorGetTest(unittest.TestCase): def testGetRgb(self): self.assertEqual(self.color.getRgb(), (20, 40, 60, 80)) - def testGetRgbF(self): - self.assertEqual(self.color.getRgbF(), (20.0/255, 40.0/255, 60.0/255, 80.0/255)) - - def testGetHsl(self): - self.assertEqual(self.color.getHsl(), (210, 128, 40, self.color.alpha())) - def testGetHslF(self): hls = colorsys.rgb_to_hls(20.0/255, 40.0/255, 60.0/255) hsla = hls[0], hls[2], hls[1], self.color.alphaF() @@ -31,11 +25,6 @@ class QColorGetTest(unittest.TestCase): hsva = int(hsv[0]*360.0), int(hsv[1]*255), int(hsv[2]*256), self.color.alpha() self.assertEqual(self.color.getHsv(), hsva) - def testGetHsvF(self): - hsv = colorsys.rgb_to_hsv(20.0/255, 40.0/255, 60.0/255) - hsva = hsv[0], hsv[1], hsv[2], self.color.alphaF() - self.assertEqual(self.color.getHsvF(), hsva) - def testGetCmyk(self): # not supported by colorsys self.assertEqual(self.color.getCmyk(), (170, 85, 0, 195, 80)) From 97875193524f407ec4594969041d84f7aa8ec546 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 27 Dec 2010 18:59:32 -0300 Subject: [PATCH 271/913] Fix QTreeWidget parent rules. QTreeWidget.clear() - remove all child ref from the current widget QTreeWidgetItem.parent() - use default policy for returned value Fix bug #547 Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 20 +++++++++++++ tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_547.py | 39 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 tests/QtGui/bug_547.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 0994331..c2b6343 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3030,6 +3030,18 @@ + + + QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem(); + Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); + for (int i = 0; i < rootItem->childCount(); ++i) { + QTreeWidgetItem *item = rootItem->child(i); + SbkObject* wrapper = bm.retrieveWrapper(item); + if (wrapper) + Shiboken::Object::setParent(0, reinterpret_cast<PyObject*>(wrapper)); + } + + @@ -3228,6 +3240,14 @@ + + + + + + + + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index fe62e8e..93b9c07 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -21,6 +21,7 @@ PYSIDE_TEST(bug_480.py) PYSIDE_TEST(bug_500.py) PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) +PYSIDE_TEST(bug_547.py) PYSIDE_TEST(bug_549.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) diff --git a/tests/QtGui/bug_547.py b/tests/QtGui/bug_547.py new file mode 100644 index 0000000..5636fb6 --- /dev/null +++ b/tests/QtGui/bug_547.py @@ -0,0 +1,39 @@ +""" Unittest for bug #547 """ +""" http://bugs.openbossa.org/show_bug.cgi?id=547 """ + +from PySide import QtGui +import sys +import unittest + +class MyMainWindow(unittest.TestCase): + def testClearFunction(self): + app = QtGui.QApplication(sys.argv) + self._tree = QtGui.QTreeWidget() + self._tree.setColumnCount(2) + self._i1 = None + self._i11 = None + + self._updateTree() + self.assertEqual(sys.getrefcount(self._i1), 3) + self.assertEqual(sys.getrefcount(self._i11), 3) + + self._i11.parent().setExpanded(True) + self._i11.setExpanded(True) + + self._updateTree() + self.assertEqual(sys.getrefcount(self._i1), 3) + self.assertEqual(sys.getrefcount(self._i11), 3) + + + def _updateTree(self): + self._tree.clear() + if self._i1 and self._i11: + self.assertEqual(sys.getrefcount(self._i1), 2) + self.assertEqual(sys.getrefcount(self._i11), 2) + + self._i1 = QtGui.QTreeWidgetItem(self._tree, ['1', ]) + self._i11 = QtGui.QTreeWidgetItem(self._i1, ['11', ]) + +if __name__ == '__main__': + unittest.main() + From 0029d0ef7e85cde40b945d6a55c321f459acda09 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 28 Dec 2010 11:49:39 -0300 Subject: [PATCH 272/913] Test for QTDESIGNER before add QTUITOOLS. This test is necessary because the module QTUITOOLS uses some classes from QTDESIGNER. Reviewer: Marcelo Lira Bruno Araujo --- PySide/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 3b85e3d..35baf3c 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -23,7 +23,9 @@ HAS_QT_MODULE(QT_QTXML_FOUND QtXml) HAS_QT_MODULE(QT_QTTEST_FOUND QtTest) HAS_QT_MODULE(QT_QTOPENGL_FOUND QtOpenGL) HAS_QT_MODULE(QT_QTSQL_FOUND QtSql) -HAS_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools) +if(QT_QTDESIGNER_FOUND) + HAS_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools) +endif() HAS_QT_MODULE(QT_QTHELP_FOUND QtHelp) HAS_QT_MODULE(QT_QTXMLPATTERNS_FOUND QtXmlPatterns) HAS_QT_MODULE(QT_QTMAEMO5_FOUND QtMaemo5) From d96649862fff5ee8e22ac3f48c9a96fea04238bf Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 28 Dec 2010 14:09:16 -0300 Subject: [PATCH 273/913] Appended QtGui library dependency on pysidetest library. --- tests/pysidetest/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 83e9202..4b94a2a 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -53,12 +53,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PYTHON_INCLUDE_PATH}) add_library(pysidetest SHARED ${pysidetest_SRC} ${pysidetest_MOC_SRC}) -target_link_libraries(pysidetest ${QT_QTCORE_LIBRARY}) +target_link_libraries(pysidetest ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) add_library(testbinding MODULE ${testbinding_SRC}) set_property(TARGET testbinding PROPERTY PREFIX "") if(WIN32) - set_target_properties(testbinding PROPERTIES SUFFIX ".pyd") + set_target_properties(testbinding PROPERTIES SUFFIX ".pyd") endif() target_link_libraries(testbinding pysidetest From c406547057691d758de8324ffb6fabff93e7f1fa Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 28 Dec 2010 14:12:24 -0300 Subject: [PATCH 274/913] Appended ${QtGui_BINARY_DIR} on typesystem_path for QtMaemo5 module. --- PySide/QtMaemo5/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/QtMaemo5/CMakeLists.txt b/PySide/QtMaemo5/CMakeLists.txt index fadf91d..30bf15c 100644 --- a/PySide/QtMaemo5/CMakeLists.txt +++ b/PySide/QtMaemo5/CMakeLists.txt @@ -11,7 +11,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qmaemo5valuebutton_wrapper. ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qtmaemo5_module_wrapper.cpp ) -set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}") +set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") # QT_QTMAEMO5_* variables are not defined by CMake if(NOT QT_QTMAEMO5_INCLUDE_DIR) From 6849ba0864c245e15b5786d959b5afa730fb906b Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 28 Dec 2010 19:43:00 -0300 Subject: [PATCH 275/913] Fix test to avoid problems on slow computers. Reviewed by Hugo Parente --- tests/QtGui/virtual_protected_inheritance_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QtGui/virtual_protected_inheritance_test.py b/tests/QtGui/virtual_protected_inheritance_test.py index 15de37d..be19952 100644 --- a/tests/QtGui/virtual_protected_inheritance_test.py +++ b/tests/QtGui/virtual_protected_inheritance_test.py @@ -57,7 +57,7 @@ class TimerEventTest(UsesQApplication): self.widget.killTimer(timer_id) - self.assertEqual(self.widget.runs, 5) + self.assert_(self.widget.runs >= self.widget.max_runs) if __name__ == '__main__': From 40f5c3ce0e88a54bf8b838b4951a23a3e147fd5a Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 28 Dec 2010 19:43:51 -0300 Subject: [PATCH 276/913] Fixed MetaObject creation based on typename. Reviewed by Hugo Parente --- libpyside/pyside.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index da896ce..5cb107a 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -138,11 +138,7 @@ void destroyQCoreApplication() void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base) { - const char* typeName = type->super.ht_type.tp_name; - int len = strlen(typeName); - for (int i = len-1; i >= 0; --i) - if (typeName[i] == '.') - typeName += i + 1; + QByteArray typeName = QByteArray(type->super.ht_type.tp_name).split('.').last(); DynamicQMetaObject* mo = new PySide::DynamicQMetaObject(typeName, base); Shiboken::ObjectType::setTypeUserData(type, mo, &Shiboken::callCppDestructor); } From 6d18229268b42db54824cc277e339bac34ad3404 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 28 Dec 2010 12:21:50 -0200 Subject: [PATCH 277/913] Changes the arg name from p to parent to make parent heuristic work. --- PySide/QtDeclarative/typesystem_declarative.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index d4edee8..05d72e8 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -79,6 +79,11 @@ + + + + + From 92b893c53242a191b76291f8fb0ce68fd284c115 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 28 Dec 2010 14:50:46 -0200 Subject: [PATCH 278/913] Fix bug#563 - "Unhandled signal emitting with invalid signature (which leads to application crash)" --- libpyside/signalmanager.cpp | 2 +- tests/QtDeclarative/bug_456.py | 2 +- tests/QtDeclarative/bug_456.qml | 2 +- tests/QtDeclarative/connect_python_qml.py | 6 +++--- tests/QtDeclarative/connect_python_qml.qml | 20 ++++++++++---------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 6cdc3e1..75a0d19 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -188,7 +188,7 @@ static bool emitNormalSignal(QObject* source, int signalIndex, const char* signa Shiboken::AutoDecRef sequence(PySequence_Fast(args, 0)); int argsGiven = PySequence_Fast_GET_SIZE(sequence.object()); - if (argsGiven > argTypes.count()) { + if (argsGiven != argTypes.count()) { PyErr_Format(PyExc_TypeError, "%s only accepts %d arguments, %d given!", signal, argTypes.count(), argsGiven); return false; } diff --git a/tests/QtDeclarative/bug_456.py b/tests/QtDeclarative/bug_456.py index 262b82e..9ed70c8 100644 --- a/tests/QtDeclarative/bug_456.py +++ b/tests/QtDeclarative/bug_456.py @@ -33,7 +33,7 @@ class TestConnectionWithInvalidSignature(TimedQApplication): root = view.rootObject() button = root.findChild(QtCore.QObject, "buttonMouseArea") view.show() - button.clicked.emit() + button.entered.emit() self.assertEqual(rotatevalue.rotation, 100) if __name__ == '__main__': diff --git a/tests/QtDeclarative/bug_456.qml b/tests/QtDeclarative/bug_456.qml index e4596fd..e8b220e 100644 --- a/tests/QtDeclarative/bug_456.qml +++ b/tests/QtDeclarative/bug_456.qml @@ -56,7 +56,7 @@ Rectangle { id: buttonMouseArea objectName: "buttonMouseArea" anchors.fill: parent - onClicked: { + onEntered: { rotatevalue.rotation = rotatevalue.val() } } diff --git a/tests/QtDeclarative/connect_python_qml.py b/tests/QtDeclarative/connect_python_qml.py index e8180f7..669eec6 100644 --- a/tests/QtDeclarative/connect_python_qml.py +++ b/tests/QtDeclarative/connect_python_qml.py @@ -19,9 +19,9 @@ class TestConnectionWithInvalidSignature(TimedQApplication): view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('connect_python_qml.qml', __file__))) root = view.rootObject() button = root.findChild(QtCore.QObject, "buttonMouseArea") - self.assertRaises(TypeError, QtCore.QObject.connect, [button,QtCore.SIGNAL('clicked()'), self.onButtonFailClicked]) - button.clicked.connect(self.onButtonClicked) - button.clicked.emit() + self.assertRaises(TypeError, QtCore.QObject.connect, [button,QtCore.SIGNAL('entered()'), self.onButtonFailClicked]) + button.entered.connect(self.onButtonClicked) + button.entered.emit() view.show() self.app.exec_() self.assert_(self.buttonClicked) diff --git a/tests/QtDeclarative/connect_python_qml.qml b/tests/QtDeclarative/connect_python_qml.qml index dbf890f..df55e1b 100644 --- a/tests/QtDeclarative/connect_python_qml.qml +++ b/tests/QtDeclarative/connect_python_qml.qml @@ -6,15 +6,15 @@ Rectangle { color: "lightgray" Rectangle { - id: button - width: 150; height: 40 - color: "darkgray" - anchors.horizontalCenter: page.horizontalCenter - y: 150 - MouseArea { - id: buttonMouseArea - objectName: "buttonMouseArea" - anchors.fill: parent - } + id: button + width: 150; height: 40 + color: "darkgray" + anchors.horizontalCenter: page.horizontalCenter + y: 150 + MouseArea { + id: buttonMouseArea + objectName: "buttonMouseArea" + anchors.fill: parent + } } } From d8f3b9629a6b1f1ab91516fdc144eb4fd80e5128 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 28 Dec 2010 18:53:06 -0200 Subject: [PATCH 279/913] Fix bug#569 - "QTableWidgetItem is missing binding of __lt__ to operator<" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 15 --------------- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_569.py | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 tests/QtGui/bug_569.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index c2b6343..2998c59 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3074,9 +3074,6 @@ - - - @@ -3085,8 +3082,6 @@ - - @@ -3110,9 +3105,6 @@ - - - @@ -3129,8 +3121,6 @@ - - @@ -3165,16 +3155,12 @@ - - - - @@ -3259,7 +3245,6 @@ - diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 93b9c07..0cd9ac2 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -23,6 +23,7 @@ PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) PYSIDE_TEST(bug_547.py) PYSIDE_TEST(bug_549.py) +PYSIDE_TEST(bug_569.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_569.py b/tests/QtGui/bug_569.py new file mode 100644 index 0000000..00d92ed --- /dev/null +++ b/tests/QtGui/bug_569.py @@ -0,0 +1,19 @@ +from PySide.QtCore import * +from PySide.QtGui import * +import unittest + + +class TestBug569(unittest.TestCase): + + def testIt(self): + types = (QTableWidgetItem, QListWidgetItem, QTreeWidgetItem) + for t in types: + a = t() + a.__lt__ = lambda(other) : True + b = t() + b.__lt__ = lambda(other) : False + self.assertTrue(a < b) + self.assertFalse(b < a) + +if __name__ == '__main__': + unittest.main() From 1d05357e2657df96b16b5cb4f2e9cc2b6ca73d2b Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 29 Dec 2010 11:55:09 -0300 Subject: [PATCH 280/913] Changed api2 test to work on MacOS during a ssh session. --- tests/QtGui/api2_test.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/QtGui/api2_test.py b/tests/QtGui/api2_test.py index e458d8b..42edba0 100644 --- a/tests/QtGui/api2_test.py +++ b/tests/QtGui/api2_test.py @@ -2,6 +2,7 @@ import unittest +import sys from PySide.QtCore import QObject from PySide.QtGui import * @@ -38,23 +39,21 @@ class DoubleQObjectInheritanceTest(UsesQApplication): obj.setRange(1, 10) obj.setValue(0) - print "Value:", obj.value() + self.assertEqual(obj.value(), 1) class QClipboardTest(UsesQApplication): def testQClipboard(self): - clip = QClipboard() + #skip this test on MacOS because the clipboard is not available during the ssh session + #this cause problems in the buildbot + if sys.platform == 'darwin': + return + clip = QApplication.clipboard() clip.setText("Testing this thing!") text, subtype = clip.text("") self.assertEqual(subtype, "plain") self.assertEqual(text, "Testing this thing!") -#class QFileDialog(UsesQApplication): -# -# def testQFileDialog(self): -# string, filtr = QFileDialog.getOpenFileName() -# print string, filtr - if __name__ == '__main__': unittest.main() From ecb060f85c3de21b6f2e6ea94417685307252791 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 28 Dec 2010 21:18:26 -0300 Subject: [PATCH 281/913] Improve QtScriptEngineDebugger test behavior The extra ContinueAction after evaluate() was crashing on MacOS X. Reviewer: Hugo Lima Reviewer: Renato Araujo --- tests/QtScriptTools/debugger_test.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/QtScriptTools/debugger_test.py b/tests/QtScriptTools/debugger_test.py index e525361..5634824 100644 --- a/tests/QtScriptTools/debugger_test.py +++ b/tests/QtScriptTools/debugger_test.py @@ -1,7 +1,7 @@ import unittest -from PySide.QtCore import SIGNAL +from PySide.QtCore import SIGNAL, QTimer from PySide.QtScript import QScriptEngine from PySide.QtScriptTools import QScriptEngineDebugger @@ -13,29 +13,32 @@ class DebuggerTest(UsesQApplication): UsesQApplication.setUp(self) self.engine = QScriptEngine() self.debugger = QScriptEngineDebugger() - self.has_suspended = False - self.has_resumed = False + self.has_suspended = 0 + self.has_resumed = 0 + self.count = 3 def suspended(self): - self.has_suspended = True - self.debugger.action(QScriptEngineDebugger.ContinueAction).trigger() + self.has_suspended += 1 + # Will emit evaluationResumed until there are more instructions to be run + QTimer.singleShot(100, self.debugger.action(QScriptEngineDebugger.StepIntoAction).trigger) def resumed(self): - self.has_resumed = True + # Will be called when debugger.state() change from Suspended to Running + # except for the first time. + self.has_resumed += 1 def testBasic(self): '''Interrupt and resume evaluation with QScriptEngineDebugger''' + self.debugger.attachTo(self.engine) self.debugger.setAutoShowStandardWindow(False) self.debugger.connect(SIGNAL('evaluationSuspended()'), self.suspended) self.debugger.connect(SIGNAL('evaluationResumed()'), self.resumed) self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() - self.engine.evaluate("3+4") - self.debugger.action(QScriptEngineDebugger.ContinueAction).trigger() - self.assert_(self.has_resumed) - self.assert_(self.has_suspended) - + self.engine.evaluate("3+4\n2+1\n5+1") + self.assertEqual(self.has_resumed, 2) + self.assertEqual(self.has_suspended, 3) if __name__ == '__main__': unittest.main() From 9b02c46c03a3e246146ccd5b63fda8cb0335aac7 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 29 Dec 2010 18:57:58 -0200 Subject: [PATCH 282/913] Fix bug#493 - "__eq__ and friends not implemented for QKeyEvent == QKeySequence" Reviewer: Marcelo Lira Lauro Moura --- PySide/QtGui/typesystem_gui_common.xml | 9 +++++++-- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_493.py | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/QtGui/bug_493.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 2998c59..be38ca9 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -128,7 +128,6 @@ - @@ -2427,7 +2426,13 @@ - + + + + %PYARG_0 = %CONVERTTOPYTHON[bool](!(&%CPPSELF == %1)); + + + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 0cd9ac2..65b10e8 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -18,6 +18,7 @@ PYSIDE_TEST(bug_430.py) PYSIDE_TEST(bug_433.py) PYSIDE_TEST(bug_467.py) PYSIDE_TEST(bug_480.py) +PYSIDE_TEST(bug_493.py) PYSIDE_TEST(bug_500.py) PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) diff --git a/tests/QtGui/bug_493.py b/tests/QtGui/bug_493.py new file mode 100644 index 0000000..bf19fa7 --- /dev/null +++ b/tests/QtGui/bug_493.py @@ -0,0 +1,21 @@ +from PySide.QtCore import * +from PySide.QtGui import * +import unittest + + +class TestBug569(unittest.TestCase): + + def testIt(self): + # We need a qapp otherwise Qt will crash when trying to detect the + # current platform + app = QApplication([]) + ev1 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Delete, Qt.NoModifier) + ev2 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Copy, Qt.NoModifier) + ks = QKeySequence.Delete + self.assertEqual(ev1, ks) + self.assertEqual(ks, ev1) + self.assertNotEqual(ev2, ks) + self.assertNotEqual(ks, ev2) + +if __name__ == '__main__': + unittest.main() From 394cdb357d88e4c6968d3986ca7820756661fa35 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 30 Dec 2010 15:26:20 -0200 Subject: [PATCH 283/913] Fix bug 546 - "Python crash on exit" Reviewer: Marcelo Lira Lauro Moura --- PySide/QtGui/typesystem_gui_common.xml | 4 ++-- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_546.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/QtGui/bug_546.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index be38ca9..c7c8f17 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3152,8 +3152,8 @@ - - + + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 65b10e8..4514731 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -22,6 +22,7 @@ PYSIDE_TEST(bug_493.py) PYSIDE_TEST(bug_500.py) PYSIDE_TEST(bug_512.py) PYSIDE_TEST(bug_525.py) +PYSIDE_TEST(bug_546.py) PYSIDE_TEST(bug_547.py) PYSIDE_TEST(bug_549.py) PYSIDE_TEST(bug_569.py) diff --git a/tests/QtGui/bug_546.py b/tests/QtGui/bug_546.py new file mode 100644 index 0000000..845b64e --- /dev/null +++ b/tests/QtGui/bug_546.py @@ -0,0 +1,14 @@ +import unittest +from PySide.QtGui import * + +class TestBug546(unittest.TestCase): + + """Test to check a crash at exit""" + def testIt(self): + app = QApplication([]) + textEdit = QPlainTextEdit() + completer = QCompleter(("foo", "bar"), textEdit) + completer.setWidget(textEdit) + +if __name__=='__main__': + unittest.main() From 9e6762eeb050496f74fdafa1325dd294bf564ce1 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 30 Dec 2010 16:36:23 -0200 Subject: [PATCH 284/913] Fix bug#514 - "Static method QByteArray.fromRawData is missing from QtCore" Reviewer: Marcelo Lira Lauro Moura --- PySide/QtCore/typesystem_core.xml | 10 +++++++++- tests/QtCore/qbytearray_test.py | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index e416e57..c785f79 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1734,7 +1734,15 @@ - + + + + + + // %FUNCTION_NAME() - avoid generation of default function call + %PYARG_0 = %CONVERTTOPYTHON[QByteArray](QByteArray(%1)); + + diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py index 2c0ee87..34dc42f 100644 --- a/tests/QtCore/qbytearray_test.py +++ b/tests/QtCore/qbytearray_test.py @@ -102,5 +102,12 @@ class QByteArrayOnQVariant(unittest.TestCase): a = QSettings().value("some_prop", QByteArray()) self.assertEqual(type(a), QByteArray) +class QByteArrayBug514(unittest.TestCase): + def testIt(self): + data = "foobar" + a = QByteArray.fromRawData(data) + self.assertEqual(type(a), QByteArray) + self.assertEqual(a.data(), data) + if __name__ == '__main__': unittest.main() From 814b80f42352199915a13a61280dfe62b8763670 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 3 Jan 2011 10:01:04 -0300 Subject: [PATCH 285/913] Fixed test to work in all platform. --- tests/QtScriptTools/debugger_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/QtScriptTools/debugger_test.py b/tests/QtScriptTools/debugger_test.py index 5634824..8805018 100644 --- a/tests/QtScriptTools/debugger_test.py +++ b/tests/QtScriptTools/debugger_test.py @@ -37,8 +37,8 @@ class DebuggerTest(UsesQApplication): self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() self.engine.evaluate("3+4\n2+1\n5+1") - self.assertEqual(self.has_resumed, 2) - self.assertEqual(self.has_suspended, 3) + self.assert_(self.has_resumed >= 1) + self.assert_(self.has_suspended >= 1) if __name__ == '__main__': unittest.main() From ba00068ce161bba9c62c0784876bcb38d252cd98 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Mon, 3 Jan 2011 11:28:02 -0300 Subject: [PATCH 286/913] Avoid conflict in test case names Reviewer: Hugo Lima Reviewer: Marcelo Lira --- tests/QtCore/qdatastream_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QtCore/qdatastream_test.py b/tests/QtCore/qdatastream_test.py index 1a75f79..7ccc12e 100644 --- a/tests/QtCore/qdatastream_test.py +++ b/tests/QtCore/qdatastream_test.py @@ -308,7 +308,7 @@ class QDataStreamShiftBitArray(unittest.TestCase): self._check_bitarray(data) -class QDataStreamShiftBitArray(unittest.TestCase): +class QDataStreamRawData(unittest.TestCase): def testRawData(self): data = QDataStream() self.assertEqual(data.readRawData(4), '\x00\x00\x00\x00') From 1af0e9f4fe50537d18c07cfa05578d3242ce21c9 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 3 Jan 2011 13:43:29 -0300 Subject: [PATCH 287/913] Fixed QWidget.parent function. Create unit test for bug 576. Fixes bug #576. Reviewer: Marcelo Lira Lauro Moura --- PySide/QtGui/typesystem_gui_common.xml | 23 ++++++++++++++---- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_576.py | 32 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 tests/QtGui/bug_576.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index c7c8f17..8884c63 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3287,6 +3287,24 @@ + + + + + + + + + + + + + + + + + + @@ -3413,11 +3431,6 @@ - - - - - diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 4514731..8906a93 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -26,6 +26,7 @@ PYSIDE_TEST(bug_546.py) PYSIDE_TEST(bug_547.py) PYSIDE_TEST(bug_549.py) PYSIDE_TEST(bug_569.py) +PYSIDE_TEST(bug_576.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_576.py b/tests/QtGui/bug_576.py new file mode 100644 index 0000000..b3c11a3 --- /dev/null +++ b/tests/QtGui/bug_576.py @@ -0,0 +1,32 @@ +""" Unittest for bug #576 """ +""" http://bugs.openbossa.org/show_bug.cgi?id=576 """ + +from PySide import QtGui, QtCore +import sys +import unittest + +class Bug576(unittest.TestCase): + def onButtonDestroyed(self, button): + self._destroyed = True + + def testWidgetParent(self): + self._destroyed = False + app = QtGui.QApplication(sys.argv) + w = QtGui.QWidget() + + b = QtGui.QPushButton("test") + b.destroyed[QtCore.QObject].connect(self.onButtonDestroyed) + self.assertEqual(sys.getrefcount(b), 2) + b.setParent(w) + self.assertEqual(sys.getrefcount(b), 3) + b.parent() + self.assertEqual(sys.getrefcount(b), 3) + b.setParent(None) + self.assertEqual(sys.getrefcount(b), 2) + del b + self.assert_(self._destroyed) + + +if __name__ == '__main__': + unittest.main() + From 1ed2877743ce786e1d71f804f1b4aa4f433aa4be Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 3 Jan 2011 14:24:19 -0200 Subject: [PATCH 288/913] Fix bug#577 - "Reference to QString in docs" --- .../snippets/code/src_gui_itemviews_qstandarditemmodel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/codesnippets/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp b/doc/codesnippets/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp index 8086919..b7f91e0 100644 --- a/doc/codesnippets/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp +++ b/doc/codesnippets/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp @@ -2,7 +2,7 @@ model = QStandardItemModel (4, 4) for row in range(4): for column in range(4): - item = QStandardItem(QString("row %0, column %1").arg(row).arg(column)) + item = QStandardItem("row %d, column %d" % (row, column)) model.setItem(row, column, item) //! [0] @@ -11,7 +11,7 @@ for row in range(4): model = QStandardItemModel() parentItem = model.invisibleRootItem() for i in range(4): - item = QStandardItem(QString("item %0").arg(i)) + item = QStandardItem("item %d" % i) parentItem.appendRow(item) parentItem = item //! [1] @@ -20,8 +20,7 @@ for i in range(4): //! [2] treeView = QTreeView(self) treeView.setModel(myStandardItemModel) -connect(treeView, SIGNAL('clicked(QModelIndex)') - this, SLOT('clicked(QModelIndex)')) +treeView.clicked[QModelIndex].connect(self.clicked) //! [2] From 7a3e7b6f86a514c661bf61c65d1098339e4ffba3 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 3 Jan 2011 14:21:40 -0300 Subject: [PATCH 289/913] Fix QTreeWidgetItem.parent function. Create unit test for new use case. Fixes bug #547 Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 2 +- tests/QtGui/bug_547.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 8884c63..b6516ab 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3231,7 +3231,7 @@ - + diff --git a/tests/QtGui/bug_547.py b/tests/QtGui/bug_547.py index 5636fb6..6b65254 100644 --- a/tests/QtGui/bug_547.py +++ b/tests/QtGui/bug_547.py @@ -6,8 +6,8 @@ import sys import unittest class MyMainWindow(unittest.TestCase): - def testClearFunction(self): - app = QtGui.QApplication(sys.argv) + app = QtGui.QApplication(sys.argv) + def testCase1(self): self._tree = QtGui.QTreeWidget() self._tree.setColumnCount(2) self._i1 = None @@ -24,6 +24,21 @@ class MyMainWindow(unittest.TestCase): self.assertEqual(sys.getrefcount(self._i1), 3) self.assertEqual(sys.getrefcount(self._i11), 3) + def testCase2(self): + self._tree = QtGui.QTreeWidget() + self._tree.setColumnCount(2) + self._i1 = None + self._i11 = None + + self._updateTree() + self.assertEqual(sys.getrefcount(self._i1), 3) + self.assertEqual(sys.getrefcount(self._i11), 3) + + self._i11.parent().setExpanded(True) + self._i11.setExpanded(True) + + self.assertEqual(sys.getrefcount(self._i1), 3) + self.assertEqual(sys.getrefcount(self._i11), 3) def _updateTree(self): self._tree.clear() @@ -32,7 +47,9 @@ class MyMainWindow(unittest.TestCase): self.assertEqual(sys.getrefcount(self._i11), 2) self._i1 = QtGui.QTreeWidgetItem(self._tree, ['1', ]) + self.assertEqual(sys.getrefcount(self._i1), 3) self._i11 = QtGui.QTreeWidgetItem(self._i1, ['11', ]) + self.assertEqual(sys.getrefcount(self._i11), 3) if __name__ == '__main__': unittest.main() From 1f1f82d5827c3ec77fcd4ee6b6ab47afa0473007 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 3 Jan 2011 16:38:30 -0300 Subject: [PATCH 290/913] Added test case for Bug #572. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug #572: Giving unicode value as 'body' argument to WebView's load method crashes python. Reviewed by Hugo Parente Reviewed by Renato Araújo --- tests/QtWebKit/webview_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/QtWebKit/webview_test.py b/tests/QtWebKit/webview_test.py index a6a40fd..ab81a30 100644 --- a/tests/QtWebKit/webview_test.py +++ b/tests/QtWebKit/webview_test.py @@ -6,6 +6,7 @@ import sys from PySide.QtCore import QObject, SIGNAL, QUrl from PySide.QtWebKit import * +from PySide.QtNetwork import QNetworkRequest from helper import adjust_filename, TimedQApplication @@ -61,5 +62,8 @@ class TestLoadFinished(TimedQApplication): if ok: self.called = True + def testNamedArgumentTypeChecking(self): + self.assertRaises(TypeError, self.view.load, QNetworkRequest(), body=unicode('foo')) + if __name__ == '__main__': unittest.main() From cc7d8dd1386138a5e88afe64664f51c33aad2f56 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 3 Jan 2011 19:54:40 -0300 Subject: [PATCH 291/913] Created support to function qAddPostRoutine. Created unit test for bug #515 Fixes bug #515 Reviewer: Marcelo Lira Lauro Moura --- PySide/QtCore/typesystem_core.xml | 31 +++++++++++++++++++++++++++++++ tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_515.py | 18 ++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 tests/QtCore/bug_515.py diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index c785f79..df04ca9 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -596,6 +596,37 @@ + + namespace PySide { + static QStack<PyObject*> globalPostRoutineFunctions; + void globalPostRoutineCallback() + { + foreach(PyObject* callback, globalPostRoutineFunctions) { + Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL)); + Py_DECREF(callback); + } + globalPostRoutineFunctions.clear(); + } + void addPostRoutine(PyObject* callback) + { + if (PyCallable_Check(callback)) { + globalPostRoutineFunctions << callback; + Py_INCREF(callback); + } else { + PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object."); + } + } + } // namespace + + + + PySide::addPostRoutine(%1); + + + + qAddPostRoutine(PySide::globalPostRoutineCallback); + + diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 8ec3cdd..6851915 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -4,6 +4,7 @@ PYSIDE_TEST(bug_408.py) PYSIDE_TEST(bug_428.py) PYSIDE_TEST(bug_462.py) PYSIDE_TEST(bug_505.py) +PYSIDE_TEST(bug_515.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) PYSIDE_TEST(deepcopy_test.py) diff --git a/tests/QtCore/bug_515.py b/tests/QtCore/bug_515.py new file mode 100644 index 0000000..c2bd9c7 --- /dev/null +++ b/tests/QtCore/bug_515.py @@ -0,0 +1,18 @@ +""" Unittest for bug #515 """ +""" http://bugs.openbossa.org/show_bug.cgi?id=515 """ + +from PySide import QtCore + +callCleanup = False +def _cleanup(): + global callCleanup + callCleanup = True + +def _checkCleanup(): + global callCleanup + assert(callCleanup) + +app = QtCore.QCoreApplication([]) +QtCore.qAddPostRoutine(_cleanup) +QtCore.qAddPostRoutine(_checkCleanup) +del app From 4351b2e5133e89c02ff26ecbf0f7df6e902efc64 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 4 Jan 2011 13:25:05 -0200 Subject: [PATCH 292/913] New format for __version_info__. The new format follow the same rules used by sys.version_info(). Reviewer: Marcelo Lira Lauro Moura --- CMakeLists.txt | 11 ++++++++++- PySide/__init__.py.in | 4 ++-- doc/conf.py.in | 2 +- libpyside/pyside.pc.in | 2 +- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/versioninfo_test.py | 20 ++++++++++++++++++++ 6 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 tests/QtCore/versioninfo_test.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 5209bab..33eda53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,16 @@ set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "1") set(BINDING_API_MINOR_VERSION "0") set(BINDING_API_MICRO_VERSION "0") +set(BINDING_API_RELEASE_LEVEL "beta") # alpha, beta, candidate, or final +set(BINDING_API_SERIAL 3) # leave as 0 when release level is final set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) +if (BINDING_API_RELEASE_LEVEL STREQUAL "final") + set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" + CACHE STRING "PySide version [full]" FORCE) +else() + set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}~${BINDING_API_RELEASE_LEVEL}${BINDING_API_SERIAL}" + CACHE STRING "PySide version [full]" FORCE) +endif() set(PYSIDE_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" CACHE STRING "Qt version used to compile PySide" FORCE) if(ENABLE_VERSION_SUFFIX) set(pyside_SUFFIX "-${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}") @@ -123,7 +132,7 @@ add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -set(ARCHIVE_NAME pyside-qt${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}+${BINDING_API_VERSION}) +set(ARCHIVE_NAME pyside-qt${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}+${BINDING_API_VERSION_FULL}) add_custom_target(dist COMMAND mkdir -p "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}" && git log > "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}/ChangeLog" && diff --git a/PySide/__init__.py.in b/PySide/__init__.py.in index f931fad..40731a8 100644 --- a/PySide/__init__.py.in +++ b/PySide/__init__.py.in @@ -1,5 +1,5 @@ __all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] import private -__version__ = "@BINDING_API_VERSION@" -__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@) +__version__ = "@BINDING_API_VERSION_FULL@" +__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@) diff --git a/doc/conf.py.in b/doc/conf.py.in index b9e7549..d2d7408 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -51,7 +51,7 @@ copyright = u'2009-2010, Nokia Corporation' # The short X.Y version. version = '@BINDING_API_VERSION@' # The full version, including alpha/beta/rc tags. -release = '@BINDING_API_VERSION@' +release = '@BINDING_API_VERSION_FULL@' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/libpyside/pyside.pc.in b/libpyside/pyside.pc.in index f7458a9..993e5a1 100644 --- a/libpyside/pyside.pc.in +++ b/libpyside/pyside.pc.in @@ -7,7 +7,7 @@ pythonpath=@SITE_PACKAGE@ Name: PySide@pyside_SUFFIX@ Description: Support library for Python bindings of Qt-based libraries. -Version: @BINDING_API_VERSION@ +Version: @BINDING_API_VERSION_FULL@ Libs: -L${libdir} -lpyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@ Cflags: -I${includedir} Requires: shiboken diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 6851915..7f8a773 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -76,6 +76,7 @@ PYSIDE_TEST(tr_noop_test.py) PYSIDE_TEST(translation_test.py) PYSIDE_TEST(unaryoperator_test.py) PYSIDE_TEST(unicode_test.py) +PYSIDE_TEST(versioninfo_test.py) if(X11) PYSIDE_TEST(qhandle_test.py) diff --git a/tests/QtCore/versioninfo_test.py b/tests/QtCore/versioninfo_test.py new file mode 100644 index 0000000..094d637 --- /dev/null +++ b/tests/QtCore/versioninfo_test.py @@ -0,0 +1,20 @@ +import unittest +import PySide + +class TestVersionInfo(unittest.TestCase): + def testIt(self): + + v = PySide.__version_info__ + self.assertEqual(type(v), tuple) + self.assertEqual(len(v), 5) + self.assertEqual(type(v[0]), int) + self.assertEqual(type(v[1]), int) + self.assertEqual(type(v[2]), int) + self.assertEqual(type(v[3]), str) + self.assertEqual(type(v[4]), int) + + self.assertEqual(type(PySide.__version__), str) + + +if __name__ == '__main__': + unittest.main() From f7fd9277f47359f8eb4490bcb8f5bdc84000035e Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 4 Jan 2011 18:32:24 -0300 Subject: [PATCH 293/913] Fixed function QDataStream.readRawData return value. The function readRawData now return None in case of error, otherwise a string with the read data. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtCore/typesystem_core.xml | 9 +++++++-- tests/QtCore/qdatastream_test.py | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index df04ca9..54513f9 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2388,8 +2388,13 @@ QByteArray data; data.resize(%2); - %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); - %PYARG_0 = PyString_FromStringAndSize(data.constData(), data.size()); + int result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); + if (result == -1) { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } else { + %PYARG_0 = PyString_FromStringAndSize(data.data(), result); + } diff --git a/tests/QtCore/qdatastream_test.py b/tests/QtCore/qdatastream_test.py index 7ccc12e..ad74457 100644 --- a/tests/QtCore/qdatastream_test.py +++ b/tests/QtCore/qdatastream_test.py @@ -311,15 +311,15 @@ class QDataStreamShiftBitArray(unittest.TestCase): class QDataStreamRawData(unittest.TestCase): def testRawData(self): data = QDataStream() - self.assertEqual(data.readRawData(4), '\x00\x00\x00\x00') + self.assertEqual(data.readRawData(4), None) ba = QByteArray() data = QDataStream(ba, QIODevice.WriteOnly) - data.writeRawData('ABC') - self.assertEqual(ba, 'ABC') + data.writeRawData('AB\x00C') + self.assertEqual(ba.data(), 'AB\x00C') data = QDataStream(ba) - self.assertEqual(data.readRawData(4), 'ABC\x00') + self.assertEqual(data.readRawData(4), 'AB\x00C') if __name__ == '__main__': unittest.main() From aa305dc5ae5f463c31938fb50cd92257b0fc7911 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 4 Jan 2011 18:46:40 -0200 Subject: [PATCH 294/913] Lock the gil on some hand written code to avoid crashes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- PySide/QtCore/typesystem_core.xml | 8 ++++---- PySide/QtDeclarative/pysideqmlregistertype.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 54513f9..f41acd5 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -650,13 +650,13 @@ // Define a global variable to handle qInstallMsgHandler callback static PyObject* qtmsghandler = 0; - void - msghandlercallback(QtMsgType type, const char* msg) + static void msgHandlerCallback(QtMsgType type, const char* msg) { + Shiboken::GilState state; Shiboken::AutoDecRef arglist(Shiboken::makeTuple(type, msg)); Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist)); } - void QtCoreModuleExit() + static void QtCoreModuleExit() { PySide::SignalManager::instance().clear(); } @@ -673,7 +673,7 @@ %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None; Py_INCREF(%PYARG_1); qtmsghandler = %PYARG_1; - qInstallMsgHandler(msghandlercallback); + qInstallMsgHandler(msgHandlerCallback); } if (%PYARG_0 == Py_None) diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp index 362e56d..0b05758 100644 --- a/PySide/QtDeclarative/pysideqmlregistertype.cpp +++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp @@ -27,6 +27,7 @@ #include // shiboken #include +#include #include // pyside #include @@ -63,6 +64,7 @@ struct ElementFactoryBase { QMutexLocker locker(&nextQmlElementMutex); PySide::nextQmlElementMemoryAddr = memory; + Shiboken::GilState state; PyObject* obj = PyObject_CallObject(pyTypes[N], 0); if (!obj || PyErr_Occurred()) PyErr_Print(); @@ -246,6 +248,7 @@ PyTypeObject PropertyListType = { // Implementation of QDeclarativeListProperty::AppendFunction callback void propListAppender(QDeclarativeListProperty* propList, QDeclarativeItem* item) { + Shiboken::GilState state; Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, item)); DeclarativeListProperty* data = reinterpret_cast(propList->data); @@ -258,6 +261,7 @@ void propListAppender(QDeclarativeListProperty* propList, QDec // Implementation of QDeclarativeListProperty::CountFunction callback int propListCount(QDeclarativeListProperty* propList) { + Shiboken::GilState state; Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); DeclarativeListProperty* data = reinterpret_cast(propList->data); @@ -275,6 +279,7 @@ int propListCount(QDeclarativeListProperty* propList) // Implementation of QDeclarativeListProperty::AtFunction callback QDeclarativeItem* propListAt(QDeclarativeListProperty* propList, int index) { + Shiboken::GilState state; Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, index)); DeclarativeListProperty* data = reinterpret_cast(propList->data); @@ -291,6 +296,7 @@ QDeclarativeItem* propListAt(QDeclarativeListProperty* propLis // Implementation of QDeclarativeListProperty::ClearFunction callback void propListClear(QDeclarativeListProperty* propList) { + Shiboken::GilState state; Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); DeclarativeListProperty* data = reinterpret_cast(propList->data); From bcb6a2eb75a85cba86c92ccb61ae6e34123758ee Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 5 Jan 2011 08:48:23 -0300 Subject: [PATCH 295/913] Fixed QWidget.setParent signature on typesystem. --- PySide/QtGui/typesystem_gui_common.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index b6516ab..9c8b06b 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3293,7 +3293,7 @@ - + From cfeea7ec045c1f9e7d4652ed2f672db2977de3a8 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 5 Jan 2011 14:10:38 -0200 Subject: [PATCH 296/913] Fix bug#557 - "Segmentation fault in QDeclarativeComponent.loadUrl()" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The signature QDeclarativeComponent(QObject*) should not exist, it's not documented and just creates a useless QDeclarativeComponent when used, useless in the sense that it will segfault when used. Reviewer: Marcelo Lira Renato Araújo --- PySide/QtDeclarative/typesystem_declarative.xml | 1 + tests/QtDeclarative/CMakeLists.txt | 1 + tests/QtDeclarative/bug_557.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/QtDeclarative/bug_557.py diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index 05d72e8..5649bf2 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -66,6 +66,7 @@ + diff --git a/tests/QtDeclarative/CMakeLists.txt b/tests/QtDeclarative/CMakeLists.txt index 5cd53e9..84bc495 100644 --- a/tests/QtDeclarative/CMakeLists.txt +++ b/tests/QtDeclarative/CMakeLists.txt @@ -1,5 +1,6 @@ PYSIDE_TEST(bug_451.py) PYSIDE_TEST(bug_456.py) +PYSIDE_TEST(bug_557.py) PYSIDE_TEST(qdeclarativenetwork_test.py) PYSIDE_TEST(qdeclarativeview_test.py) PYSIDE_TEST(connect_python_qml.py) diff --git a/tests/QtDeclarative/bug_557.py b/tests/QtDeclarative/bug_557.py new file mode 100644 index 0000000..c78aaf1 --- /dev/null +++ b/tests/QtDeclarative/bug_557.py @@ -0,0 +1,14 @@ +from PySide.QtCore import * +from PySide.QtGui import * +from PySide.QtDeclarative import * + +import sys + +app = QApplication(sys.argv) + +engine = QDeclarativeEngine() +component = QDeclarativeComponent(engine) + +# This should segfault if the QDeclarativeComponent has not QDeclarativeEngine +component.loadUrl(QUrl.fromLocalFile('foo.qml')) + From e4eaf410aff780efc4e7f5bc693a7b031938d1c5 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 5 Jan 2011 14:42:39 -0300 Subject: [PATCH 297/913] Fixed QtNetwork test to use '127.0.0.1' instead of 'localhost' This is necessary to make all test to be able run on any buildbot machine. Fix Http server shutdown sequence to avoid deadlocks. Fixes bug #587 Reviewer: Hugo Parente Lima Marcelo Lira --- tests/QtNetwork/accessManager_test.py | 12 +++++++++--- tests/QtNetwork/basic_auth_test.py | 19 +++++++++++-------- tests/QtNetwork/http_test.py | 12 +++++++++--- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tests/QtNetwork/accessManager_test.py b/tests/QtNetwork/accessManager_test.py index 172dab8..65a8480 100644 --- a/tests/QtNetwork/accessManager_test.py +++ b/tests/QtNetwork/accessManager_test.py @@ -19,20 +19,26 @@ class AccessManagerCase(UsesQCoreApplication): def tearDown(self): super(AccessManagerCase, self).tearDown() + if self.httpd: + self.httpd.shutdown() + self.httpd = None + + def goAway(self): self.httpd.shutdown() + self.app.quit() + self.httpd = None def slot_replyFinished(self, reply): self.assertEqual(type(reply), QNetworkReply) self.called = True - self.app.quit() + self.goAway() def testNetworkRequest(self): manager = QNetworkAccessManager() manager.finished.connect(self.slot_replyFinished) - manager.get(QNetworkRequest(QUrl("http://localhost:%s" % self.httpd.port()))) + manager.get(QNetworkRequest(QUrl("http://127.0.0.1:%s" % self.httpd.port()))) self.app.exec_() self.assert_(self.called) - self.httpd.shutdown() if __name__ == '__main__': unittest.main() diff --git a/tests/QtNetwork/basic_auth_test.py b/tests/QtNetwork/basic_auth_test.py index b095f09..bc41d65 100644 --- a/tests/QtNetwork/basic_auth_test.py +++ b/tests/QtNetwork/basic_auth_test.py @@ -15,19 +15,23 @@ class testAuthenticationSignal(UsesQCoreApplication): self._resultOk = False def tearDown(self): - self.httpd.shutdown() - del self.httpd + if self.httpd: + self.httpd.shutdown() + del self.httpd super(testAuthenticationSignal, self).tearDown() + def goAway(self): + self.httpd.shutdown() + self.app.quit() + self.httpd = None + def onAuthRequest(self, hostname, port, auth): self.assert_(isinstance(auth, QAuthenticator)) self._resultOk = True - self.app.quit() - + self.goAway() def testwaitSignal(self): - http = QHttp() - http.setHost("localhost", self.httpd.port()) + http = QHttp('127.0.0.1', self.httpd.port()) http.connect(SIGNAL("authenticationRequired(const QString&, quint16, QAuthenticator*)"), self.onAuthRequest) path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/") data = http.get(str(path)) @@ -35,8 +39,7 @@ class testAuthenticationSignal(UsesQCoreApplication): self.assert_(self._resultOk) def testwaitSignal2(self): - http = QHttp() - http.setHost("localhost", self.httpd.port()) + http = QHttp('127.0.0.1', self.httpd.port()) # Using new signal slot syntax causes a segfault http.authenticationRequired.connect(self.onAuthRequest) path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/") diff --git a/tests/QtNetwork/http_test.py b/tests/QtNetwork/http_test.py index ee6eeea..b6bfea5 100644 --- a/tests/QtNetwork/http_test.py +++ b/tests/QtNetwork/http_test.py @@ -16,18 +16,24 @@ class HttpSignalsCase(UsesQCoreApplication): super(HttpSignalsCase, self).setUp() self.httpd = TestServer() self.httpd.start() - self.http = QHttp('localhost' , self.httpd.port()) + self.http = QHttp("127.0.0.1" , self.httpd.port()) self.called = False def tearDown(self): - self.httpd.shutdown() + if self.httpd: + self.httpd.shutdown() + del self.httpd self.http = None self.httpd = None super(HttpSignalsCase, self).tearDown() + def goAway(self): + self.httpd.shutdown() + self.app.quit() + def callback(self, ident): self.called = True - self.app.quit() + self.goAway() def testDefaultArgs(self): #QHttp signal requestStarted signal From adb9268807aca51c9332e266d6649005c5e9577f Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 5 Jan 2011 19:11:53 -0200 Subject: [PATCH 298/913] Only try to play the ogg file if the system has the capability to do it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix a failing test on macosx. Reviewer: Marcelo Lira Renato Araújo --- tests/phonon/basic_playing_test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/phonon/basic_playing_test.py b/tests/phonon/basic_playing_test.py index 45f6c12..4eb2ccd 100644 --- a/tests/phonon/basic_playing_test.py +++ b/tests/phonon/basic_playing_test.py @@ -38,9 +38,13 @@ class TestSimplePlaying(UsesQCoreApplication): del self.source def testFinishedSignal(self): - # Should pass if finished() is called - self.media.play() - self.app.exec_() + # Check for ogg support before playing it + if (phonon.Phonon.BackendCapabilities.isMimeTypeAvailable('audio/ogg')): + # Should pass if finished() is called + self.media.play() + self.app.exec_() + else: + print 'Ogg format not supported! Playback test skipped!' def testMediaSource(self): self.assertEqual(self.media.currentSource(), self.source) From 5985c015b2b7efe3dad01e37b869a765dd1b8588 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 6 Jan 2011 13:32:55 -0300 Subject: [PATCH 299/913] Fixed QTreeWidgetItem.parent function policy. Fixes bug #585 Reviewer: Hugo Parente Lima Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 9c8b06b..676829e 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3232,13 +3232,28 @@ - - - + + // Only call the parent function if this return some value + // the parent can be the TreeWidget + if (%0) + Shiboken::Object::setParent(%PYARG_0, %PYSELF); + + + + + + + // Only call the parent function if this return some value + // the parent can be the TreeWidgetItem + if (%0) + Shiboken::Object::setParent(%PYARG_0, %PYSELF); + + + From b6343a7674347d1ddae27f61965eb83dd5b2223b Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 6 Jan 2011 13:32:35 -0300 Subject: [PATCH 300/913] Created unit test for bug #585. Reviewer: Hugo Parente Lima Marcelo Lira --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_585.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/QtGui/bug_585.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 8906a93..6032808 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -27,6 +27,7 @@ PYSIDE_TEST(bug_547.py) PYSIDE_TEST(bug_549.py) PYSIDE_TEST(bug_569.py) PYSIDE_TEST(bug_576.py) +PYSIDE_TEST(bug_585.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_585.py b/tests/QtGui/bug_585.py new file mode 100644 index 0000000..7c37150 --- /dev/null +++ b/tests/QtGui/bug_585.py @@ -0,0 +1,26 @@ +'''Test bug 585: http://bugs.openbossa.org/show_bug.cgi?id=585''' + +from PySide import QtCore ,QtGui +import sys +import unittest + + +class Bug585(unittest.TestCase): + def testCase(self): + app = QtGui.QApplication([]) + self._tree = QtGui.QTreeWidget() + self._tree.setColumnCount(2) + i1 = QtGui.QTreeWidgetItem(self._tree, ['1', ]) + i2 = QtGui.QTreeWidgetItem(self._tree, ['2', ]) + refCount = sys.getrefcount(i1) + + # this function return None + # because the topLevelItem does not has a parent item + # but still have a TreeWidget as a parent + self._tree.topLevelItem(0).parent() + + self.assertEqual(refCount, sys.getrefcount(i1)) + +if __name__ == '__main__': + unittest.main() + From 44b71a0ff22cf724b394003131b344ff013a0886 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 5 Jan 2011 18:54:02 -0300 Subject: [PATCH 301/913] Fixed PATH variable for tests on win32 platform. --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f4c73b4..f12e62c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,7 @@ else() if(WIN32) set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/tests/util;${testbinding_BINARY_DIR}") - set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};${pysidetest_BINARY_DIR};$ENV{PATH}") + set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};${pysidetest_BINARY_DIR};${SHIBOKEN_INCLUDE_DIR}/../../bin;$ENV{PATH}") set(LIBRARY_PATH_VAR "PATH") string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}") string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}") From 42e52dec9cd5db837a9fda2663b9c873dac1cd7b Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 6 Jan 2011 16:23:16 -0300 Subject: [PATCH 302/913] Refactoring to Phonon basic playing test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also replaced the ogg audio tone file for a wav one. Reviewed by Hugo Parente Reviewed by Renato Araújo --- tests/phonon/basic_playing_test.py | 58 +++++++++++++---------------- tests/phonon/tone.ogg | Bin 4300 -> 0 bytes tests/phonon/tone.wav | Bin 0 -> 8942 bytes 3 files changed, 26 insertions(+), 32 deletions(-) delete mode 100644 tests/phonon/tone.ogg create mode 100644 tests/phonon/tone.wav diff --git a/tests/phonon/basic_playing_test.py b/tests/phonon/basic_playing_test.py index 4eb2ccd..49df7d5 100644 --- a/tests/phonon/basic_playing_test.py +++ b/tests/phonon/basic_playing_test.py @@ -1,34 +1,35 @@ import os import unittest - -from PySide import QtCore -from PySide import phonon - +from PySide.phonon import Phonon from helper import UsesQCoreApplication -# XXX Hack to get the correct filename -example_file = os.path.join(os.path.dirname(__file__),'tone.ogg') +sample_file = os.path.join(os.path.dirname(__file__), 'tone.wav') + +def checkBackendCapabilities(func): + def function(self, *args, **kw): + if Phonon.BackendCapabilities.isMimeTypeAvailable('audio/x-wav'): + func(self, *args, **kw) + else: + print 'Wav format not supported! Playback test skipped!' + return function + class TestSimplePlaying(UsesQCoreApplication): def setUp(self): super(TestSimplePlaying, self).setUp() self.app.setApplicationName('Dummy') - self.source = phonon.Phonon.MediaSource(example_file) - self.media = phonon.Phonon.MediaObject() + self.source = Phonon.MediaSource(sample_file) + self.media = Phonon.MediaObject() self.media.setCurrentSource(self.source) - QtCore.QObject.connect(self.media, - QtCore.SIGNAL('finished()'), - self.app, - QtCore.SLOT('quit()')) - + self.media.finished.connect(self.app.quit) self.called = False # prevent locking with: # request to play a stream, but no valid audio ... - self.output = phonon.Phonon.AudioOutput() - self.path = phonon.Phonon.createPath(self.media, self.output) + self.output = Phonon.AudioOutput() + self.path = Phonon.createPath(self.media, self.output) def tearDown(self): super(TestSimplePlaying, self).tearDown() @@ -37,14 +38,11 @@ class TestSimplePlaying(UsesQCoreApplication): del self.media del self.source + @checkBackendCapabilities def testFinishedSignal(self): - # Check for ogg support before playing it - if (phonon.Phonon.BackendCapabilities.isMimeTypeAvailable('audio/ogg')): - # Should pass if finished() is called - self.media.play() - self.app.exec_() - else: - print 'Ogg format not supported! Playback test skipped!' + # Should pass if finished() is called + self.media.play() + self.app.exec_() def testMediaSource(self): self.assertEqual(self.media.currentSource(), self.source) @@ -57,18 +55,14 @@ class TestSimplePlaying(UsesQCoreApplication): def state_cb(self, newState, OldState): self.called = True + @checkBackendCapabilities def testStateChanged(self): - # Check for ogg support before playing it - if (phonon.Phonon.BackendCapabilities.isMimeTypeAvailable('audio/ogg')): - QtCore.QObject.connect(self.media, - QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'), - self.state_cb) + self.media.stateChanged['Phonon::State', 'Phonon::State'].connect(self.state_cb) + self.media.play() + self.app.exec_() + self.assert_(self.called) - self.media.play() - self.app.exec_() - self.assert_(self.called) - else: - print 'Ogg format not supported! Playback test skipped!' if __name__ == '__main__': unittest.main() + diff --git a/tests/phonon/tone.ogg b/tests/phonon/tone.ogg deleted file mode 100644 index dc1a455d3bab7c403ce4e60717b157709d4cc479..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4300 zcmai24Ny~8_P?nJ2_TISX{fRP7Y&7nuq6oAuw|AHspdgI9trYMYzah!@F59d*JFrp z@=z-&%3k*76or_mP^HMA zt+j6zkBmy9Av*BzV==ROu12st3NFQc|&S(rN`$Y%T0Dq00OaXY#(r|N{80>*{!U(77%8tjr6%;4Vibt!8R z#36h)x12>%owSl$!G`Xy9K{5;yG7ybcc%4-bI=4<78~?sXG2`*muEU^L+|?z&PBQe z49*j={Kcfq-VYqp-%`#9R$3l+44WMo>?P9CD~lOPr^Hv{T}=uQWj6~$YA_S+I?fXI zv!?nvmoD?-zx7Y>2)Vp1I#Dc=z@tjvTOwO3Q7x5}rZknOohwZ_SDtpYJpEC52D{>M z`?2)KBdXa<$7rZ^i=goi-oE+y_S=H?HJXZ^XHXX95{yy58L#gUcJ0sY&1oJ!aCSI< zYQTSLz}3bA7;>O?gIaTRUH{egr!>m`cMCr-;fKP(m*Yj8@giO{$s1SrJJ~!ufgq;g zq`z4ayh|B8u6zaBuHu~+wXv7Ji+%P<5U8*t6wc?Ei#Qj-8)U$OB4n>JY)L6v0#{HT z`Tggx4KH8__tgHzTs3`LU53pqY7onAqer>gH336q+ZUK_PWSMVz)g3z)xc_A__#{k z>@#9$YPLl%Z^r8m#1fx8X>L6^r&G=dU3Gf<=#YD}lgTg-b6zVgZWgZ$;LDlUIT@}c z!`hTN-SU|c7L2O2%|1gTV!OP@urTavnfX|73szKp+AJSoq{HZ6SuOv##GvMW3!iX^ zTgFwk<Z%k@Ln)UA3gN#J^W zMnO=qthxwCFI$pSG$|(WZpezK1NRMYcKxQyPqo>9auVFVp@J9Cr^KAXm|ci<{YT*ZmRCC ztX`?C^{r~msnQuo+VduRS4aP6`z3RBDR|HzbD|Zzr!wa}pA!YyG~h3KXty!!GB~t2 z`njhAfYA9m*BIM5l0XJ5k|B#^fJ7Yj`xyh&#bD7wFgW%ELS6`Mfgo#`)rz{vg0N&d zf0?(oP2kw}30u?6+~z7+x4F13!YAxpytFhIt_#(8%6~dw02K-f8KW7hdetvSX@Gb-HI( znP3ref}cy^u#Ak-ouM(TM4TZXV>#HU!78ykk6~XIZi(57E+z;7h?F31Z2V zhh$MKx$Y^F410?_M56D+5|3!f2FXIBNHUZ^8!WpfmVE9hSsa#K_k4SAqw2;sQ3||T zfvQ?+EPdUYpWgIXl!#>$wOz6_9FkBhNs!1=#FCT}S;`~HUTbL#P!mPhHb^AHl55}R zOBzdW6-(0h%C0?s(fV{gyoz`JLA^Hzb{d&W56Z#4R!9q9SV=)XFA#yD!49O!HAJ-a&m zz-7#Tb@ZUIxA*M8R}^*Bv}!3@9SwY|3!mybdwh?$&42J7~y} zyTVFj`kAp}CV3z06!RUq$~eNz(e5E~x!Nm!7ED|#oM>rqCl27+dD5v(zlV^wX|1HZ zzw3(hYpm0g$O+KSr{)?gS5j-%XEK9UI;j}-P44)g_W2eV9{-{U?A!urQD|DZj%;7oh+*- z2-Asra=N8~5>-}92=U>1A{KT<5dGz3Y98O(Lgt0Qu0T{hkr!Y|O^Y2;F;iV^yD|+W z$#YE>Q0}c~#}NHPp7H|z^7BNFiBfJbd#2Tb@NO}_&5*THM+lX+5tZbOFo&s_7WgqDrv*L+MQkLFOQs{} z-a|7295-79bZ@<9j9-8`Nsi-SMF7+twzPE=Rhend>rxnKCuFe&gLB8xOV2KwV|TJL znVa=&h>M<;3BF}3-6H+GGG`)uam^mW4=-mDLT^13)Xp5J=kn&X$sE{_{TzA2RqD#G zz>38|e(N={gpc7cc+{i2wKt^A-{uA5%ncxDUTd)g){RRbci}L34v3a_Ep@1Y3oT)2PPR5uHZX!5=GFa zeuV)v@=(Dv>sBg{2=W>;Az^eraf)x(cwJ2+UElhqLL6!es zMi`*ZTAu`8YYTfL-CmWy>TY|@%zIp@XQz!x zyLRBuyZBQ!GT}DD9&3UfJ8sfc;P*N;5T3RuLg4ESD8X@n4`j49l{l#+Nk4CWBXx9K zNhJb6wv)HsO6G!=P`ZBb3Z?35#BN+~O+6X_DM!Gov?ip21QzpEX%D}1o`n2lXZAn> zrOILJ@&J6uDyqzzj1HkiXV0myu9BX1Zn>;;?+ zj2d?+<+LE#KBsjD9k%jLOHzmg*H8o-RBa;$mvWblnQLE5)q()gHPk7*wvKsxeZ6~whZf+A&`p~9S)}Hz zt*orvU)wQuXAN&>mZtNQFC4sWWU8an?N=2C+t_v?cL-f?CsP-4N=;Wr<%px_A9-7N zJpaGF{^on7haTJyw21!giPX2Jdj5e>s_=Bh2fPPIUwgx);{WVx;hO&NmD%N`1>s-5 znR@r5x4-$OSd6gmIEh<^mY@6Cd*8&^rSaad+q@4`_I=%bWjL90@OB~Xrzig+++3N( z5O(!&;>H&b($MLYeMh>#7*1x}dEgRFJ?gO-gvg1WvVRTI&|@)8G@t5M`d(5y+F9u)FC-un5E=szP4n?C>m diff --git a/tests/phonon/tone.wav b/tests/phonon/tone.wav new file mode 100644 index 0000000000000000000000000000000000000000..2fa06a72a996900a3991c639a1120497a4d02f0f GIT binary patch literal 8942 zcmXY$Wl$Vjw1puAcX!v|8r-GjTkYjA=Fd;MO$ zI)A!PovN;`I%|J>t?ldTY6ez;Lvx_cc3piGxo9u@$?IsNxqfOQ?1haYG7}gVl`vm>~i0;*=N}Q zMeuysMEFxoDeeovbb<3?%EgI`$rrgUGF|uzl;NIYrotD(UI!2Rcl$i>9CTT*ud;%f z<{OM@O{}Ii7pOJHIEGRiFdwf*83?{#`p=ZjFhu*I+FuH8 zQXC@5yf*BOXFQMkckt_MOU2V4Mj!W+JExm5KZUCJN*xPYvT5m6$(9NHvCdIL)B&;% z>4>O8tohOK!;r`e!bnGCPTKRRz}SxoGAZmC_BoveaitYilJ%)AkGif5d>iYYG5D3R zp|+QIY<0GQ!R^dJ_6{||5^ z{2;s_uoF~)F`PD59G!sd42=mA^*8h3@ciJ?U|(%@-*n%=Q5&Zgq@XV~FZ_{Lfj#?- z-j(3bU|)m7c4s)hAASs807PZO`iWk$p4LDVYpD^dyQ3VMJE z;4KnJ)}YGJuSLtpX(WD0amxtG$t-}EnpWX{)-pLc#W58PwK`2d+ar5l4JS=b%%5K+{pS7ioZ*<|5_h|xgak|utpd~J z)2A5kS#a7dIQ`{b%Pjgxdybvpt`KgqrepC1Cd4zd{O_1Y; ztA&@P@0`DNuyNQBQXIXHxs7{^w*X!M*MJ2)3qBjmhS>~%j>rso8^{bdgze7E_?o++PQi7!H=N@_-7Nv%Trs^N&Kq&2TYql>Pmw~v_rhoIz8 z0bwR6QXVX4!JEphxYh4fOY zI%SKbNvZ=IL46Vf*_hHnZKJEjOvn96#HVUxn&r|9?aBq7b|&QA`7t1;2t1 z2krq)q9@jt$H;4CQu3jk)B^npD#yj(C%pa(X&-hn!3*2Q5KK@CqnK zG9YJAKF~U%ZpU6vXiC19{wTXK|5Ax_<<+{5CUl2ZpY({?)b)kBRh4b<4;SMb)(!3u zp%{q)xiytuO;BISeN|mJijqHEy+a_Vf?2O#03jtQh^yJFsVHX7S*z6qJ=f%KfYIK+{!! z+}O@C%+AWW+g%hU2+s^W4w*;XN5x>S;@a_D0GjZf5I`sZGVrFj%NTVO89@#435@nj z_J+IHI1SsDS_B$b>FsJ9E6>SBi~9;rb6scII=y{xxEo#&ifA3E+aZI5mAtktUU zFRsgbl=UiYF)1oOFGeY9pQ=G=A~k@z;4#q%>;?Ntb`)NkZB$20MLb(_bQ+k|pNA_p zu5hmf8&%r}dg_OoC;rS?tbE@(+Q*;vGn;b#5Ev2Tk(E$p)@aa$oliIaX%ppW?Do{_ zp|5hlU%^+xIKpkwGT1M;7`zAY0k{Z^;+JqAuwCfva4m#)h(O>ozaQRc_hBbKI|j=F zV@>@C&Ce?D<$@(7gi5%BSZ5jT|6$+GS;Z_EO(~4%^*!jAYWh%jqw;IXnS#RXvUI_e zx`d`!!{}|A3^kq{Nm_#V@e}kSS(4vV9B7EB?wFML{v<@&`7BgkchSf4w>1q7=4}(* z*@J20KW9&VId4Yqv7F$~ws1)BV?{qo(-hyF^U|3#v^B$9yF0A9IC}c}aQfd4dK9XM ze1f`%VZ<5WH}Qdh8!(M$!*^lzFgmCX1V`vb-~)Iz?6Zfa%N_gYR_><51||>-FDiIQ zaf;OP2D0y*d3q$do4No$60Ome`XE2+h_o~2r(3|GjQyObfDnv?iFZaDf0{ULP` zQphBD16o}miPTCCp$5*>lx)^+?& z^P%AxI@>XikMKLmbon&Z|Fm=r5=`bS=j`H~B|U6mGVtiY&X5>{2ud9@f>p!w0-u0X zsA47KKjOHtI_O!XW0+m=qQ8l+k=LZFt0UUR!FnRdzM<^&E`J7TLD%okZMG-d=uN0mdQ9i2U#=bUIc9FAQV>vp^ak3~=F-u!HF2 za0!G)$V`BvpSL%U`xB=`+wT?@#(8>M8r+c5+r^&4F76@QA+`7+sZ>3=6{Cz!{^MO~qR6jib`=>cd40^l~dNphy}{~rrU@x4h` z)8JX}^F)eA%6Dpv8*AI{_XH1Jn)o<3ylk*V+UGib$h^$yC=e;uATy!VrT$e{^ZX0* zOquG;dE$)UcB7C|*s-cWK?=rfNhTRx-hVb}JJHIc=cshW|dzB8R6&4+c3l~X0g z1!LK5kU}yOVq$lq;%UVcJu)ZB8~j6L17Cn>QVKbMilO&J$HX-!`lc#o!gK2iUzfeE zZmD-~-RT+}7#(At_5KyNA+-1J@hQ_)j$uA6(VNnr6+fRN=x`YQZI*4F=n(8$;W_9- z_vZ>$4I4+Ap$)P1xC49@pg@o&WB@~WI_?m2g!+tZ4^0cw^T+sDdbYa=JBV73n4%2} zv`5u?6>_8qBK&-@?7B=PN7lQe>k&)lGeTqB1IAsiS_JC{s)kDy3$t^+XH=zlB&x>Y zqnYT36bxCBNMbE~bCR|A|&hXC3FSuA5QWg1=u_dYV@BWBU z`trTZtYS76Vv-vkL)d6vOGp$`EY|EOsF=Jj!MIX z;Ar?~zyZKb$OjJagE)6A7A+8t4+{<6@i+I?^6GX~b+ohLG0!k!*R@u+Q#vQJBntBD zaaN!8IO*TJyve&7A4EQi#l^DnFXmDNgHwEF(Ca3wSjzt^a4C2 zP7;;DesG0!iQ-KA5TzNblkg_lB;6+aQ@(zQNTo$xRMYtmroR1Q!70xL`YQAGUw_sZ zaI8JthC=^HWXsj7WN2Q|-!pczMA{iR7rP&M&-*`3TY3C z4BYn_q*@DBA`iN2Ag^rG< zYjt*&sFI5O3)#5ztYqH=|JanM%d~$ftmJh_=i5Xs@C*2a)JA?yrO+i~Hse&1a#O!# zHs;zFah40$AQ~oHKX>07d_0~uyYb6&vv5!QgnU+z^Co|zD3gq|lDPVe&I_XjGf5i; z$23=FFCpJ9fBj(luwO_!v@*63*Ncw?R)Ky10G{A&a9=V1qQsFdp-Mq?crz^4L)+!1 z{Y@)f(;@>-ZCy2O1s17#;mf@2>|f5DJIdODub(VdPA87W_YZa&v^4+xRux~mUGO<4 zBBLwjrx_0Cj9_SKqD{(@>6+aSE>&^BlQ);%z)6C`OM9w=5>wT$RjSM+w7CP>LNF!J}A6V!)vn`J~GX>O0~zkba<@8D&QtT z{-H9+r>NH$Ron%emFAfRT56yUu{?bV} zm#6q$8ZFAlpT*&DcJLV3W8F;ubz|0j+;#9;_s>?B2Cf>`a@V5%+~myORL>-Zc%PUF zdK*=i(oI@}NEiSng9uUt`Is_EQ;%+o?M~22nM$9{HY?~aDXE;SGi&ba_}2G!gfi8+ zAhq^zd*+W1V+E@s&tsu7i8;Atm1fPy`bWkNmY#OP&R^V{yi@&51Mh~oBf7$u&}rCH z+z$RR5D#F0VtfkD2#Y`~guf2^5^Ng)`qI4o-KretZJNz*ouAc}*DzI9mfaQ05P)$l zGDnam6wuSSQb>b!G|Y(~9p_yr>;(#I(!zvJHz&I?lgY`L*SBP=Bhy z62rA6;3|GY_Kos&4MV-E^WqjpwtP;}Zfjn%zHb7?g4@C_hSSiuv5UA3JPGIn(gA5e z1>Xeusrm45#Iq2az)Yy?ee2HbY+`rLa@aUfpQ>4^k}CI9!c1t0`!4GV!-qd|+ZC(V z7R;t(Ms)hH9i2^=>)b2RB`x{avu~%DCgT#Yv6WE~5DR6v z>Q$kDGlrVFD?8?BquHKf=dj4vjGPlCsoVbkc z6sJVxIPd6r+5kn1ybN-IKZtLLbHq5XhZIT)pv6apLw;&3IV!yJ}@ zA{o%q*bba5z(#mOh$X-YRH$YhVfipk;o=CPko17xzO!C0-9{WYZA#32&!_4Rs1GXT z%G?m+6Nu+jW==ghx1YP|zWjT(dOUitxO<}&*T7x#yG*|5W3GQDDzzo?Ra|tm6n&p! zNFD-biGD;q;!UD7s6$F3zo6F9FUR2GYm@G!-On1#yIG8`cvHLC7}<{P#SFikY?@bH z1%LDZ0U3l@LGEKgv_zy_xk@&qbYYXbmXUT3oVh$gU~u?;pi8I`vK_UDX~pRP`h*t3 zAHq+90znE$#SLKSC{`p-Xjvc+oEKK8zqIH!c1~P?Vd@BF6Cf zK>T;?iu*kC1d#IpF(E+_HCOUK-&J5eu?55aY!8$dBFF%ZI4N4_us9#V8ycb6G;CFGh*Rz^32{a&TrK^(U36g@sxjd$9wT$+MP1}gIvx{X@)R7;3 zjUCd>`E`#fKbFkq|DAm^JuTTK!7TP=lnKq5QV9`cg7}azMKjZ5DSq zaT#LBcFvu`^JNy*|J9#uE$E^R#EtdNNdJ1Yv9^mno@5H(sNs_l#Yn$ae0vV3!)^4` ztkgQ!f#BNZx#CmkuNLeWc8o-!{jtBHo3#nR2wsF4fEO5qYVUb;Cz2;@HRz6iyw7t_ z5!WyWjJ3R3njxc((m8p>eW@IgP`)Mh2TX@YFL%W^Dwgiec#Js@T<9uov93R@Ixe*@ zY|BZ_=t&7m)QP(oeL~x%z{rB6^I!w9oG1oPf$U@&^wEgv47 z6kE8sI{4e=Pd$S*Yc{u-5J7@2m!}e|iPQgW>}iRyvv6*3=Ybvh(E=wz+7JP#e=u&i zG<*tRLAXZHBzys$;e~P57&g=m#DfsEz$bqHcpJHsohodJ7M8{_dZQZi$}O^=#LWbI zxsWW=r-Xyet+y*i^T!htLmNGc?cW;pYK1Edis^ZNS%GPJNvQZ+F@y93YA+ceVZchL zVwDnoKz~vp`9Fvub}>5f5lNzH0$F}}OGVY?V>PCY&21lho(z#DI_8vD-fo@lKR(@O zzQ#2upe=q?_Ow68D67c&My$jPZZ8wyRe! zEvQa$kFfRGbdZ}2>o_XKOCs{6vPIHEl27CJVtk@FX$q7C(pzwV_=%WE)B`0*H_0kg zdwO*=DQ+MUlj@oIESIIIr);WPuc5g0Zg<$=&GD$&&0qeT^?SA_6=#h&`r(CIu~n=M+1t4n*;)+5O$yh$BR8iy+js; zz6d&jEBUN>JakF7PqGR%9WzkSwo}tlV3Nug_T!yl!=G6>yuQP{9={kqZ8oakAJ&=K zZ2t316X6{!rIc>DvtW+Ev8)}14?7wGo+=X^-H@;M>wWQb}zmhk$tIiikj#6p=pS@*<