From 0bd140c2c19974e37091d038bd827be895e1bfeb Mon Sep 17 00:00:00 2001 From: Nils <> Date: Mon, 20 Apr 2020 14:25:32 +0200 Subject: [PATCH] For testing disable program database --- engine/api.py | 13 +++++++++---- qtgui/mainwindow.py | 2 +- qtgui/waitdialog.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/engine/api.py b/engine/api.py index c801562..0ba4b24 100644 --- a/engine/api.py +++ b/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 diff --git a/qtgui/mainwindow.py b/qtgui/mainwindow.py index 667f86d..7e22e82 100644 --- a/qtgui/mainwindow.py +++ b/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() diff --git a/qtgui/waitdialog.py b/qtgui/waitdialog.py index ef72ded..9dbd172 100644 --- a/qtgui/waitdialog.py +++ b/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)