diff options
Diffstat (limited to 'sources/pyside2')
-rw-r--r-- | sources/pyside2/doc/gettingstarted.rst | 58 | ||||
-rw-r--r-- | sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py | 39 |
2 files changed, 86 insertions, 11 deletions
diff --git a/sources/pyside2/doc/gettingstarted.rst b/sources/pyside2/doc/gettingstarted.rst index d7a138b20..dbe22a806 100644 --- a/sources/pyside2/doc/gettingstarted.rst +++ b/sources/pyside2/doc/gettingstarted.rst @@ -28,9 +28,9 @@ Guides per platform You can refer to the following pages for platform specific instructions: - * `Windows`_, - * `macOS`_, - * `Linux`_, + * `Windows`_ + * `macOS`_ + * `Linux`_ * Mobile platforms (iOS/Android) **(no support)** * Embedded platforms **(no official support)** @@ -92,12 +92,12 @@ Building the documentation The documentation is being generated using **qdoc** to get the API information, and also **sphinx** for the local Python related notes. -The system required ``libxml2`` and `libxslt``, also on the Python environment, ``sphinx`` and +The system required ``libxml2`` and ``libxslt``, also on the Python environment, ``sphinx`` and ``graphviz`` need to be installed before running the installation process:: pip install graphviz sphinx -After installing ``graphviz`, the ``dot`` command needs to be in PATH, otherwise, +After installing ``graphviz``, the ``dot`` command needs to be in PATH, otherwise, the process will fail. Installing ``graphviz`` system-wide is also an option. Since the process rely on a Qt installation, you need to specify where the ``qtbase`` directory @@ -111,3 +111,51 @@ directory, and run:: make apidoc Finally, you will get a ``html`` directory containing all the generated documentation. + +Using the internal tools +------------------------ + +A set of tools can be found under the ``tools/`` directory inside the ``pyside-setup`` repository. + +* ``checklibs.py``: Script to analyze dynamic library dependencies of Mach-O binaries. + To use this utility, just run:: + + python checklibs.py /path/to/some.app/Contents/MacOS/Some + + This script was fetched from this repository_. + +* ``create_changelog.py``: Script used to create the CHANGELOG that you can find in the ``dist/`` + directory. Usage:: + + python create_changelog.py -r 5.14.1 -v v5.14.0..5.14 -t bug-fix + +* ``debug_windows.py``: This script can be used to find out why PySide2 modules + fail to load with various DLL errors like Missing DLL or Missing symbol in DLL. + + You can think of it as a Windows version of ``ldd`` / ``LD_DEBUG``. + + Underneath it uses the ``cdb.exe`` command line debugger, and the ``gflags.exe`` tool, both + installed with the latest Windows Kit. + + The aim is to ask users to run this script when they encounter PySide2 imports not working on + Windows. The user should then provide the generated log file. + + Incidentally it can also be used for any Windows executables, not just Python. + To use it just run:: + + python debug_windows.py + +* ``missing_bindings.py``: This script is used to compare the state of PySide2 and PyQt5 + regarding available modules and classses. This content is displayed in our `wiki page`_, + and can be used as follows:: + + python missing_bindings.py --qt-version 5.14.1 -w all + + Please keep in mind we rely on BeautifulSoup_ to parse the content, so you will be to install + it besides PySide2 and PyQt5 (Including additional modules like DataVisualiztion, QtCharts, + WebEngine, etc). + + +.. _repository: https://github.com/liyanage/macosx-shell-scripts/ +.. _`wiki page`: https://wiki.qt.io/Qt_for_Python_Missing_Bindings +.. _BeautifulSoup: https://www.crummy.com/software/BeautifulSoup/ diff --git a/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py b/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py index 1117b553e..7fc879fa9 100644 --- a/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py +++ b/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py @@ -34,10 +34,12 @@ import unittest sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "util")) -from PySide2.QtCore import QBuffer, QTimer -from PySide2.QtWidgets import QApplication +from PySide2.QtCore import QBuffer, Qt, QTimer +from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout +from PySide2.QtWebEngine import QtWebEngine from PySide2.QtWebEngineWidgets import QWebEngineView, QWebEngineProfile -from PySide2.QtWebEngineCore import QWebEngineUrlSchemeHandler +from PySide2.QtWebEngineCore import (QWebEngineUrlScheme, + QWebEngineUrlSchemeHandler) import py3kcompat as py3k class TestSchemeHandler(QWebEngineUrlSchemeHandler): @@ -51,19 +53,44 @@ class TestSchemeHandler(QWebEngineUrlSchemeHandler): self.buffer.aboutToClose.connect(self.buffer.deleteLater) request.reply(py3k.b("text/plain;charset=utf-8"), self.buffer) + class MainTest(unittest.TestCase): def test_SchemeHandlerRedirect(self): + self._loaded = False + QApplication.setAttribute(Qt.AA_ShareOpenGLContexts); + QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + QtWebEngine.initialize() app = QApplication([]) + + scheme_name = py3k.b("testpy") + scheme = QWebEngineUrlScheme(scheme_name) + scheme.setSyntax(QWebEngineUrlScheme.Syntax.Path) + QWebEngineUrlScheme.registerScheme(scheme) handler = TestSchemeHandler() profile = QWebEngineProfile.defaultProfile() - profile.installUrlSchemeHandler(py3k.b("testpy"), handler) + profile.installUrlSchemeHandler(scheme_name, handler) + + top_level_widget = QWidget() + top_level_widget.setWindowTitle('web_engine_custom_scheme.py') + top_level_widget.resize(400, 400) + layout = QVBoxLayout(top_level_widget) view = QWebEngineView() - view.loadFinished.connect(app.quit) + layout.addWidget(view) + + view.loadFinished.connect(self._slot_loaded) QTimer.singleShot(5000, app.quit) - view.show() + + top_level_widget.show() view.load("testpy:hello") app.exec_() + + self.assertTrue(self._loaded) self.assertEqual(view.url(), "testpy:goodbye") + def _slot_loaded(self): + self._loaded = True + QApplication.quit() + + if __name__ == '__main__': unittest.main() |