Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/offlineimap/ui/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/offlineimap/ui/Curses.pyo
�
��Vc@sddlmZmZmZmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlZddd��YZddd	��YZd
dd��YZdefd
��YZdejfd��YZde
efd��YZdS(i����(tRLockt
currentThreadtLocktEvent(tdequeN(tUIBase(tExitNotifyThreadt
CursesUtilcBsSeZd�Zd�Zd�Zed�Zd�Zd�Zd�Z	d�Z
RS(cOs%t�|_t�|_i|_dS(N(Rtiolockttframe_locktcolormap(tselftargstkwargs((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt__init__ s	cCstj|j|�S(s<Return the curses color pair, that corresponds to the color.(tcursest
color_pairR
(Rtcol_name((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytcurses_colorpair)sc	Cs�d|jd<tjdtjtj�d|jd<tj}dtjtfdtjtfdtjtfdtjtfd	tj	tfd
tj
tfdtjtff}d}xA|D]9\}}}|d7}||j|<tj|||�q�WdS(
s,Initialize the curses color pairs available.itwhiteitbannertblacktbluetredtpurpletcyantgreentorangeN(R
Rt	init_pairtCOLOR_WHITEt
COLOR_BLUEtCOLOR_BLACKtFalset	COLOR_REDt
COLOR_MAGENTAt
COLOR_CYANtCOLOR_GREENtCOLOR_YELLOW(Rtbcoltcolorstitnametfcoltbold((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytinit_colorpairs.s 

	

cCs|jj|�S(s�Locks the Curses ui thread.

        Can be invoked multiple times from the owning thread. Invoking
        from a non-owning thread blocks and waits until it has been
        unlocked by the owning thread.(Rtacquire(Rtblock((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytlockFscCs|jj�dS(sUnlocks the Curses ui thread.

        Decrease the lock counter by one and unlock the ui thread if the
        counter reaches 0.  Only call this method when the calling
        thread owns the lock. A RuntimeError is raised if this method is
        called when the lock is unlocked.N(Rtrelease(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytunlockOscOs-|j�z|||�Wd|j�XdS(s'Perform an operation with full locking.N(R/R1(RttargetRR
((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytexec_lockedYs
cCsd�}|j|�dS(NcSstjj�tj�dS(N(Rtpanelt
update_panelstdoupdate(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytlockedstuffcs
(R3(RR7((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytrefreshbs	cCs
t|d�S(Ntstdscr(thasattr(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytisactivehs(t__name__t
__module__RRR,tTrueR/R1R3R8R;(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRs						
			tCursesAccountFramecBsGeZdZd�Zdd�Zd�Zd�Zd�Zd�ZRS(s�Notable instance variables:

    - account: corresponding Account()
    - children
    - ui
    - key
    - window: curses window associated with an account
    cCsFg|_|r|nd|_||_d|_d|_d|_dS(sG
        :param account: An Account() or None (for eg SyncrunnerThread)s*ControliN(tchildrentaccounttuitNonetwindowtacc_numtlocation(RRBRA((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRvs				icCso|rd|d|dfnd}d|j||jf}|jj|jjdd|�t|�|_dS(sVDraw the account status string.

        secs tells us how long we are going to sleep.s%3d:%02di<tactives%s: [%s] %12.12s: iN(RERARBR3RDtaddstrtlenRF(Rtsecstsleepstrtaccstr((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytdrawleadstr�s$cCsY||_||_|j�x6|jD]+}|j||jd�|jd7_q&WdS(s�Register an curses win and a hotkey as Account window.

        :param curses_win: the curses window associated with an account
        :param acc_num: int denoting the hotkey associated with this account.iiN(RDRERMR@tupdateRF(Rt
curses_winREtchild((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt	setwindow�s		
cCsAt|j|j|jd�}|jd7_|jj|�|S(s_Create a new ThreadFrame and append it to self.children.

        :returns: The new ThreadFrameii(tCursesThreadFrameRBRDRFR@tappend(Rttf((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytget_new_tframe�scCs=|j|�|jj|jj�tj|�|jj�S(smShow how long we are going to sleep and sleep.

        :returns: Boolean, whether we want to abort the sleep(	RMRBR3RDR8ttimetsleepRAtget_abort_event(Rt	sleepsecst
remainingsecs((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytsleeping�s

cCsYt|jtjj�rU|jjd|j�|jjjd|jj	dd�ndS(s8Request that we stop sleeping asap and continue to sync.s%Requested synchronization for acc: %ss
Account %st	skipsleept1N(
t
isinstanceRAtofflineimaptaccountstAccountRBtinfotconfigtsetR)(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytsyncnow�s(	R<R=t__doc__RRMRQRUR[Re(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR?ls			
	
RRcBs>eZdZd�Zdd�Zd�Zd�Zd�ZRS(s-curses_color: current color pair for logging.cCs:||_||_||_||_tjd�|_dS(s_
        :param ui: is a Blinkenlights() instance
        :param acc_win: curses Account windowiN(RBRDtxtyRRtcurses_color(RRBtacc_winRgRh((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�s
				icCs0||jj|�B|_||_|j�dS(s{Draw the thread symbol '@' in the specified color

        :param modifier: Curses modified, such as curses.A_BOLD
        N(RBRRit	colornametdisplay(Rtcolortmodifier((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytsetcolor�s	cs#�fd�}�jj|�dS(Ncs3�jj�j�jd�j��jj�dS(Nt@(RDtaddchRhRgRiR8((R(s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytlocked_display�s"(RBR3(RRr((Rs9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRl�scCs)||_||_||_|j�dS(s<Update the xy position of the '.' (and possibly the aframe).N(RDRhRgRl(RRjRgRh((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRN�s			cCs|jd�dS(NR(Ro(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt	std_color�s(R<R=RfRRoRlRNRs(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRR�s	
		tInputHandlercBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s+Listens for input via the curses interfacescCsKtt|�j�d|_||_t�|_t�|_	|j
�dS(N(tsuperRtRRCtchar_handlerRBRtenabledRt	inputlocktstart(RRB((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�s		ccs]|jj�xI|jj�rX|j�|jjj�}WdQX|dkr|VqqWdS(s�Return the key pressed or -1.

        Wait until `enabled` and loop internally every stdscr.timeout()
        msecs, releasing the inputlock.
        :returns: char or None if disabled while in hereNi����(Rwtwaittis_setRxRBR9tgetch(Rtchar((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt
get_next_char�s

cCs;x4tr6|j�}x|D]}|j|�qWqWdS(N(R>R~Rv(Rtchar_genR}((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytruns	
cCsF|j�7||_|dkr/|jj�n
|jj�WdQXdS(sSets a character callback handler.

        If a key is pressed it will be passed to this handler. Keys
        include the curses.KEY_RESIZE key.

        callback is a function taking a single arg -- the char pressed.
        If callback is None, input will be ignored.N(RxRvRCRwtclearRd(Rtcallback((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt
set_char_hdlrs
	
	cCs|jj�|jj�dS(s�Call this method when you want exclusive input control.

        Make sure to call input_release afterwards! While this lockis
        held, input can go to e.g. the getpass input.N(RwR�RxR-(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt
input_acquires
cCs|jj�|jj�dS(s1Call this method when you are done getting input.N(RxR0RwRd(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt
input_release%s
(	R<R=RfRR~R�R�R�R�(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRt�s	
	
				tCursesLogHandlercBseZdZd�ZRS(s?self.ui has been set to the UI class before anything is invokedcCs�tjj||�}|jj�j}|jjj�|jj�zT|jj	j
�\}}|sk|r�|jj	jd�n|jj	j||�Wd|jj
�|jjj�X|jj	j�|jjj�dS(Ni
(tloggingt
StreamHandlertformatRBtgettfRiR	R-R/tlogwintgetyxRqRHR1R0tnoutrefreshR9R8(Rtrecordtlog_strRmRhRg((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytemit/s

(R<R=RfR�(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�,st
BlinkenlightscBs.eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd!d�Zed�Zd�Zd�Z d�Z!d�Z"d �Z#RS("s�Curses-cased fancy UI.

    Notable instance variables self. ....:

       - stdscr: THe curses std screen
       - bannerwin: The top line banner window
       - width|height: The total curses screen dimensions
       - logheight: Available height for the logging part
       - log_con_handler: The CursesLogHandler()
       - threadframes:
       - accframes[account]: 'Accountframe'cOs*tt|�j||�tj|�dS(N(RuR�RR(RRR
((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRPscCs?t�}tjd�|_|j|j�|jj|�|S(s�Backend specific console handler.

        Sets up things and adds them to self.logger.
        :returns: The logging.Handler() for console outputs%(message)s(R�R�t	Formattert	formattertsetFormattertloggert
addHandler(Rtch((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytsetup_consolehandlerUs
	cCs�tjj�r#tjj�r#tStjjdd�s<tStj	dd!dkshtj	dd!dkr�yt
j�t
j�Wq�tSXnt
S(	s6Returns true if the backend is usable ie Curses works.tTERMiiiiN(ii(iii(tsyststdouttisattytstdinR tostenvirontgetRCtversion_infoRtinitscrtendwinR>(ts((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytisusablegs,
cCs i|_i|_i|_t�|_tj�|_tj�tj	�|jj
d�|jjd�tj�d|_ytjd�|_WnnX|jj�|jj�|j�||j_|j�t|�|_|jj|j�|j�jd�|jtj�dS(Nii�iR(tavailablethreadframestthreadframest	accframesRtaflockRR�R9tnoechotcbreaktkeypadttimeouttstart_colorRCt	oldcursortcurs_setR�R8R,t_log_con_handlerRBtsetupwindowsRttinputhandlerR�t
on_keypressedR�RoRbR_R(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytinit_banner{s0			


	



cGs-|j�jd�tt|�j|�dS(s=Output that we start syncing an account (and start counting).RN(R�RoRuR�tacct(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�t
connecting(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tsyncfolders(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�t
syncingfolder(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tskippingfolder(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tloadmessagelist(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tsyncingmessages(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tcopyingmessage(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tdeletingmessages(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�taddingflags(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�t
deletingflags(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scGs-|j�jd�tt|�j|�dS(NR(R�RoRuR�tcallhook(RR((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��sicCs3|j�jdtj�tt|�j|�dS(NR(R�RoRtA_BOLDRuR�twarn(Rtmsgtminor((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��scCs�|j|�}|j�[||j|kro|j||}|jd�|j|j|�|j||=nWdQXtt|�j|�dS(NR(	tgetthreadaccountR	R�RoR�RSRuR�tthreadExited(RtthreadtaccRT((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��s

c	Cs�t�}|j�}|j��y&||j|krD|j||SWn.tk
rui|j|<t�|j|<nXt|j|�r�|j|j�}|j	�n|j
|�j�}||j||<WdQX|S(s/Return the ThreadFrame() of the current thread.N(RR�R	R�tKeyErrorRR�RItpopleftRstgetaccountframeRU(Rt
cur_threadR�RT((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��s	



cCs�|tjkr|j�n|dks4|dkr8dSt|�dkrs|jd�tjjj|j	d�nyt
t|��}Wntk
r�dSX|t|j
�kr�dS|j|j
|�j�dS(Nii�tqsRequested shutdown via 'q'i(Rt
KEY_RESIZEt
resizetermtchrR�R_R`Ratset_abort_eventRctintt
ValueErrorRIthotkeysR�Re(Rtkeytindex((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��s


cCsK|j�jd�|jd|d|df�tt|�j||�S(NRsNext sync in %d:%02di<(R�RoRbRuR�RW(RRYRA((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyRWscCsA|s|j�jd�n|j|j��}|j||�S(NR(R�RoR�R�R[(RRYRZtaccframe((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR[scCs|j|jt�dS(sResize the current windows.N(R3R�R>(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�scCstj|�dS(N(Rt
mainException(R((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�scCst|jj�|j�z>|jd�|jd|�|jj�|jj�}Wd|j�|jj�X|S(Ns *** Input Requireds+ *** Please enter password for account %s: (	R�R�R/R�R�R8tgetstrR1R�(RtaccountnameRcterrmsgtpassword((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pytgetpass"s


	

cCs�|jj�\|_|_|jt|j�d|_|r�tj|j|j�|j	j
d|j�|jj
|j|j�n?tjd|jdd�|_	tj|j|jdd�|_|j
�|jjt�|jjt�|j�tt|jj���|_|jd}d}g|_xg|jD]\}tjd|j|d�}|j|j||�|jj|�|d7}|d8}q=Wtj�dS(s�Setup and draw bannerwin and logwin.

        If `resize`, don't create new windows, just adapt size. This
        function should be invoked with CursesUtils.locked().iiN(R9tgetmaxyxtheighttwidthRIR�t	logheightRR�t	bannerwintresizeR�tnewwintdraw_bannerwintidlokR>tscrolloktdraw_logwintreversedtsortedtkeysR`R�RQRSR6(RR�tposR�RARj((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�4s.!


	
cCs�tj�r%tj|jd�B}n	tj}|jj�|jjd|�dtj	tj
f}|jjdd||�|jjd|jt
tj�dtj|�|jj�dS(sDraw the top-line banner line.Rt s%s %siiN(Rt
has_colorsR�Rt	A_REVERSER�R�tbkgdR_t__productname__t__version__RHR�RIt
__copyright__R�(RRmtstring((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�Ts	
	
#
cCs^tj�rtjd�}n	tj}|jjdd�|jj�|jjd|�dS(s(Re)draw the current logwindow.iR�N(RR�RtA_NORMALR�tmoveteraseR�(RRm((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�ds	
cCs[|j�E||jkr$|j|St||�|j|<|jdt�WdQX|j|S(spReturn an AccountFrame() corresponding to acc_name.

        Note that the *control thread uses acc_name `None`.R�N(R�R�R?R�R>(Rtacc_name((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�os
cOs�tj�|jjd�tj�tj�|jj|j�t	j
|�tt|�j
|_
tt|�j||�dS(Ni(RtnocbreakR9R�techoR�R�t
removeHandlerR�RR�RuR�R�t	terminate(RRR
((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�|s



cCstj||�dS(N(RtthreadException(RR�((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR��sN($R<R=RfRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RWR[R�R�RCR�R R�R�R�R�R�R�(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyR�Cs@				$													
						 			
	((((t	threadingRRRRtcollectionsRRVR�R�RR�tofflineimap.ui.UIBaseRtofflineimap.threadutilRR_RR?RRRtR�R�R�(((s9/usr/lib/python2.7/site-packages/offlineimap/ui/Curses.pyt<module>s"MO+F

Spamworldpro Mini