Skip to content

Commit

Permalink
Merge pull request #215 from dalthviz/fixes_issue_214
Browse files Browse the repository at this point in the history
PR: Handle per user font installation failing due to missing/not available registry keys
  • Loading branch information
ccordoba12 authored Oct 20, 2022
2 parents 5a31b9d + c20d090 commit 6fa3d4f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions qtawesome/iconic_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,15 @@ def _install_fonts(self, fonts_directory):
GFRI_ISTRUETYPE)
if is_truetype:
fontname += ' (TrueType)'
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, FONTS_REG_PATH, 0,
winreg.KEY_SET_VALUE) as key:
winreg.SetValueEx(key, fontname, 0, winreg.REG_SZ, filename)
try:
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, FONTS_REG_PATH, 0,
winreg.KEY_SET_VALUE) as key:
winreg.SetValueEx(key, fontname, 0, winreg.REG_SZ, filename)
except OSError:
# Needed to support older Windows version where
# font installation per user is not possible/related registry
# entry is not available
# See spyder-ide/qtawesome#214
return fonts_directory

return user_fonts_dir

0 comments on commit 6fa3d4f

Please # to comment.