Dictionary path bug fix & added warning whenever a selected dictionary isn't installed
This commit is contained in:
parent
e61e6b124e
commit
cf229cb9c8
@ -79,7 +79,7 @@ class Language:
|
|||||||
def get_dictionary_dir():
|
def get_dictionary_dir():
|
||||||
"""Return the path to the QtWebEngine's dictionaries directory."""
|
"""Return the path to the QtWebEngine's dictionaries directory."""
|
||||||
return os.path.join(QLibraryInfo.location(QLibraryInfo.DataPath),
|
return os.path.join(QLibraryInfo.location(QLibraryInfo.DataPath),
|
||||||
'/qtwebengine_dictionaries')
|
'qtwebengine_dictionaries')
|
||||||
|
|
||||||
|
|
||||||
def get_language_list_file():
|
def get_language_list_file():
|
||||||
|
@ -140,9 +140,16 @@ class DictionaryLanguageSetter(DefaultProfileSetter):
|
|||||||
if settings is not None:
|
if settings is not None:
|
||||||
raise ValueError("'settings' may not be set with "
|
raise ValueError("'settings' may not be set with "
|
||||||
"DictionaryLanguageSetter!")
|
"DictionaryLanguageSetter!")
|
||||||
files = [lang.file[:-5]
|
installed_langs = dict([(lang.code, lang.file)
|
||||||
for lang in get_installed_languages() if lang.code in value]
|
for lang in get_installed_languages()])
|
||||||
super()._set(files, settings)
|
lang_files = []
|
||||||
|
for lang_code in value:
|
||||||
|
if lang_code in installed_langs:
|
||||||
|
lang_files.append(installed_langs[lang_code][:-5])
|
||||||
|
else:
|
||||||
|
message.warning('Language {} is not installed.'
|
||||||
|
.format(lang_code))
|
||||||
|
super()._set(lang_files, settings)
|
||||||
|
|
||||||
|
|
||||||
def _init_stylesheet(profile):
|
def _init_stylesheet(profile):
|
||||||
|
Loading…
Reference in New Issue
Block a user