1
0
forked from IPKM/nmreval

saving removes bad characters

This commit is contained in:
Dominik Demuth
2023-01-26 19:30:39 +01:00
parent af313c7a58
commit 0eb0a4be77
3 changed files with 17 additions and 9 deletions

View File

@ -114,7 +114,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
self.datawidget.management = self.management
self.integralwidget.management = self.management
# self.drawingswidget.graphs = self.management.graphs
self.drawingswidget.graphs = self.management.graphs
self.ac_group = QtWidgets.QActionGroup(self)
self.ac_group.addAction(self.action_lm_fit)
@ -126,8 +126,6 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
self.ac_group2.addAction(self.action_x_range)
self.ac_group2.addAction(self.action_custom_range)
self.action_draw_object.setVisible(False)
def _init_signals(self):
self.actionRedo = self.management.undostack.createRedoAction(self)
icon = QtGui.QIcon.fromTheme("edit-redo")
@ -268,6 +266,10 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
param_outfile = re.sub('[_\s-]?<label>[_\s-]?', '', savefile.stem)
bad_character = r'/*<>\|:"'
for c in bad_character:
param_outfile = param_outfile.replace(c, '')
if save_dialog.agr_cb.isChecked():
self.current_graph_widget.export(savefile.with_name(param_outfile + '.agr'))
@ -598,8 +600,9 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
def _select_drawingswidget(self, onoff):
if onoff:
self.drawingswidget(self.management.graphs.list())
self.drawingswidget.connected_figure = self.management.current_graph
if self.drawingswidget.graphs is None:
self.drawingswidget.graphs = self.management.graphs
self.drawingswidget.update_tree()
else:
self.drawingswidget.clear()

View File

@ -1116,7 +1116,12 @@ class UpperManagement(QtCore.QObject):
else:
real_outnames.append(full_name)
outpath_set = path.with_name(real_outnames[-1]+path.suffix)
out_name = real_outnames[-1]
bad_character = r'/*<>\|:"'
for c in bad_character:
out_name = out_name.replace(c, '')
outpath_set = path.with_name(out_name+path.suffix)
data_i.save(outpath_set)