Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def axis_box(self, axis=0):
box = NXComboBox()
for node in self.group.values():
if node is not self.signal and self.check_axis(node, axis):
box.addItem(node.nxname)
if box.count() == 0:
return None
if 'axes' in self.signal.attrs:
from nexusformat.nexus.tree import _readaxes
default_axis = _readaxes(self.signal.axes)[axis]
else:
axes = self.group.nxaxes
if axes is not None:
default_axis = self.group.nxaxes[axis].nxname
else:
default_axis = None
if default_axis:
try:
box.setCurrentIndex(box.findText(default_axis))
except Exception:
pass
else:
box.setCurrentIndex(0)
return box