Add explicit reference directory for os relpath calls to avoid issue #581 on Windows
This commit is contained in:
+14
-5
@@ -180,11 +180,14 @@ class GuiTheme:
|
|||||||
def loadFonts(self):
|
def loadFonts(self):
|
||||||
"""Add the fonts in the assets fonts folder to the app.
|
"""Add the fonts in the assets fonts folder to the app.
|
||||||
"""
|
"""
|
||||||
|
logger.debug("Loading additional fonts")
|
||||||
|
|
||||||
ttfList = []
|
ttfList = []
|
||||||
fontAssets = os.path.join(self.mainConf.assetPath, self.fontPath)
|
fontAssets = os.path.join(self.mainConf.assetPath, self.fontPath)
|
||||||
for fontFam in os.listdir(fontAssets):
|
for fontFam in os.listdir(fontAssets):
|
||||||
fontDir = os.path.join(fontAssets, fontFam)
|
fontDir = os.path.join(fontAssets, fontFam)
|
||||||
if os.path.isdir(fontDir):
|
if os.path.isdir(fontDir):
|
||||||
|
logger.verbose("Found font: %s" % fontFam)
|
||||||
if fontFam not in self.guiFontDB.families():
|
if fontFam not in self.guiFontDB.families():
|
||||||
for fontFile in os.listdir(fontDir):
|
for fontFile in os.listdir(fontDir):
|
||||||
ttfFile = os.path.join(fontDir, fontFile)
|
ttfFile = os.path.join(fontDir, fontFile)
|
||||||
@@ -192,10 +195,11 @@ class GuiTheme:
|
|||||||
ttfList.append(ttfFile)
|
ttfList.append(ttfFile)
|
||||||
|
|
||||||
for ttfFile in ttfList:
|
for ttfFile in ttfList:
|
||||||
logger.verbose("Font asset: %s" % os.path.relpath(ttfFile))
|
relPath = os.path.relpath(ttfFile, fontAssets)
|
||||||
|
logger.verbose("Adding font: %s" % relPath)
|
||||||
fontID = self.guiFontDB.addApplicationFont(ttfFile)
|
fontID = self.guiFontDB.addApplicationFont(ttfFile)
|
||||||
if fontID < 0:
|
if fontID < 0:
|
||||||
logger.error("Failed to add font: %s" % os.path.relpath(ttfFile))
|
logger.error("Failed to add font: %s" % relPath)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -251,7 +255,8 @@ class GuiTheme:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def loadTheme(self):
|
def loadTheme(self):
|
||||||
|
"""Load the currently specified GUI theme.
|
||||||
|
"""
|
||||||
logger.debug("Loading theme files")
|
logger.debug("Loading theme files")
|
||||||
logger.debug("System icon theme is '%s'" % str(QIcon.themeName()))
|
logger.debug("System icon theme is '%s'" % str(QIcon.themeName()))
|
||||||
|
|
||||||
@@ -321,6 +326,9 @@ class GuiTheme:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def loadSyntax(self):
|
def loadSyntax(self):
|
||||||
|
"""Load the currently specified syntax highlighter theme.
|
||||||
|
"""
|
||||||
|
logger.debug("Loading syntax theme files")
|
||||||
|
|
||||||
confParser = configparser.ConfigParser()
|
confParser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
@@ -367,7 +375,7 @@ class GuiTheme:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def listThemes(self):
|
def listThemes(self):
|
||||||
"""Scan the gui themes folder and list all themes.
|
"""Scan the GUI themes folder and list all themes.
|
||||||
"""
|
"""
|
||||||
if self.themeList:
|
if self.themeList:
|
||||||
return self.themeList
|
return self.themeList
|
||||||
@@ -761,7 +769,8 @@ class GuiIcons:
|
|||||||
# Otherwise, we start looking for it
|
# Otherwise, we start looking for it
|
||||||
# First in the theme folder
|
# First in the theme folder
|
||||||
if iconKey in self.themeMap:
|
if iconKey in self.themeMap:
|
||||||
logger.verbose("Loading: %s" % os.path.relpath(self.themeMap[iconKey]))
|
relPath = os.path.relpath(self.themeMap[iconKey], self.mainConf.iconPath)
|
||||||
|
logger.verbose("Loading: %s" % relPath)
|
||||||
return QIcon(self.themeMap[iconKey])
|
return QIcon(self.themeMap[iconKey])
|
||||||
|
|
||||||
# Next, we try to load the Qt style icons
|
# Next, we try to load the Qt style icons
|
||||||
|
|||||||
Reference in New Issue
Block a user