%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/idlelib/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/idlelib/EditorWindow.pyc


Pac@sddlZddlZddlZddlZddlZddlTddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZmZddlmZddlmZd
ZdejZdZedZdefdYZeZ defdYZ!dZ"dZ#ddl$Z$e$Z%[$defdYZ&dZ'idd6dd6dd6Z(d Z)d!Z*d"Z+e,d#krdd$l-m.Z.e.e+ndS(%iN(t*(tMultiCallCreator(t
WindowList(tSearchDialog(t
GrepDialog(t
ReplaceDialog(tPyParse(tidleConf(taboutDialogttextViewtconfigDialog(t
macosxSupport(thelpis (%s)cCstj\}}}}}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((s0/usr/local/lib/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(tNonetsplittclosetimptfind_modulet	PY_SOURCEtload_modulet__path__tAttributeErrortImportErrort__name__t
__import__t__file__tostpathtsplitext(
tfullnameR'tfilettgttfilenametdescrtmoduletmtbasetext((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt_find_module's2




	
t
HelpDialogcBs;eZdZddZdZdZddZRS(cCsd|_d|_dS(N(Rtparenttdlg(tself((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt__init__Js	cCs[ddl}|jdtdd|jdkrA|j|n|rW|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
        iNsEditorWindow.HelpDialog is no longer used by Idle.
It will be removed in 3.6 or later.
It has been replaced by private help.HelpWindow
t
stackleveli(twarningstwarntDeprecationWarningR5Rtshow_dialogt
nearwindow(R6R4tneartw((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytdisplayNs	
cCsr||_tjjtjjtjjtd}tj|d|dt	|_
}|jd|jddS(Nshelp.txttHelptmodals	<Destroy>t+(
R4R&R'tjointabspathtdirnameR%R	t	view_filetFalseR5tbindtdestroy(R6R4tfnR5((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR<`s	-"cCs\|j}|jd|jdf}|j|jd||j|jdS(Ni
s=+%d+%d(R5twinfo_rootxtwinfo_rootytwithdrawtgeometryt	deiconifytlift(R6R>R5tgeom((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR=fs	 

cCsd|_d|_dS(N(RR5R4(R6tev((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRJqs	N(R#t
__module__R7RR@R<R=RJ(((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR3Hs
			tEditorWindowcBskeZddlmZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZd{Zd{d{d{d{dZd	Zd
ZdZdZd{d
Zd|d}d~ddddgZdZdZd{ZdZdgZd!Z d"Z!d#Z"d$Z#d{d%Z$d{d&Z%d{d'Z&d{d(Z'd)Z(d*Z)d+Z*d{d,Z+d{d-Z,d.Z-d/Z.d0Z/d1Z0d2Z1d3Z2d4Z3d5Z4d6Z5d{d7Z6d{d8Z7d{d9Z8d:Z9d;Z:d<Z;d=Z<d>Z=d?Z>d@Z?dAZ@dBZAdCZBdDZCdEZDdFZEdGZFd{dHZGdIZHdJZIdKZJdLZKdMZLdNZMdOZNdPZOdQdRZPdSZQdQdTZRdUZSdVZTdWZUdXZVdYZWdZZXd[ZYd\ZZd]Z[d^Z\d{d_Z]d{d{d`Z^daZ_d{dbZ`d{dcZaddZbdeZcdfZddgZeefdhZgdiZhdjZidkZjdlZkdmZldnZmdoZndpZodqZpdrZqdsZrdtZsduZtdvZudwZvdxZwdyZxdzZyRS(i(t
Percolator(tColorDelegator(t
UndoDelegator(t	IOBindingtfilesystemencodingtencoding(tBindings(tToplevel(tMultiStatusBarcCs	tjdkrvtjjtjdd}tjj	drddtj
d }tjjdrld}q
d	}tjj||dd}n}tjd d
krtjjtjddt}tjj
|r
|}q
n*tjdkr
tjjtjd
}ntjj|}tjj
|r_|t_tjdkrsdtjt_qsqvdtj
d t_n||_|p|j}||_ytjWntk
rdt_nXt||_tj|d|j|_}	|r|j|_|j|j_ni|_i|j_tjjtjd|_t|	|_ }
t!|
dd|_"}tj#ddddd|_$idd6dd6dd6d d!6|j$d6tj#ddd"ddd"6}t%d#krd$|d%<nt&t'|
||_(}
|j(|j_)|j*|j+|jj,d&|j-|jj.d'|j/t0j1r|
j.d'|j/|
j.d(|j2|
j.d)|j2n|
j.d*|j2|
j.d+|j3|
j.d,|j4|
j.d-|j5|
j.d.|j6|
j.d/|j7|
j.d0|j8|
j.d1|j9|
j.d2|j:|
j.d3|j;|
j.d4d5|
j.d6|j<|
j.d7|j=|
j.d8|j>|
j.d9|j?|
j.d:|j@|
j.d;|jA|
j.d<|jB|
j.d=|jC|
j.d>|jD|
j.d?|jE|
j.d@|jF|
j.dA|jG|
j.dB|jH|
j.dC|jI|
j.dD|jJ|
j.dE|jK|
j.dF|jL|
j.dG|jM|
j.dH|jN|
j.dI|jOd |
j.dJ|jOdK|
j.dL|jP|
j.dM|jQ|
j.dN|jR|r||j|<|rp||jS|<n|
j.dO|jT|
j.dP|jjU|
j.dQ|jV|
j.dR|jWn|jX|
jY|dS<|jZdTt[dUt\|j]|
dV<tj^|jdd|
dW<|
jZdTt_dUt`dXdK|
jZdTtadUt`dXdK|
jbtj#ddYdZdd[}||_cd\|_d|jd|_e|jftg|_hdh|_i|jj|
|_k}|jl|_m}|jn||jo|
_o|jp|
_p|jq|jr|js||_t}|ju|jvt|jd`d |_w|jxdajyddbdcddd d|jw|jzd|_{|rtjj||rtjj|r|j}|q|j~|n|j|jr|j|j||j|jxjde}|r	|jdf}|dkrC	dg}n|d krf	|j|dK}n||_tj|jntj|_tj|_tj|_dS(iNtDocs
index.htmltlinuxspython-docs-s%s.%s.%sis/var/www/html/python/s/var/www/html/python/index.htmls/usr/share/doc/twinsPython%s.chmtdarwins0Resources/English.lproj/Documentation/index.htmlsfile://shttps://docs.python.org/%d.%d/is>>> tmenusrecent-files.lsttnametvbartmainRUtwidthttypetintttextitpadxtnonetwrapithighlightthicknesstheightg!@t
wordprocessorttabstyletWM_DELETE_WINDOWs<<close-window>>s<Control-Button-1>s<2>s<3>s<<cut>>s<<copy>>s	<<paste>>s<<center-insert>>s<<help>>s<<python-docs>>s<<about-idle>>s<<open-config-dialog>>s<<open-module>>s<<do-nothing>>cSsdS(Ntbreak((tevent((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt<lambda>ts<<select-all>>s<<remove-selection>>s<<find>>s<<find-again>>s<<find-in-files>>s<<find-selection>>s<<replace>>s
<<goto-line>>s<<smart-backspace>>s<<newline-and-indent>>s<<smart-indent>>s<<indent-region>>s<<dedent-region>>s<<comment-region>>s<<uncomment-region>>s<<tabify-region>>s<<untabify-region>>s<<toggle-tabs>>s<<change-indentwidth>>s<Left>s<Right>is<<del-word-left>>s<<del-word-right>>s<<beginning-of-line>>s<<open-new-window>>s<<close-all-windows>>s<<open-class-browser>>s<<open-path-browser>>tcommandtsidetfilltyscrollcommandtfonttexpandtIndents
use-spacestboolii2ii@KLttearoffR*tlabelsRecent Filest	underlinetwindowstendi(i2ii@KL(RUthelp_urlRR&R'RDRtprefixtplatformtcountRtisdirRtisfiletnormpathtflisttroottps1R!tMenutmenubarRtListedToplevelttoptvarsttkinter_varstinversedictt
instance_dictRt
GetUserCfgDirtrecent_files_pathtFramet
text_framet	ScrollbarRet	GetOptionRgt	TkVersionRtTextRjtfocused_widgett
createmenubartapply_bindingstprotocolRRItclose_eventRtisAquaTktright_menu_eventtcuttcopytpastetcenter_insert_eventthelp_dialogtpython_docstabout_dialogt
config_dialogtopen_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_bartyviewtpacktRIGHTtYtsettGetFonttLEFTtBOTHtTOPt	focus_settusetabsttabwidthtindentwidthtset_notabs_indentwidthRHtcontext_use_ps1tnum_context_linesRVtperRXtundotinsertfiltertundo_block_starttundo_block_stoptset_saved_change_hooktsaved_change_hookRYtiotset_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,tkeyRtdochometpyvertbasepathtchmfileRRRettext_optionsRjt	usespacesRRRRcR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR7s4				

	









	
		


	%


	

	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
isinstancetunicodetdecodeRZtUnicodeDecodeErrorR[(R6R,((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt_filename_to_unicode_s

cCs)|jj\}}|jj|dS(NRs(RtdefaultfilenameRtnew(R6RtRFtbasename((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRnscCs||jd@dkr&|jdkr&dS|jjdr|jjdddr|jjdddrt|jjdjdd	}nR|jjdd}x:tt	|D]}||dkrPqqWt	|}t|jjdjdd	}||krd}nd
t
|d}|jd	@dkr\|jjdddn|jjds|jjddnY|jj|jjdd|jjdr|jjddn|jjdd|jj|}|jjd}|jj|d|r)||}}n|jjddd|jj
d|||jjd||jjddS(NiitHometiomarks<=sinsert lineendsinsert linestartRit s	tinsertsinsert linestart+tctsels1.0Rs	sel.firstt	my_anchort<ssel.lastt>Rs(R
s	(tstatetkeysymRjRtcompareRiRRtxrangetlentstrt
tag_removetmark_setttag_addtsee(R6Rttinsertpttlinetlineattdesttfirsttlast((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRss>"(%	0cCs|j|j|_t|jdddddd}tjdkra|jjddd	tn|jjd
dd	t|jjdd
d	t|jjd	t	dt
|jd	t	dt
|jjd|j
|jjddd|jj|j
dS(NRoitborderwidtht
backgroundtgrey75Rbt	_padding1s    RxtcolumnsCol: ?RsLn: ?Rys<<set-line-and-column>>s<KeyRelease>s<ButtonRelease>(R^Rt
status_barRRRt	set_labelRRtBOTTOMtXRjRItset_line_and_columnt	event_addt
after_idle(R6tsep((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs!
cCsS|jjtjd\}}|jjdd||jjdd|dS(NRR(sCol: %sRsLn: %s(RjRtINSERTRR)R*(R6RtRR(((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR-s!R*t_Fileteditt_EdittformattF_ormattrunt_Runtoptionst_OptionsRt_WindowRt_HelpcCs|j}i|_}xe|jD]Z\}}t|\}}t|d|dd||<}|jd|d|d|q Wtjrt|dddd|d<}|jdd	d|n|j|jd
j	t
|_|jdS(NRdRiRRcRtappletapplicationtIDLER(
RRt
menu_specstprepstrRtadd_cascadeRt
isCarbonTkt
fill_menusRtENDtbase_helpmenu_lengthtreset_help_menu_entries(R6tmbarRRdRRRc((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	
  
cCsk|jd}|jd}|dkr1d}n||jkrZ|j|jd|ntj|dS(NRRii(RRRRtdeleteRtadd_windows_to_menu(R6RcR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
	c	Cs%|jjdd|j|jf|js9|jn|j}||_tjd dk}|rz|jj	ddnxr|j
D]g}y|\}}}Wntk
rqnX|dkrqnt
||}|j|d|qW|j|j|j|r!|jj	ddndS(	NRs@%d,%diRatcursortarrowRtibeam(RjRtxtytrmenut
make_rmenuRtRRtconfigtrmenu_specst
ValueErrorRtgetattrtentryconfigurettk_popuptx_rootty_root(	R6RtRPtiswintitemRt	eventnametverify_stateR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs(#	
		
tCloses<<close-window>>cCst|jdd}xg|jD]\}|d|d}}|dk	rq|j|d}|jd|d|q|jqW||_dS(NRiicSs|j|dS(N(tevent_generate(RjR\((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRwsRRw(RRjRSRtadd_commandRRP(R6RPR[RR\Rw((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRQscCs
|jS(N(trmenu_check_copy(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytrmenu_check_cutscCs=y|jjd}Wntk
r*dSX|r5dSdSdS(Ns	sel.firsttdisabledtnormal(RjRtTclError(R6tindx((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRas

cCs=y |jjjd|jdWntk
r4dSXdSdS(Nstk::GetSelectiont	CLIPBOARDRcRd(RjttktcallRe(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytrmenu_check_pastes
 
cCstj|jddS(sHandle Help 'About IDLE' event.s
About IDLEN(RtAboutDialogR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCstj|jddS(s&Handle Options 'Configure IDLE' event.tSettingsN(R
tConfigDialogR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs/|jr|j}n	|j}tj|dS(sHandle Help 'IDLE Help' event.N(RRRt
show_idlehelp(R6RtR4((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR!s		cCsytjd dkreytj|jWqutk
ra}tjdddt|d|j	quXnt
j|jdS(NiRattitlesDocument Start FailuretmessageR4Rs(RRR&t	startfileRtWindowsErrorRRRRjt
webbrowsertopen(R6Rttwhy((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR*scCs|jjddS(Ns<<Cut>>Rs(RjR_(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR5scCs*|jjdsdS|jjddS(NRs<<Copy>>Rs(Rjt
tag_rangesR_(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR9scCs$|jjd|jjddS(Ns	<<Paste>>RRs(RjR_R(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR@scCs=|jjddd|jjdd|jjddS(NRs1.0send-1cRRs(RjRRR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyREscCs*|jjddd|jjddS(NRs1.0RR(RjRR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRKscs:|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+1cssel.last-1ccsM|jd@dkrIyddWqItk
rEqIXndS(Niis	sel.firstR(RRe(Rt(t
edge_indextedges_tabletself_text_indextself_text_mark_set(s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytmove_at_edgeZs

(ssel.first+1cssel.last-1c(RjRR(R6RwR{((RwRxRyRzs0/usr/local/lib/python2.7/idlelib/EditorWindow.pyROs
cCs|jjddS(Ns
<Meta-Delete>Rs(RjR_(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRcscCs|jjddS(Ns<Meta-d>Rs(RjR_(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRgscCstj|jdS(NRs(RtfindRj(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRkscCstj|jdS(NRs(Rt
find_againRj(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRoscCstj|jdS(NRs(Rtfind_selectionRj(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRsscCs tj|j|j|jdS(NRs(RtgrepRjRR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRwscCstj|jdS(NRs(RtreplaceRj(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR{scCsp|j}tjddd|}|dkr1dS|dkrK|jdS|jdd||jddS(NtGotosGo to line number:R4RsiRs%d.0(RjRRRtbellRR(R6RtRjtlineno((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs		
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||S(Ns	sel.firstssel.lastRvtModulesAEnter the name of a Python module
to search on sys.path and open:R4tinitialvaluesImport errorsUnsupported types%s is not a source module(RjRRetstripRt	askstringR2t	NameErrorR"RRRRRRRRtRR(	R6RtRdtft	file_pathtsuffixtmodetmtypetmsg((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs6

	"	
	cCs|jj}|jjdko!|sC|j}|dkrCdSntjj|\}}tjj	|\}}ddl
m}|j|j||gdS(NtPyShellEditorWindowi(tClassBrowser(
RR,t	__class__R#RRR&R'RR(tidlelibRR(R6RtR,theadttailR0R1R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs$ddlm}|j|jdS(Ni(tPathBrowser(RRR(R6RtR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCsl|dk	rh|dkrh|jjdd||jjddd|jjddd|jndS(NiRs%d.0Rs1.0Rs
insert +1l(RRjRRRtcenter(R6R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytgotolines
cCs|stjj|rtStjjtjj|\}}tjj|dkr]tSy&t|}|j}|j	Wnt
k
rtSX|jdo|j
ddkS(Ns.pys.pyws#!tpythoni(s.pys.pyw(R&R'RtTrueR(R
tnormcaseRttreadlineRtIOErrorRHt
startswithR|(R6R,R0R1RR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs$
cCs)|jr%|jj|d|_ndS(N(Rtunregister_maybe_terminateR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt
close_hooks	cCs
||_dS(N(R(R6R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytset_close_hookscCsD|jr|jj|n|j|jj||jdS(N(Rtfilename_changed_editRRtupdate_windowlist_registryR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
	
cCs}|jr
dS|j|jjr4|j|_n|jry|jj|j|jj|j|jj|jndS(N(	RRRR,RWRtremovefilterRR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt
_addcolorizers		cCs:|js
dS|jj|jj|jd|_dS(N(RtremovecolorsRRR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt_rmcolorizers
	
cCs|j|jtj}tj|d}tj|ddd}tj|d}|jjd|dd|dd|d	|dd
|dtdkr|jjd|dnd
S(sUpdate the color themeRdRKtfgBgtfgthilitet
foregroundR%tinsertbackgroundtselectforegroundtselectbackgroundg!@tinactiveselectbackgroundN(RRRtCurrentThemetGetHighlightRjRRR(R6tthemet
normal_colorstcursor_colort
select_colors((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs




cCs#tj|jdd|jd<dS(s.Update the text widgets' font if it is changedRfRUR{N(RRRRj(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt	ResetFontscCstj|j_}x-|jD]\}}|jj||q#Wx\|jD]N}tj|}|rSx0|jD]\}}|jj||q{WqSqSWdS(s/Remove the keybindings before they are changed.N(	RtGetCurrentKeySetR\tdefault_keydefstitemsRjtevent_deletetget_standard_extension_namestGetExtensionBindings(R6tkeydefsRttkeylistt
extensionNametxkeydefs((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytRemoveKeybindings
sc
Cstj|j_}|jx9|jD]+}tj|}|r-|j|q-q-Wi}xd|jjD]V}i||d<x?|dD]3}|r|d||dt|dd<qqWqoWx|j	j
D]}|j	|}|jt}|dkr
qn|d7}xtd|D]}	|j|	dkr'|j|	d}
|
r|j|	d}d}||kr|||kr|||}qn|rt||}
|j|	d|
qqq'q'WqWdS(s-Update the keybindings after they are changediiRwtacceleratorRRvN(RRR\RRRRtmenudefsRARtkeysRRERtrangeRht	entrycgettget_acceleratortentryconfig(
R6RRRt
menuEventDictRcR[tmenubarItemRRtacceltitemNameRt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytApplyKeybindingss<
/

cCs.|js*tjddddd|_ndS(sCUpdate the indentwidth if changed and not using tabs in this windowRfR}s
num-spacesRhRiN(RRRR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR=s	cCstj}|jd}|jt}||jkrQ|j|jd|n|r|jx>|D]3}|j|d}|j	d|dd|qhWn||jd<dS(s3Update the additional help entries on the Help menuRiRiRwN(
RtGetAllExtraHelpSourcesListRRRERFRIRt"_EditorWindow__extra_help_callbackR`(R6t	help_listthelpmenuthelpmenu_lengthtentrytcmd((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRGDs


!cs|fd}|S(sCCreate a callback with the helpfile value frozen at definition timecs|jd	s$tjj|}ntjd dkrytj|Wqtk
r}tj	dddt
|djqXn
tj
|dS(
NtwwwthttpiRaRosDocument Start FailureRpR4(RR(RR&R'RRRRqRrRRRRjRsRt(thelpfileRu(R6(s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytdisplay_extra_helpWs((R6RR((R6s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt__extra_help_callbackUscCsSg}tjj|jrEt|jd}|j}WdQXn|rtjj|d}||kr}|j|n|jd|ng}xD|D]<}d|kstjj|dd!r|j	|qqWg|D]}||kr|^q}d}|dt
|!}y,t|jd}|j|WdQXWn`tk
r}t
|jd	tst|j_tjd
ddd
t|d|jqnXx|jjjD]}	|	j}
|
jdtxlt|D]^\}}|j}|j|}
|	j|}|
j d||d|
d|ddqWqWdS(s/Load and update the recent files list and menustrNs
isit1234567890ABCDEFGHIJKR?trecentfilelist_error_displayedRosIDLE WarningRps|Cannot update File menu Recent Files list. Your operating system says:
%s
Select OK and IDLE will continue without updating.R4RR
RwR(!R&R'RRRtt	readlinesREtremoveRtappendRt
writelinesRRURRHRRRtshowwarningRRjRRRRRIREt	enumeratetrstripRt#_EditorWindow__recent_file_callbackR`(R6tnew_filetrf_listtrf_list_filet	bad_pathsR'tulcharstrf_fileterrtinstanceRctit	file_namet
ufile_nametcallback((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRdsH
&%
	cs|fd}|S(Ncsjjd|dS(NteditFile(RRt(t
fn_closure(R6(s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytopen_recent_files((R6RR((R6s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt__recent_file_callbackscCs|j}|j}|r9|r9|d|t}n$|rH|}n|rW|}nd}|pl|pl|}|jsd|}d|}n|jj||jj|dS(Ns - tUntitleds*%s*s*%s(tshort_titlet
long_titlet_py_versiont	get_savedRtwm_titletwm_iconname(R6tshorttlongRoticon((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs		

cCs
|jjS(N(RR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs|jj|dS(N(Rt	set_saved(R6tflag((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs|jjdS(N(Rt
reset_undo(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs:|jj}|r'tjj|}nd}|j|S(NR(RR,R&R'R
R(R6R,((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
cCs|j|jjpdS(NRv(RRR,(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs|jdS(N(R(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRsRcCsb|j}|j\}}|j|}||}td||d}|jt|dS(Nii(Rjtgetwindowlinest	getlinenotmaxRtfloat(R6tmarkRjRtbotRRotnewtop((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	
cCsp|j}|jd}|jd}||krf|jdkrft|d}||d}n||fS(Ns@0,0s@0,65535iRo(RjRtwinfo_heightRi(R6RjRRRo((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	cCs"|j}tt|j|S(N(RjRiRR(R6RRj((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	cCs:|jj}tjd|}tt|j}|S(sReturn (width, height, x, y)s(\d+)x(\d+)\+(-?\d+)\+(-?\d+)(Rtwm_geometrytretmatchtmapRitgroups(R6RRR/ttuple((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytget_geometryscCs|jdS(N(R(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCsh|jrd|jsW|jjdkr:|jjn|jj|jjn|jjSdS(NRd(RRRRRPtlowerRQt	maybesave(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	
cCs/|j}t|dkr+|jn|S(Ntcancel(RRt_close(R6treply((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
cCs|jjr%|jd|jjntj|j|j|jjd|_d|_	|j
r|j
jtd|_
nd|_d|_
|jjd|_|jj|jr|jndS(NR(RR,RRtunregister_callbackRtunload_extensionsRRRRRHRjRRRRJR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs"

					
	
	cCsi|_|jdS(N(t
extensionstload_standard_extensions(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	cCsCx3|jjD]"}t|dr|jqqWi|_dS(NR(RtvaluesthasattrR(R6tins((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs[xT|jD]F}y|j|Wq
dGt|GHddl}|jq
Xq
WdS(NsFailed to load extensioni(Rtload_extensiontreprt	tracebackt	print_exc(R6RdR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR
scCstjdtS(Nteditor_only(Rt
GetExtensionsR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCsVyt|ttg}Wntk
r<dG|GHdSXt||}tj|}t|dr|j|j	|n||}||j
|<|rR|j|x|jD]}|j
dd}x|d dkr|d}qWx|ddkr|d }qW|d	}t||r|jj|t||qqWndS(
Ns
Failed to import extension: Rt-t_iRiRt_event(R$tglobalstlocalsR"RURRRRDRRRRRRjRI(R6RdtmodtclsRRtveventt
methodname((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs,
	


cCsg|dkr|jj}n|j}||_x3|jD]%\}}|r:|j||q:q:WdS(N(RR\RRjRRR.(R6RRjRtR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR1s		c
Csf|d	kr|jj}n|d	kr6|jj}n|j}|j}x|D]\}}|j|}|svqOnx|D]}|s|jq}|\}	}
|	d dk}|r|	d}	nt|	\}}	t	||
}
||
d}|r8|j
|
t}|jd|	d|d|d|
d|q}|j
d|	d|d|d|
q}WqOWd	S(
sAdd appropriate entries to the menus and submenus

        Menus that are absent or None in self.menudict are ignored.
        it!cSs|j|dS(N(R_(RjR\((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRwSsRRRwRtvariableN(RR\RRRRjRRRARtget_var_objt
BooleanVartadd_checkbuttonR`(R6RRRRjtmnamet	entrylistRcRRR\tcheckbuttonRRRwtvar((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRD:s8		



cCs2|j|}|r%|j}|St|dS(N(R-RR(R6RdR3tvalue((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytgetvar_s
cCs5|j||}|r(|j|n	t|dS(N(R-RR(R6RdR4tvartypeR3((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytsetvargscCs@|jj|}|r<|r<||j|j|<}n|S(N(RRRj(R6RdR6R3((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR-ns
cCs<|jr4|jjd|p3d|jj|kSdSdS(NtTODOtSTRINGi(RRjt
tag_prevranget	tag_names(R6t
text_index((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytis_char_in_string~s	cCsKy2|jjd}|jjd}||fSWntk
rFdSXdS(Ns	sel.firstssel.last(NN(RjRReR(R6R"R#((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytget_selection_indicess
cCs|jdpt}t|S(Nttabs(RjtTK_TABWIDTH_DEFAULTRi(R6tcurrent((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytget_tabwidthscCs^|j}|j|krZ|jjdd|dd|jd|}|jd|ndS(NR{tmeasures
-displayoftnR?(RjRBRhRitmastert	configure(R6tnewtabwidthRjtpixels((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytset_tabwidths		
cCsu|ra|ra|j}d|ko/dknr@||_n|j|jkrat|_qan|j|jdS(Nii(tguess_indentRRRHRRI(R6RtguessR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCs|j}|j\}}|rK|rK|j|||jd|dS|jdd}|dkr|jdddr|jdn
|jdS|dd	kr|jddS|j}t|j	|}|d
kst
|d|j|j}|jr't
jjdd}	nd}	d
}
x]||	krFPn|d }|
d}
t|j	|}||ks|dd	kr6Pq6q6W|j|jd
|
d||kr|jdd||n|jdS(NRRssinsert linestartRvRs1.0s	insert-1cis 	iis
s
insert-%dcR
(RjR>RIRRRRRRt
expandtabstAssertionErrorRRRRRRRR(R6RtRjR"R#tcharsRthavetwanttlast_line_of_promptt
ncharsdeleted((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRsJ	

		



c
CsH|j}|j\}}|jz|r||r|t|t|krY|j|S|j|||jd|n|jdd}t||j	\}}|t
|kr|j||jnU|j
rd}n3t
|j|j	}|j}	d|	||	}|jd||jddSWd|jXdS(NRsinsert linestarts	R
Rs(RjR>Rt
index2lineRRIRRt
classifywsRRtreindent_toRRRLRRR(
R6RtRjR"R#Rtrawt	effectivetpadRD((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs,	

			
cCs|j}|j\}}|jz|rW|rW|j|||jd|n|jdd}dt|}}x*||kr||dkr|d}qW||kr|jdddS|| }d}tj	j
dd}	x:|r+|ddkr+||	kr+|d }|d}qW|rI|jd	|dnx&|jddkrq|jdqLW|jddt|jd}
t
j|j|j}|js^x|jD]}t|
|d}
t|
d
}|j|d}|j||j|j|j|}|dk	s@|
dkrPqqW|j|pWdnW|jdd}|r|d}nd}|j|d}|j||jd|j}|t
jkr|t
jkrn|t
jkr|jd|n|t
jkr)|j |j!nc|t
j"krs|j#dkr]|jd|q|j |j$ndst%d
|fdS|j&}|jd||j'r|j(|n"|r|j)r|j*|ndSWd|j+d|j,XdS(NRsinsert linestartis 	is
Rsisinsert - %d charss.0tconsoles1.0sbogus continuation type %r(-RjR>RRIRRRRRRRRSRRtParserRRRRRRtset_strtfind_good_parse_startt_build_char_in_string_funcRtset_loR:tget_continuation_typetC_NONEtC_STRING_FIRST_LINEtC_STRING_NEXT_LINESt	C_BRACKETRUtcompute_bracket_indenttC_BACKSLASHtget_num_lines_in_stmttcompute_backslash_indentRMtget_base_indent_stringtis_block_openerRtis_block_closerRRR(R6RtRjR"R#RRRDtindentRQtlnoROtcontexttstartattstartatindextrawtexttbodRR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs	

%
	




cCs||jd}|S(NcSs||d|S(Ns+%dc((toffsett_startindext_icis((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pytinnerqs(R=(R6t
startindexRu((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR]psc
Cs|j\}}}}xmtt|D]Y}||}|r+t||j\}}	|	|j}	|j|	||||<q+q+W|j||||dS(NRs(t
get_regionRRRTRRt_make_blankst
set_region(
R6RtRRRNtlinestposRRVRW((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRvs

"c
Cs|j\}}}}xvtt|D]b}||}|r+t||j\}}	t|	|jd}	|j|	||||<q+q+W|j||||dS(NiRs(	RwRRRTRRRRxRy(
R6RtRRRNRzR{RRVRW((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
"cCsk|j\}}}}x6tt|dD]}||}d|||<q/W|j||||dS(Nis##(RwRRRy(R6RtRRRNRzR{R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs

cCs|j\}}}}xttt|D]`}||}|sGq+n|d dkrd|d}n|d dkr|d}n|||<q+W|j||||dS(Nis##it#(RwRRRy(R6RtRRRNRzR{R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs


c
Cs|j\}}}}|j}|dkr4dSxutt|D]a}||}|rGt||\}	}
t|
|\}}d|d|||	||<qGqGW|j||||dS(Ns	R
(Rwt_asktabwidthRRRRTtdivmodRy(
R6RtRRRNRzRR{RRVRWtntabstnspaces((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs
%cCs|j\}}}}|j}|dkr4dSx1tt|D]}||j|||<qGW|j||||dS(N(RwR}RRRRLRy(R6RtRRRNRzRR{((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRscCsZ|jddd
|jdd|jdd	d
|jrV|j|_d|_ndS(NsToggle tabss
Turn tabs tontoffs?
Indent width swill bes
remains ats 8.s!
 Note: a tab is always 8 columnsR4iRs(RR(swill bes
remains at(RRRjR(R6Rt((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs!
cCs_|jddd|jd|jdddd}|r[||jkr[|jr[||_nd	S(
NsIndent widths6New indent width (2-16)
(Always use 8 when using tabs)R4RtminvalueitmaxvalueiRs(RRjRR(R6RtR	((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRs			cCs|j}|j\}}|rP|rP|j|d}|j|d}n|jd}|jd}|j||}|jd}||||fS(Ns
 linestarts-1c lineend +1csinsert linestartsinsert lineend +1cs
(RjR>RRR(R6RjR"R#RRRNRz((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRws	cCs|j}dj|}||kr2|jdS|jddd|jd||j|j|||j|||j|j	d|ddS(Ns
Rs1.0RR(
RjRDRRRRRIRRR(R6RRRNRzRjtnewchars((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRys	


cCs=|jr1t||j\}}d|d|Sd|SdS(Ns	R
(RR~R(R6RDRR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRxs	cCsk|j}|j|jdddr;|jddn|r]|jd|j|n|jdS(Nsinsert linestarts!=R(RjRRRIRRxR(R6R(Rj((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRUs	
cCs.|jddd|jd|jddddS(	Ns	Tab widthsColumns per tab? (2-16)R4RRiRi(RRjR(R6((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR}s		cCsrt|j|jj\}}|r`|r`t||j\}}t||j\}}n
d}}||S(Ni(tIndentSearcherRjRR7RT(R6topenertindentedRVtindentsmalltindentlarge((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRJs!
N(R*R2(R3R4(R5R6(R7R8(R9R:(RR;(RR<(R^s<<close-window>>N(zR#RTtidlelib.PercolatorRVtidlelib.ColorDelegatorRWtidlelib.UndoDelegatorRXtidlelib.IOBindingRYRZR[RR\tTkinterR]tidlelib.MultiStatusBarR^RRR7RRRRR-R@RRRPRRSRQRbRaRjRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGRRRRRRRRRRRRRRRRRRRRRRRRRDR5R7R-R=R>RBRIRRRRRR]RRRRRRRRRwRyRxRUR}RJ(((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRUxs			)				
																			"											$			,										
													%							0	#	k					
					
		
			cCstt|S(N(RiR(R((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRSscCstd}}x]|D]U}|dkr:|d}|d}q|dkre|d}||d|}qPqW||fS(NiR
is	((tsRRVRWtch((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRT&s




RcBs;eZdZdZejejd
dZd	ZRS(cCs6||_||_d|_|_d|_|_dS(Ni(RjRRtfinishedRtblkopenlinetindentedline(R6RjR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR7>s		cCsd|jr
dS|jd}|_t|d}|jj|ddrMdS|jj||dS(NRvis.0s>=Rs lineend+1c(RRRRjRR(R6RR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRDs	tclasstdeftfortifttrytwhilec		Cs^|jrnN||kr0||kr0||_n*||krZ|jrZ||_d|_ndS(Ni(RRR(	R6RhttokentstartRRtINDENTtNAMEtOPENERS((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt
tokeneaterMs		cCsmtj}|jt_z;ytj|j|jWntjtfk
rNnXWd|t_X|j|j	fS(N(
t	_tokenizettabsizeRttokenizeRRt
TokenErrortSyntaxErrorRR(R6tsave_tabsize((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR7Ys	
(RRRRRR(	R#RTR7RRRRRR7(((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyR7s		
	cCs>|jd}|dkr4|| ||d}n||fS(NR#ii(R|(RR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRAist[tbracketleftt]tbracketrightt/tslashcCs|j|}|s7tjr;|dddhkr;dS|d}tjdd|}tjdd	|}tjd
d|}tjdd|}tjd
d|}tjdd|}tjdd|}tjdd|}tjdd|}|S(Ns<<open-module>>s
<<goto-line>>s<<change-indentwidth>>Rvis-[a-z]\bcSs|jjS(N(tgrouptupper(R/((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRuRvs\b\w+\bcSstj|j|jS(N(tkeynamesRR(R/((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRuRvsKey-tCancels
Ctrl-BreaksControl-sCtrl-R"RCs><R
RR(RRt	isCocoaTkR
tsub(RR\RR((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyRxs"
cCsF|j}|jddd|jddd|jddddS(	Nttcl_wordBreakAftersa biRt
tcl_wordcharss[a-zA-Z0-9_]ttcl_nonwordcharss
[^a-zA-Z0-9_](RhRi(RRh((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt
fixwordbreakss	cCsr|}t|tjdr-tjd}nd}tj|dtd|d|}|jjd|j	dS(NiRR,s<<close-all-windows>>(
RRtargvRRtsetupAppRURjRIR(R4RR,R3((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt_editor_windows

t__main__(R7(/RR&RR
RRRRRstidlelib.MultiCallRRRRRRRtidlelib.configHandlerRRR	R
RRR@tpython_versionRRRR2tobjectR3t
helpDialogRURSRTRRRRARRRRR#tidlelib.idle_test.htestR7(((s0/usr/local/lib/python2.7/idlelib/EditorWindow.pyt<module>s^
	!-			
2		
				

Zerion Mini Shell 1.0