Esempio n. 1
0
 def control_getwcs(self, arg):
     if not self.wcs:
         self.wcs = irafgwcs.IrafGWcs()
     if self.returnData:
         self.returnData = self.returnData + self.wcs.pack()
     else:
         self.returnData = self.wcs.pack()
Esempio n. 2
0
    def clear(self, name=None):

        """Clear the plot and start a new page"""

        # don't create new plot if current plot is empty
        if not self.isPageBlank():
            # ignore any pending WCS changes
            self.wcs.clearPending()
            self.gkibuffer = self.gkibuffer.split()
            self.wcs = irafgwcs.IrafGWcs()
            self.startNewPage()
            if name is None:
                if gki.tasknameStack:
                    name = gki.tasknameStack[-1]
                else:
                    name = ""
            self.history.append(
                    (self.gkibuffer, self.wcs, name, self.getHistory()) )
            self.pageVar.set(len(self.history)-1)
            self.bttnVar.set(len(self.history)-1)
            self.StatusLine.write(text=" ")
            if self._toWriteAtNextClear and self.StatusLine:
                # Often clear() is called at the start of a task, and we (or
                # the derived class) may have requested some text be shown
                # right after the next possible clear().  Show and delete it.
                self.StatusLine.write(text=self._toWriteAtNextClear)
                self._toWriteAtNextClear = None
                # note - this will only be seen for interactive task starts
            self.flush()
        elif (self.history[-1][2] == "") and gki.tasknameStack:
            # plot is empty but so is name -- set name
            h = self.history[-1]
            self.history[-1] = h[0:2] + (gki.tasknameStack[-1],) + h[3:]
Esempio n. 3
0
 def control_setwcs(self, arg):
     self.wcs = irafgwcs.IrafGWcs(arg)
Esempio n. 4
0
    def __init__(self, windowName, manager):

        gki.GkiKernel.__init__(self)
        self.name = 'Tkplot'
        self._errorMessageCount = 0
        self._slowraise = 0
        self._toWriteAtNextClear = None
        self.irafGkiConfig = gki._irafGkiConfig
        self.windowName = windowName
        self.manager = manager

        # redraw table ignores control functions
        self.redrawFunctionTable = self.functionTable[:]
        for opcode in self._controlOps:
            self.redrawFunctionTable[opcode] = None

        # Create the root window as required, but hide it
        irafutils.init_tk_default_root()
        # note size is just an estimate that helps window manager place window
        self.top = TKNTR.Toplevel(visual='best',width=600,height=485)
        # Read the epar options database file
        optfile = "epar.optionDB"
        try:
            self.top.option_readfile(os.path.join(os.curdir,optfile))
        except TKNTR.TclError:
            try:
                self.top.option_readfile(os.path.join(userWorkingHome,optfile))
            except TKNTR.TclError:
                self.top.option_readfile(os.path.join(pyrafDir,optfile))
        self.top.title(windowName)
        self.top.iconname(windowName)
        self.top.protocol("WM_DELETE_WINDOW", self.gwdestroy)
        self.makeMenuBar()
        self.makeGWidget()
        self.makeStatus()
        self.gwidget.redraw = self.redraw
        self.gwidget.pack(side=TKNTR.TOP, expand=1, fill=TKNTR.BOTH)
        self.gwidget.bind('<Enter>', self.focusOnGwidget) # if mouse enters gw

        self.colorManager.setColors(self.gwidget)
        self.wcs = irafgwcs.IrafGWcs()
        self.linestyles = gki.IrafLineStyles()
        self.hatchfills = gki.IrafHatchFills()
        self.textAttributes = gki.TextAttributes()
        self.lineAttributes = gki.LineAttributes()
        self.fillAttributes = gki.FillAttributes()
        self.markerAttributes = gki.MarkerAttributes()

        self.StatusLine = gki.StatusLine(self.top.status, self.windowName)
        self.history = [(self.gkibuffer, self.wcs, "", self.getHistory())]
        self._currentPage = 0
        # Master page variable, pageVar, any change to it is watched & acted on
        self.pageVar = TKNTR.IntVar()
        self.pageVar.set(self._currentPage)
        # _setPageVar is callback for changes to pageVar
        self.pageVar.trace('w', self._setPageVar)
        # Also hold a var just for the # of the selected page button: bttnVar
        # This one causes no events when it is set!
        self.bttnVar = TKNTR.IntVar()
        self.bttnVar.set(0)
        windowID = self.gwidget.winfo_id()
        self.flush()
        if sys.platform != 'darwin': # this step is unneeded on OSX
            wutil.setBackingStore(windowID)
Esempio n. 5
0
 def control_setwcs(self, arg):
     self.wcs = irafgwcs.IrafGWcs(arg)
     # Need to store this in the (persistent) kernel
     kernel.wcs = self.wcs