1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Now first tries to load PyQt6, and if it cannot be loaded, tries PyQt5

This commit is contained in:
Adolfo Gómez García 2023-05-24 02:53:12 +02:00
parent 5770d94c33
commit 99645044f0
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 5 additions and 3 deletions

View File

@ -38,7 +38,6 @@ import webbrowser
import threading import threading
import typing import typing
# First, try to use PyQt6, available on arm64, x86_64, i386, ...
from uds.ui import QtCore, QtWidgets, QtGui, QSettings, Ui_MainWindow from uds.ui import QtCore, QtWidgets, QtGui, QSettings, Ui_MainWindow
from uds.rest import RestApi, RetryException, InvalidVersion from uds.rest import RestApi, RetryException, InvalidVersion

View File

@ -31,12 +31,13 @@ Author: Adolfo Gómez, dkmaster at dkmon dot com
''' '''
# First, try to use PyQt6, available on arm64, x86_64, i386, ... # First, try to use PyQt6, available on arm64, x86_64, i386, ...
try: try:
from PyQt6 import QtCore, QtWidgets, QtGui from PyQt6 import QtCore, QtWidgets, QtGui # type: ignore
from PyQt6.QtCore import QSettings from PyQt6.QtCore import QSettings # type: ignore
from .qt6.UDSLauncherMac import Ui_MacLauncher from .qt6.UDSLauncherMac import Ui_MacLauncher
from .qt6.UDSWindow import Ui_MainWindow from .qt6.UDSWindow import Ui_MainWindow
from .qt6 import UDSResources_rc from .qt6 import UDSResources_rc
QT_VERSION = 6
except ImportError: # If not found, try to use PyQt5 (not available on arm64) except ImportError: # If not found, try to use PyQt5 (not available on arm64)
from PyQt5 import QtCore, QtWidgets, QtGui # type: ignore from PyQt5 import QtCore, QtWidgets, QtGui # type: ignore
@ -45,4 +46,6 @@ except ImportError: # If not found, try to use PyQt5 (not available on arm64)
from .qt5.UDSLauncherMac import Ui_MacLauncher # type: ignore from .qt5.UDSLauncherMac import Ui_MacLauncher # type: ignore
from .qt5.UDSWindow import Ui_MainWindow # type: ignore from .qt5.UDSWindow import Ui_MainWindow # type: ignore
from .qt5 import UDSResources_rc # type: ignore from .qt5 import UDSResources_rc # type: ignore
QT_VERSION = 5
__all__ = ['QtCore', 'QtWidgets', 'QtGui', 'Ui_MacLauncher', 'Ui_MainWindow', 'UDSResources_rc', 'QSettings', 'QT_VERSION']