Skip to content

Commit

Permalink
[gui][ImageStack] add an option to avoir reseting the plot each time
Browse files Browse the repository at this point in the history
  • Loading branch information
payno committed Feb 10, 2021
1 parent 3a8e7fb commit 4b31ff2
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion silx/gui/plot/ImageStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def stop(self):

def __init__(self, parent):
super(_PlotWithWaitingLabel, self).__init__(parent=parent)
self._autoResetZoom = True
layout = qt.QStackedLayout(self)
layout.setStackingMode(qt.QStackedLayout.StackAll)

Expand All @@ -88,6 +89,19 @@ def close(self) -> bool:
super(_PlotWithWaitingLabel, self).close()
self.updateThread.stop()

def setAutoResetZoom(self, reset):
"""
Should we reset the zoom when adding an image (eq. when browsing)
:param bool reset:
"""
self._autoResetZoom = reset
if self._autoResetZoom:
self._plot.resetZoom()

def isAutoResetZoom(self):
return self._autoResetZoom

def setWaiting(self, activate=True):
if activate is True:
self._plot.clear()
Expand All @@ -97,7 +111,7 @@ def setWaiting(self, activate=True):

def setData(self, data):
self.setWaiting(activate=False)
self._plot.addImage(data=data)
self._plot.addImage(data=data, resetzoom=self._autoResetZoom)

def clear(self):
self._plot.clear()
Expand Down Expand Up @@ -601,3 +615,13 @@ def _notifyLoading(self):
"""display a simple image of loading..."""
self._plot.setWaiting(activate=True)

def setAutoResetZoom(self, reset):
"""
Should we reset the zoom when adding an image (eq. when browsing)
:param bool reset:
"""
self._plot.setAutoResetZoom(reset)

def isAutoResetZoom(self) -> bool:
return self._plot.isAutoResetZoom()

0 comments on commit 4b31ff2

Please sign in to comment.