Package pyraf :: Module GkiMpl :: Class GkiMplKernel
[hide private]
[frames] | no frames]

Class GkiMplKernel

source code


matplotlib graphics kernel implementation

Instance Methods [hide private]
 
makeGWidget(self, width=600, height=420)
Make the graphics widget.
source code
 
getAdjustedHeight(self)
Calculate an adjusted height to make the plot look better in the widget's viewfield - otherwise the graphics are too close to the top of the window.
source code
 
getTextPointSize(self, gkiTextScaleFactor, winWidth, winHeight)
Make a decision on the best font size (point) based on the size of the graphics window and other factors
source code
 
clearMplData(self)
Clear all lines, patches, text, etc.
source code
 
resizeGraphics(self, width, height)
It is time to set a magnitude to our currently normalized lines, and send them to the figure.
source code
 
gcur(self)
Return cursor value after key is typed
source code
 
gcurTerminate(self, msg='Window destroyed by user')
Terminate active gcur and set EOF flag
source code
 
pre_imcur(self)
Override this so as to redraw if needed
source code
 
taskStart(self, name)
Because of redirection, this is not always called on the first plot but it should be called for every successive one.
source code
 
taskDone(self, name)
Called when a task is finished
source code
 
update(self)
Update for all Tk events.
source code
 
doubleRedrawHack(self)
This is a hack to prevent the double redraw on first plots.
source code
 
prepareToRedraw(self)
This is a hook for things that need to be done before the redraw from metacode.
source code
 
getHistory(self)
Additional information for page history
source code
 
setHistory(self, info)
Restore using additional information from page history
source code
 
startNewPage(self)
Setup for new page
source code
 
clearPage(self)
Clear buffer for new page
source code
 
isPageBlank(self)
Returns true if this page is blank
source code
 
activate(self)
Not really needed for Tkplot widgets (used to set OpenGL win)
source code
 
incrPlot(self)
Plot any new commands in the buffer
source code
 
_plotAppend(self, plot_function, *args)
Append a 2-tuple (plot_function, args) to the draw buffer
source code
 
gki_clearws(self, arg) source code
 
gki_cancel(self, arg) source code
 
gki_flush(self, arg, force=False)
Asked to render current plot immediately.
source code
 
gki_polyline(self, arg)
Instructed to draw a GKI polyline
source code
 
gki_polymarker(self, arg)
Instructed to draw a GKI polymarker.
source code
 
calculateMplTextAngle(self, charUp, textPath)
From the given GKI charUp and textPath values, calculate the rotation angle to be used for text.
source code
 
gki_text(self, arg)
Instructed to draw some GKI text
source code
 
gki_fillarea(self, arg)
Instructed to draw a GKI fillarea
source code
 
gki_putcellarray(self, arg) source code
 
gki_setcursor(self, arg) source code
 
gki_plset(self, arg) source code
 
gki_pmset(self, arg) source code
 
gki_txset(self, arg) source code
 
gki_faset(self, arg) source code
 
gki_getcursor(self, arg) source code
 
gki_getcellarray(self, arg) source code
 
gki_unknown(self, arg) source code
 
gRedraw(self) source code
 
redraw(self, o=None)
Redraw for expose or resize events, also called when page menu is used.
source code

Inherited from gkitkbase.GkiInteractiveTkBase: __init__, backPage, clear, control_clearws, control_closews, control_deactivatews, control_getwcs, control_openws, control_reactivatews, control_setwcs, createNewWindow, deleteAllPlots, deletePlot, doprint, editMenuInit, errorMessage, firstPage, flush, focusOnGwidget, forceFocus, getHelp, getWindowID, getWindowName, gki_setwcs, gwdestroy, hasFocus, iconify, lastPage, load, makeEditMenu, makeFileMenu, makeHelpMenu, makeMenuBar, makePageMenu, makeStatus, makeWindowMenu, nextPage, pageMenuInit, raiseWindow, save, saveCursorPos, setCursorColor, setDrawingColor, translate, windowMenuInit

Inherited from gkitkbase.GkiInteractiveTkBase (private): _setPageVar

Inherited from gki.GkiKernel: append, clearReturnData, control, createFunctionTables, getBuffer, getStderr, getStdin, getStdout, popStdio, preferTtyIpc, pushStdio, redoN, redrawOriginal, undoN

Class Variables [hide private]

Inherited from gkitkbase.GkiInteractiveTkBase: MAX_ERROR_COUNT

Inherited from gkitkbase.GkiInteractiveTkBase (private): _controlOps

Method Details [hide private]

makeGWidget(self, width=600, height=420)

source code 

Make the graphics widget. Also perform some self init.

getAdjustedHeight(self)

source code 

Calculate an adjusted height to make the plot look better in the widget's viewfield - otherwise the graphics are too close to the top of the window. Use in place of self.__ysz

clearMplData(self)

source code 

Clear all lines, patches, text, etc. from the figure as well as any of our own copies we may be keeping around to facilitate redraws/resizes/etc. of the figure.

resizeGraphics(self, width, height)

source code 

It is time to set a magnitude to our currently normalized lines, and send them to the figure. Here we assume that __normLines & __normPatches are already fully populated.

gcur(self)

source code 

Return cursor value after key is typed

Overrides: gki.GkiKernel.gcur

pre_imcur(self)

source code 

Override this so as to redraw if needed

Overrides: gki.GkiKernel.pre_imcur

taskStart(self, name)

source code 

Because of redirection, this is not always called on the first plot but it should be called for every successive one.

Overrides: gki.GkiKernel.taskStart

taskDone(self, name)

source code 

Called when a task is finished

Overrides: gki.GkiKernel.taskDone

update(self)

source code 

Update for all Tk events. This should not be called unless necessary since it can cause double redraws. It is used in the imcur task to allow window resize (configure) events to be caught while a task is running. Possibly it should be called during long-running tasks too, but that will probably lead to more extra redraws

prepareToRedraw(self)

source code 

This is a hook for things that need to be done before the redraw from metacode. We'll simply clear drawBuffer.

Overrides: gki.GkiKernel.prepareToRedraw

activate(self)

source code 

Not really needed for Tkplot widgets (used to set OpenGL win)

Overrides: gkitkbase.GkiInteractiveTkBase.activate

gki_flush(self, arg, force=False)

source code 

Asked to render current plot immediately. Also used by redraw(). NOTE: This is called multiple times (~8) for a single prow call. There is a performance improvement gained by skipping the resize calculation between taskStart() and taskDone(). This class adds the 'force' arg which forces it to redraw once whether we are "saving draws" or not.

gki_polymarker(self, arg)

source code 

Instructed to draw a GKI polymarker. IRAF only implements points for polymarker, so that makes it simple.

calculateMplTextAngle(self, charUp, textPath)

source code 

From the given GKI charUp and textPath values, calculate the rotation angle to be used for text. Oddly, it seems that textPath and charUp both serve similar purposes, so we will have to look at them both in order to figure the rotation angle. One might have assumed that textPath could have meant "L to R" vs. "R to L", but that does not seem to be the case - it seems to be rotation angle.

redraw(self, o=None)

source code 

Redraw for expose or resize events, also called when page menu is used. This method generally should not be called directly -- call gwidget.tkRedraw() instead since it does some other preparations.