Commit 21b79202 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[gui][magnification] Add value class for magnification values

parent 17d9c976
......@@ -26,10 +26,19 @@
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "04/06/2021"
__date__ = "16/07/2021"
from silx.gui import qt
from silx.utils.enum import Enum as _Enum
class Value(_Enum):
"""
Methods available to compute the background.
"""
PIXEL_2X = 3.75
PIXEL_10X = 0.75
class MagnificationWidget(qt.QMainWindow):
......@@ -43,6 +52,8 @@ class MagnificationWidget(qt.QMainWindow):
widget = qt.QWidget()
layout = qt.QVBoxLayout()
self._magnification = Value.PIXEL_2X.value
self._checkbox2x = qt.QCheckBox("2x magnification")
self._checkbox10x = qt.QCheckBox("10x magnification")
self._checkboxManual = qt.QCheckBox("Manual magnification:")
......@@ -116,9 +127,9 @@ class MagnificationWidget(qt.QMainWindow):
def _saveMagnification(self):
if self._checkbox2x.isChecked():
d = 3.75
magnification = Value.PIXEL_2X.value
elif self._checkbox10x.isChecked():
d = 0.75
magnification = Value.PIXEL_10X.value
else:
magnification = self._manualLE.text()
if magnification == "":
......@@ -127,7 +138,8 @@ class MagnificationWidget(qt.QMainWindow):
msg.setText("Magnification value has to be entered when choosing manual")
msg.exec_()
return
self._magnification = float(magnification)
self.dataset.compute_transformation(d)
self.dataset.compute_transformation(self.magnification)
self.sigComputed.emit()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment