from matplotlib.backend_bases import cursors
rcParams = matplotlib.rcParams
from matplotlib._pylab_helpers import Gcf
cursors.POINTER: "arrow",
cursors.SELECT_REGION: "tcross",
(1) Start the internal python interpreter...
and make the 'pylab' module from the main python/casapy namespace
visible inside it. ( done inside TPPlotter ) Note that 'pylab' is the
only module of casapy that is visible from this internal interpreter.
(2) figmanager = pl.get_current_fig_manager()
-> This gets a handle to the current window, canvas, toolbar.
(3) Create the python-C++ call-back module -> PyBind.
( description in tables/implement/TablePlot/PlotterGlobals.cc )
(3) TablePlotTkAgg.py implements a python class called 'PlotFlag'
which takes an instance of 'PyBind' and 'figmanager' and makes
the connection between the two.
- Additional buttons are placed in the toolbar, and their callbacks
defined to call methods of PyBind.
- The toolbar event-loop is captured - by explicitly disconnecting
previous bindings, and re-defining them for 'pan','zoom','mark-region'
modes. (need to do all three, to get them to interact properly with each other)
- Some Canvas events are also redefined to allow mark-region boxes to
automatically resize and move around, when the window is resized or
when in pan or zoom modes. ( This is needed to allow flagging with
(4) Back to the internal python interpreter. The following steps are carried out.
-> figmanager = pl.get_current_fig_manager()
-> from TablePlotTkagg import PlotFlag
-> pf = PlotFlag( PyBind )
-> pf.setup_custom_features( figmanager )
----> All binding is complete at this point.
----> All other logic is to ensure things like... make sure new buttons are
added only when needed... make sure they *are* added when needed... and
this has to keep up with the native TkAgg matplotlib backend's
whimsical decisions of when to create a new figure and when not to.
def __init__(self,PyBind):