mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
First Qt5 conversion commit
Replaced PyQt4 with PyQt5 and made all adjustments necessary to make dupeGuru start up.
This commit is contained in:
@@ -196,7 +196,7 @@ def copy_packages(packages_names, dest, create_links=False, extra_ignores=None):
|
||||
shutil.copy(source_path, dest_path)
|
||||
|
||||
def copy_qt_plugins(folder_names, dest): # This is only for Windows
|
||||
from PyQt4.QtCore import QLibraryInfo
|
||||
from PyQt5.QtCore import QLibraryInfo
|
||||
qt_plugin_dir = QLibraryInfo.location(QLibraryInfo.PluginsPath)
|
||||
def ignore(path, names):
|
||||
if path == qt_plugin_dir:
|
||||
@@ -444,7 +444,7 @@ def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
|
||||
delete_files_with_pattern(op.join(dest_folder, 'distutils'), '*.exe')
|
||||
|
||||
def fix_qt_resource_file(path):
|
||||
# pyrcc4 under Windows, if the locale is non-english, can produce a source file with a date
|
||||
# pyrcc5 under Windows, if the locale is non-english, can produce a source file with a date
|
||||
# containing accented characters. If it does, the encoding is wrong and it prevents the file
|
||||
# from being correctly frozen by cx_freeze. To work around that, we open the file, strip all
|
||||
# comments, and save.
|
||||
|
||||
@@ -46,8 +46,8 @@ try:
|
||||
|
||||
except ImportError:
|
||||
try:
|
||||
from PyQt4.QtCore import QUrl
|
||||
from PyQt4.QtGui import QDesktopServices
|
||||
from PyQt5.QtCore import QUrl, QStandardPaths
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
import os.path as op
|
||||
def _open_path(path):
|
||||
url = QUrl.fromLocalFile(str(path))
|
||||
@@ -58,10 +58,10 @@ except ImportError:
|
||||
|
||||
def _special_folder_path(special_folder):
|
||||
if special_folder == SpecialFolder.Cache:
|
||||
qtfolder = QDesktopServices.CacheLocation
|
||||
qtfolder = QStandardPaths.CacheLocation
|
||||
else:
|
||||
qtfolder = QDesktopServices.DataLocation
|
||||
return str(QDesktopServices.storageLocation(qtfolder))
|
||||
qtfolder = QStandardPaths.DataLocation
|
||||
return QStandardPaths.standardLocations(qtfolder)[0]
|
||||
|
||||
except ImportError:
|
||||
raise Exception("Can't setup desktop functions!")
|
||||
|
||||
@@ -59,7 +59,7 @@ def get_locale_name(lang):
|
||||
|
||||
#--- Qt
|
||||
def install_qt_trans(lang=None):
|
||||
from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale
|
||||
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale
|
||||
if not lang:
|
||||
lang = str(QLocale.system().name())[:2]
|
||||
localename = get_locale_name(lang)
|
||||
@@ -116,7 +116,7 @@ def install_gettext_trans_under_qt(base_folder, lang=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 PyQt4.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
|
||||
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
|
||||
if not lang:
|
||||
lang = str(QLocale.system().name())[:2]
|
||||
localename = get_locale_name(lang)
|
||||
|
||||
Reference in New Issue
Block a user