From ffd1624cb9b980abcced959e9c722e23e7ff04e8 Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Thu, 23 May 2019 19:02:56 -0700 Subject: [PATCH] Use defaultSuffix for smarter file extension handling. --- pyqtgraph/flowchart/Flowchart.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pyqtgraph/flowchart/Flowchart.py b/pyqtgraph/flowchart/Flowchart.py index f28ebc3b..ae03d4c2 100644 --- a/pyqtgraph/flowchart/Flowchart.py +++ b/pyqtgraph/flowchart/Flowchart.py @@ -526,11 +526,6 @@ class Flowchart(Node): 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 """ @@ -540,9 +535,10 @@ class Flowchart(Node): if startDir is None: startDir = '.' self.fileDialog = FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)") + self.fileDialog.setDefaultSuffix("fc") self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) self.fileDialog.show() - self.fileDialog.fileSelected.connect(self.saveFileSelected) + self.fileDialog.fileSelected.connect(self.saveFile) return fileName = asUnicode(fileName) configfile.writeConfigFile(self.saveState(), fileName)