Exemplo n.º 1
0
    def closeEvent(self, ce):
        if self.saveBeforeClose():
            self.clear()
            ce.accept()
        else:
            ce.ignore()
            return

        QWidget.closeEvent(self, ce)
        orngHistory.logCloseSchema(self.schemaID)
Exemplo n.º 2
0
 def closeEvent(self, ce):
     if self.saveBeforeClose():
         self.clear()
         ce.accept()
     else:
         ce.ignore()
         return
         
     QWidget.closeEvent(self, ce)
     orngHistory.logCloseSchema(self.schemaID)
Exemplo n.º 3
0
    def closeEvent(self, ce):
        newSettings = self.loadedSettingsDict and self.loadedSettingsDict != dict(
            [(widget.caption, widget.instance.saveSettingsStr())
             for widget in self.widgets])

        self.synchronizeContexts()
        #if self.canvasDlg.settings["autoSaveSchemasOnClose"] and self.widgets != []:
        if self.widgets != []:
            self.save(
                os.path.join(self.canvasDlg.canvasSettingsDir,
                             "lastSchema.tmp"))

        if self.canvasDlg.settings["dontAskBeforeClose"]:
            if newSettings and self.schemaName != "":
                self.save()
            self.clear()
            self.removeTempDoc()
            ce.accept()
        else:
            res = QMessageBox.question(self, 'Orange Canvas',
                                       'Do you wish to save the schema?',
                                       QMessageBox.Yes, QMessageBox.No,
                                       QMessageBox.Cancel)
            if res == QMessageBox.Yes:
                self.saveDocument()
                ce.accept()
                self.clear()
            elif res == QMessageBox.No:
                self.clear()
                self.removeTempDoc()
                ce.accept()
            else:
                ce.ignore(
                )  # we pressed cancel - we don't want to close the document
                return

        QWidget.closeEvent(self, ce)
        orngHistory.logCloseSchema(self.schemaID)