Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hooks: add missing Qt plugins and translations #2390

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 33 additions & 13 deletions cx_Freeze/hooks/_qthooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ def load_qt_phonon(finder: ModuleFinder, module: Module) -> None:
copy_qt_files(finder, name, "PluginsPath", "phonon_backend")


def load_qt_qt3dinput(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "3dinputdevices")


def load_qt_qt3drender(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "sceneparsers")
copy_qt_files(finder, name, "PluginsPath", "geometryloaders")
copy_qt_files(finder, name, "PluginsPath", "renderplugins")
copy_qt_files(finder, name, "PluginsPath", "renderers")


def load_qt_qtbluetooth(finder: ModuleFinder, module: Module) -> None:
"""Include translations for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "TranslationsPath", "qtconnectivity_*.qm")


def load_qt_qtdesigner(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
Expand Down Expand Up @@ -223,18 +244,6 @@ def load_qt_qtnetwork(finder: ModuleFinder, module: Module) -> None:
copy_qt_files(finder, name, "PluginsPath", "bearer") # ?


def load_qt_qtopengl(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "renderers")


def load_qt_qtopenglwidgets(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "renderers")


def load_qt_qtpositioning(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
Expand All @@ -259,7 +268,6 @@ def load_qt_qtquick(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "scenegraph")
copy_qt_files(finder, name, "PluginsPath", "sceneparsers") # pyqt6


def load_qt_qtquick3d(finder: ModuleFinder, module: Module) -> None:
Expand Down Expand Up @@ -305,6 +313,18 @@ def load_qt_qtsql(finder: ModuleFinder, module: Module) -> None:
copy_qt_files(finder, name, "PluginsPath", "sqldrivers")


def load_qt_qttexttospeech(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "texttospeech")


def load_qt_qtvirtualkeyboard(finder: ModuleFinder, module: Module) -> None:
"""Include plugins for the module."""
name = _qt_implementation(module)
copy_qt_files(finder, name, "PluginsPath", "virtualkeyboard")


def load_qt_qtwebenginecore(finder: ModuleFinder, module: Module) -> None:
"""Include module dependency and QtWebEngineProcess files."""
name = _qt_implementation(module)
Expand Down
3 changes: 0 additions & 3 deletions cx_Freeze/hooks/pyqt5/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
load_qt_qtmultimedia as load_pyqt5_qtmultimedia,
)
from cx_Freeze.hooks._qthooks import load_qt_qtnetwork as load_pyqt5_qtnetwork
from cx_Freeze.hooks._qthooks import load_qt_qtopengl as load_pyqt5_qtopengl
from cx_Freeze.hooks._qthooks import (
load_qt_qtpositioning as load_pyqt5_qtpositioning,
)
Expand Down Expand Up @@ -122,12 +121,10 @@ def load_pyqt5_qtwebenginecore(finder: ModuleFinder, module: Module) -> None:
"load_pyqt5_qtgui",
"load_pyqt5_qtmultimedia",
"load_pyqt5_qtnetwork",
"load_pyqt5_qtopengl",
"load_pyqt5_qtpositioning",
"load_pyqt5_qtprintsupport",
"load_pyqt5_qtqml",
"load_pyqt5_qtsql",
"load_pyqt5_qtsvg",
"load_pyqt5_qtwebenginecore",
"load_pyqt5_qtwebenginewidgets",
"load_pyqt5_qtwidgets",
Expand Down
25 changes: 18 additions & 7 deletions cx_Freeze/hooks/pyqt6/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
from cx_Freeze._compat import IS_CONDA, IS_MACOS, IS_MINGW
from cx_Freeze.common import get_resource_file_path
from cx_Freeze.hooks._qthooks import copy_qt_files
from cx_Freeze.hooks._qthooks import load_qt_qt3dinput as load_pyqt6_qt3dinput
from cx_Freeze.hooks._qthooks import (
load_qt_qt3drender as load_pyqt6_qt3drender,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtbluetooth as load_pyqt6_qtbluetooth,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtdesigner as load_pyqt6_qtdesigner,
)
Expand All @@ -22,10 +29,6 @@
load_qt_qtmultimedia as load_pyqt6_qtmultimedia,
)
from cx_Freeze.hooks._qthooks import load_qt_qtnetwork as load_pyqt6_qtnetwork
from cx_Freeze.hooks._qthooks import load_qt_qtopengl as load_pyqt6_qtopengl
from cx_Freeze.hooks._qthooks import (
load_qt_qtopenglwidgets as load_pyqt6_qtopenglwidgets,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtpositioning as load_pyqt6_qtpositioning,
)
Expand All @@ -43,6 +46,12 @@
load_qt_qtserialport as load_pyqt6_qtserialport,
)
from cx_Freeze.hooks._qthooks import load_qt_qtsql as load_pyqt6_qtsql
from cx_Freeze.hooks._qthooks import (
load_qt_qttexttospeech as load_pyqt6_qttexttospeech,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtvirtualkeyboard as load_pyqt6_qtvirtualkeyboard,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtwebenginecore as load_pyqt6_qtwebenginecore,
)
Expand Down Expand Up @@ -130,13 +139,14 @@ def load_pyqt6_qtwidgets(finder: ModuleFinder, module: Module) -> None:

__all__ = [
"load_pyqt6",
"load_pyqt6_qt3dinput",
"load_pyqt6_qt3drender",
"load_pyqt6_qtbluetooth",
"load_pyqt6_qtdesigner",
"load_pyqt6_qtgui",
"load_pyqt6_qtlocation",
"load_pyqt6_qtmultimedia",
"load_pyqt6_qtnetwork",
"load_pyqt6_qtopengl",
"load_pyqt6_qtopenglwidgets",
"load_pyqt6_qtpositioning",
"load_pyqt6_qtprintsupport",
"load_pyqt6_qtquick",
Expand All @@ -146,7 +156,8 @@ def load_pyqt6_qtwidgets(finder: ModuleFinder, module: Module) -> None:
"load_pyqt6_qtserialport",
"load_pyqt6_qtqml",
"load_pyqt6_qtsql",
"load_pyqt6_qtsvg",
"load_pyqt6_qttexttospeech",
"load_pyqt6_qtvirtualkeyboard",
"load_pyqt6_qtwebenginecore",
"load_pyqt6_qtwebenginewidgets",
"load_pyqt6_qtwebsockets",
Expand Down
3 changes: 0 additions & 3 deletions cx_Freeze/hooks/pyside2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from cx_Freeze.hooks._qthooks import (
load_qt_qtnetwork as load_pyside2_qtnetwork,
)
from cx_Freeze.hooks._qthooks import load_qt_qtopengl as load_pyside2_qtopengl
from cx_Freeze.hooks._qthooks import (
load_qt_qtpositioning as load_pyside2_qtpositioning,
)
Expand Down Expand Up @@ -143,13 +142,11 @@ def load_pyside2_qtwebenginecore(finder: ModuleFinder, module: Module) -> None:
"load_pyside2_qtgui",
"load_pyside2_qtmultimedia",
"load_pyside2_qtnetwork",
"load_pyside2_qtopengl",
"load_pyside2_qtpositioning",
"load_pyside2_qtprintsupport",
"load_pyside2_qtqml",
"load_pyside2_qtscript",
"load_pyside2_qtsql",
"load_pyside2_qtsvg",
"load_pyside2_qtwebenginecore",
"load_pyside2_qtwebenginewidgets",
"load_pyside2_qtwidgets",
Expand Down
32 changes: 23 additions & 9 deletions cx_Freeze/hooks/pyside6/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
code_object_replace_function,
get_resource_file_path,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qt3dinput as load_pyside6_qt3dinput,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qt3drender as load_pyside6_qt3drender,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtbluetooth as load_pyside6_qtbluetooth,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtdesigner as load_pyside6_qtdesigner,
)
Expand All @@ -25,10 +34,6 @@
from cx_Freeze.hooks._qthooks import (
load_qt_qtnetwork as load_pyside6_qtnetwork,
)
from cx_Freeze.hooks._qthooks import load_qt_qtopengl as load_pyside6_qtopengl
from cx_Freeze.hooks._qthooks import (
load_qt_qtopenglwidgets as load_pyside6_qtopenglwidgets,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtpositioning as load_pyside6_qtpositioning,
)
Expand All @@ -48,6 +53,12 @@
load_qt_qtserialport as load_pyside6_qtserialport,
)
from cx_Freeze.hooks._qthooks import load_qt_qtsql as load_pyside6_qtsql
from cx_Freeze.hooks._qthooks import (
load_qt_qttexttospeech as load_pyside6_qttexttospeech,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtvirtualkeyboard as load_pyside6_qtvirtualkeyboard,
)
from cx_Freeze.hooks._qthooks import (
load_qt_qtwebenginecore as load_pyside6_qtwebenginecore,
)
Expand Down Expand Up @@ -132,20 +143,22 @@ def {name}(package_dir):
return []
"""
code = code_object_replace_function(code, name, source)
finder.include_module("inspect") # for shiboken6

module.code = code

# extra modules
finder.include_module("inspect") # for shiboken6


__all__ = [
"load_pyside6",
"load_pyside6_qt3dinput",
"load_pyside6_qt3drender",
"load_pyside6_qtbluetooth",
"load_pyside6_qtdesigner",
"load_pyside6_qtgui",
"load_pyside6_qtlocation",
"load_pyside6_qtmultimedia",
"load_pyside6_qtnetwork",
"load_pyside6_qtopengl",
"load_pyside6_qtopenglwidgets",
"load_pyside6_qtpositioning",
"load_pyside6_qtprintsupport",
"load_pyside6_qtquick",
Expand All @@ -155,7 +168,8 @@ def {name}(package_dir):
"load_pyside6_qtserialport",
"load_pyside6_qtqml",
"load_pyside6_qtsql",
"load_pyside6_qtsvg",
"load_pyside6_qttexttospeech",
"load_pyside6_qtvirtualkeyboard",
"load_pyside6_qtwebenginecore",
"load_pyside6_qtwebenginewidgets",
"load_pyside6_qtwebsockets",
Expand Down