qfc@sddlZddlZddlZddlZddlTddlZddlZddlZddlm Z ddl m Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd lmZdd l mZmZmZdd l mZd ZdZedZdefdYZeZdefdYZdZdZ ddl!Z!e!Z"[!defdYZ#dZ$idd6dd6dd6Z%dZ&d Z'd!Z(e)d"kre(ndS(#iN(t*(tMultiCallCreator(tidlever(t WindowList(t SearchDialog(t GrepDialog(t ReplaceDialog(tPyParse(tidleConf(t aboutDialogttextViewt configDialog(t macosxSupporticCstj\}}}}}d||f}|rB|d|f7}n|dkrb|d|f7}n'|dkr|d|d|f7}n|S(sYFormat sys.version_info to produce the Sphinx version string used to install the chm docss%s%ss%st candidatesrc%stfinali(tsyst version_info(tmajortminortmicrotleveltserialtrelease((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt_sphinx_versions  c CsSd}x|jdD]}|dk r5|jntj||\}}}|dtjkrgPntj||||}y |j}Wqtk rt d|j qXqW|dtjkrFt |}y |j }Wntk rqFXd}t jj|\}} | dkr'd} n|| }|dtjf}n|||fS(sCVersion of imp.find_module() that handles hierarchical module namest.isNo source for module s.pycs.pyN(tNonetsplittclosetimpt find_modulet PY_SOURCEt load_modulet__path__tAttributeErrort ImportErrort__name__t __import__t__file__tostpathtsplitext( tfullnameR'tfilettgttfilenametdescrtmoduletmtbasetext((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt _find_module$s2          t HelpDialogcBs;eZdZddZdZdZddZRS(cCsd|_d|_dS(N(Rtparenttdlg(tself((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt__init__Gs cCs9|jdkr|j|n|r5|j|ndS(s Display the help dialog. parent - parent widget for the help window near - a Toplevel widget (e.g. EditorWindow or PyShell) to use as a reference for placing the help window N(R5Rt show_dialogt nearwindow(R6R4tnear((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytdisplayKscCsr||_tjjtjjtjjtd}tj|d|dt |_ }|j d|j ddS(Nshelp.txttHelptmodals t+( R4R&R'tjointabspathtdirnameR%R t view_filetFalseR5tbindtdestroy(R6R4tfnR5((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR8Xs -"cCs\|j}|jd|jdf}|j|jd||j|jdS(Ni s=+%d+%d(R5t winfo_rootxt winfo_rootytwithdrawtgeometryt deiconifytlift(R6R:R5tgeom((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR9^s     cCsd|_d|_dS(N(RR5R4(R6tev((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyREis N(R#t __module__R7RR;R8R9RE(((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR3Es    t EditorWindowcBseZddlmZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZddlmZd~Zd~d~d~d~dZd Zd Zd Zd Zd~d ZdddddddgZejred=dedZ<d?Z=d@Z>dAZ?dBZ@dCZAdDZBdEZCdFZDdGZEdHZFdIZGdJZHd~dKZIdLZJdMZKdNZLdOZMdPZNdQZOdRZPdSZQdTdUZRdVZSdTdWZTdXZUdYZVdZZWd[ZXd\ZYd]ZZd^Z[d_Z\d`Z]daZ^d~dbZ_d~d~dcZ`ddZad~deZbd~dfZcdgZddhZediZfdjZgehdkZidlZjdmZkdnZldoZmdpZndqZodrZpdsZqdtZrduZsdvZtdwZudxZvdyZwdzZxd{Zyd|Zzd}Z{RS(i(t Percolator(tColorDelegator(t UndoDelegator(t IOBindingtfilesystemencodingtencoding(tBindings(tToplevel(tMultiStatusBarc Cs tjdkrstjjtjdd}tjj drddtj d }tjj drld}q d }tjj||dd}nztjd d krtjjtjdd t }tjj |r |}q n'tjr tjjtjd }ntjj|}tjj |r\|t_tjd krpdtjt_qpqsdtj d t_ntj} ||_|p|j}||_y tjWntk rdt_nXt||_tj|d|j|_} |r|j|_|j|j_ni|_i|j_tjjtj d|_!t"| |_#} t$| dd|_%} tj&ddddd|_'idd6dd6dd6|j'd6tj&ddd ddd 6} t(d!krd"| d#|j1d5|j?|j1d6|j@|j1d7|jA|j1d8|jB|j1d9|jC|j1d:|jD|j1d;|jE|j1d<|jF|j1d=|jG|j1d>|jH|j1d?|jI|j1d@|jJ|j1dA|jK|j1dB|jL|j1dC|jM|j1dD|jN|j1dE|jO|j1dF|jPdG|j1dH|jPdI|j1dJ|jQ|j1dK|jR|j1dL|jS|r||j|<|r_||jT|>> tmenusrecent-files.lsttnametvbartmainRPtwidthttypetintttextitpadxtnonetwraptheightg!@t wordprocessorttabstyletWM_DELETE_WINDOWs<>ss<3>s<>s<>s <>s<>s<>s<>s<>s<>s<>s<>cSsdS(Ntbreak((tevent((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytss<>s<>s<>s<>s<>s<>s <>s <>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>sisis<>s<>s<>s<>s<>s<>s<>tcommandtsidetfilltyscrollcommandtnormals font-boldtbooltboldtfonts font-sizetexpandtIndents use-spacesii2ii@KLR*tlabels Recent Filest underlinetwindowstendi(i2ii@KL(RPthelp_urlRR&R'R?RtprefixtplatformtcountRtisdirRtisfileR trunningAsOSXApptnormpathRt CurrentThemetflisttroottps1R!tMenutmenubarRtListedToplevelttoptvarst tkinter_varst inversedictt instance_dictt GetUserCfgDirtrecent_files_pathtFramet text_framet ScrollbarR`t GetOptionRbt TkVersionRtTextRetfocused_widgett createmenubartapply_bindingstprotocolRRDt close_eventtright_menu_eventtcuttcopytpastetcenter_insert_eventt help_dialogt python_docst about_dialogt config_dialogt open_modulet select_alltremove_selectiont find_eventtfind_again_eventtfind_in_files_eventtfind_selection_eventt replace_eventtgoto_line_eventtsmart_backspace_eventtnewline_and_indent_eventtsmart_indent_eventtindent_region_eventtdedent_region_eventtcomment_region_eventtuncomment_region_eventttabify_region_eventtuntabify_region_eventttoggle_tabs_eventtchange_indentwidth_eventtmove_at_edge_if_selectiont del_word_lefttdel_word_rightt home_callbacktdictt new_callbacktclose_all_callbacktopen_class_browsertopen_path_browsertset_status_bartyviewtpacktRIGHTtYtsettconfigtLEFTtBOTHtTOPt focus_settusetabsttabwidtht indentwidthtset_notabs_indentwidthRCtcontext_use_ps1tnum_context_linesRQtperRStundot insertfiltertundo_block_starttundo_block_stoptset_saved_change_hooktsaved_change_hookRTtiotset_filename_change_hooktfilename_change_hooktrecent_files_menutmenudicttinsert_cascadetupdate_recent_files_listtcolortexiststloadfilet set_filenametResetColorizertset_indentation_paramstispythonsourcetload_extensionstgettindext add_separatort wmenu_endtregister_callbacktpostwindowsmenut tkMessageBoxtaskyesnottkSimpleDialogt askintegert showerror(R6RR,tkeyRtdochometpyvertbasepathtchmfilet currentThemeRRR`t text_optionsRet fontWeightt usespacesRRRR^R}((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR7{s>                                          %           cCsxt|ts| r|Sy|j|jSWnCtk rsy|j|jSWqttk ro|jdSXnXdS(s8convert filename to unicode in order to display it in Tks iso8859-1N(t isinstancetunicodetdecodeRUtUnicodeDecodeErrorRV(R6R,((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt_filename_to_unicode]s  cCs)|jj\}}|jj|dS(NRm(RtdefaultfilenameRtnew(R6RnRAtbasename((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRlscCs||jd@dkr&|jdkr&dS|jjdr|jjdddr|jjdddrt|jjdjdd }nR|jjdd}x:tt |D]}||dkrPqqWt |}t|jjd jdd }||krd}nd t |d}|jd @dkr\|jj dddn|jjds|jj dd nY|jj|jjdd|jjd r|jj ddn|jj dd|jj|}|jjd}|jj|d|r)||}}n|jj ddd|jj d|||jj d ||jjd dS(NiitHometiomarks<=sinsert lineendsinsert linestartRit s tinsertsinsert linestart+tctsels1.0R}s sel.firstt my_anchortRm(R s (tstatetkeysymReRtcompareRdRRtxrangetlentstrt tag_removetmark_setttag_addtsee(R6Rntinsertpttlinetlineattdesttfirsttlast((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRqs>"( %  0cCs|j|j|_tjr=|jjdddtn|jjdddt|jjdddt|jjdtdt |j j d |j |j j d d d |j j|j dS( Nt _padding1s RqtcolumnsCol: ?RsLn: ?Rrs<>s s(RYRt status_barR Rt set_labelRRtBOTTOMtXReRDtset_line_and_columnt event_addt after_idle(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs   cCsS|jjtjd\}}|jjdd||jjdd|dS(NRR"sCol: %sRsLn: %s(ReRtINSERTRR#R$(R6RnRR"((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR's!R*t_Fileteditt_EdittformattF_ormattrunt_Runtoptionst_OptionsR|t_Windowsthelpt_Helpit_WindowicCs|j}i|_}x_|jD]T\}}t|\}}t|d|||<}|jd|d|d|q Wtj|jrt|dd|d<}|jddd|n|j |jdj t |_ |j dS( NR_RzR^R{tapplet applicationtIDLER5(RRt menu_specstprepstrRt add_cascadeR tisCarbonAquaTkRt fill_menusRtENDtbase_helpmenu_lengthtreset_help_menu_entries(R6tmbarRR_RzR{R^((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs    cCsk|jd}|jd}|dkr1d}n||jkrZ|j|jd|ntj|dS(NR|R}ii(RRRRtdeleteRtadd_windows_to_menu(R6R^R}((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs   c Cs%|jjdd|j|jf|js9|jn|j}||_tjd dk}|rz|jj ddnxr|j D]g}y|\}}}Wnt k rqnX|dkrqnt ||}|j|d|qW|j|j|j|r!|jj ddndS( NR s@%d,%diR\tcursortarrowRtibeam(ReRtxtytrmenut make_rmenuRnRRRt rmenu_specst ValueErrorRtgetattrtentryconfigurettk_popuptx_rootty_root( R6RnRKtiswintitemRzt eventnamet verify_stateR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs(#      tCloses<>cCst|jdd}xg|jD]\}|d|d}}|dk rq|j|d}|jd|d|q|jqW||_dS(NttearoffiicSs|j|dS(N(tevent_generate(ReRV((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRpsRzRp(RReRMRt add_commandRRK(R6RKRURzRVRp((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRLs cCs |jS(N(trmenu_check_copy(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytrmenu_check_cutscCs=y|jjd}Wntk r*dSX|r5dSdSdS(Ns sel.firsttdisabledRt(ReRtTclError(R6tindx((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR\s  cCs=y |jjjd|jdWntk r4dSXdSdS(Nstk::GetSelectiont CLIPBOARDR^Rt(RettktcallR_(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytrmenu_check_pastes   cCstj|jddS(Ns About IDLE(R t AboutDialogR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRscCstj|jddS(NtSettings(R t ConfigDialogR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRscCs8|jr|j}n |j}tj|d|jdS(NR:(RRt helpDialogR;(R6RnR4((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs   cCsytjd dkreytj|jWqutk ra}tjdddt|d|j quXnt j |jdS(NiR\ttitlesDocument Start FailuretmessageR4Rm( RRR&t startfileR~t WindowsErrorRRRRet webbrowsertopen(R6Rntwhy((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR#scCs|jjddS(Ns<>Rm(ReRZ(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR.scCs*|jjdsdS|jjddS(NR s<>Rm(Ret tag_rangesRZ(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR2scCs$|jjd|jjddS(Ns <>R Rm(ReRZR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR9scCs=|jjddd|jjdd|jjddS(NR s1.0send-1cR Rm(ReRRR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR>scCs*|jjddd|jjddS(NR s1.0R}R (ReRR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRDscs:|jj|jjdfd}|S(sCursor move begins at start or end of selection When a left/right cursor key is pressed create and return to Tkinter a function which causes a cursor move from the associated edge of the selection. s sel.first+1cs sel.last-1ccsM|jd@dkrIyddWqItk rEqIXndS(Niis sel.firstR (RR_(Rn(t edge_indext edges_tabletself_text_indextself_text_mark_set(s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt move_at_edgeSs   (s sel.first+1cs sel.last-1c(ReRR(R6RqRu((RqRrRsRts,/usr/lib64/python2.7/idlelib/EditorWindow.pyRHs   cCs|jjddS(Ns Rm(ReRZ(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR\scCs|jjddS(NsRm(ReRZ(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR`scCstj|jdS(NRm(RtfindRe(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRdscCstj|jdS(NRm(Rt find_againRe(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRhscCstj|jdS(NRm(Rtfind_selectionRe(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRlscCs tj|j|j|jdS(NRm(RtgrepReRR(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRpscCstj|jdS(NRm(RtreplaceRe(R6Rn((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRtscCsp|j}tjddd|}|dkr1dS|dkrK|jdS|jdd||jddS(NtGotosGo to line number:R4RmiR s%d.0(ReRRRtbellRR(R6RnRetlineno((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRxs     c CsPy|jjdd}Wntk r2d}n X|j}tjddd|jd|}|ru|j}n|sdSy"t|\}}\}}}Wn9ttfk r}t j dt |d|jdSX|t j kr t j d d |d|jdS|r |jn|jr<|jj|n|jj|dS( Ns sel.firstssel.lastttModulesAEnter the name of a Python module to search on sys.path and open:R4t initialvalues Import errorsUnsupported types%s is not a source module(ReRR_tstripRt askstringR2t NameErrorR"RRRRRRRRnRR( R6RnR_tfR*tsuffixtmodeRctmsg((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs4    "   cCs|jj}|s<tjddd|j|jjdStjj |\}}tjj |\}}ddl m }|j |j ||gdS(Ns No filenames&This buffer has no associated filenametmasteri(t ClassBrowser(RR,RRReRRR&R'RR(tidlelibRR(R6RnR,theadttailR0R1R((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs   cCs$ddlm}|j|jdS(Ni(t PathBrowser(RRR(R6RnR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRscCsl|dk rh|dkrh|jjdd||jjddd|jjddd|jndS(NiR s%d.0R s1.0R}s insert +1l(RReRRRtcenter(R6R}((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytgotolines cCs| stjj|rtStjjtjj|\}}tjj|dkr]tSy&t|}|j}|j Wnt k rt SX|j do|j ddkS(Ns.pys.pyws#!tpythoni(s.pys.pyw(R&R'RtTrueR(RtnormcaseRntreadlineRtIOErrorRCt startswithRv(R6R,R0R1RR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs$   cCs)|jr%|jj|d|_ndS(N(Rtunregister_maybe_terminateR(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt close_hooks cCs ||_dS(N(R(R6R((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytset_close_hookscCsD|jr|jj|n|j|jj||jdS(N(Rtfilename_changed_editRRtupdate_windowlist_registryR(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs   cCs}|jr dS|j|jjr4|j|_n|jry|jj|j|jj|j|jj|jndS(N( RRRR,RRRt removefilterRR(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt _addcolorizers  cCs:|js dS|jj|jj|jd|_dS(N(Rt removecolorsRRR(R6((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt _rmcolorizers   c Cs|j|jtjddd}tj|d}tj|ddd}tj|d}|jjd |d d |d d |d |d d |d dS(sUpdate the colour themeRatThemeR_RtRFtfgBgtfgthilitet foregroundt backgroundtinsertbackgroundtselectforegroundtselectbackgroundN(RRRRt GetHighlightReR(R6tthemet normal_colorst cursor_colort select_colors((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRs      c Csnd}tjdddddr*d}n|jjdtjdddtjddd dd |fd S( s.Update the text widgets' font if it is changedRtRaRPs font-boldRcRuRvRws font-sizeRdN(RRReR(R6R((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt ResetFonts cCstj|j_}x-|jD]\}}|jj||q#Wx\|jD]N}tj|}|rSx0|jD]\}}|jj||q{WqSqSWdS(s/Remove the keybindings before they are changed.N( RtGetCurrentKeySetRWtdefault_keydefstitemsRet event_deletetget_standard_extension_namestGetExtensionBindings(R6tkeydefsRntkeylistt extensionNametxkeydefs((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytRemoveKeybindings sc Cstj|j_}|jx9|jD]+}tj|}|r-|j|q-q-Wi}xd|jjD]V}i||d|D]3}|j|d}|j d|dd|qhWn||jd>N(|R#ROtidlelib.PercolatorRQtidlelib.ColorDelegatorRRtidlelib.UndoDelegatorRStidlelib.IOBindingRTRURVRRWtTkinterRXtidlelib.MultiStatusBarRYRR~R7RRRRR'R;R RRRRKRRMRLR]R\RdRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRR RR RRRRRRR?R-R/R%R5R6R:R@RRRRRRTRRRRRRRRRnRpRoRLRtRA(((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRPps   )                             !             -                   %      0 # k      cCstt|S(N(RdR(R((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRJscCstd}}x]|D]U}|dkr:|d}|d}q|dkre|d}||d|}qPqW||fS(NiR is ((tsRRMRNtch((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRKs       R}cBs;eZdZdZejejd dZd ZRS( cCs6||_||_d|_|_d|_|_dS(Ni(ReRRtfinishedRt blkopenlinet indentedline(R6ReR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR75s  cCsd|jr dS|jd}|_t|d}|jj|ddrMdS|jj||dS(NR~is.0s>=R}s lineend+1c(RRRReRR(R6RR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR;s tclasstdeftfortifttrytwhilec Cs^|jr nN||kr0||kr0||_n*||krZ|jrZ||_d|_ndS(Ni(RRR( R6RcttokentstartR}RtINDENTtNAMEtOPENERS((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyt tokeneaterDs   cCsmtj}|jt_z;ytj|j|jWntjtfk rNnXWd|t_X|j|j fS(N( t _tokenizettabsizeRttokenizeRRt TokenErrort SyntaxErrorRR(R6t save_tabsize((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR0Ps   (RRRRRR( R#ROR7RRRRRR0(((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR}.s    cCs>|jd}|dkr4|| ||d}n||fS(NRii(Rv(RR((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyR<`s t[t bracketleftt]t bracketrightt/tslashcCs |j|}| s7tjr;|dddhkr;dS|d}tjdd|}tjdd |}tjd d|}tjd d |}tjd d|}tjdd|}tjdd|}tjdd|}tjdd|}|S(Ns<>s <>s<>R~is-[a-z]\bcSs|jjS(N(tgrouptupper(R/((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRoyss\b\w+\bcSstj|j|jS(N(tkeynamesRR(R/((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyRozssKey-tCancels Ctrl-BreaksControl-sCtrl-RR>s>>(tTkRRIRtargvRRPRtquitReRDRtmainloopRE(RR,R,((s,/usr/lib64/python2.7/idlelib/EditorWindow.pyttests     t__main__(*RR&RRRRRRmtidlelib.MultiCallRRRRRRRRtidlelib.configHandlerRR R R R R8RRR2tobjectR3RhRPRJRKRRR}R<RRRRR#(((s,/usr/lib64/python2.7/idlelib/EditorWindow.pytsX         !(   2