From 50db2f3b2ea800fdc3e197705c210ab7afcfb0de Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 20 Dec 2010 11:18:42 -0200 Subject: [PATCH 001/662] Fix bug#558 - "print attribute of a QWebFrame cannot be accessed normally" --- PySide/QtGui/typesystem_gui_common.xml | 2 ++ PySide/QtWebKit/typesystem_webkit.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index cf8f273..c27c4a0 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -4909,11 +4909,13 @@ + + diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index da709a4..d6fc9a7 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -53,6 +53,7 @@ + From a9424b314ef086262ec1cc4b62a733d0dd86aaf8 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 20 Dec 2010 13:47:41 -0200 Subject: [PATCH 002/662] Fix bug#481 - "mimeData() missing from QListWidget, QTreeWidget, QTableWidget" 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 | 3 --- 1 file changed, 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index c27c4a0..cc27c4b 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3032,7 +3032,6 @@ - @@ -3265,7 +3264,6 @@ - @@ -4126,7 +4124,6 @@ - From db35d78b27389be9794b620c95cd290bf98a93dc Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 20 Dec 2010 15:06:33 -0200 Subject: [PATCH 003/662] Fix bug#544 - "QtCore.QRect missing binding for method getCoords" Reviewer: Marcelo Lira Lauro Moura --- PySide/QtCore/typesystem_core.xml | 88 +++++++++++++++++++++++++++++-- tests/QtCore/qrect_test.py | 12 ++++- 2 files changed, 95 insertions(+), 5 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index a30e50e..507e55a 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -862,10 +862,48 @@ }; - + + + + + + + + + + + + + + + + + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + - + + + + + + + + + + + + + + + + + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + @@ -881,8 +919,50 @@ - - + + + + + + + + + + + + + + + + + + qreal a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + + + + + + + + + + + + + + + + + + qreal a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + diff --git a/tests/QtCore/qrect_test.py b/tests/QtCore/qrect_test.py index 3c5f5be..a6d38d9 100644 --- a/tests/QtCore/qrect_test.py +++ b/tests/QtCore/qrect_test.py @@ -3,7 +3,7 @@ import unittest -from PySide.QtCore import QPoint, QRect +from PySide.QtCore import QPoint, QRect, QRectF class RectConstructor(unittest.TestCase): @@ -97,6 +97,16 @@ class RectOperator(unittest.TestCase): rect3 = rect1 | rect2 self.assertEqual(rect3, rect1) + def testGetCoordsAndRect(self): + rect1 = QRect(1, 2, 3, 4) + self.assertEqual(rect1.getRect(), (1, 2, 3, 4)) + self.assertEqual(rect1.getCoords(), (1, 2, 3, 5)) + + rect1 = QRectF(1, 2, 3, 4) + self.assertEqual(rect1.getRect(), (1, 2, 3, 4)) + self.assertEqual(rect1.getCoords(), (1, 2, 4, 6)) + + if __name__ == '__main__': unittest.main() From c350f418c7fc9650a89f5a9be29e7987927bdd9a Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 20 Dec 2010 15:52:58 -0300 Subject: [PATCH 004/662] QObject.sender should not steal the returned object ownership to Python. --- 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 507e55a..76bcaeb 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1433,7 +1433,7 @@ - + From 05d011ccfa3ad442adb3639f9db87d49dd346299 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 20 Dec 2010 17:41:53 -0300 Subject: [PATCH 005/662] Fixed type system for TestView from pysidetest directory. --- tests/pysidetest/typesystem_pysidetest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pysidetest/typesystem_pysidetest.xml b/tests/pysidetest/typesystem_pysidetest.xml index afa764c..cf7774a 100644 --- a/tests/pysidetest/typesystem_pysidetest.xml +++ b/tests/pysidetest/typesystem_pysidetest.xml @@ -3,7 +3,7 @@ - + From 7771798cf27896c43054699c5f53468cd8bf14cf Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 17 Dec 2010 19:37:35 -0300 Subject: [PATCH 006/662] Fixes bug #502. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ownership of the editor returned by the Python override of QAbstractItemDelegate.createEditor(...) is now transferred to C++. A test was added to simulate the situation that triggers the bug, instead of relying on an example with a view, model and editable cells. See: http://bugs.openbossa.org/show_bug.cgi?id=502 Reviewed by Lauro Moura Reviewed by Renato Araújo --- PySide/QtGui/typesystem_gui_common.xml | 3 + tests/pysidetest/CMakeLists.txt | 9 ++- .../pysidetest/delegatecreateseditor_test.py | 55 +++++++++++++++++++ tests/pysidetest/testview.cpp | 20 +++++-- tests/pysidetest/testview.h | 10 +++- tests/pysidetest/typesystem_pysidetest.xml | 1 + 6 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 tests/pysidetest/delegatecreateseditor_test.py diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index cc27c4b..940f730 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3047,6 +3047,9 @@ + + + diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 7cf9e56..4a4c27a 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -32,8 +32,8 @@ set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-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}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${QT_QTCORE_INCLUDE_DIR} - --typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR} + --include-paths=${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${QT_QTCORE_INCLUDE_DIR}${PATH_SEP}${QT_QTGUI_INCLUDE_DIR} + --typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR} --output-directory=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -44,8 +44,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} + ${QT_QTGUI_INCLUDE_DIR} ${SHIBOKEN_INCLUDE_DIR} + ${pyside_SOURCE_DIR} ${QtCore_BINARY_DIR}/PySide/QtCore + ${QtGui_BINARY_DIR}/PySide/QtGui ${libpyside_SOURCE_DIR} ${PYTHON_INCLUDE_PATH}) @@ -63,12 +66,14 @@ target_link_libraries(testbinding ${PYTHON_LIBRARIES} ${SHIBOKEN_LIBRARY} ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} ${SBK_PYTHON_LIBRARIES}) add_dependencies(testbinding pyside QtCore libpyside pysidetest) PYSIDE_TEST(homonymoussignalandmethod_test.py) +PYSIDE_TEST(delegatecreateseditor_test.py) PYSIDE_TEST(modelview_test.py) PYSIDE_TEST(version_test.py) diff --git a/tests/pysidetest/delegatecreateseditor_test.py b/tests/pysidetest/delegatecreateseditor_test.py new file mode 100644 index 0000000..0054e79 --- /dev/null +++ b/tests/pysidetest/delegatecreateseditor_test.py @@ -0,0 +1,55 @@ +#!/usr/bin/python + +import unittest +from helper import UsesQApplication + +from testbinding import TestView +from PySide.QtCore import Qt +from PySide.QtGui import QAbstractItemDelegate, QComboBox + +id_text = 'This is me' + +class DelegateDoesntKeepReferenceToEditor(QAbstractItemDelegate): + def createEditor(self, parent, option, index): + comboBox = QComboBox(parent) + comboBox.addItem(id_text) + return comboBox + + +class DelegateKeepsReferenceToEditor(QAbstractItemDelegate): + def __init__(self, parent=None): + QAbstractItemDelegate.__init__(self, parent) + self.comboBox = QComboBox() + self.comboBox.addItem(id_text) + + def createEditor(self, parent, option, index): + self.comboBox.setParent(parent) + return self.comboBox + + +class EditorCreatedByDelegateTest(UsesQApplication): + + def testDelegateDoesntKeepReferenceToEditor(self): + view = TestView(None) + delegate = DelegateDoesntKeepReferenceToEditor() + view.setItemDelegate(delegate) + editor = view.getEditorWidgetFromItemDelegate() + self.assertEqual(type(editor), QComboBox) + self.assertEqual(editor.count(), 1) + self.assertEqual(editor.itemData(0, Qt.DisplayRole), id_text) + editor.metaObject() + + def testDelegateKeepsReferenceToEditor(self): + view = TestView(None) + delegate = DelegateKeepsReferenceToEditor() + view.setItemDelegate(delegate) + editor = view.getEditorWidgetFromItemDelegate() + self.assertEqual(type(editor), QComboBox) + self.assertEqual(editor.count(), 1) + self.assertEqual(editor.itemData(0, Qt.DisplayRole), id_text) + editor.metaObject() + + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/pysidetest/testview.cpp b/tests/pysidetest/testview.cpp index 22ef9dd..75620e0 100644 --- a/tests/pysidetest/testview.cpp +++ b/tests/pysidetest/testview.cpp @@ -1,12 +1,24 @@ #include "testview.h" -#include -#include + +#include +#include +#include QVariant TestView::getData() { QModelIndex index; - QVariant data = m_model->data(index); - return data; + return m_model->data(index); +} + +QWidget* +TestView::getEditorWidgetFromItemDelegate() const +{ + if (!m_delegate) + return 0; + + QModelIndex index; + QStyleOptionViewItem options; + return m_delegate->createEditor(0, options, index); } diff --git a/tests/pysidetest/testview.h b/tests/pysidetest/testview.h index 1a65ea4..76a6f00 100644 --- a/tests/pysidetest/testview.h +++ b/tests/pysidetest/testview.h @@ -2,12 +2,15 @@ #define TESTVIEW_H #include -#include #ifdef pysidetest_EXPORTS #define PYSIDE_EXPORTS 1 #endif #include "pysidemacros.h" +class QWidget; +class QAbstractListModel; +class QAbstractItemDelegate; + class PYSIDE_API TestView : public QObject { Q_OBJECT @@ -15,8 +18,13 @@ public: TestView(QAbstractListModel* model, QObject* parent = 0) : QObject(parent), m_model(model) {} QAbstractListModel* model() { return m_model; } QVariant getData(); + + void setItemDelegate(QAbstractItemDelegate* delegate) { m_delegate = delegate; } + QWidget* getEditorWidgetFromItemDelegate() const; + private: QAbstractListModel* m_model; + QAbstractItemDelegate* m_delegate; }; #endif // TESTVIEW_H diff --git a/tests/pysidetest/typesystem_pysidetest.xml b/tests/pysidetest/typesystem_pysidetest.xml index cf7774a..9cc4130 100644 --- a/tests/pysidetest/typesystem_pysidetest.xml +++ b/tests/pysidetest/typesystem_pysidetest.xml @@ -1,6 +1,7 @@ + From 3f0291dfe49cdf15325600aba362a0fc5662d19d Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 21 Dec 2010 12:17:56 -0300 Subject: [PATCH 007/662] Fixed global functions from QT_TR_NOOP and QT_TRANSLATE_NOOP family. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These function just return one of their arguments as result, and the buggy implementation was forgetting to increment the reference count for the returned object. A new unit test was added. Reviewed by Hugo Parente Reviewed by Renato Araújo --- PySide/QtCore/typesystem_core.xml | 30 ++++++++++++------- PySide/typesystem_templates.xml | 6 ++++ tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/tr_noop_test.py | 48 +++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 tests/QtCore/tr_noop_test.py diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 76bcaeb..e416e57 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2895,20 +2895,30 @@ - - (void)%1;%PYARG_0 = %PYARG_1; + + + + - - (void)%1;%PYARG_0 = %PYARG_1; + + + + - - (void)%1;(void)%2;%PYARG_0 = %PYARG_2; + + + + - - (void)%1;(void)%2;(void)%3;%PYARG_0 = %PYARG_2; + + + + - - (void)%1;%PYARG_0 = %PYARG_1; + + + + diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 9d39bb4..4604fda 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -238,5 +238,11 @@ return %CONVERTTOPYTHON[%TRANSPOSED_TYPE](%CPPSELF.transposed()); + + + 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 008/662] 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 009/662] 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 010/662] 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 011/662] 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 012/662] 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 013/662] 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 014/662] 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 015/662] 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 016/662] 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 017/662] 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 018/662] 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 019/662] 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 020/662] 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 021/662] 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 022/662] 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 023/662] 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 024/662] 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 025/662] 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 026/662] 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 027/662] 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 028/662] 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 029/662] 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 030/662] 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 031/662] 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 032/662] 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 033/662] 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 034/662] 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 035/662] 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 036/662] 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 037/662] 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 038/662] 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 039/662] 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 040/662] 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 041/662] 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 042/662] 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 043/662] 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 044/662] 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 045/662] 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 046/662] 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 047/662] 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 048/662] 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 049/662] 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 050/662] 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 051/662] 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 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 Ga_~P Date: Thu, 6 Jan 2011 18:45:44 -0300 Subject: [PATCH 052/662] 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 053/662] 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 054/662] 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 055/662] 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 056/662] 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 057/662] 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 058/662] 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 059/662] 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 060/662] 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 061/662] 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 062/662] 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 063/662] 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 064/662] 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 065/662] 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 066/662] 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 067/662] 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 068/662] 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 @@ +