From fec410360851b4d8a065dc86e33c435f4635fa6d Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Thu, 2 Feb 2023 17:09:04 +0100 Subject: [PATCH] look for fits without parent during save; fixes T258 --- src/gui_qt/main/management.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py index aa07a67..2a2549f 100644 --- a/src/gui_qt/main/management.py +++ b/src/gui_qt/main/management.py @@ -9,6 +9,7 @@ from nmreval.fit.model import Model from nmreval.fit.result import FitResult from nmreval.fit.minimizer import FitRoutine from nmreval.lib.colors import available_cycles +from nmreval.lib.logger import logger from nmreval.math.interpol import interpolate from nmreval.math.logfourier import logft from nmreval.math.smooth import smooth @@ -322,8 +323,8 @@ class UpperManagement(QtCore.QObject): value_set.add(data_i.value) if joined is not None: - joined.group = '/'.join(group_set) - joined.name = '/'.join(name_set) + joined.group = '+'.join(group_set) + joined.name = '+'.join(name_set) if len(value_set) == 1: joined.value = value_set.pop() @@ -1103,7 +1104,12 @@ class UpperManagement(QtCore.QObject): data_i = self.data[set_id] if isinstance(data_i, FitContainer): - full_name += ' fit(' + self.data[data_i.parent_set].name + ')' + try: + full_name += ' fit(' + self.data[data_i.parent_set].name + ')' + except KeyError: + # TODO fits should have a parent set + logger.warning(f'Fit {data_i} without valid parent : key is [{data_i.parent_set}') + full_name += ' fit' if strip_spaces: full_name = full_name.replace(' ', '_')