示例#1
0
 def _showOpenButton(self):
     """ Override this so that we can use rules in irafpar. """
     # See if there exist any special versions on disk to load
     # Note that irafpar caches the list of these versions
     return irafpar.haveSpecialVersions(self.taskName, self.pkgName)
示例#2
0
    def __init__(self,  taskName):

        MODE_KEYS_EMACS = [ "esc"]

        MODE_KEYS_VI = ["esc", "tab",
                        "ctrl u", "ctrl U",
                        "ctrl t", "ctrl T"]

        TPAR_BINDINGS = {  # Page level bindings
                          "quit"   : self.QUIT,
                          "exit "  : self.EXIT,
                          "help"   : self.HELP,
                          "end" : self.MOVE_END,
                          "home" : self.MOVE_START,
                         }

        # Get the Iraftask object
        if isinstance(taskName, irafpar.IrafParList):
            # IrafParList acts as an IrafTask for our purposes
            self.taskObject = taskName
        else:
            # taskName must be a string or an IrafTask object
            self.taskObject = iraf.getTask(taskName)

        # Now go back and ensure we have the full taskname
        self.taskName = self.taskObject.getName()
        self.pkgName = self.taskObject.getPkgname()
        self.paramList = self.taskObject.getParList(docopy=1)

        # See if there exist any special versions on disk to load
        self.__areAnyToLoad = irafpar.haveSpecialVersions(self.taskName,
                              self.pkgName) # irafpar caches them

        # Ignore the last parameter which is $nargs
        self.numParams = len(self.paramList) - 1

        # Get default parameter values for unlearn
        self.get_default_param_list()
        self.make_entries()

        self.escape = False

        if URWID_PRE_9P9:
            self._createButtonsOld()
        else:
            self._createButtons()


        self.colon_edit = PyrafEdit("", "", wrap="clip", align="left", inform=self.inform)
        self.listitems = [urwid.Divider(" ")] + self.entryNo + \
                         [urwid.Divider(" "), self.colon_edit,
                          self.buttons]
        self.listbox = urwid.ListBox( self.listitems )

        self.listbox.set_focus(1)
        self.footer = urwid.Text("")
        self.header = TparHeader(self.pkgName, self.taskName)

        self.view = urwid.Frame(
                                self.listbox,
                                header=self.header,
                                footer=self.footer)

        self._editor = iraf.envget("editor")
        BINDINGS = {}
        BINDINGS.update(TPAR_BINDINGS)
        if self._editor == "vi":
            BINDINGS.update(TPAR_BINDINGS_VI)
            MODE_KEYS = MODE_KEYS_VI
        else:
            BINDINGS.update(TPAR_BINDINGS_EMACS)
            MODE_KEYS = MODE_KEYS_EMACS
        Binder.__init__(self, BINDINGS, self.inform, MODE_KEYS)
示例#3
0
文件: tpar.py 项目: rendinam/pyraf
    def __init__(self, taskName):

        MODE_KEYS_EMACS = ["esc"]

        MODE_KEYS_VI = ["esc", "tab", "ctrl u", "ctrl U", "ctrl t", "ctrl T"]

        TPAR_BINDINGS = {  # Page level bindings
                          "quit"   : self.QUIT,
                          "exit "  : self.EXIT,
                          "help"   : self.HELP,
                          "end" : self.MOVE_END,
                          "home" : self.MOVE_START,
                         }

        # Get the Iraftask object
        if isinstance(taskName, irafpar.IrafParList):
            # IrafParList acts as an IrafTask for our purposes
            self.taskObject = taskName
        else:
            # taskName must be a string or an IrafTask object
            self.taskObject = iraf.getTask(taskName)

        # Now go back and ensure we have the full taskname
        self.taskName = self.taskObject.getName()
        self.pkgName = self.taskObject.getPkgname()
        self.paramList = self.taskObject.getParList(docopy=1)

        # See if there exist any special versions on disk to load
        self.__areAnyToLoad = irafpar.haveSpecialVersions(
            self.taskName, self.pkgName)  # irafpar caches them

        # Ignore the last parameter which is $nargs
        self.numParams = len(self.paramList) - 1

        # Get default parameter values for unlearn
        self.get_default_param_list()
        self.make_entries()

        self.escape = False

        if URWID_PRE_9P9:
            self._createButtonsOld()
        else:
            self._createButtons()

        self.colon_edit = PyrafEdit("",
                                    "",
                                    wrap="clip",
                                    align="left",
                                    inform=self.inform)
        self.listitems = [urwid.Divider(" ")] + self.entryNo + \
                         [urwid.Divider(" "), self.colon_edit,
                          self.buttons]
        self.listbox = urwid.ListBox(self.listitems)

        self.listbox.set_focus(1)
        self.footer = urwid.Text("")
        self.header = TparHeader(self.pkgName, self.taskName)

        self.view = urwid.Frame(self.listbox,
                                header=self.header,
                                footer=self.footer)

        self._editor = iraf.envget("editor")
        BINDINGS = {}
        BINDINGS.update(TPAR_BINDINGS)
        if self._editor == "vi":
            BINDINGS.update(TPAR_BINDINGS_VI)
            MODE_KEYS = MODE_KEYS_VI
        else:
            BINDINGS.update(TPAR_BINDINGS_EMACS)
            MODE_KEYS = MODE_KEYS_EMACS
        Binder.__init__(self, BINDINGS, self.inform, MODE_KEYS)