1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-02-09 06:11:38 +00:00

Next batch of qt6 upgrades

This commit is contained in:
2022-07-08 22:17:42 -05:00
parent 4d56bd3515
commit ec35c2df8f
9 changed files with 94 additions and 65 deletions

View File

@@ -44,8 +44,8 @@ def special_folder_path(special_folder: SpecialFolder, portable: bool = False) -
try:
from PyQt5.QtCore import QUrl, QStandardPaths
from PyQt5.QtGui import QDesktopServices
from PyQt6.QtCore import QUrl, QStandardPaths
from PyQt6.QtGui import QDesktopServices
from qt.util import get_appdata
from core.util import executable_folder
from hscommon.plat import ISWINDOWS, ISOSX
@@ -71,7 +71,7 @@ try:
if ISWINDOWS and portable:
folder = op.join(executable_folder(), "cache")
else:
folder = QStandardPaths.standardLocations(QStandardPaths.CacheLocation)[0]
folder = QStandardPaths.standardLocations(QStandardPaths.StandardLocation.CacheLocation)[0]
else:
folder = get_appdata(portable)
return folder

View File

@@ -82,7 +82,7 @@ def get_locale_name(lang: str) -> Union[str, None]:
# --- Qt
def install_qt_trans(lang: str = None) -> None:
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale
from PyQt6.QtCore import QCoreApplication, QTranslator, QLocale
if not lang:
lang = str(QLocale.system().name())[:2]
@@ -139,7 +139,7 @@ def install_gettext_trans_under_qt(base_folder: os.PathLike, lang: str = None) -
# So, we install the gettext locale, great, but we also should try to install qt_*.qm if
# available so that strings that are inside Qt itself over which I have no control are in the
# right language.
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
from PyQt6.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
if not lang:
lang = str(QLocale.system().name())[:2]
@@ -155,7 +155,7 @@ def install_gettext_trans_under_qt(base_folder: os.PathLike, lang: str = None) -
if ISLINUX:
# Under linux, a full Qt installation is already available in the system, we didn't bundle
# up the qm files in our package, so we have to load translations from the system.
qmpath = op.join(QLibraryInfo.location(QLibraryInfo.TranslationsPath), qmname)
qmpath = op.join(QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath), qmname)
else:
qmpath = op.join(base_folder, qmname)
qtr = QTranslator(QCoreApplication.instance())