Browse Source

For testing disable program database

master
Nils 4 years ago
parent
commit
0bd140c2c1
  1. 13
      engine/api.py
  2. 2
      qtgui/mainwindow.py
  3. 2
      qtgui/waitdialog.py

13
engine/api.py

@ -188,7 +188,7 @@ def sessionRoot():
def currentSession():
return nsmServerControl.internalState["currentSession"]
def sessionList():
def sessionList()->list:
"""Updates the list each call. Use only this from a GUI for active query.
Otherwise sessionRemove and sessionCopy will not have updated the list"""
r = nsmServerControl.exportSessionsAsDicts()
@ -197,24 +197,29 @@ def sessionList():
def buildSystemPrograms():
"""Build a list of dicts with the .desktop files (or similar) of all NSM compatible programs
present on the system"""
return True
programDatabase.build()
def getSystemPrograms():
def getSystemPrograms()->list:
"""Returns the cached database from buildProgramDatabase. No automatic update. Empty on program
start"""
return []
return programDatabase.programs
def setSystemsPrograms(listOfDicts:list):
return True
programDatabase.loadPrograms(listOfDicts)
def getNsmExecutables()->set:
"""Cached access fort fast membership tests. Is this program in the PATH?"""
return set()
return programDatabase.nsmExecutables
def getUnfilteredExecutables():
def getUnfilteredExecutables()->list:
"""Return a list of unique names without paths or directories of all exectuables in users $PATH.
This is intended for a program starter prompt. GUI needs to supply tab completition or search
itself"""
itself"""
return []
return programDatabase.unfilteredExecutables

2
qtgui/mainwindow.py

@ -221,8 +221,8 @@ class MainWindow(QtWidgets.QMainWindow):
settings = QtCore.QSettings("LaborejoSoftwareSuite", METADATA["shortName"])
settings.remove("programDatabase")
WaitDialog(self, title, text, informativeText, api.buildSystemPrograms)
logger.info("Asking api to getSystemPrograms while waiting")
WaitDialog(self, title, text, informativeText, api.buildSystemPrograms)
settings.setValue("programDatabase", api.getSystemPrograms())
self._updateGUIWithCachedPrograms()

2
qtgui/waitdialog.py

@ -50,7 +50,7 @@ class WaitDialog(QtWidgets.QMessageBox):
#title = QtCore.QCoreApplication.translate("AskBeforeQuit", "About to quit")
super().__init__()
logger.info(f"Starting blocking dialog {title}")
logger.info(f"Starting blocking dialog {title} for {longRunningFunction}")
self.mainWindow = mainWindow
self.setWindowFlag(QtCore.Qt.Popup, True)
self.setIcon(self.Information)

Loading…
Cancel
Save