8tJc@ sdZddklZddkZddkZddkZddkZddkl Z ddk Zddk Z ddk l Z l Z ddklZddklZlZlZlZlZlZddklZdd klZddkiZdd klZddkZddk Z ei!a"d Z#d Z$hei%ei&6ei'ei(6ei)ei*6ei+ei,6Z-hd ei.6d ei/6dei06dei16dei06dei16dd6dd6Z2ddZ4dZ5dZ6dZ7e8e7_9dZ:dei;fdYZ<de fdYZ=dZ>defdYZ?dd,dYZ@d ZAd!ZBd"ZCd#d-d$YZDd%d.d&YZEd'ZFd(ZGd)ZHd*efd+YZIe?ZJdS(/s A backend for FLTK Copyright: Gregory Lielens, Free Field Technologies SA and John D. Hunter 2004 This code is released under the matplotlib license i(tdivisionN(tFigureCanvasAgg(trcParamstverbose(tis_string_like(t RendererBasetGraphicsContextBasetFigureManagerBasetFigureCanvasBasetNavigationToolbar2tcursors(tFigure(tGcf(t SubplotToolcC sFtido-x/totiitidqWndGHdS(Nig{Gzt?sfl loop already running(t Fl_runningtacquiretTruetFltktFltcheckttimetsleep(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytFltk_run_interactive$s  iKtshifttcontroltwiniicC sti|dS(N(Rt fl_message(tmsgtparent((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyterror_msg_fltkDscC s?tio.ti}|dj o|iiq;ndS(N(t matplotlibtis_interactiveR t get_activetNonetcanvastdraw(t figManager((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytdraw_if_interactiveHs   cC sLxtiD]}|iq Wtiotitdntt_dS(s Show all the figures and enter the fltk mainloop in another thread This allows to keep hand in interractive python session Warning: does not work under windows This should be the last line of your script N((R tget_all_fig_managerstshowt _needmaintthreadtstart_new_threadRtFalse(tmanager((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytishowOs   cC sIxtiD]}|iq Wtiotiitt_ndS(sk Show all the figures and enter the fltk mainloop This should be the last line of your script N(R R&R'R(RRtrunR+(R,((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR'\s    cO s|idt}|||}tidddd}t|}|i|i|it|||}t i o|in|S(s. Create a new figure manager instance t FigureClassi i( tpopR RtFl_Double_WindowtFigureCanvasFltkAggtendR't make_currenttFigureManagerFltkAggRR(tnumtargstkwargsR/tfiguretwindowR"R$((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytnew_figure_managerms     t FltkCanvascB s/eZdZdZddZdZRS(cC sPtii|dd||d||_d|_t|_d|_d|_ dS(NiR"(NN( Rt Fl_Widgett__init__t_sourceR!t_oldsizeR+t _draw_overlayt_buttont_key(tselftxtytwthtltsource((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>s     cC s|i|if}|i|jo*||_|ii||iin|iiii\}}}}t i |ii ddddt |t |dd|i dS(Nii(RGRHR@R?tresizeR#R9tbboxtboundsRt fl_draw_imaget buffer_rgbatinttredraw(RDtnewsizett1tt2RGRH((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR#s :c C s|djo"|iiii\}}}}n4|iiii\}}}} |i\}}}}t|t|} } ti|ii| | | | t|t|dt|ddS(Ni( R!R?R9RLRMRPRRNRO( RDRLRSRTRGRHtt1ott2otwothoRERF((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytblits  "cC satii}tii}|iiii|}|tijp|ti jodS|ti jontii }|djot ||_ n%yt||_ Wnd|_ nXti|i|i dS|tijo#ti|i|i d|_ nT|tijo|iitiio d|_nDtiio d|_n'tiio d|_n d|_|io||_||_ntiio!ti|i|||idSti|i|||idSn_|ti jo|i!dS|ti"jodS|ti#joti$|i||dS|ti%jo|ii|ioXtii|i|_&tii|i|_'ti(|i|i|i&|i'nti$|i||dS|ti)joR|ii|ioti*nti+|i|||id|_dSdS(Niiiii(,RRtevent_xtevent_yR?R9RLtheighttFL_FOCUSt FL_UNFOCUSt FL_KEYDOWNt event_keytchrRCt special_keyR!Rtkey_press_eventtFL_KEYUPtkey_release_eventtFL_PUSHR:R4t event_button1RBt event_button2t event_button3RAt_oldxt_oldyt event_clickstbutton_press_eventtFL_ENTERt take_focustFL_LEAVEtFL_MOVEtmotion_notify_eventtFL_DRAGt_dxt_dytfl_overlay_rectt FL_RELEASEtfl_overlay_cleartbutton_release_event(RDteventRERFtyftikey((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pythandlesv             &  N(t__name__t __module__R>R#R!RYR}(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR<s R2cB skeZdZdZdZdZeZdZdZe i i e_ dZ e i i e _ RS(cC sfti|||iii\}}}}t|t|}}tdd||d||_dS(NiR"(RR>R9RLRMRPR<R"(RDR9RSRTRGRH((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>scC sC|\}}|ii}||}||}|ii||dS(N(R9tdpitset_size_inches(RDtsizeRGRHtdpivaltwinchthinch((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRKs     cC sti||iidS(N(RR#R"RQ(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR#s cC s|ii|dS(N(R"RY(RDRL((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRYscC s|iS(N(R"(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytwidgetscC sti||dS(N(Rtstart_event_loop_default(RDttimeout((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytstart_event_loopscC sti|dS(N(Rtstop_event_loop_default(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytstop_event_loops(R~RR>RKR#RYR'RRRRt__doc__RR(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR2s       cC s!|iiti|idS(N(R:thideR tdestroyt_num(tptrtfigman((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytdestroy_figures R5cB s2eZdZdZdZdZdZRS(s Public attributes canvas : The FigureCanvas instance num : The Figure number toolbar : The fltk.Toolbar window : The fltk.Window c  sti|||iii\}}}}t|t|}}|_ii||dd|_ii iii ddii t |_ |_tiddjot|_n4tiddjot|_n d_ii|iio*iiiiiiniifd}i ii|dS( Nis Figure %di^ittoolbartclassicttoolbar2c s%idjoiindS(s8this will be called whenever the current axes is changedN(RR!tupdate(tfig(RD(sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytnotify_axes_change)s(RR>R9RLRMRPR:Rt window_titletlabelt size_rangetcallbackRR"RRRtNavigationToolbarRtNavigationToolbar2FltkAggR!t add_resizableRtaddRR'tadd_axobserver( RDR"R6R:RSRTRGRHR((RDsI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>s.       cC s*|i|i}}|iid|dS(Ntwidth(RR\Rt configure(RDRzRR\((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRK.scC s*ti}|ii|iidS(N(t windowingt FocusManagerR"R#R:RQ(RDt_focus((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR'2s  cC s||_|ii|dS(N(RR:R(RDttitle((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytset_window_title7s (R~RRR>RKR'R(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR5s    tAxisMenucB s,eZdZdZdZdZRS(cC s*||_|i|_tiddddd|_|iiddt|d|iiddt|ti g|_ g|_ xUt |iD]D}|i i d|d|ii|i |dt|tiqWxKt |iD]:}|i i |ii|i ||i |iqWdS( Nii2i tAxess Select Alls Invert AllsAxis %di(Rtnaxest_naxesRtFl_Menu_Buttont_mbuttonRt select_allt invert_alltFL_MENU_DIVIDERt _axis_txtt _axis_vartrangetappendt set_activetFL_MENU_TOGGLEt find_itemtset(RDRti((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR><s    *#cC so|i|joxXt|i|D]D}|iid|d|ii|i|dt|tiq#Wxt|i|D]:}|i i|ii |i||i |i q~Wn|i|jox9t|id|ddD]}|ii |dqW|o,|i |d |_ |i|d |_qUg|_ g|_n||_td|dS(NsAxis %diiii( RRRRRRRRRRRRtremove(RDRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytadjustJs(*#   cC s|iS(N(R(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR^scC sLg}tt|iD]%}|i|io ||qq~}|S(N(RtlenRtvalue(RDt_[1]Rta((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyt get_indicesasH(R~RR>RRR(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR;s   cC s|ii|idS(N(RRR(Rtamenu((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRescC s@x,|iD]!}|ip|iq q Wt||dS(N(RRRR(RRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRhs   cC s/x|iD]}|iq Wt||dS(N(RRR(RRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRms t FLTKButtoncB seZddZdZRS(RcC stiitdd|}ti||_d}|djo2tidd|d|_|ii ti n|djo2ti dd|d|_|ii ti n|djo6ti dd|d d|_|ii ti nf|d joXti dd|d|_|ii ti |iiti|iitin|d |_|ii|i|ii|||ii|i|ii|i||_dS( Ntdatapathtimagesitrepeatii Rtlightitpushedt (tostpathtjoinRRt Fl_PNM_ImagetimtFl_Repeat_ButtontbtboxtFL_THIN_UP_BOXt Fl_ButtontFl_Light_Buttont FL_UP_BOXtdown_boxt FL_DOWN_BOXttypetFL_TOGGLE_BUTTONt tooltiptextttooltipRtimagetdeimage(RDttexttfiletcommandtargumentRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>ss.     cC s|iS(N(R(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs(R~RR>R(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRrs RcB s;eZdZdZdZdZdZdZRS(sq Public attriubutes canvas - the FigureCanvas (FigureCanvasFltkAgg = customised fltk.Widget) c C s||_||_tiitiddtiid|_|ii|i i i \}}}}t |t |}}ti d|ddd|_|iiti|ii i|_t|i|_td||_td d d d d td|ddfdd|_td dd dd td|ddfdd|_td dd dd td|ddfdd|_td dd dd td|ddfdd|_td dd dd td|ddfdd|_td dd dd td|ddfdd|_td dd dd td|ddfdd|_ td d d dd td|ddfdd|_!td d!d d"d t"d||_#|ii$dS(#Nt.t*s Save FigureiiiiRRtLeftRsstock_left.ppmRRiRERRtRightsstock_right.ppmitZoomInXsstock_zoom-in.ppmtZoomOutXsstock_zoom-out.ppmtUps stock_up.ppmRFtDownsstock_down.ppmtZoomInYtZoomOutYtSavesstock_save_as.ppm(%R"RRt Fl_File_Icontload_system_iconstFl_File_ChoosertCREATEt_fcRR9RLRMRPtFl_Packt_groupRt FL_HORIZONTALtaxest_axesRRRtomenuRtpantbLefttbRighttzoomtbZoomInXt bZoomOutXtbUptbDowntbZoomInYt bZoomOutYt save_figuretbSaveR3(RDR"RRSRTRGRH((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>sP   !  ! ! ! ! ! ! ! ! cC s|iS(N(R(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRscC sti|iidS(N(R RRR(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytclosescC s;||_g}|iD]}||i|q~|_dS(N(t_indRt_active(RDtindRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs cC s5|iii|_t|i}|ii|dS(N(R"R9RRRRR(RDR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs(R~RRR>RRRR(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs  7   cC s_|\}}}x<|iD]1}|djo|i|q|i|qW|iidS(NRE(RtpanxtpanyRR'(Rtargtbaset directiontaxeR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs  cC s_|\}}}x<|iD]1}|djo|i|q|i|qW|iidS(NRE(RtzoomxtzoomyRR'(RR R R R R((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs  c C s|ii}|ii}|i}|id}g}xTt|D]F\}\}} d| |f} |i| ||jo |}qMqMWdi|}|i} | i || i || i x| i ot iiqWd} | ioD| iddjo.d} t i| d| id\} } n| djodStii| }| i||| i d}y|ii| d|WnGtj o;}ditt|}d| |f}t|nXdS( Nis %s (*.%s)s titformats s$Failed to save %s: Error msg was %s(R"tget_supported_filetypestget_default_filetypetitemstsortt enumerateRRRtfiltert filter_valueR'tvisibleRRtwaitR!tcountRtfl_filename_absoluteRRtdirnamet directoryt print_figuretIOErrortmaptstrR(RR t filetypestdefault_filetypetsorted_filetypestselected_filtertfiltersRtexttnameRt file_choosertfnametstatustlastDirRRterr((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRsH          #(   RcB szeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( sd Public attriubutes canvas - the FigureCanvas figman - the Figure manager cC s8||_||_ti||t|_t|_dS(N(R"RR R>R+t pan_selectedt zoom_selected(RDR"R((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR>$s    cC s!tit|titidS(N(Rt fl_cursortcursordtFL_BLACKtFL_WHITE(RDtcursor((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyt set_cursor+scC s|iidS(N(R"R#(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytdynamic_update.scG s|i |_t|_t|ii_|io|iiidn|iiid|io|iiidn|iiidt i ||dS(Nii( R/R+R0R"RAtbPanRRtbZoomR R(RDR7((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR1s    cG s|i |_|i|ii_t|_|io|iiidn|iiid|io|iiidn|iiidt i ||dS(Nii( R0R"RAR+R/R8RRR9R R(RDR7((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyR?s    cG sztidddd}tdd }t|}|i|iddt|ii|}|i |i dS( Nidiitfigsizeiittopg?(ii( RR1R R2R3tsubplots_adjustR R"R9R'(RDR7R:ttoolfigR"ttool((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pytconfigure_subplotsMs   c C sCtiitiddtiid|_|ii|iii i \}}}}t |t |}}ti d|ddd|_ |i iti|iii|_t|i|_td||_td d d d d |id||_td dd dd |id||_td dd dd |id||_td dd dd |id|dd|_td dd dd |id|dd|_ td dd dd |i!d|dd|_"td dd dd t#d||_$|i i%ti&dd|d|_'|i i(|i'|i)dS(NRRs Save FigureiiiiRRtHomeRshome.ppmRRtBacksback.ppmtForwards forward.ppmsPan/Zoomsmove.ppmRRsZoom to rectangleszoom_to_rect.ppmsConfigure Subplotss subplots.ppmRs filesave.ppmi(*RRRRRRRR"R9RLRMRPRRRRRRRRRRRthometbHometbacktbBacktforwardtbForwardRR8RR9R?tbsubplotRRR3t Fl_OutputtmessageRR(RDRSRTRGRH((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyt _init_toolbarWsD !        cC s|iS(N(R(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRscC sti|iidS(N(R RRR(RD((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRscC s;||_g}|iD]}||i|q~|_dS(N(RRR(RDRRR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs cC sB|iii|_t|i}|ii|ti|dS(N( R"R9RRRRRR R(RDR((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRscC s|ii|dS(N(RKR(RDts((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyt set_messages(R~RRR>R6R7RRR?RLRRRRRN(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyRs      ,    ((((KRt __future__RRtsystmathtfltkRt backend_aggRtos.pathRRRtmatplotlib.cbookRtmatplotlib.backend_basesRRRRR R tmatplotlib.figureR tmatplotlib._pylab_helpersR tmatplotlib.windowingRtmatplotlib.widgetsR R)Rt allocate_lockRRtPIXELS_PER_INCHtFL_CURSOR_HANDtHANDtFL_CURSOR_ARROWtPOINTERtFL_CURSOR_CROSSt SELECT_REGIONtFL_CURSOR_MOVEtMOVER2t FL_Shift_Rt FL_Shift_Lt FL_Control_Rt FL_Control_LRbR!RR%R-R'RR(R;R=R<R2RR5RRRRRRRRRRt FigureManager(((sI/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_fltkagg.pyt sh$   .                 `$ 4*   O )}