Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/PyMca5/PyMcaGui/io/hdf5/QNexusWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def dataSourceDestroyed(weakrefReference):
if hasattr(self.hdf5Widget, "expandToDepth"):
self.hdf5Widget.expandToDepth(0)

def _autoRefreshDatasets(self, source=None):
def _autoRefreshDatasets(self, source=None, moveToLastSlice=True):
"""
Auto-refresh: re-read datasets and re-plot without re-building the tree.
The tree remains fully interactive (click, select, expand).
Expand Down Expand Up @@ -552,7 +552,10 @@ def _autoRefreshDatasets(self, source=None):

# Replot with the cached entry list (always REPLACE).
_, selType = self._lastAction.split()
ddict = {'action': 'REPLACE %s' % selType}
ddict = {
'action': 'REPLACE %s' % selType,
'refreshtolastslice': moveToLastSlice,
}
self.buttonsSlot(ddict, emit=True,
entryList=self._autoRefreshEntries)

Expand Down Expand Up @@ -1176,6 +1179,7 @@ def buttonsSlot(self, ddict, emit=True, entryList=None):
sel['selection']['LabelNames'] = cntSelection['aliaslist']
#sel['selection']['aliaslist'] = cntSelection['aliaslist']
sel['selection']['selectiontype'] = selectionType
sel['refreshtolastslice'] = ddict.get('refreshtolastslice', False)
if selectionType.upper() == "SCAN":
if cntSelection['cntlist'][yCnt].startswith("/"):
actualDatasetPath = posixpath.join(entry,
Expand Down Expand Up @@ -1355,6 +1359,7 @@ def buttonsSlot(self, ddict, emit=True, entryList=None):
sel['selection']['cntlist'] = cntSelection['cntlist']
sel['selection']['LabelNames'] = cntSelection['aliaslist']
sel['selection']['selectiontype'] = selectionType
sel['refreshtolastslice'] = ddict.get('refreshtolastslice', False)
sel['selection']['plot_yaxis'] = 'right'
if selectionType.upper() == "SCAN":
sel['scanselection'] = True
Expand Down
10 changes: 10 additions & 0 deletions src/PyMca5/PyMcaGui/pymca/PyMcaImageWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,19 @@ def _addSelection(self, selectionlist):
self.slider.setValue(0)
self.slider.show()
self.setName(legend+" 0")
if sel.get("refreshtolastslice", False) and self._nImages > 1:
self._showLastImageSlice()
if self._plotEnabled:
self.plotImage(True)

def _showLastImageSlice(self):
if USE_BROWSER:
# Reuse the existing method from FrameBrowser.
self.slider._browser._lastClicked()
else:
# simply set slider to last number possible.
self.slider.setValue(self._nImages - 1)

def _getAxesLabelsFromSelection(self, selection):
labels = []
if "x" in selection:
Expand Down
2 changes: 1 addition & 1 deletion src/PyMca5/PyMcaGui/pymca/PyMcaMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def _dispatcherAddSelectionSlot(self, dictOrList):
self.imageWindowDict[legend]._addSelection(ddict)
return
elif self._is2DSelection(ddict):
_logger.info("2D selection")
_logger.debug("2D selection")
if self.imageWindowCorrelator is None:
self.imageWindowCorrelator = RGBCorrelator.RGBCorrelator()
#toadd = True
Expand Down
Loading