mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	Fix #760, issue with language on windows
Fix the issue related to run.py qsettings not using the same options as in preferences.py
This commit is contained in:
		
							parent
							
								
									421a58a61c
								
							
						
					
					
						commit
						95ccbad92b
					
				| @ -66,6 +66,20 @@ def adjust_after_deserialization(v): | ||||
|     return v | ||||
| 
 | ||||
| 
 | ||||
| def createQSettings(): | ||||
|     # Create a QSettings instance with the correct arguments. | ||||
|     # On windows use an ini file in the AppDataLocation instead of registry if possible as it | ||||
|     # makes it easier for a user to clear it out when there are issues. | ||||
|     if ISWINDOWS: | ||||
|         Locations = QStandardPaths.standardLocations(QStandardPaths.AppDataLocation) | ||||
|         if Locations: | ||||
|             return QSettings(op.join(Locations[0], "settings.ini"), QSettings.IniFormat) | ||||
|         else: | ||||
|             return QSettings() | ||||
|     else: | ||||
|         return QSettings() | ||||
| 
 | ||||
| 
 | ||||
| # About QRect conversion: | ||||
| # I think Qt supports putting basic structures like QRect directly in QSettings, but I prefer not | ||||
| # to rely on it and stay with generic structures. | ||||
| @ -77,18 +91,7 @@ class Preferences(QObject): | ||||
|     def __init__(self): | ||||
|         QObject.__init__(self) | ||||
|         self.reset() | ||||
|         # On windows use an ini file in the AppDataLocation instead of registry if possible as it | ||||
|         # makes it easier for a user to clear it out when there are issues. | ||||
|         if ISWINDOWS: | ||||
|             Locations = QStandardPaths.standardLocations(QStandardPaths.AppDataLocation) | ||||
|             if Locations: | ||||
|                 self._settings = QSettings( | ||||
|                     op.join(Locations[0], "settings.ini"), QSettings.IniFormat | ||||
|                 ) | ||||
|             else: | ||||
|                 self._settings = QSettings() | ||||
|         else: | ||||
|             self._settings = QSettings() | ||||
|         self._settings = createQSettings() | ||||
| 
 | ||||
|     def _load_values(self, settings, get): | ||||
|         pass | ||||
|  | ||||
							
								
								
									
										5
									
								
								run.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								run.py
									
									
									
									
									
								
							| @ -9,13 +9,14 @@ import sys | ||||
| import os.path as op | ||||
| import gc | ||||
| 
 | ||||
| from PyQt5.QtCore import QCoreApplication, QSettings | ||||
| from PyQt5.QtCore import QCoreApplication | ||||
| from PyQt5.QtGui import QIcon, QPixmap | ||||
| from PyQt5.QtWidgets import QApplication | ||||
| 
 | ||||
| from hscommon.trans import install_gettext_trans_under_qt | ||||
| from qtlib.error_report_dialog import install_excepthook | ||||
| from qtlib.util import setupQtLogging | ||||
| from qtlib.preferences import createQSettings | ||||
| from qt import dg_rc  # noqa: F401 | ||||
| from qt.platform import BASE_PATH | ||||
| from core import __version__, __appname__ | ||||
| @ -52,7 +53,7 @@ def main(): | ||||
|     QCoreApplication.setApplicationName(__appname__) | ||||
|     QCoreApplication.setApplicationVersion(__version__) | ||||
|     setupQtLogging() | ||||
|     settings = QSettings() | ||||
|     settings = createQSettings() | ||||
|     lang = settings.value("Language") | ||||
|     locale_folder = op.join(BASE_PATH, "locale") | ||||
|     install_gettext_trans_under_qt(locale_folder, lang) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user