Beispiel #1
0
    def openFile(self):
        fname = self.filename
        try:
            os.remove(fname + '.py')
        except:
            pass
        if self.modified:
            ret = self.askSaving()
            if ret == QMessageBox.Save:
                self.saveFile()
            elif ret == QMessageBox.Cancel:
                return
            self.scene.newDgm()

        filename = QFileDialog.getOpenFileName(self,
                                               'Open',
                                               '.',
                                               filter='*.dgm')
        filename = filename[0]
        if filename != '':
            fname = QtCore.QFileInfo(filename)
            self.filename = str(fname.baseName())
            self.path = str(fname.absolutePath())
            self.setWindowTitle(self.filename)
            self.scene.loadDgm(self.getFullFileName())
            self.modified = False
Beispiel #2
0
 def saveFile(self):
     filename = QFileDialog.getSaveFileName(self,
                                            'Save',
                                            self.path + '/' + self.filename,
                                            filter='*.dgm')
     filename = filename[0]
     if filename != '':
         fname = QtCore.QFileInfo(filename)
         self.filename = str(fname.baseName())
         self.path = str(fname.absolutePath())
         self.setWindowTitle(self.filename)
         self.scene.saveDgm(self.getFullFileName())
         self.modified = False
Beispiel #3
0
    def __init__(self, filename='untitled', runflag=False):
        if filename != 'untitled':
            self.fname = QtCore.QFileInfo(filename)
            self.mypath = str(self.fname.absolutePath())
            self.fname = str(self.fname.baseName())
        else:
            self.fname = 'untitled'
            self.mypath = os.getcwd()
        self.runflag = runflag

        app = QApplication(sys.argv)
        library = Library()
        library.setGeometry(20, 20, 400, 980)
        library.show()
        main = SupsiSimMainWindow(library, self.fname, self.mypath,
                                  self.runflag)
        main.setGeometry(500, 100, 1024, 768)

        main.show()
        ret = app.exec_()
        app.deleteLater()