From 8edb649d972640a7161e1bcbb239c20cdd8ca8b4 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 22 Dec 2024 17:44:13 -0600 Subject: [PATCH] Addon Manager: Add fallbacks for PySide to WidgetFilterSelector Ensure that this part of the Addon Manager can be tested outside FreeCAD by falling back to explicit PySide imports. --- .../Widgets/addonmanager_widget_filter_selector.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py index 5b6c1e3913db..a8fb528dc4ab 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py @@ -38,18 +38,12 @@ def translate(_: str, text: str): # Get whatever version of PySide we can try: - import PySide # Use the FreeCAD wrapper + from PySide import QtCore, QtWidgets # Use the FreeCAD wrapper except ImportError: try: - import PySide6 # Outside FreeCAD, try Qt6 first - - PySide = PySide6 + from PySide6 import QtCore, QtWidgets # Outside FreeCAD, try Qt6 first except ImportError: - import PySide2 # Fall back to Qt5 (if this fails, Python will kill this module's import) - - PySide = PySide2 - -from PySide import QtCore, QtWidgets + from PySide2 import QtCore, QtWidgets # Fall back to Qt5 class FilterType(IntEnum):