From fd134f77c6fde72df39a14820482f182e899fdc0 Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Thu, 23 May 2019 17:53:42 -0700 Subject: [PATCH] Only append .fc file extension if not added in the file dialog. --- pyqtgraph/flowchart/Flowchart.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pyqtgraph/flowchart/Flowchart.py b/pyqtgraph/flowchart/Flowchart.py index 6a486232..f28ebc3b 100644 --- a/pyqtgraph/flowchart/Flowchart.py +++ b/pyqtgraph/flowchart/Flowchart.py @@ -525,7 +525,12 @@ class Flowchart(Node): self.restoreState(state, clear=True) self.viewBox.autoRange() self.sigFileLoaded.emit(fileName) - + + def saveFileSelected(self, fileName): + if not fileName.endswith('.fc'): + fileName += '.fc' + self.saveFile(fileName=fileName) + def saveFile(self, fileName=None, startDir=None, suggestedFileName='flowchart.fc'): """Save this flowchart to a .fc file """ @@ -537,11 +542,8 @@ class Flowchart(Node): self.fileDialog = FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)") self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) self.fileDialog.show() - self.fileDialog.fileSelected.connect(self.saveFile) + self.fileDialog.fileSelected.connect(self.saveFileSelected) return - fileName = unicode(fileName) - if not fileName.endswith('.fc'): - fileName += '.fc' fileName = asUnicode(fileName) configfile.writeConfigFile(self.saveState(), fileName) self.sigFileSaved.emit(fileName)