Exemplo n.º 1
0
 def saveFile(self, fileName=None, startDir=None, suggestedFileName='flowchart.fc'):
     if fileName is None:
         if startDir is None:
             startDir = self.filePath
         if startDir is None:
             startDir = '.'
         self.fileDialog = pg.FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
         #self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
         self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) 
         #self.fileDialog.setDirectory(startDir)
         self.fileDialog.show()
         self.fileDialog.fileSelected.connect(self.saveFile)
         return
         #fileName = QtGui.QFileDialog.getSaveFileName(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
     configfile.writeConfigFile(self.saveState(), fileName)
     self.sigFileSaved.emit(fileName)
Exemplo n.º 2
0
 def loadFile(self, fileName=None, startDir=None):
     if fileName is None:
         if startDir is None:
             startDir = self.filePath
         if startDir is None:
             startDir = '.'
         self.fileDialog = pg.FileDialog(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
         #self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
         #self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) 
         self.fileDialog.show()
         self.fileDialog.fileSelected.connect(self.loadFile)
         return
         ## 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 = str(fileName)
     state = configfile.readConfigFile(fileName)
     self.restoreState(state, clear=True)
     self.viewBox.autoRange()
     #self.emit(QtCore.SIGNAL('fileLoaded'), fileName)
     self.sigFileLoaded.emit(fileName)
Exemplo n.º 3
0
 def open_folder_dialog(self, title, starting_dir=HOME_DIR):
     dirname = pg.FileDialog().getExistingDirectory(self, title, starting_dir)
     return dirname
Exemplo n.º 4
0
 def save_file_dialog(self, title, supported_exts, starting_dir=HOME_DIR):
     filename, _ = pg.FileDialog().getSaveFileName(self, title, starting_dir, supported_exts)
     return filename