Commit 233909f4 authored by payno's avatar payno

[gui][XASObjectDialog]several small fix

parent acff6304
......@@ -103,6 +103,7 @@ class XASObjectDialog(qt.QWidget):
self.getEnergyUrl = self._h5Dialog.getEnergyUrl
self.setConfigurationUrl = self._h5Dialog.setConfigurationUrl
self.getConfigurationUrl = self._h5Dialog.getConfigurationUrl
self.getDimensions = self._h5Dialog.getDimensions
self.setDimensions = self._h5Dialog.setDimensions
# default setting
......@@ -122,7 +123,10 @@ class XASObjectDialog(qt.QWidget):
def check_url(url_path, name):
if url_path in (None, ''):
raise ValueError(' '.join(('No', name, 'url defined')))
url = DataUrl(path=url_path)
if isinstance(url_path, DataUrl):
url = url_path
else:
url = DataUrl(path=url_path)
if not url.is_valid():
raise ValueError(' '.join((name, 'url is invalid. Does the file / path still exists ?')))
......@@ -358,10 +362,10 @@ class _SpectraDimensions(qt.QWidget):
"""Change the value of the combobox of the value == value for an
unset value"""
if dimCB.currentText() == value:
text = getUnsetDimension()
if text is None:
dim = getUnsetDimension()
if dim is None:
return
index = dimCB.findText(text)
index = dimCB.findText(dim.value)
assert index >= 0
dimCB.setCurrentIndex(index)
_updateIfNecessary(get_third, unique_value)
......
......@@ -129,8 +129,12 @@ class XASInputOW(OWWidget):
def load_url(url_path, setter):
if url_path != '':
try:
if isinstance(url_path, DataUrl):
url = url_path
else:
url = DataUrl(url_path)
try:
if url and url.is_valid():
setter(url.path())
except ... as e:
......
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