Esempio n. 1
0
 def _saveAsPostSave_Hook(self, fnameToBeUsed):
     """ Override this to notify irafpar. """
     # Notify irafpar that there is a new special-purpose file on the scene
     irafpar.newSpecialParFile(self.taskName, self.pkgName, fnameToBeUsed)
Esempio n. 2
0
    def save_as(self):
        """ Save the parameter settings to a user-specified file.  Any
        changes here must be coordinated with the corresponding epar saveAs
        function. """

        # The user wishes to save to a different name.
        fname = self.select_file(
                "Save parameter values to which file?", overwriteCheck=True)

        # Now save the parameters
        if fname == None:
            msg = "Parameters NOT saved to a file."
            okdlg = urwutil.DialogDisplay(msg, 8, 0)
            okdlg.add_buttons([ ("OK",0) ])
            okdlg.main()
            return

        # Tpar apparently does nothing with children (PSETs), so skip the
        # check or set or save of them

        # Notify them that pset children will not be saved as part of
        # their special version
        pars = []
        for par in self.paramList:
            if par.type == "pset": pars.append(par.name)
        if len(pars):
            msg = "If you have made any changes to the PSET "+ \
                  "values for:\n\n"
            for p in pars: msg += "     "+p+"\n"
            msg = msg+"\nthose changes will NOT be explicitly saved to:"+ \
                  '\n\n"'+fname+'"'
            # title='PSET Save-As Not Yet Supported
            okdlg = urwutil.DialogDisplay(msg, 0, 0)
            okdlg.add_buttons([ ("OK",0) ])
            okdlg.main()

        # Verify all the entries (without save), keeping track of the invalid
        # entries which have been reset to their original input values
        self.badEntriesList = self.check_set_save_entries(False)

        # If there were invalid entries, prepare the message dialog
        ansOKCANCEL = True
        if self.badEntriesList:
            ansOKCANCEL = self.process_bad_entries(self.badEntriesList,
                                                   self.taskName)
        if not ansOKCANCEL:
            return # should we tell them we are not saving ?

        # If there were no invalid entries or the user said OK, finally
        # save to their stated file.  Since we have already processed the
        # bad entries, there should be none returned.
        mstr = "TASKMETA: task="+self.taskName+" package="+self.pkgName
        if self.check_set_save_entries(doSave=True, filename=fname, \
                                       comment=mstr):
            raise Exception("Unexpected bad entries for: "+self.taskName)

        # Let them know what they just did
        msg = 'Saved to: "'+fname+'"'
        okdlg = urwutil.DialogDisplay(msg, 8, 0)
        okdlg.add_buttons([ ("OK",0) ])
        okdlg.main()

        # Notify irafpar that there is a new special-purpose file on the scene
        irafpar.newSpecialParFile(self.taskName, self.pkgName, fname)
Esempio n. 3
0
    def save_as(self):
        """ Save the parameter settings to a user-specified file.  Any
        changes here must be coordinated with the corresponding epar saveAs
        function. """

        # The user wishes to save to a different name.
        fname = self.select_file("Save parameter values to which file?",
                                 overwriteCheck=True)

        # Now save the parameters
        if fname == None:
            msg = "Parameters NOT saved to a file."
            okdlg = urwutil.DialogDisplay(msg, 8, 0)
            okdlg.add_buttons([("OK", 0)])
            okdlg.main()
            return

        # Tpar apparently does nothing with children (PSETs), so skip the
        # check or set or save of them

        # Notify them that pset children will not be saved as part of
        # their special version
        pars = []
        for par in self.paramList:
            if par.type == "pset": pars.append(par.name)
        if len(pars):
            msg = "If you have made any changes to the PSET "+ \
                  "values for:\n\n"
            for p in pars:
                msg += "     " + p + "\n"
            msg = msg+"\nthose changes will NOT be explicitly saved to:"+ \
                  '\n\n"'+fname+'"'
            # title='PSET Save-As Not Yet Supported
            okdlg = urwutil.DialogDisplay(msg, 0, 0)
            okdlg.add_buttons([("OK", 0)])
            okdlg.main()

        # Verify all the entries (without save), keeping track of the invalid
        # entries which have been reset to their original input values
        self.badEntriesList = self.check_set_save_entries(False)

        # If there were invalid entries, prepare the message dialog
        ansOKCANCEL = True
        if self.badEntriesList:
            ansOKCANCEL = self.process_bad_entries(self.badEntriesList,
                                                   self.taskName)
        if not ansOKCANCEL:
            return  # should we tell them we are not saving ?

        # If there were no invalid entries or the user said OK, finally
        # save to their stated file.  Since we have already processed the
        # bad entries, there should be none returned.
        mstr = "TASKMETA: task=" + self.taskName + " package=" + self.pkgName
        if self.check_set_save_entries(doSave=True, filename=fname, \
                                       comment=mstr):
            raise Exception("Unexpected bad entries for: " + self.taskName)

        # Let them know what they just did
        msg = 'Saved to: "' + fname + '"'
        okdlg = urwutil.DialogDisplay(msg, 8, 0)
        okdlg.add_buttons([("OK", 0)])
        okdlg.main()

        # Notify irafpar that there is a new special-purpose file on the scene
        irafpar.newSpecialParFile(self.taskName, self.pkgName, fname)