PKGBUILDs/extra/freecad/pyside6.patch
2024-04-16 00:00:47 +00:00

121 lines
5.4 KiB
Diff

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)
diff --git a/src/Mod/Arch/importIFClegacy.py b/src/Mod/Arch/importIFClegacy.py
index 8935233f09..20c395ed9d 100644
--- a/src/Mod/Arch/importIFClegacy.py
+++ b/src/Mod/Arch/importIFClegacy.py
@@ -1800,7 +1800,7 @@ def explorer(filename,schema="IFC2X3_TC1.exp"):
tree.headerItem().setText(1, "")
tree.headerItem().setText(2, "Item and Properties")
bold = QtGui.QFont()
- bold.setWeight(75)
+ bold.setWeight(QtGui.QFont.Weight(75))
bold.setBold(True)
#print(ifc.Entities)
diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py
index b19101e9ca..b44425e012 100644
--- a/src/Mod/Draft/DraftGui.py
+++ b/src/Mod/Draft/DraftGui.py
@@ -406,7 +406,7 @@ class DraftToolBar:
self.promptlabel = self._label("promptlabel", self.layout, hide=task)
self.cmdlabel = self._label("cmdlabel", self.layout, hide=task)
boldtxt = QtGui.QFont()
- boldtxt.setWeight(75)
+ boldtxt.setWeight(QtGui.QFont.Weight(75))
boldtxt.setBold(True)
self.cmdlabel.setFont(boldtxt)