Some updates to the theme class
This commit is contained in:
+13
@@ -25,6 +25,10 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class Theme:
|
class Theme:
|
||||||
|
|
||||||
|
# Icons should either have a valid icon name by using Qt internal
|
||||||
|
# QIcon.fromTheme, as specified here:
|
||||||
|
# https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||||
|
# If there is no fallback, the variable should be None.
|
||||||
ICON_MAP = {
|
ICON_MAP = {
|
||||||
"root" : "drive-harddisk",
|
"root" : "drive-harddisk",
|
||||||
"folder" : "folder",
|
"folder" : "folder",
|
||||||
@@ -37,6 +41,7 @@ class Theme:
|
|||||||
"close" : "edit-delete",
|
"close" : "edit-delete",
|
||||||
"search" : "edit-find",
|
"search" : "edit-find",
|
||||||
"replace" : "edit-find-replace",
|
"replace" : "edit-find-replace",
|
||||||
|
"time" : None,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, theParent):
|
def __init__(self, theParent):
|
||||||
@@ -132,6 +137,7 @@ class Theme:
|
|||||||
def loadTheme(self):
|
def loadTheme(self):
|
||||||
|
|
||||||
logger.debug("Loading theme files")
|
logger.debug("Loading theme files")
|
||||||
|
logger.debug("System icon theme is '%s'" % str(QIcon.themeName()))
|
||||||
|
|
||||||
# CSS File
|
# CSS File
|
||||||
cssData = ""
|
cssData = ""
|
||||||
@@ -147,9 +153,16 @@ class Theme:
|
|||||||
iconsDir = path.join(self.themePath,self.iconPath)
|
iconsDir = path.join(self.themePath,self.iconPath)
|
||||||
if path.isdir(iconsDir):
|
if path.isdir(iconsDir):
|
||||||
for iconName in self.ICON_MAP:
|
for iconName in self.ICON_MAP:
|
||||||
|
iconFile = path.join(iconsDir,iconName+".svg")
|
||||||
|
if path.isfile(iconFile):
|
||||||
|
self.themeIcons[iconName] = QIcon(iconFile)
|
||||||
|
logger.verbose("Loaded theme icon '%s'" % (iconName+".svg"))
|
||||||
|
continue
|
||||||
iconFile = path.join(iconsDir,iconName+".png")
|
iconFile = path.join(iconsDir,iconName+".png")
|
||||||
if path.isfile(iconFile):
|
if path.isfile(iconFile):
|
||||||
self.themeIcons[iconName] = QIcon(iconFile)
|
self.themeIcons[iconName] = QIcon(iconFile)
|
||||||
|
logger.verbose("Loaded theme icon '%s'" % (iconName+".png"))
|
||||||
|
continue
|
||||||
|
|
||||||
# Config File
|
# Config File
|
||||||
confParser = configparser.ConfigParser()
|
confParser = configparser.ConfigParser()
|
||||||
|
|||||||
Reference in New Issue
Block a user