Commit 2e588d5b authored by Josef Brandt's avatar Josef Brandt

Bugfix in custom z-level setup

parent 69ffaf01
......@@ -25,7 +25,4 @@ class InvalidParticleError(Exception):
class NotConnectedContoursError(Exception):
pass
class ValueNotSetError(Exception):
pass
\ No newline at end of file
......@@ -559,7 +559,11 @@ class OpticalScan(QtWidgets.QWidget):
softwarez = self.ramanctrl.getSoftwareZ() # get current software z
points[:,2] += softwarez-self.ramanctrl.getUserZ()
zrange = self.zLevelSetter.getZLevels()
try:
zrange = self.zLevelSetter.getZLevels()
except ValueError:
return
zmaxstack = max(zrange)
if len(zrange) == 1:
zmaxstack = 0.0
......
......@@ -7,7 +7,6 @@ Created on Fri Oct 25 09:39:14 2019
from PyQt5 import QtWidgets, QtCore
import sys
import numpy as np
from .errors import ValueNotSetError
class ZLevelSetter(QtWidgets.QLabel):
......@@ -251,9 +250,9 @@ class ZLevelSetter(QtWidgets.QLabel):
elif self.customChecker.isChecked():
try:
zLevels = self._getCustomLevels()
except ValueNotSetError:
except ValueError:
QtWidgets.QMessageBox.critical(self, 'Error', 'Invalid entry in custom level selection')
return
raise ValueError
return np.array(zLevels)
def _getCustomLevels(self):
......@@ -266,7 +265,7 @@ class ZLevelSetter(QtWidgets.QLabel):
try:
levels.append(float(lineEdit.text()))
except:
raise ValueNotSetError
raise ValueError
return sorted(levels)
......
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