diff --git a/gui/control_main.py b/gui/control_main.py index 78bebe80..eb3f80f6 100644 --- a/gui/control_main.py +++ b/gui/control_main.py @@ -3775,22 +3775,24 @@ def addRequestsToAllSelectedCB(self): samplesConsidered.add(self.selectedSampleID) else: # If queue collect is off does not matter how many requests you select only one will be added to current pin self.selectedSampleID = self.mountedPin_pv.get() - self.selectedSampleRequest = daq_utils.createDefaultRequest( - self.selectedSampleID - ) - self.dataPathGB.setFilePrefix_ledit( - str(self.selectedSampleRequest["request_obj"]["file_prefix"]) - ) - self.dataPathGB.setDataPath_ledit( - str(self.selectedSampleRequest["request_obj"]["directory"]) - ) - self.EScanDataPathGB.setFilePrefix_ledit( - str(self.selectedSampleRequest["request_obj"]["file_prefix"]) - ) - self.EScanDataPathGB.setDataPath_ledit( - str(self.selectedSampleRequest["request_obj"]["directory"]) - ) - self.addSampleRequestCB(selectedSampleID=self.selectedSampleID) + # Only add a request if a sample is actually mounted + if self.selectedSampleID: + self.selectedSampleRequest = daq_utils.createDefaultRequest( + self.selectedSampleID + ) + self.dataPathGB.setFilePrefix_ledit( + str(self.selectedSampleRequest["request_obj"]["file_prefix"]) + ) + self.dataPathGB.setDataPath_ledit( + str(self.selectedSampleRequest["request_obj"]["directory"]) + ) + self.EScanDataPathGB.setFilePrefix_ledit( + str(self.selectedSampleRequest["request_obj"]["file_prefix"]) + ) + self.EScanDataPathGB.setDataPath_ledit( + str(self.selectedSampleRequest["request_obj"]["directory"]) + ) + self.addSampleRequestCB(selectedSampleID=self.selectedSampleID) self.progressDialog.close() self.treeChanged_pv.put(1)