From c83eba212ac7e0ca4313e3067f5af172319019bf Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Tue, 28 May 2024 12:36:06 +0800 Subject: [PATCH] Make open asset directory optional in low PySide6 version Signed-off-by: Loren Eteval --- Furious/Window/XrayAssetViewerWindow.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Furious/Window/XrayAssetViewerWindow.py b/Furious/Window/XrayAssetViewerWindow.py index 048c93d5..8e4a1780 100644 --- a/Furious/Window/XrayAssetViewerWindow.py +++ b/Furious/Window/XrayAssetViewerWindow.py @@ -57,6 +57,21 @@ class XrayAssetViewerWindow(AppQMainWindow): self.xrayAssetViewerWidget = XrayAssetViewerQListWidget(parent=self) self.setCentralWidget(self.xrayAssetViewerWidget) + if versionToValue(PYSIDE6_VERSION) <= versionToValue('6.1.3'): + openAssetDirectoryActions = [None] + else: + # openUrl will crash on PySide6 6.1.3, probably a Qt bug + openAssetDirectoryActions = [ + AppQAction( + _('Open Asset Directory'), + callback=lambda: self.openAssetDirectory(), + shortcut=QtCore.QKeyCombination( + QtCore.Qt.KeyboardModifier.ControlModifier, + QtCore.Qt.Key.Key_O, + ), + ), + ] + self.fileMenu = AppQMenu( AppQAction( _('Refresh'), @@ -67,14 +82,7 @@ class XrayAssetViewerWindow(AppQMainWindow): ), ), AppQSeperator(), - AppQAction( - _('Open Asset Directory'), - callback=lambda: self.openAssetDirectory(), - shortcut=QtCore.QKeyCombination( - QtCore.Qt.KeyboardModifier.ControlModifier, - QtCore.Qt.Key.Key_O, - ), - ), + *openAssetDirectoryActions, AppQAction( _('Import From File...'), callback=lambda: self.appendNewItem(),