Browse Source

more log messages around findicons

master
Nils 4 years ago
parent
commit
2b26ed792d
  1. 3
      engine/findicons.py
  2. 24
      engine/findprograms.py

3
engine/findicons.py

@ -93,10 +93,13 @@ def updateCache(serializedCache:list=None):
if serializedCache:
#Convert str to real paths
logger.info("Filling icon cache with previously serialized data")
_cache = set([pathlib.Path(r) for r in serializedCache if pathlib.Path(r).is_file()])
else:
#Already real paths as a set
logger.info("Building icon cache from scratch")
_cache = _buildCache()
logger.info("Icon cache complete")
def getSerializedCache()->list: #list of strings, not paths. This is for saving in global system config for faster startup
global _cache

24
engine/findprograms.py

@ -170,6 +170,7 @@ class SupportedProgramsDatabase(object):
"""Qt Settings will send us this"""
self.programs = cache["programs"] #list of dicts
findicons.updateCache(cache["iconPaths"])
logger.info("Restoring program list from serialized cache")
self.nsmExecutables = set(d["argodejoExec"] for d in self.programs)
def getCache(self)->dict:
@ -247,29 +248,6 @@ class SupportedProgramsDatabase(object):
except KeyError:
pass #Double entries like zyn-jack zyn-alsa etc.
"""
if exe in self.knownDesktopFiles: #Shortcut through internal database
entry = self.knownDesktopFiles[exe]
else: #Reverse Search desktop files.
for entry in self.desktopEntries:
if "exec" in entry and exe.lower() in entry["exec"].lower():
break #found entry. break inner loop to keep it
else: #Foor loop ended. Did not find any matching desktop file
#If we omit continue it will just write exe and fullPath in any desktop file.
continue
#Found match!
entry["argodejoFullPath"] = fullPath
#We don't want .desktop syntax like "qmidiarp %F"
entry["argodejoExec"] = exe
matches.append(entry)
try:
leftovers.remove((exe,fullPath))
except KeyError:
pass #Double entries like zyn-jack zyn-alsa etc.
"""
for exe,fullPath in leftovers:
pseudoEntry = {"name": exe.title(), "argodejoExec":exe, "argodejoFullPath":fullPath}
matches.append(pseudoEntry)

Loading…
Cancel
Save