• File: squeezer.cpython-37.opt-2.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/squeezer.cpython-37.opt-2.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 6.18 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

YI~d(2@sddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dddZGd	d
d
ejZGdddZeed
krddlmZedddddS)N)idleConf)	view_text)Hovertip)macosxPcCsd}d}d}d}xtd|D]~}||}||7}||7}||dkrp||krb||d|7}|d7}d}n$||||7}||kr|d7}|}|d7}qW|t||7}|dkr||d|7}n|d8}|S)Nrz[\t\n]
)refinditerstartlen)sZ	linewidthZtabwidthposZ	linecountZcurrent_columnmnumcharsr5/opt/alt/python37/lib64/python3.7/idlelib/squeezer.pycount_lines_with_wrappings.rc@sFeZdZddZddZdddZddd	Zdd
dZdZd
dZ	dS)ExpandingButtonc
s|_||_||_||_|j|_}|j|_}|jj|_|dkrFdnd}d|d|d}t	j
j|||ddd	d
}	t||	dd|
d
|jtr|
d|jn|
d|j|fddd|_||jdS)NrlineslinezSqueezed text ( z).z#FFFFC0z#FFFFE0)textZ
backgroundZactivebackgroundz5Double-click to expand, right-click for more options.r)Zhover_delayz<Double-Button-1>z
<Button-2>z
<Button-3>cst|t|t|S)N)int)offsetlength)rrr<lambda>zz*ExpandingButton.__init__.<locals>.<lambda>)rtags
numoflinessqueezereditwinrperbottom	base_texttkButton__init__rZbindexpandrZisAquaTkcontext_menu_eventZselection_handleis_dangerousZ
after_idleset_is_dangerous)
selfrrr r!r"rZline_pluralityZbutton_textZbutton_tooltip_textr)rrr(_s*

zExpandingButton.__init__csLd|j|jdkpDt|jdkpDtfddtd|jD|_dS)N2iiPc3s |]}t|dkVqdS)rN)r
group).0Z
line_match)dangerous_line_lenrr	<genexpr>sz3ExpandingButton.set_is_dangerous.<locals>.<genexpr>z[^\n]+)	rZwinfo_widthr r
ranyr
rr+)r-r)r1rr,s

z ExpandingButton.set_is_dangerousNcCs|jdkr||jrTtjddddddg|jt|jftj|j	d}|sTdS|j
|j	||j|j
|j
||jj|dS)	NzExpand huge output?z

z5The squeezed output is very long: %d lines, %d chars.z2Expanding it could make IDLE slow or unresponsive.z5It is recommended to view or copy the output instead.zReally expand?)titlemessagedefaultparentbreak)r+r,tkMessageBoxZaskokcanceljoinr r
rZCANCELrr%insertindexrdeleter!expandingbuttonsremove)r-eventZconfirmrrrr)s$	

zExpandingButton.expandcCs|||jdS)N)Zclipboard_clearZclipboard_appendr)r-r@rrrcopyszExpandingButton.copycCst|jd|jddddS)NzSqueezed Output ViewerFZnone)Zmodalwrap)rrr)r-r@rrrviewszExpandingButton.view))rArA)rCrCcCsf|jdd|j|jftj|jdd}x&|jD]\}}|j|t||dq2W|	|j
|jdS)Nr;z@%d,%dr)Ztearoff)labelZcommandr8)rZmark_setxyr&ZMenurmenu_specsZadd_commandgetattrZtk_popupZx_rootZy_root)r-r@ZrmenurDZmethod_namerrrr*sz"ExpandingButton.context_menu_event)N)N)N)
__name__
__module____qualname__r(r,r)rArCrGr*rrrrrTs 



rc@s0eZdZeddZddZddZddZd	S)
SqueezercCstjdddddd|_dS)NmainZPyShellzauto-squeeze-min-linesrr.)typer6)rZ	GetOptionauto_squeeze_min_lines)clsrrrreloadszSqueezer.reloadcsd|_|j_|jj_dtdtd_g_d|j	ffdd	}||_	dS)NZborderpadxrcs|dkr|||Sj}t||kr.|||S|}||krJ|||St|||}dtjjd|dddd	dtj
j|dS)NstdoutZiomark)windowrSpady)
rOr
count_linesrZmark_gravityr&ZRIGHT
window_createZseeupdateZLEFTr>append)rrwriterOr expandingbutton)r-rrrmywrites 





z"Squeezer.__init__.<locals>.mywrite)
r"rr#r$r%rZcgetZwindow_width_deltar>r])r-r"r_r)r-rrr(s

zSqueezer.__init__cCst||jjS)N)rr"width)r-rrrrrYszSqueezer.count_linesc
Cs|jtj}x$dD]}||krPqW|jdS|j|tjd\}}|j||}t|dkr|ddkr|jd|}|dd}|j	
||||}t||||}|jj
||dd	d
t|j}	x2|	dkr|j|j|	dd|r|	d8}	qW|j|	|dS)
N)rTstderrr8z+1crr	z%s-1crUrV)rWrSrXr>)r	tag_namesr&ZINSERTZbellZ
tag_prevrangegetr
r<r%r=rYrrZr>Zcomparer;)
r-r@rdZtag_namerendrr r^irrrsqueeze_current_text_event s,	






z#Squeezer.squeeze_current_text_eventN)rIrJrKclassmethodrQr(rYrhrrrrrLs?
rL__main__)rMzidlelib.idle_test.test_squeezerrRF)	verbosityexit)r)r
Ztkinterr&Ztkinter.messageboxZ
messageboxr9Zidlelib.configrZidlelib.textviewrZidlelib.tooltiprZidlelibrrr'rrLrQrIZunittestrMrrrr<module>s
8r