diff --git a/easyDiffractionApp/Logic/Connections.py b/easyDiffractionApp/Logic/Connections.py index f46e698..547f462 100644 --- a/easyDiffractionApp/Logic/Connections.py +++ b/easyDiffractionApp/Logic/Connections.py @@ -290,6 +290,8 @@ def updateExperimentPageOnly(self): ######### def onFittingFitFinished(self): + # Update the blocks first + self._proxy.model.updateBlocksFromPhases() # Model page console.debug(formatMsg('main', 'Updating structure view for the current model...')) self._proxy.model.updateCurrentModelStructView() @@ -297,6 +299,7 @@ def onFittingFitFinished(self): self._proxy.model.setDataBlocksCif() # Experiment page + self._proxy.experiment.updateBlocksFromJob() console.debug(formatMsg('main', 'Replacing arrays...')) self._proxy.experiment.replaceArrays() console.debug(formatMsg('main', f'Redrawing curves on experiment page using {self._proxy.plotting.currentLib1d}...')) diff --git a/easyDiffractionApp/Logic/Experiment.py b/easyDiffractionApp/Logic/Experiment.py index 09ce7fd..0636410 100644 --- a/easyDiffractionApp/Logic/Experiment.py +++ b/easyDiffractionApp/Logic/Experiment.py @@ -250,6 +250,12 @@ def loadExperimentFromCifString(self, cifString="", job_name=""): # self._job.interface = self._interface self.dataBlocksChanged.emit() + def updateBlocksFromJob(self): + blocks = self.jobToBlock(job=self.job) + self._dataBlocksNoMeas = [] + self._dataBlocksNoMeas.append(blocks) + self.dataBlocksChanged.emit() + def jobToBlock(self, job=None): ''' Convert a Job object to a list of data blocks, without the measured data diff --git a/easyDiffractionApp/Logic/Fittables.py b/easyDiffractionApp/Logic/Fittables.py index 421fd9d..10e9fbe 100644 --- a/easyDiffractionApp/Logic/Fittables.py +++ b/easyDiffractionApp/Logic/Fittables.py @@ -159,11 +159,13 @@ def editSilently(self, blockType, blockIdx, category, rowIndex, name, field, val changedIntern = self._proxy.model.editDataBlockLoopParam(blockIdx, category, name, rowIndex, field, value) self._proxy.model.blocksToLoopPhase(blockIdx, category, name, rowIndex, field, value) changedCryspy = self._proxy.model.editCalculatorDictByLoopParam(blockIdx, category, name, rowIndex, field, value) - if changedIntern and changedCryspy: - if blockType == 'model': - self.modelChangedSilently.emit() - elif blockType == 'experiment': - self.experimentChangedSilently.emit() + #if changedIntern and changedCryspy: + ### genericUpdate now messes with changedIntern and changedCryspy + ### so we just force the updates + if blockType == 'model': + self.modelChangedSilently.emit() + elif blockType == 'experiment': + self.experimentChangedSilently.emit() def set(self): _data = [] diff --git a/easyDiffractionApp/Logic/Model.py b/easyDiffractionApp/Logic/Model.py index ac2475a..d13d3a5 100644 --- a/easyDiffractionApp/Logic/Model.py +++ b/easyDiffractionApp/Logic/Model.py @@ -248,6 +248,13 @@ def loadModelsFromEdCif(self, edCif): self.updateCifOnInterface(cif=edCif) self.dataBlocksChanged.emit() + def updateBlocksFromPhases(self): + self._dataBlocks = [] # clear the list + for phase in self.job.phases: + self._dataBlocks.append(self.phaseToBlocks([phase])) + self.setDataBlocksCif() + self.dataBlocksChanged.emit() + def updateCifOnInterface(self, cif=None): ''' Update the CIF representation on the current interface