Exemple #1
0
    def open_file(self):
        """Open data file"""
        try:
            for i in self.mainwidget.imagewidget.plot.items:
                if dwwidg.is_flag(i):
                    msgBox = QMessageBox()
                    msgBox.setText(
                        "There are not saved flags! Are you sure to discard them?"
                    )
                    msgBox.addButton(QMessageBox.Cancel)
                    msgBox.addButton(QMessageBox.Ok)
                    msgBox.setDefaultButton(QMessageBox.Cancel)
                    ret = msgBox.exec_()
                    if ret == QMessageBox.Cancel:
                        return -1
                    elif ret == QMessageBox.Ok:
                        break
        except:
            pass

        self.toolbar.clear()
        try:
            self.flag_toolbar.close()
        except:
            pass
        try:
            self._open_file()
        except:
            msgBox = QMessageBox()
            msgBox.setText("File structure not recognized!")
            msgBox.exec_()
            return -1
Exemple #2
0
 def close_dw(self):
     """Close DW"""
     try:
         for i in self.mainwidget.imagewidget.plot.items:
             if dwwidg.is_flag(i):
                 msgBox = QMessageBox()
                 msgBox.setText(
                     "There are not saved flags! Are you sure to discard them?"
                 )
                 msgBox.addButton(QMessageBox.Cancel)
                 msgBox.addButton(QMessageBox.Ok)
                 msgBox.setDefaultButton(QMessageBox.Cancel)
                 ret = msgBox.exec_()
                 if ret == QMessageBox.Cancel:
                     return -1
                 elif ret == QMessageBox.Ok:
                     break
         self.close()
     except:
         self.close()
Exemple #3
0
    def close_file(self):
        """Close data file"""
        for i in self.mainwidget.imagewidget.plot.items:
            if dwwidg.is_flag(i):
                msgBox = QMessageBox()
                msgBox.setText(
                    "There are not saved flags! Are you sure to discard them?")
                msgBox.addButton(QMessageBox.Cancel)
                msgBox.addButton(QMessageBox.Ok)
                msgBox.setDefaultButton(QMessageBox.Cancel)
                ret = msgBox.exec_()
                if ret == QMessageBox.Cancel:
                    return -1
                elif ret == QMessageBox.Ok:
                    break

        self.mainwidget.close()
        self.toolbar.clear()
        self.flag_toolbar.close()
        self.data.close()
        del self.data
        del self.mainwidget
        self.setWindowTitle(APP_NAME)
Exemple #4
0
    def fitfile(self):
        if self.fitc == None:
            msgBox = QMessageBox()
            msgBox.setText("Fit not yet executed!")
            msgBox.exec_()
            return -1

        msgBox = QMessageBox()
        msgBox.setText("Save correction file?")
        #msgBox.setInformativeText("A correction file will be saved in the root directory of the observation.")
        msgBox.addButton(QMessageBox.Cancel)
        msgBox.addButton(QMessageBox.Ok)
        msgBox.setDefaultButton(QMessageBox.Cancel)
        ret = msgBox.exec_()
        if ret != QMessageBox.Ok:
            return -1

        name = getsavefilename(self,
                               _("Save File"),
                               self.data_ref.dir_name + "/" + basename(
                                   normpath(self.data_ref.dir_name) + "_fit." +
                                   self.data_ref.files_type),
                               options=QFileDialog.DontConfirmOverwrite)
        if str(name[0]):
            if exists(str(name[0])):
                msgBox = QMessageBox()
                msgBox.setText("File exists!")
                msgBox.setInformativeText("Do you want to update it?")
                msgBox.addButton(QMessageBox.Cancel)
                msgBox.addButton(QMessageBox.Ok)
                msgBox.setDefaultButton(QMessageBox.Cancel)
                ret = msgBox.exec_()
                if ret != QMessageBox.Ok:
                    return -1

            self.data_ref.fitfile(str(name[0]), self.fitc)