From 415cd3c8f89359308e05c5f15fde67af61d591a7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 May 2020 08:28:31 +0200 Subject: Tabbedbrowser example: Fix downloads Fix names broken by 90c1c767095e583d0315e87c0592597020858246. Task-number: PYSIDE-1311 Change-Id: I4533209dfe47b07138fd797eb2f67321ba3b83a5 Reviewed-by: Cristian Maureira-Fredes --- examples/webenginewidgets/tabbedbrowser/browsertabwidget.py | 2 +- examples/webenginewidgets/tabbedbrowser/downloadwidget.py | 6 +++--- examples/webenginewidgets/tabbedbrowser/main.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py b/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py index 8b96b3ddd..093eed6bb 100644 --- a/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py +++ b/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py @@ -241,4 +241,4 @@ class BrowserTabWidget(QTabWidget): return -1 def _download_requested(self, item): - self.downloadRequested.emit(item) + self.download_requested.emit(item) diff --git a/examples/webenginewidgets/tabbedbrowser/downloadwidget.py b/examples/webenginewidgets/tabbedbrowser/downloadwidget.py index a118f6eec..73b8d116b 100644 --- a/examples/webenginewidgets/tabbedbrowser/downloadwidget.py +++ b/examples/webenginewidgets/tabbedbrowser/downloadwidget.py @@ -92,7 +92,7 @@ class DownloadWidget(QProgressBar): path = self._download_item.path() tool_tip = "{}\n{}".format(self._download_item.url().toString(), QDir.toNativeSeparators(path)) - total_bytes = self._download_item.total_bytes() + total_bytes = self._download_item.totalBytes() if total_bytes > 0: tool_tip += "\n{}K".format(total_bytes / 1024) state = self.state() @@ -118,11 +118,11 @@ class DownloadWidget(QProgressBar): def _launch(self): DownloadWidget.open_file(self._download_item.path()) - def mouse_double_click_event(self, event): + def mouseDoubleClickEvent(self, event): if self.state() == QWebEngineDownloadItem.DownloadCompleted: self._launch() - def context_menu_event(self, event): + def contextMenuEvent(self, event): state = self.state() context_menu = QMenu() launch_action = context_menu.addAction("Launch") diff --git a/examples/webenginewidgets/tabbedbrowser/main.py b/examples/webenginewidgets/tabbedbrowser/main.py index 8a75cd5e0..5bf1c72a9 100644 --- a/examples/webenginewidgets/tabbedbrowser/main.py +++ b/examples/webenginewidgets/tabbedbrowser/main.py @@ -359,9 +359,9 @@ class MainWindow(QMainWindow): del old_download item.accept() - download_widget = download_widget(item) - download_widget.removeRequested.connect(self._remove_download_requested, - Qt.QueuedConnection) + download_widget = DownloadWidget(item) + download_widget.remove_requested.connect(self._remove_download_requested, + Qt.QueuedConnection) self.statusBar().addWidget(download_widget) def _remove_download_requested(self): -- cgit v1.2.3 From c43ca25defb7ace120c9439336e4be9c7e3f8530 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 28 May 2020 08:11:06 +0200 Subject: Tabbedbrowser example: Fix download removal Fix class name broken by 90c1c767095e583d0315e87c0592597020858246. Task-number: PYSIDE-1311 Change-Id: Ib562a0ba3b4fc0a586ff642ddfad77075c4d9240 Reviewed-by: Christian Tismer --- examples/webenginewidgets/tabbedbrowser/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webenginewidgets/tabbedbrowser/main.py b/examples/webenginewidgets/tabbedbrowser/main.py index 5bf1c72a9..438dd5c9d 100644 --- a/examples/webenginewidgets/tabbedbrowser/main.py +++ b/examples/webenginewidgets/tabbedbrowser/main.py @@ -353,7 +353,7 @@ class MainWindow(QMainWindow): def _download_requested(self, item): # Remove old downloads before opening a new one for old_download in self.statusBar().children(): - if (type(old_download).__name__ == 'download_widget' and + if (type(old_download).__name__ == 'DownloadWidget' and old_download.state() != QWebEngineDownloadItem.DownloadInProgress): self.statusBar().removeWidget(old_download) del old_download -- cgit v1.2.3 From 88af089cb0419e1f1a27dc77e11f5513f9ddd8d0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Jun 2020 13:59:14 +0200 Subject: Potential fix for deploying with cx_freeze using zip_include_packages In __init.py__, check for a zip archive and do not add DLL paths relative to it. Amends d9cfec8e010b48036e5e879ccc99879538a4f7d2. Change-Id: I18320bd6a8f784f20287c4a5ed65e9229989031c Fixes: PYSIDE-1257 Reviewed-by: Cristian Maureira-Fredes --- sources/pyside2/PySide2/__init__.py.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in index 8013ac68a..f860c6ac9 100644 --- a/sources/pyside2/PySide2/__init__.py.in +++ b/sources/pyside2/PySide2/__init__.py.in @@ -12,6 +12,9 @@ __version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @B def _additional_dll_directories(package_dir): # Find shiboken2 relative to the package directory. root = os.path.dirname(package_dir) + # Check for a flat .zip as deployed by cx_free(PYSIDE-1257) + if root.endswith('.zip'): + return [] shiboken2 = os.path.join(root, 'shiboken2') if os.path.isdir(shiboken2): # Standard case, only shiboken2 is needed return [shiboken2] -- cgit v1.2.3 From 76d5ddebc281543294a330da3e56feea080581bb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 9 Jun 2020 10:52:48 +0200 Subject: Fix leaking reference in PySide2 property getter Remove Py_INCREF on result obtained from PyObject_CallObject() in getValue(PySideProperty*,*source). Change-Id: Ic070df29be0fd0eadcd37bc0210339205f957c8f Fixes: PYSIDE-1321 Reviewed-by: Christian Tismer --- sources/pyside2/libpyside/pyside.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index d22958398..e2b8708ce 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -328,7 +328,6 @@ PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *nam Py_DECREF(attr); if (!value) return 0; - Py_INCREF(value); attr = value; } -- cgit v1.2.3 From f2e63d3588c8422d84d9ff5480427a83d68083bb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Jun 2020 07:56:19 +0200 Subject: shiboken: Fix default-initialized function arguments Specifying {} causes it to be qualified, check this. Change-Id: Idd23c8a5af01cd7fbb63a2e5a01bb349c530fe54 Fixes: PYSIDE-1325 Reviewed-by: Christian Tismer --- sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 2 +- sources/shiboken2/tests/libsample/pen.cpp | 4 ++++ sources/shiboken2/tests/libsample/pen.h | 5 +++++ sources/shiboken2/tests/samplebinding/pen_test.py | 2 ++ sources/shiboken2/tests/samplebinding/typesystem_sample.xml | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index b7852c017..b6ab70d1f 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -589,7 +589,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction { QString value = arg->defaultValueExpression(); - if (value.isEmpty() + if (value.isEmpty() || value == QLatin1String("{}") || arg->hasModifiedDefaultValueExpression() || isPointer(arg->type())) { return value; diff --git a/sources/shiboken2/tests/libsample/pen.cpp b/sources/shiboken2/tests/libsample/pen.cpp index d30071f49..b08721f79 100644 --- a/sources/shiboken2/tests/libsample/pen.cpp +++ b/sources/shiboken2/tests/libsample/pen.cpp @@ -65,3 +65,7 @@ int Pen::ctorType() { return m_ctor; } + +void Pen::drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints) +{ +} diff --git a/sources/shiboken2/tests/libsample/pen.h b/sources/shiboken2/tests/libsample/pen.h index ca079198b..6b3bf9f1a 100644 --- a/sources/shiboken2/tests/libsample/pen.h +++ b/sources/shiboken2/tests/libsample/pen.h @@ -49,11 +49,16 @@ class LIBSAMPLE_API Pen public: enum { EmptyCtor, EnumCtor, ColorCtor, CopyCtor }; + enum RenderHints { None = 0, Antialiasing = 0x1, TextAntialiasing = 0x2 }; + Pen(); Pen(SampleNamespace::Option option); Pen(const Color& color); Pen(const Pen& pen); + // PYSIDE-1325, default initializer + void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {}); + int ctorType(); private: int m_ctor; diff --git a/sources/shiboken2/tests/samplebinding/pen_test.py b/sources/shiboken2/tests/samplebinding/pen_test.py index 408871bb3..89abf4d54 100644 --- a/sources/shiboken2/tests/samplebinding/pen_test.py +++ b/sources/shiboken2/tests/samplebinding/pen_test.py @@ -63,6 +63,8 @@ class TestPen(unittest.TestCase): def testPenWithIntConvertedToColor(self): pen = Pen(1) self.assertEqual(pen.ctorType(), Pen.ColorCtor) + pen.drawLine(0, 0, 5, 5) + if __name__ == '__main__': unittest.main() diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml index 30ad5def7..3aaecf247 100644 --- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml +++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml @@ -2310,6 +2310,7 @@ + -- cgit v1.2.3 From 67b971fea687b26e466a20fa01a830f9ac682c39 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Wed, 3 Jun 2020 11:46:35 +0200 Subject: Use pyside2-uic instead of uic for the loadUiType Since we deploy the pyside2-uic wrapper inside the bin/ directory of virtual environments, that takes care of using the 'uic' binary we ship with the wheels, which is located in site-packages/PySide2/. The current implementation of loadUiType, runs 'uic -g python' but for people without a Qt installation, it has no effect since 'uic' is neither in PATH, nor in the system. Using 'pyside2-uic' instead will solve this issue. Task-number: PYSIDE-1223 Change-Id: I2c801a16c9ff4faa5cf8711bd718a634f017e592 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/glue/qtuitools.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp index 668b512e4..d81f6205a 100644 --- a/sources/pyside2/PySide2/glue/qtuitools.cpp +++ b/sources/pyside2/PySide2/glue/qtuitools.cpp @@ -137,16 +137,19 @@ if (uiFileName.isEmpty()) { Py_RETURN_NONE; } -QString uicBin("uic"); -QStringList uicArgs = {"-g", "python", QString::fromUtf8(uiFileName)}; +// Use the 'pyside2-uic' wrapper instead of 'uic' +// This approach is better than rely on 'uic' since installing +// the wheels cover this case. +QString uicBin("pyside2-uic"); +QStringList uicArgs = {QString::fromUtf8(uiFileName)}; QProcess uicProcess; uicProcess.start(uicBin, uicArgs); if (!uicProcess.waitForFinished()) { - qCritical() << "Cannot run 'uic': " << uicProcess.errorString() << " - " + qCritical() << "Cannot run 'pyside2-uic': " << uicProcess.errorString() << " - " << "Exit status " << uicProcess.exitStatus() << " (" << uicProcess.exitCode() << ")\n" - << "Check if 'uic' is in PATH"; + << "Check if 'pyside2-uic' is in PATH"; Py_RETURN_NONE; } QByteArray uiFileContent = uicProcess.readAllStandardOutput(); -- cgit v1.2.3 From 4a4e44c6f8487f882d443ebfc05795cc75ba5e6e Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 16 Jun 2020 23:23:59 +0100 Subject: Use Q_OS_WIN instead of _WINDOWS for the path splitter _WINDOWS is MSVC specific Fixes passing --include-paths when using MinGW Change-Id: I041484eccf521869f4fb532edc55d2e1cf4063e4 Reviewed-by: Friedemann Kleint --- sources/shiboken2/generator/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp index 25daea99e..7c9ce4fb2 100644 --- a/sources/shiboken2/generator/main.cpp +++ b/sources/shiboken2/generator/main.cpp @@ -41,7 +41,7 @@ #include "headergenerator.h" #include "qtdocgenerator.h" -#ifdef _WINDOWS +#ifdef Q_OS_WIN static const QChar pathSplitter = QLatin1Char(';'); #else static const QChar pathSplitter = QLatin1Char(':'); -- cgit v1.2.3 From b7e8b5e4114c034a750433d661b20944ce8b303c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Thu, 25 Jun 2020 09:18:09 +0300 Subject: Update virtualenv to 20.0.25 Updating virtualenv version to 20.0.25 while previous started to fail. Also increasing the timeout value for output. Change-Id: I391c1c85d490b57cdbab41d5bfcba396384c1994 Reviewed-by: Friedemann Kleint --- coin/instructions/execute_test_instructions.yaml | 2 +- coin_build_instructions.py | 4 +++- coin_test_instructions.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml index 87abb476c..a00f5676e 100644 --- a/coin/instructions/execute_test_instructions.yaml +++ b/coin/instructions/execute_test_instructions.yaml @@ -30,7 +30,7 @@ instructions: - type: ExecuteCommand command: "c:\\users\\qt\\MSVC.bat python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" maxTimeInSeconds: 14400 - maxTimeBetweenOutput: 300 + maxTimeBetweenOutput: 500 enable_if: condition: property property: host.os diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 5c3033b04..5d11e9d52 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -47,6 +47,8 @@ from build_scripts.utils import get_ci_qmake_path import os import datetime import calendar +import site +import sys # Values must match COIN thrift CI_HOST_OS = option_value("os") @@ -110,7 +112,7 @@ def call_setup(python_ver, phase): if phase in ["BUILD"]: rmtree(_env, True) # Pinning the virtualenv before creating one - run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv") + run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv") run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv") # When the 'python_ver' variable is empty, we are using Python 2 # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue diff --git a/coin_test_instructions.py b/coin_test_instructions.py index c3752cb9f..79a788038 100644 --- a/coin_test_instructions.py +++ b/coin_test_instructions.py @@ -44,6 +44,8 @@ from build_scripts.utils import run_instruction from build_scripts.utils import rmtree from build_scripts.utils import get_ci_qmake_path import os +import site +import sys # Values must match COIN thrift CI_HOST_OS = option_value("os") @@ -65,7 +67,7 @@ def call_testrunner(python_ver, buildnro): _pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH) rmtree(_env, True) # Pinning the virtualenv before creating one - run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv") + run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv") run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv") # When the 'python_ver' variable is empty, we are using Python 2 # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue -- cgit v1.2.3 From 52f29458d7d6cb379d28d84021819516723d9169 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Jun 2020 09:53:06 +0200 Subject: pthreads: Try to abandon the GIL in case a thread was terminated When terminating a thread using QThread::terminate() via (pthread_cancel(), QThread::run() is aborted and the lock is released, but ~GilState() is still executed for some reason. Add a cancel handler to the thread which tells GilState to abandon the lock. Fixes: PYSIDE-1282 Change-Id: I70abd42b5a2afd49aaa8cc5e8be0a92ed63f49d3 Reviewed-by: Cristian Maureira-Fredes --- .../PySide2/QtCore/typesystem_core_common.xml | 8 ++++++- sources/pyside2/PySide2/glue/qtcore.cpp | 28 ++++++++++++++++++++++ sources/shiboken2/libshiboken/gilstate.cpp | 7 ++++++ sources/shiboken2/libshiboken/gilstate.h | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 26193a0aa..8294947ed 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -1460,9 +1460,15 @@ + - + + + + diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 111e324b9..41ee743e7 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1960,3 +1960,31 @@ PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first)); PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second)); return %out; // @snippet return-qpair + +// @snippet qthread_pthread_cleanup +#ifdef Q_OS_UNIX +# include +# include +static void qthread_pthread_cleanup(void *arg) +{ + // PYSIDE 1282: When terminating a thread using QThread::terminate() + // (pthread_cancel()), QThread::run() is aborted and the lock is released, + // but ~GilState() is still executed for some reason. Prevent it from + // releasing. + auto gil = reinterpret_cast(arg); + gil->abandon(); +} +#endif // Q_OS_UNIX +// @snippet qthread_pthread_cleanup + +// @snippet qthread_pthread_cleanup_install +#ifdef Q_OS_UNIX +pthread_cleanup_push(qthread_pthread_cleanup, &gil); +#endif +// @snippet qthread_pthread_cleanup_install + +// @snippet qthread_pthread_cleanup_uninstall +#ifdef Q_OS_UNIX +pthread_cleanup_pop(0); +#endif +// @snippet qthread_pthread_cleanup_uninstall diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp index a59c6f01e..76a4d0e61 100644 --- a/sources/shiboken2/libshiboken/gilstate.cpp +++ b/sources/shiboken2/libshiboken/gilstate.cpp @@ -63,5 +63,12 @@ void GilState::release() } } +// Abandon the lock: Only for special situations, like termination of a +// POSIX thread (PYSIDE 1282). +void GilState::abandon() +{ + m_locked = false; +} + } // namespace Shiboken diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h index d22f688ba..fbf39ead0 100644 --- a/sources/shiboken2/libshiboken/gilstate.h +++ b/sources/shiboken2/libshiboken/gilstate.h @@ -57,6 +57,7 @@ public: GilState(); ~GilState(); void release(); + void abandon(); private: PyGILState_STATE m_gstate; bool m_locked = false; -- cgit v1.2.3 From bdb6f68fd65537d6bd3f6e2e896a8471a81a9279 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jul 2020 10:45:58 +0200 Subject: Add changelog for 5.14.2.3 Change-Id: I8f748da4de7f17a1ab2a71c947e245d916ce17f9 Reviewed-by: Christian Tismer --- dist/changes-5.14.2.3 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 dist/changes-5.14.2.3 diff --git a/dist/changes-5.14.2.3 b/dist/changes-5.14.2.3 new file mode 100644 index 000000000..6f17bc4bd --- /dev/null +++ b/dist/changes-5.14.2.3 @@ -0,0 +1,35 @@ +Qt for Python 5.14.2.3 is a bug-fix release. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qtforpython/ + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* PySide2 * +**************************************************************************** + + - [PYSIDE-1223] pyside2-uic instead of uic is not used for loadUiType() + - [PYSIDE-1257] Deployment with cx_freeze using zip_include_packages has + been fixed + - [PYSIDE-1282] A crash using QThread.terminate() on pthreads has + been fixed + - [PYSIDE-1311] The downloads functionality of the Tabbedbrowser example + has been fixed + - [PYSIDE-1321] A leaking reference in the PySide2 property getter has + been fixed + +**************************************************************************** +* Shiboken2 * +**************************************************************************** + + - [PYSIDE-1325] Wrong generated code for default-initialized function + arguments ({}) has been fixed -- cgit v1.2.3