Fix: flowchart saveFile and loadFile in python3
This commit is contained in:
parent
1036edf618
commit
e98f3582a8
@ -514,7 +514,6 @@ class Flowchart(Node):
|
|||||||
return
|
return
|
||||||
## NOTE: was previously using a real widget for the file dialog's parent, but this caused weird mouse event bugs..
|
## NOTE: was previously using a real widget for the file dialog's parent, but this caused weird mouse event bugs..
|
||||||
#fileName = QtGui.QFileDialog.getOpenFileName(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
|
#fileName = QtGui.QFileDialog.getOpenFileName(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
|
||||||
fileName = unicode(fileName)
|
|
||||||
state = configfile.readConfigFile(fileName)
|
state = configfile.readConfigFile(fileName)
|
||||||
self.restoreState(state, clear=True)
|
self.restoreState(state, clear=True)
|
||||||
self.viewBox.autoRange()
|
self.viewBox.autoRange()
|
||||||
@ -535,7 +534,8 @@ class Flowchart(Node):
|
|||||||
self.fileDialog.fileSelected.connect(self.saveFile)
|
self.fileDialog.fileSelected.connect(self.saveFile)
|
||||||
return
|
return
|
||||||
#fileName = QtGui.QFileDialog.getSaveFileName(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
|
#fileName = QtGui.QFileDialog.getSaveFileName(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
|
||||||
fileName = unicode(fileName)
|
if not fileName.endswith('.fc'):
|
||||||
|
fileName += '.fc'
|
||||||
configfile.writeConfigFile(self.saveState(), fileName)
|
configfile.writeConfigFile(self.saveState(), fileName)
|
||||||
self.sigFileSaved.emit(fileName)
|
self.sigFileSaved.emit(fileName)
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ class FlowchartCtrlWidget(QtGui.QWidget):
|
|||||||
#self.setCurrentFile(newFile)
|
#self.setCurrentFile(newFile)
|
||||||
|
|
||||||
def fileSaved(self, fileName):
|
def fileSaved(self, fileName):
|
||||||
self.setCurrentFile(unicode(fileName))
|
self.setCurrentFile(fileName)
|
||||||
self.ui.saveBtn.success("Saved.")
|
self.ui.saveBtn.success("Saved.")
|
||||||
|
|
||||||
def saveClicked(self):
|
def saveClicked(self):
|
||||||
@ -689,7 +689,7 @@ class FlowchartCtrlWidget(QtGui.QWidget):
|
|||||||
#self.setCurrentFile(newFile)
|
#self.setCurrentFile(newFile)
|
||||||
|
|
||||||
def setCurrentFile(self, fileName):
|
def setCurrentFile(self, fileName):
|
||||||
self.currentFileName = unicode(fileName)
|
self.currentFileName = fileName
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
self.ui.fileNameLabel.setText("<b>[ new ]</b>")
|
self.ui.fileNameLabel.setText("<b>[ new ]</b>")
|
||||||
else:
|
else:
|
||||||
|
@ -374,7 +374,7 @@ class Node(QtCore.QObject):
|
|||||||
pos = self.graphicsItem().pos()
|
pos = self.graphicsItem().pos()
|
||||||
state = {'pos': (pos.x(), pos.y()), 'bypass': self.isBypassed()}
|
state = {'pos': (pos.x(), pos.y()), 'bypass': self.isBypassed()}
|
||||||
termsEditable = self._allowAddInput | self._allowAddOutput
|
termsEditable = self._allowAddInput | self._allowAddOutput
|
||||||
for term in self._inputs.values() + self._outputs.values():
|
for term in list(self._inputs.values()) + list(self._outputs.values()):
|
||||||
termsEditable |= term._renamable | term._removable | term._multiable
|
termsEditable |= term._renamable | term._removable | term._multiable
|
||||||
if termsEditable:
|
if termsEditable:
|
||||||
state['terminals'] = self.saveTerminals()
|
state['terminals'] = self.saveTerminals()
|
||||||
|
Loading…
Reference in New Issue
Block a user