diff --git a/engine/api.py b/engine/api.py index 79fab81..5644284 100644 --- a/engine/api.py +++ b/engine/api.py @@ -330,10 +330,6 @@ def sessionQuery(nsmSessionName:str): Exports a single session project in the format of nsmServerControl.exportSessionsAsDicts""" return nsmServerControl.sessionAsDict(nsmSessionName) -def sessionForceLiftLock(nsmSessionName:str): - nsmServerControl.forceLiftLock(nsmSessionName) - callbacks._sessionLocked(nsmSessionName, False) - def sessionDelete(nsmSessionName:str): nsmServerControl.deleteSession(nsmSessionName) diff --git a/engine/findprograms.py b/engine/findprograms.py index 2de956d..75fc245 100644 --- a/engine/findprograms.py +++ b/engine/findprograms.py @@ -121,12 +121,15 @@ class SupportedProgramsDatabase(object): #command = f"grep -iRsnl {path} -e /nsm/server/announce" #Py>=3.7 completedProcess = subprocess.run(command, capture_output=True, text=True, shell=True) + """ + #Look into executable files. Slow and didn't bring up any new programs. Better to keep the database up to date ourselves. completedProcess = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True) #universal_newlines is an alias for text, which was deprecated in 3.7 because text is more understandable. capture_output replaces the two PIPEs in 3.7 for fullPath in completedProcess.stdout.split(): self.progressHook(f"{fullPath}") exe = pathlib.Path(fullPath).relative_to(path) if not str(exe) in excludeFromProcessingSet: #skip over any known file, good or bad result.append((str(exe), str(fullPath))) + """ for prg in whiteSet: self.progressHook(f"{prg}") diff --git a/engine/nsmservercontrol.py b/engine/nsmservercontrol.py index 9eeda52..ae68e61 100644 --- a/engine/nsmservercontrol.py +++ b/engine/nsmservercontrol.py @@ -1419,21 +1419,6 @@ class NsmServerControl(object): lockFile = pathlib.Path(basePath, ".lock") return lockFile.exists() - def forceLiftLock(self, nsmSessionName:str): - """Removes lockfile, no matter if session is actually open or just a remainder - from a crash. - If no lock exist it does nothing.""" - self._updateSessionListBlocking() - - if self._checkIfLocked(nsmSessionName): - basePath = pathlib.Path(self.sessionRoot, nsmSessionName) - assert basePath.exists() #implied by _checkIfLocked - lockFile = pathlib.Path(basePath, ".lock") - lockFile.unlink(missing_ok=True) - logger.info(f"{nsmSessionName} was forced to unlock by us.") - else: - logger.info(f"Tried to unlock, but {nsmSessionName} is not locked") - def getSessionFiles(self, nsmSessionName:str)->list: """Return all session files, useful to present to the user, e.g. as warning before deletion""" @@ -1566,7 +1551,6 @@ class NsmServerControl(object): else: mycopy() - self.forceLiftLock(newName) except Exception as e: #we don't want to crash if user tries to copy to /root or so. logger.error(e) return False diff --git a/qtgui/designer/mainwindow.py b/qtgui/designer/mainwindow.py index 6f2d9ac..ca5ad5d 100644 --- a/qtgui/designer/mainwindow.py +++ b/qtgui/designer/mainwindow.py @@ -91,10 +91,6 @@ class Ui_MainWindow(object): self.button_delete_selected_session.setEnabled(False) self.button_delete_selected_session.setObjectName("button_delete_selected_session") self.verticalLayout_3.addWidget(self.button_delete_selected_session) - self.button_remove_lock_selected_session = QtWidgets.QPushButton(self.widget) - self.button_remove_lock_selected_session.setEnabled(False) - self.button_remove_lock_selected_session.setObjectName("button_remove_lock_selected_session") - self.verticalLayout_3.addWidget(self.button_remove_lock_selected_session) self.checkBoxNested = QtWidgets.QCheckBox(self.widget) self.checkBoxNested.setChecked(True) self.checkBoxNested.setObjectName("checkBoxNested") @@ -324,7 +320,6 @@ class Ui_MainWindow(object): self.button_rename_selected_session.setText(_translate("MainWindow", "Rename Selected")) self.button_copy_selected_session.setText(_translate("MainWindow", "Copy Selected")) self.button_delete_selected_session.setText(_translate("MainWindow", "Delete Selected")) - self.button_remove_lock_selected_session.setText(_translate("MainWindow", "Remove Lock")) self.checkBoxNested.setText(_translate("MainWindow", "Tree View")) self.session_programs.setTitle(_translate("MainWindow", "Double-click to load program")) self.session_loaded.setTitle(_translate("MainWindow", "In current session")) diff --git a/qtgui/designer/mainwindow.ui b/qtgui/designer/mainwindow.ui index fed2dd6..7455162 100644 --- a/qtgui/designer/mainwindow.ui +++ b/qtgui/designer/mainwindow.ui @@ -193,16 +193,6 @@ - - - - false - - - Remove Lock - - - diff --git a/qtgui/sessiontreecontroller.py b/qtgui/sessiontreecontroller.py index 8850a34..cbec784 100644 --- a/qtgui/sessiontreecontroller.py +++ b/qtgui/sessiontreecontroller.py @@ -184,7 +184,6 @@ class SessionTreeController(object): self.mainWindow.ui.button_copy_selected_session.clicked.connect(lambda: self._askForCopyAndCopy(self.treeWidget.currentItem().sessionDict["nsmSessionName"])) self.mainWindow.ui.button_rename_selected_session.clicked.connect(lambda: self._askForNameAndRenameSession(self.treeWidget.currentItem().sessionDict["nsmSessionName"])) self.mainWindow.ui.button_delete_selected_session.clicked.connect(lambda: self.deleteSessionItem(self.treeWidget.currentItem())) - self.mainWindow.ui.button_remove_lock_selected_session.clicked.connect(lambda: api.sessionForceLiftLock(self.treeWidget.currentItem().sessionDict["nsmSessionName"])) logger.info("Full View Session Chooser ready") @@ -283,9 +282,7 @@ class SessionTreeController(object): listOfLabelsAndFunctions = [ (QtCore.QCoreApplication.translate("SessionTree", "Copy Session"), lambda: self._askForCopyAndCopy(item.sessionDict["nsmSessionName"])) ] - if item.isDisabled(): - listOfLabelsAndFunctions.append((QtCore.QCoreApplication.translate("SessionTree", "Force Lock Removal"), lambda: api.sessionForceLiftLock(item.sessionDict["nsmSessionName"]))) - else: + if not item.isDisabled(): listOfLabelsAndFunctions.append((QtCore.QCoreApplication.translate("SessionTree", "Rename Session"), lambda: self._askForNameAndRenameSession(item.sessionDict["nsmSessionName"]))) #Delete should be the bottom item. listOfLabelsAndFunctions.append((QtCore.QCoreApplication.translate("SessionTree", "Delete Session"), lambda: self.deleteSessionItem(item))) @@ -323,7 +320,6 @@ class SessionTreeController(object): self.mainWindow.ui.button_copy_selected_session.setEnabled(sessionSelectedState) self.mainWindow.ui.button_rename_selected_session.setEnabled(sessionSelectedState) self.mainWindow.ui.button_delete_selected_session.setEnabled(sessionSelectedState) - self.mainWindow.ui.button_remove_lock_selected_session.setEnabled(sessionSelectedState and item.sessionDict["locked"] == True) def _reactSignal_itemDoubleClicked(self, item:QtWidgets.QTreeWidgetItem, column:int): if not item.isDisabled() and type(item) is SessionItem: @@ -385,4 +381,3 @@ class SessionTreeController(object): if self._cachedSessionDicts: #not startup self._reactCallback_sessionsChanged(self._cachedSessionDicts) self.treeWidget.sortItems(self.sortByColumnValue, self.sortDescendingValue) -