PKGBUILDs/extra/freecad/pyside6.patch

96 lines
4.3 KiB
Diff
Raw Normal View History

2024-04-05 18:14:43 +00:00
diff --git a/src/Mod/AddonManager/package_details.py b/src/Mod/AddonManager/package_details.py
index c9d1ae311a..9c0e040ea5 100644
--- a/src/Mod/AddonManager/package_details.py
+++ b/src/Mod/AddonManager/package_details.py
@@ -26,7 +26,7 @@
import os
from typing import Optional
-from PySide import QtCore, QtGui, QtWidgets
+from PySide6 import QtCore, QtGui, QtWidgets
import addonmanager_freecad_interface as fci
@@ -51,14 +51,14 @@ translate = fci.translate
show_javascript_console_output = False
try:
- from PySide import QtWebEngineWidgets
+ from PySide6 import QtWebEngineCore, QtWebEngineWidgets
HAS_QTWEBENGINE = True
except ImportError:
fci.Console.PrintWarning(
translate(
"AddonsInstaller",
- "Addon Manager Warning: Could not import QtWebEngineWidgets -- README data will display as text-only",
+ "Addon Manager Warning: Could not import QtWebEngineCore -- README data will display as text-only",
)
+ "\n"
)
@@ -715,14 +714,14 @@ class PackageDetails(QtWidgets.QWidget):
if HAS_QTWEBENGINE:
- class RestrictedWebPage(QtWebEngineWidgets.QWebEnginePage):
+ class RestrictedWebPage(QtWebEngineCore.QWebEnginePage):
"""A class that follows links to FreeCAD wiki pages, but opens all other
clicked links in the system web browser"""
def __init__(self, parent):
super().__init__(parent)
self.settings().setAttribute(
- QtWebEngineWidgets.QWebEngineSettings.ErrorPageEnabled, False
+ QtWebEngineCore.QWebEngineSettings.ErrorPageEnabled, False
)
self.stored_url = None
@@ -731,7 +730,7 @@ if HAS_QTWEBENGINE:
navigation requests to the FreeCAD Wiki (for translation purposes) --
anything else will open in a new window.
"""
- if _type == QtWebEngineWidgets.QWebEnginePage.NavigationTypeLinkClicked:
+ if _type == QtWebEngineCore.QWebEnginePage.NavigationTypeLinkClicked:
# See if the link is to a FreeCAD Wiki page -- if so, follow it,
# otherwise ask the OS to open it
if (
@@ -754,11 +753,11 @@ if HAS_QTWEBENGINE:
global show_javascript_console_output
if show_javascript_console_output:
tag = translate("AddonsInstaller", "Page JavaScript reported")
- if level == QtWebEngineWidgets.QWebEnginePage.InfoMessageLevel:
+ if level == QtWebEngineCore.QWebEnginePage.InfoMessageLevel:
fci.Console.PrintMessage(f"{tag} {lineNumber}: {message}\n")
- elif level == QtWebEngineWidgets.QWebEnginePage.WarningMessageLevel:
+ elif level == QtWebEngineCore.QWebEnginePage.WarningMessageLevel:
fci.Console.PrintWarning(f"{tag} {lineNumber}: {message}\n")
- elif level == QtWebEngineWidgets.QWebEnginePage.ErrorMessageLevel:
+ elif level == QtWebEngineCore.QWebEnginePage.ErrorMessageLevel:
fci.Console.PrintError(f"{tag} {lineNumber}: {message}\n")
def _reload_stored_url(self):
diff --git a/src/Mod/AddonManager/AddonManager.py b/src/Mod/AddonManager/AddonManager.py
index cb8bb63d8a..7445173537 100644
--- a/src/Mod/AddonManager/AddonManager.py
+++ b/src/Mod/AddonManager/AddonManager.py
@@ -427,15 +427,15 @@ class CommandAddonManager:
"You must restart FreeCAD for changes to take effect.",
)
)
- m.setIcon(m.Warning)
- m.setStandardButtons(m.Ok | m.Cancel)
- m.setDefaultButton(m.Cancel)
+ m.setIcon(m.Icon.Warning)
+ m.setStandardButtons(m.StandardButton.Ok | m.StandardButton.Cancel)
+ m.setDefaultButton(m.StandardButton.Cancel)
okBtn = m.button(QtWidgets.QMessageBox.StandardButton.Ok)
cancelBtn = m.button(QtWidgets.QMessageBox.StandardButton.Cancel)
okBtn.setText(translate("AddonsInstaller", "Restart now"))
cancelBtn.setText(translate("AddonsInstaller", "Restart later"))
ret = m.exec_()
- if ret == m.Ok:
+ if ret == m.StandardButton.Ok:
# restart FreeCAD after a delay to give time to this dialog to close
QtCore.QTimer.singleShot(1000, utils.restart_freecad)