§
    Žpma®]  ã                   ó   — d dl mZmZmZmZ d dlmZ d dlZd dlZd dl	Z	d dl
Z
d dlZd dlmZ d dlmZ d dlZ G d„ d¦  «        Z G d„ d	¦  «        Z G d
„ d¦  «        Z G d„ de¦  «        Z G d„ dej        ¦  «        Z G d„ dee¦  «        ZdS )é    )ÚRLockÚcurrentThreadÚLockÚEvent)ÚdequeN)ÚUIBase)ÚExitNotifyThreadc                   ó@   — e Zd Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Zd„ Z	d	„ Z
d
S )Ú
CursesUtilc                 ó`   — t          ¦   «         | _        t          ¦   «         | _        i | _        d S ©N)r   ÚiolockÚtframe_lockÚcolormap)ÚselfÚargsÚkwargss      ú0/usr/share/offlineimap3/offlineimap/ui/Curses.pyÚ__init__zCursesUtil.__init__    s(   € å‘g”gˆŒÝ ™7œ7ˆÔð ˆŒØHÐHó    c                 ó@   — t          j        | j        |         ¦  «        S )z<Return the curses color pair, that corresponds to the color.)ÚcursesÚ
color_pairr   )r   Úcol_names     r   Úcurses_colorpairzCursesUtil.curses_colorpair)   s   € õ Ô  ¤¨xÔ!8Ñ9Ô9Ð9r   c           	      óÂ  — d| j         d<   t          j        dt          j        t          j        ¦  «         d| j         d<   t          j        }dt          j        dfdt          j        dfdt          j        dfd	t          j        dfd
t          j        dfdt          j	        dfdt          j
        dff}d}|D ]+\  }}}|dz  }|| j         |<   t          j        |||¦  «         Œ,dS )z,Initialize the curses color pairs available.r   Úwhiteé   ÚbannerÚblackFÚblueÚredÚpurpleÚcyanÚgreenÚorangeN)r   r   Ú	init_pairÚCOLOR_WHITEÚ
COLOR_BLUEÚCOLOR_BLACKÚ	COLOR_REDÚCOLOR_MAGENTAÚ
COLOR_CYANÚCOLOR_GREENÚCOLOR_YELLOW)r   ÚbcolÚcolorsÚiÚnameÚfcolÚbolds          r   Úinit_colorpairszCursesUtil.init_colorpairs.   sõ   € ð "#ˆŒ�gÑÝÔ˜�FÔ.µÔ0AÑBÔBÐBØ"#ˆŒ�hÑåÔ!ˆà•fÔ(¨%Ð0Ø•VÔ&¨Ð.Ø•FÔ$ eÐ,Ø•vÔ+¨UÐ3Ø•VÔ&¨Ð.Ø•fÔ(¨%Ð0Ø•vÔ*¨EÐ2ð4ˆð ˆØ &ð 	,ð 	,ÑˆD�$˜Ø�‰FˆAØ"#ˆDŒM˜$ÑÝÔ˜Q  dÑ+Ô+Ð+Ð+ð	,ð 	,r   Tc                 ó6   — | j                              |¦  «        S )zÎ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.)r   Úacquire)r   Úblocks     r   ÚlockzCursesUtil.lockF   s   € ð Œ{×"Ò" 5Ñ)Ô)Ð)r   c                 ó8   — | j                              ¦   «          dS )a  Unlocks 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)r   Úrelease©r   s    r   ÚunlockzCursesUtil.unlockO   s   € ð 	Œ×ÒÑÔÐÐÐr   c                 óš   — |                       ¦   «          	  ||i |¤Ž |                      ¦   «          dS # |                      ¦   «          w xY w)z'Perform an operation with full locking.N)r:   r>   )r   Útargetr   r   s       r   Úexec_lockedzCursesUtil.exec_lockedY   sN   € ð 	�	Š	‰Œˆð	ØˆF�DÐ#˜FÐ#Ð#Ð#à�KŠK‰MŒMˆMˆMˆMøˆD�KŠK‰MŒMˆMˆMøøøs	   –4 ´A
c                 ó6   — d„ }|                       |¦  «         d S )Nc                  óh   — t           j                             ¦   «          t          j        ¦   «          d S r   )r   ÚpanelÚupdate_panelsÚdoupdate© r   r   Úlockedstuffz'CursesUtil.refresh.<locals>.lockedstuffc   s*   € ÝŒL×&Ò&Ñ(Ô(Ð(ÝŒOÑÔÐÐÐr   )rA   )r   rH   s     r   ÚrefreshzCursesUtil.refreshb   s-   € ð	ð 	ð 	ð 	×Ò˜Ñ%Ô%Ð%Ð%Ð%r   c                 ó"   — t          | d¦  «        S )NÚstdscr)Úhasattrr=   s    r   ÚisactivezCursesUtil.isactivei   s   € Ý�t˜XÑ&Ô&Ð&r   N)T)Ú__name__Ú
__module__Ú__qualname__r   r   r6   r:   r>   rA   rI   rM   rG   r   r   r   r      s”   € € € € € ðIð Ið Ið:ð :ð :ð
,ð ,ð ,ð0*ð *ð *ð *ðð ð ðð ð ð&ð &ð &ð'ð 'ð 'ð 'ð 'r   r   c                   ó8   — e Zd ZdZd„ Zd
d„Zd„ Zd„ Zd„ Zd„ Z	d	S )ÚCursesAccountFramez¡Notable instance variables:

    - account: corresponding Account()
    - children
    - ui
    - key
    - window: curses window associated with an account
    c                 ób   — g | _         |r|nd| _        || _        d| _        d| _        d| _        dS )zG
        :param account: An Account() or None (for eg SyncrunnerThread)z*ControlNr   )ÚchildrenÚaccountÚuiÚwindowÚacc_numÚlocation)r   rV   rU   s      r   r   zCursesAccountFrame.__init__w   s;   € ð ˆŒØ")Ð9�w�w¨zˆŒØˆŒØˆŒàˆŒàˆŒˆˆr   r   c                 óÀ   ‡ ‡— |rd|dz  |dz  fz  nd}‰ j         ›d|›d‰ j        d›d�Šˆˆ fd„}‰ j                             |¦  «         t	          ‰¦  «        ‰ _        d	S )
zVDraw the account status string.

        secs tells us how long we are going to sleep.z%3d:%02dé<   Úactivez: [z] z>12.12z: c                  ón   •— 	 ‰j                              dd‰ ¦  «         d S # t          j        $ r Y d S w xY w©Nr   )rW   Úaddstrr   Úerror)Úaccstrr   s   €€r   r_   z.CursesAccountFrame.drawleadstr.<locals>.addstr�   sL   ø€ ðØ”×"Ò" 1 a¨Ñ0Ô0Ð0Ð0Ð0øÝ”<ð ð ð Ø��ðøøøs   ƒ! ¡4³4N)rX   rU   rV   rA   ÚlenrY   )r   ÚsecsÚsleepstrr_   ra   s   `   @r   ÚdrawleadstrzCursesAccountFrame.drawleadstr…   s�   øø€ ð
 <@ÐM�: ¨¡¨T°B©YÐ 7Ñ7Ð7ÀXˆØ)-¬¨¨°x°x°xÀÄÀÀÀÐNˆð	ð 	ð 	ð 	ð 	ð 	ð 	Œ×Ò˜FÑ#Ô#Ð#å˜F™œˆŒˆˆr   c                 óþ   — || _         || _        |                      ¦   «          | j                             | j         j        ¦  «         | j        D ].}|                     || j        d¦  «         | xj        dz  c_        Œ/dS )zÍ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.r   r   N)	rW   rX   re   rV   rA   ÚnoutrefreshrT   ÚupdaterY   )r   Ú
curses_winrX   Úchilds       r   Ú	setwindowzCursesAccountFrame.setwindow—   s„   € ð !ˆŒØˆŒØ×ÒÑÔÐØŒ×Ò˜DœKÔ3Ñ4Ô4Ð4à”]ð 	ð 	ˆEØ�LŠL˜ T¤]°AÑ6Ô6Ð6ØˆMŒM˜QÑˆMŒMˆMð	ð 	r   c                 óœ   — t          | j        | j        | j        d¦  «        }| xj        dz  c_        | j                             |¦  «         |S )z_Create a new ThreadFrame and append it to self.children.

        :returns: The new ThreadFramer   r   )ÚCursesThreadFramerV   rW   rY   rT   Úappend)r   Útfs     r   Úget_new_tframez!CursesAccountFrame.get_new_tframe¦   sH   € õ
 ˜tœw¨¬°T´]ÀAÑFÔFˆØˆŒ˜ÑˆŒØŒ×Ò˜RÑ Ô Ð Øˆ	r   c                 óÎ   — |                       |¦  «         | j                             | j        j        ¦  «         t          j        |¦  «         | j                             ¦   «         S )zmShow how long we are going to sleep and sleep.

        :returns: Boolean, whether we want to abort the sleep)	re   rV   rA   rW   rI   ÚtimeÚsleeprU   Úget_abort_event)r   Ú	sleepsecsÚremainingsecss      r   ÚsleepingzCursesAccountFrame.sleeping°   sW   € ð
 	×Ò˜Ñ'Ô'Ð'ØŒ×Ò˜DœKÔ/Ñ0Ô0Ð0ÝŒ
�9ÑÔÐØŒ|×+Ò+Ñ-Ô-Ð-r   c                 óò   — t          | j        t          j        j        ¦  «        rR| j                             d| j        z  ¦  «         | j        j                             d| j        j	        z  dd¦  «         dS dS )z8Request that we stop sleeping asap and continue to sync.z%Requested synchronization for acc: %sz
Account %sÚ	skipsleepÚ1N)
Ú
isinstancerU   ÚofflineimapÚaccountsÚAccountrV   ÚinfoÚconfigÚsetr3   r=   s    r   ÚsyncnowzCursesAccountFrame.syncnowº   s|   € õ
 �d”l¥KÔ$8Ô$@ÑAÔAð 	6ØŒG�LŠLÐ@À4Ä<ÑOÑPÔPÐPØŒLÔ×#Ò# L°4´<Ô3DÑ$DØ$/°ñ6ô 6ð 6ð 6ð 6ð	6ð 	6r   N©r   )
rN   rO   rP   Ú__doc__r   re   rk   rp   rw   r‚   rG   r   r   rR   rR   m   s}   € € € € € ðð ðð ð ð$ð $ð $ð $ð$ð ð ðð ð ð.ð .ð .ð6ð 6ð 6ð 6ð 6r   rR   c                   ó2   — e Zd ZdZd„ Zd	d„Zd„ Zd„ Zd„ ZdS )
rm   z-curses_color: current color pair for logging.c                 óp   — || _         || _        || _        || _        t	          j        d¦  «        | _        dS )z_
        :param ui: is a Blinkenlights() instance
        :param acc_win: curses Account windowr   N)rV   rW   ÚxÚyr   r   Úcurses_color)r   rV   Úacc_winr‡   rˆ   s        r   r   zCursesThreadFrame.__init__È   s9   € ð
 ˆŒØˆŒØˆŒØˆŒÝ"Ô-¨aÑ0Ô0ˆÔÐÐr   r   c                 ó€   — || j                              |¦  «        z  | _        || _        |                      ¦   «          dS )z¢Draw the thread symbol '@' in the specified color

        :param color: Curses colorname
        :param modifier: Curses modified, such as curses.A_BOLD
        N)rV   r   r‰   Ú	colornameÚdisplay)r   ÚcolorÚmodifiers      r   ÚsetcolorzCursesThreadFrame.setcolorÓ   s9   € ð % t¤w×'?Ò'?ÀÑ'FÔ'FÑFˆÔØˆŒØ�Š‰Œˆˆˆr   c                 óF   ‡ — ˆ fd„}‰ j                              |¦  «         d S )Nc                  óÀ   •— 	 ‰ j                              ‰ j        ‰ j        d‰ j        ¦  «         n# t
          j        $ r Y nw xY w‰ j                              ¦   «          d S )Nú@)rW   Úaddchrˆ   r‡   r‰   r   r`   rI   r=   s   €r   Úlocked_displayz1CursesThreadFrame.display.<locals>.locked_displayß   sj   ø€ ðØ”×!Ò! $¤&¨$¬&°#°tÔ7HÑIÔIÐIÐIøÝ”<ð ð ð Ø�ðøøøàŒK×ÒÑ!Ô!Ð!Ð!Ð!s   ƒ,0 °AÁA)rV   rA   )r   r•   s   ` r   r�   zCursesThreadFrame.displayÞ   s:   ø€ ð	"ð 	"ð 	"ð 	"ð 	"ð 	Œ×Ò˜NÑ+Ô+Ð+Ð+Ð+r   c                 óX   — || _         || _        || _        |                      ¦   «          dS )z<Update the xy position of the '.' (and possibly the aframe).N)rW   rˆ   r‡   r�   )r   rŠ   r‡   rˆ   s       r   rh   zCursesThreadFrame.updateé   s*   € ð ˆŒØˆŒØˆŒØ�Š‰Œˆˆˆr   c                 ó0   — |                       d¦  «         d S ©Nr    )r�   r=   s    r   Ú	std_colorzCursesThreadFrame.std_colorñ   s   € Ø�Š�gÑÔÐÐÐr   Nrƒ   )	rN   rO   rP   r„   r   r�   r�   rh   r™   rG   r   r   rm   rm   Å   sj   € € € € € Ø7Ð7ð	1ð 	1ð 	1ð	ð 	ð 	ð 	ð	,ð 	,ð 	,ðð ð ðð ð ð ð r   rm   c                   ó@   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )ÚInputHandlerz+Listens for input via the curses interfacesc                 óæ   •— t          t          | ¦  «                             ¦   «          d | _        || _        t          ¦   «         | _        t          ¦   «         | _        |  	                    ¦   «          d S r   )
Úsuperr›   r   Úchar_handlerrV   r   Úenabledr   Ú	inputlockÚstart)r   rV   Ú	__class__s     €r   r   zInputHandler.__init__ü   sU   ø€ Ý�l˜DÑ!Ô!×*Ò*Ñ,Ô,Ð,Ø ˆÔØˆŒÝ‘w”wˆŒå™œˆŒà�
Š
‰Œˆˆˆr   c              #   ó2  K  — | j                              ¦   «          | j                              ¦   «         rb| j        5  | j        j                             ¦   «         }ddd¦  «         n# 1 swxY w Y   |dk    r|V — | j                              ¦   «         °`dS dS )zÇ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 hereNéÿÿÿÿ)rŸ   ÚwaitÚis_setr    rV   rK   Úgetch)r   Úchars     r   Úget_next_charzInputHandler.get_next_char  sâ   è è € ð 	Œ×ÒÑÔÐØŒl×!Ò!Ñ#Ô#ð 	Ø”ð .ð .Ø”w”~×+Ò+Ñ-Ô-�ð.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .à�rŠzˆzØ�
�
�
ð	 Œl×!Ò!Ñ#Ô#ð 	ð 	ð 	ð 	ð 	s   ¼A'Á'A+Á.A+c                 ób   — 	 |                       ¦   «         }|D ]}|                      |¦  «         ŒŒ/r   )r©   rž   )r   Úchar_genr¨   s      r   ÚrunzInputHandler.run  sC   € ð	(Ø×)Ò)Ñ+Ô+ˆHØ ð (ð (�Ø×!Ò! $Ñ'Ô'Ð'Ð'ð	(r   c                 ó¾   — | j         5  || _        |€| j                             ¦   «          n| j                             ¦   «          ddd¦  «         dS # 1 swxY w Y   dS )a  Sets 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)r    rž   rŸ   Úclearr�   )r   Úcallbacks     r   Úset_char_hdlrzInputHandler.set_char_hdlr  s©   € ð Œ^ð 	#ð 	#Ø (ˆDÔàÐØ”×"Ò"Ñ$Ô$Ð$Ð$à”× Ò Ñ"Ô"Ð"ð	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s   ˆ=AÁAÁAc                 ój   — | j                              ¦   «          | j                             ¦   «          dS )z´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)rŸ   r®   r    r8   r=   s    r   Úinput_acquirezInputHandler.input_acquire,  s2   € ð 	Œ×ÒÑÔÐØŒ×ÒÑ Ô Ð Ð Ð r   c                 ój   — | j                              ¦   «          | j                             ¦   «          dS )z1Call this method when you are done getting input.N)r    r<   rŸ   r�   r=   s    r   Úinput_releasezInputHandler.input_release5  s2   € ð 	Œ×ÒÑ Ô Ð ØŒ×ÒÑÔÐÐÐr   )rN   rO   rP   r„   r   r©   r¬   r°   r²   r´   Ú__classcell__©r¢   s   @r   r›   r›   õ   s‰   ø€ € € € € Ø5Ð5ðð ð ð ð ðð ð ð(ð (ð (ð#ð #ð #ð"!ð !ð !ðð ð ð ð ð ð r   r›   c                   ó   — e Zd ZdZd„ ZdS )ÚCursesLogHandlerz?self.ui has been set to the UI class before anything is invokedc                 ó  — t           j                             | |¦  «        }| j                             ¦   «         j        }| j        j                             ¦   «          | j                             ¦   «          	 | j        j	         
                    ¦   «         \  }}|s|r| j        j	                             d¦  «         | j        j	                             ||¦  «         | j        j	                             ¦   «          | j        j                             ¦   «          | j                             ¦   «          | j        j                             ¦   «          d S # | j                             ¦   «          | j        j                             ¦   «          w xY w)Né
   )ÚloggingÚStreamHandlerÚformatrV   Úgettfr‰   r   r8   r:   ÚlogwinÚgetyxr”   r_   rg   rK   rI   r>   r<   )r   ÚrecordÚlog_strrŽ   rˆ   r‡   s         r   ÚemitzCursesLogHandler.emit?  s@  € ÝÔ'×.Ò.¨t°VÑ<Ô<ˆØ”—’‘”Ô,ˆð 	ŒÔ×#Ò#Ñ%Ô%Ð%ØŒ�Š‰Œˆð
	*Ø”7”>×'Ò'Ñ)Ô)‰DˆAˆqØð )�Að )Ø””×$Ò$ RÑ(Ô(Ð(àŒGŒN×!Ò! '¨5Ñ1Ô1Ð1ØŒGŒN×&Ò&Ñ(Ô(Ð(ØŒGŒN×"Ò"Ñ$Ô$Ð$àŒG�NŠNÑÔÐØŒGÔ×'Ò'Ñ)Ô)Ð)Ð)Ð)øð ŒG�NŠNÑÔÐØŒGÔ×'Ò'Ñ)Ô)Ð)Ð)øøøs   Á7B E Å9F	N)rN   rO   rP   r„   rÃ   rG   r   r   r¸   r¸   <  s)   € € € € € ØIÐIð*ð *ð *ð *ð *r   r¸   c                   ó&  ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zˆ fd„Zˆ fd„Z	ˆ fd„Z
ˆ fd	„Zˆ fd
„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zˆ fd„Zd%ˆ fd„	Zˆ fd„Zd„ Zd„ Zˆ fd„Zd„ Zd„ Zd„ Zd&d„Zd'd„Zd „ Zd!„ Z d"„ Z!ˆ fd#„Z"d$„ Z#ˆ xZ$S )(ÚBlinkenlightsa�  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'c                 ó|   •—  t          t          | ¦  «        j        |i |¤Ž t                               | ¦  «         d S r   )r�   rÅ   r   r   ©r   r   r   r¢   s      €r   r   zBlinkenlights.__init__c  s?   ø€ Ø+��m˜TÑ"Ô"Ô+¨TÐ<°VÐ<Ð<Ð<Ý×Ò˜DÑ!Ô!Ð!Ð!Ð!r   c                 ó¼   — t          ¦   «         }t          j        d¦  «        | _        |                     | j        ¦  «         | j                             |¦  «         |S )z’Backend specific console handler.

        Sets up things and adds them to self.logger.
        :returns: The logging.Handler() for console outputz%(message)s)r¸   r»   Ú	FormatterÚ	formatterÚsetFormatterÚloggerÚ
addHandler)r   Úchs     r   Úsetup_consolehandlerz"Blinkenlights.setup_consolehandlerh  sT   € õ ÑÔˆõ !Ô*¨=Ñ9Ô9ˆŒØ
�Š˜œÑ'Ô'Ð'àŒ×Ò˜rÑ"Ô"Ð"ð ˆ	r   c                 ó†  — t           j                             ¦   «         s t           j                             ¦   «         rdS t          j                             dd¦  «        sdS t           j        dd…         dk     st           j        dd…         dk    r0	 t          j	        ¦   «          t          j
        ¦   «          n#  Y dS xY wdS )	z6Returns true if the backend is usable ie Curses works.FÚTERMNr   é   )é   é   )rÓ   rÔ   rÔ   T)ÚsysÚstdoutÚisattyÚstdinÚosÚenvironÚgetÚversion_infor   ÚinitscrÚendwin)Úss    r   ÚisusablezBlinkenlights.isusablez  sµ   € õ Œz× Ò Ñ"Ô"ð 	¥s¤y×'7Ò'7Ñ'9Ô'9ð 	Ø�5åŒz�~Š~˜f dÑ+Ô+ð 	Ø�5õ Ô˜A˜a˜CÔ  6Ò)Ð)­SÔ-=¸aÀ¸cÔ-BÀiÒ-OÐ-OðÝ”Ñ Ô Ð Ý”‘”��øðØ�u�uøøøØˆts   Â&B9 Â9B>c                 óp  — i | _         i | _        i | _        t          ¦   «         | _        t          j        ¦   «         | _        t          j        ¦   «          t          j	        ¦   «          | j         
                    d¦  «         | j                             d¦  «         t          j        ¦   «          d | _        	 t          j        d¦  «        | _        n#  Y nxY w| j                             ¦   «          | j                             ¦   «          |                      ¦   «          | | j        _        |                      ¦   «          t+          | ¦  «        | _        | j                             | j        ¦  «         |                      ¦   «                              d¦  «         |                      t8          j        ¦  «         d S )Nr   iè  r   r"   )ÚavailablethreadframesÚthreadframesÚ	accframesr   Úaflockr   rÝ   rK   ÚnoechoÚcbreakÚkeypadÚtimeoutÚstart_colorÚ	oldcursorÚcurs_setr®   rI   r6   Ú_log_con_handlerrV   Úsetupwindowsr›   Úinputhandlerr°   Úon_keypressedr¾   r�   r   r|   r   r=   s    r   Úinit_bannerzBlinkenlights.init_bannerŽ  si  € Ø%'ˆÔ"ØˆÔØˆŒÝ‘f”fˆŒå”nÑ&Ô&ˆŒåŒ‰ŒˆåŒ‰ŒˆàŒ×Ò˜1ÑÔÐàŒ×Ò˜DÑ!Ô!Ð!ÝÔÑÔÐàˆŒð	Ý#œ_¨QÑ/Ô/ˆDŒNˆNøð	ØˆDøøøàŒ×ÒÑÔÐØŒ×ÒÑÔÐØ×ÒÑÔÐà#'ˆÔÔ Ø×ÒÑÔÐå(¨Ñ.Ô.ˆÔØÔ×'Ò'¨Ô(:Ñ;Ô;Ð;à�
Š
‰Œ×Ò˜eÑ$Ô$Ð$Ø�	Š	•+Ô$Ñ%Ô%Ð%Ð%Ð%s   Â6C ÃCc                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  dS )z=Output that we start syncing an account (and start counting).r#   N)r¾   r�   r�   rÅ   Úacct©r   r   r¢   s     €r   ró   zBlinkenlights.acct²  sA   ø€ ð 	�
Š
‰Œ×Ò˜hÑ'Ô'Ð'Ø'��m˜TÑ"Ô"Ô'¨Ð.Ð.Ð.Ð.r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S ©Nr   )r¾   r�   r�   rÅ   Ú
connectingrô   s     €r   r÷   zBlinkenlights.connecting¸  s?   ø€ Ø�
Š
‰Œ×Ò˜gÑ&Ô&Ð&Ø-��m˜TÑ"Ô"Ô-¨tÐ4Ð4Ð4Ð4r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S ©Nr!   )r¾   r�   r�   rÅ   Úsyncfoldersrô   s     €r   rú   zBlinkenlights.syncfolders¼  ó?   ø€ Ø�
Š
‰Œ×Ò˜fÑ%Ô%Ð%Ø.��m˜TÑ"Ô"Ô.°Ð5Ð5Ð5Ð5r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S ©Nr$   )r¾   r�   r�   rÅ   Úsyncingfolderrô   s     €r   rþ   zBlinkenlights.syncingfolderÀ  ó?   ø€ Ø�
Š
‰Œ×Ò˜fÑ%Ô%Ð%Ø0��m˜TÑ"Ô"Ô0°$Ð7Ð7Ð7Ð7r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S rý   )r¾   r�   r�   rÅ   Úskippingfolderrô   s     €r   r  zBlinkenlights.skippingfolderÄ  s?   ø€ Ø�
Š
‰Œ×Ò˜fÑ%Ô%Ð%Ø1��m˜TÑ"Ô"Ô1°4Ð8Ð8Ð8Ð8r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S )Nr%   )r¾   r�   r�   rÅ   Úloadmessagelistrô   s     €r   r  zBlinkenlights.loadmessagelistÈ  s?   ø€ Ø�
Š
‰Œ×Ò˜gÑ&Ô&Ð&Ø2��m˜TÑ"Ô"Ô2°DÐ9Ð9Ð9Ð9r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S rù   )r¾   r�   r�   rÅ   Úsyncingmessagesrô   s     €r   r  zBlinkenlights.syncingmessagesÌ  s?   ø€ Ø�
Š
‰Œ×Ò˜fÑ%Ô%Ð%Ø2��m˜TÑ"Ô"Ô2°DÐ9Ð9Ð9Ð9r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S ©Nr"   )r¾   r�   r�   rÅ   Úignorecopyingmessagerô   s     €r   r  z"Blinkenlights.ignorecopyingmessageÐ  s?   ø€ Ø�
Š
‰Œ×Ò˜eÑ$Ô$Ð$Ø7��m˜TÑ"Ô"Ô7¸Ð>Ð>Ð>Ð>r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S )Nr&   )r¾   r�   r�   rÅ   Úcopyingmessagerô   s     €r   r
  zBlinkenlights.copyingmessageÔ  s?   ø€ Ø�
Š
‰Œ×Ò˜hÑ'Ô'Ð'Ø1��m˜TÑ"Ô"Ô1°4Ð8Ð8Ð8Ð8r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S r  )r¾   r�   r�   rÅ   Údeletingmessagesrô   s     €r   r  zBlinkenlights.deletingmessagesØ  s?   ø€ Ø�
Š
‰Œ×Ò˜eÑ$Ô$Ð$Ø3��m˜TÑ"Ô"Ô3°TÐ:Ð:Ð:Ð:r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S rù   )r¾   r�   r�   rÅ   Úaddingflagsrô   s     €r   r  zBlinkenlights.addingflagsÜ  rû   r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S rù   )r¾   r�   r�   rÅ   Údeletingflagsrô   s     €r   r  zBlinkenlights.deletingflagsà  rÿ   r   c                 ó�   •— |                       ¦   «                              d¦  «          t          t          | ¦  «        j        |Ž  d S rö   )r¾   r�   r�   rÅ   Úcallhookrô   s     €r   r  zBlinkenlights.callhookä  s?   ø€ Ø�
Š
‰Œ×Ò˜gÑ&Ô&Ð&Ø+��m˜TÑ"Ô"Ô+¨TÐ2Ð2Ð2Ð2r   r   c                 ó¼   •— |                       ¦   «                              dt          j        ¦  «         t	          t
          | ¦  «                             |¦  «         d S r  )r¾   r�   r   ÚA_BOLDr�   rÅ   Úwarn)r   ÚmsgÚminorr¢   s      €r   r  zBlinkenlights.warné  sG   ø€ Ø�
Š
‰Œ×Ò˜e¥V¤]Ñ3Ô3Ð3Ý�m˜TÑ"Ô"×'Ò'¨Ñ,Ô,Ð,Ð,Ð,r   c                 óŠ  •— |                       |¦  «        }| j        5  || j        |         v rV| j        |         |         }|                     d¦  «         | j        |                              |¦  «         | j        |         |= d d d ¦  «         n# 1 swxY w Y   t          t          | ¦  «                             |¦  «         d S r˜   )	Úgetthreadaccountr   rã   r�   râ   rn   r�   rÅ   ÚthreadExited)r   ÚthreadÚaccro   r¢   s       €r   r  zBlinkenlights.threadExitedí  sý   ø€ Ø×#Ò# FÑ+Ô+ˆØÔð 	3ð 	3Ø˜Ô*¨3Ô/Ð/Ð/ØÔ& sÔ+¨FÔ3�Ø—’˜GÑ$Ô$Ð$ØÔ*¨3Ô/×6Ò6°rÑ:Ô:Ð:ØÔ% cÔ*¨6Ð2ð	3ð 	3ð 	3ñ 	3ô 	3ð 	3ð 	3ð 	3ð 	3ð 	3ð 	3øøøð 	3ð 	3ð 	3ð 	3õ 	�m˜TÑ"Ô"×/Ò/°Ñ7Ô7Ð7Ð7Ð7s   žA&BÂBÂBc                 óR  — t          ¦   «         }|                      ¦   «         }| j        5  	 || j        |         v r| j        |         |         cddd¦  «         S n0# t          $ r# i | j        |<   t          ¦   «         | j        |<   Y nw xY wt          | j        |         ¦  «        r4| j        |                              ¦   «         }| 	                    ¦   «          n'|  
                    |¦  «                             ¦   «         }|| j        |         |<   ddd¦  «         n# 1 swxY w Y   |S )z/Return the ThreadFrame() of the current thread.N)r   r  r   rã   ÚKeyErrorr   râ   rb   Úpopleftr™   Úgetaccountframerp   )r   Ú
cur_threadr  ro   s       r   r¾   zBlinkenlights.gettf÷  s‹  € õ #‘_”_ˆ
Ø×#Ò#Ñ%Ô%ˆàÔð 	4ð 	4ð:Ø Ô!2°3Ô!7Ð7Ð7ØÔ,¨SÔ1°*Ô=ð		4ð 	4ð 	4ð 	4ñ 	4ô 	4ð 	4ð 	4ð 8øåð :ð :ð :à)+�Ô! #Ñ&Ý27±'´'�Ô*¨3Ñ/Ð/Ð/ð:øøøõ �4Ô-¨cÔ2Ñ3Ô3ð @ØÔ/°Ô4×<Ò<Ñ>Ô>�Ø—’‘”��à×)Ò)¨#Ñ.Ô.×=Ò=Ñ?Ô?�Ø13ˆDÔ˜cÔ" :Ñ.ð!	4ð 	4ð 	4ñ 	4ô 	4ð 	4ð 	4ð 	4ð 	4ð 	4ð 	4øøøð 	4ð 	4ð 	4ð 	4ð" ˆ	s5   ªD¬!AÁDÁ*BÂDÂBÂBDÄD Ä#D c                 ó  — |t           j        k    r|                      ¦   «          d S |dk     s|dk    rd S t          |¦  «        dk    r?|                      d¦  «         t
          j        j                             | j	        d¦  «         	 t          t          |¦  «        ¦  «        }n# t          $ r Y d S w xY w|t          | j        ¦  «        k    rd S |                      | j        |         ¦  «                             ¦   «          d S )Nr   éÿ   ÚqzRequested shutdown via 'q'rÒ   )r   Ú
KEY_RESIZEÚ
resizetermÚchrr  r|   r}   r~   Úset_abort_eventr€   ÚintÚ
ValueErrorrb   Úhotkeysr   r‚   )r   ÚkeyÚindexs      r   rð   zBlinkenlights.on_keypressed  sü   € à•&Ô#Ò#Ð#Ø�OŠOÑÔÐØˆFà�Š7ˆ7�c˜C’i�iØˆFÝˆs‰8Œ8�sŠ?ˆ?à�IŠIÐ2Ñ3Ô3Ð3ÝÔ Ô(×8Ò8¸¼ÀaÑHÔHÐHð	Ý�˜C™œ‘M”MˆEˆEøÝð 	ð 	ð 	ØˆFˆFð	øøøà•C˜œÑ%Ô%Ò%Ð%àˆFà×Ò˜Tœ\¨%Ô0Ñ1Ô1×9Ò9Ñ;Ô;Ð;Ð;Ð;s   ÂB% Â%
B3Â2B3c                 óä   •— |                       ¦   «                              d¦  «         |                      d|dz  |dz  fz  ¦  «         t          t          | ¦  «                             ||¦  «        S )Nr"   zNext sync in %d:%02dr[   )r¾   r�   r   r�   rÅ   rs   )r   ru   rU   r¢   s      €r   rs   zBlinkenlights.sleep&  sd   ø€ Ø�
Š
‰Œ×Ò˜eÑ$Ô$Ð$Ø�	Š	Ð(¨I¸©N¸IÈ¹NÐ+KÑKÑLÔLÐLÝ•] DÑ)Ô)×/Ò/°	¸7ÑCÔCÐCr   c                 óÎ   — |s'|                       ¦   «                              d¦  «         |                      |                      ¦   «         ¦  «        }|                     ||¦  «        S rö   )r¾   r�   r   r  rw   )r   ru   rv   Úaccframes       r   rw   zBlinkenlights.sleeping+  s[   € Øð 	+à�JŠJ‰LŒL×!Ò! 'Ñ*Ô*Ð*Ø×'Ò'¨×(=Ò(=Ñ(?Ô(?Ñ@Ô@ˆØ× Ò  ¨MÑ:Ô:Ð:r   c                 ó<   — |                       | j        d¦  «         dS )zResize the current windows.TN)rA   rî   r=   s    r   r&  zBlinkenlights.resizeterm2  s#   € ð 	×Ò˜Ô*¨DÑ1Ô1Ð1Ð1Ð1r   c                 ó.   — t          j        | ¦  «         d S r   )r   ÚmainExceptionr=   s    r   r3  zBlinkenlights.mainException7  s   € ÝÔ˜TÑ"Ô"Ð"Ð"Ð"r   Nc                 ó6  — | j                              ¦   «          |                      ¦   «          	 |                      d¦  «         |                      d|z  ¦  «         | j                             ¦   «          | j                             ¦   «         }|                      ¦   «          | j                              ¦   «          n2# |                      ¦   «          | j                              ¦   «          w xY wt          |t          ¦  «        r|                     d¬¦  «        S |S )Nz *** Input Requiredz* *** Please enter password for user '%s': zutf-8)Úencoding)rï   r²   r:   r  r¿   rI   Úgetstrr>   r´   r{   ÚbytesÚdecode)r   Úusernamer€   ÚerrmsgÚpasswords        r   ÚgetpasszBlinkenlights.getpass:  s  € àÔ×'Ò'Ñ)Ô)Ð)ð 	�	Š	‰Œˆð		.à�IŠIÐ+Ñ,Ô,Ð,Ø�IŠIÐBØññ  ô  ð  àŒK×ÒÑ!Ô!Ð!Ø”{×)Ò)Ñ+Ô+ˆHà�KŠK‰MŒMˆMØÔ×+Ò+Ñ-Ô-Ð-Ð-øð �KŠK‰MŒMˆMØÔ×+Ò+Ñ-Ô-Ð-Ð-øøøõ �h¥Ñ&Ô&ð 	5Ø—?’?¨G�?Ñ4Ô4Ð4Øˆs   ¯AB< Â</C+Fc                 ó®  — | j                              ¦   «         \  | _        | _        | j        t	          | j        ¦  «        z
  dz
  | _        |r¶t          j        | j        | j        ¦  «        rt          j	        | j        | j        ¦  «         | j
                             d| j        ¦  «         | j                             | j        | j        ¦  «         | j                              ¦   «          | j                              ¦   «          nGt          j        d| j        dd¦  «        | _
        t          j        | j        | j        dd¦  «        | _        |                      ¦   «          | j                             d¦  «         | j                             d¦  «         |                      ¦   «          | j                             ¦   «         | _        | j        dz
  }d}g | _        | j        D ]c}t          j        d| j        |d¦  «        }| j        |                              ||¦  «         | j                             |¦  «         |dz  }|dz  }Œdt          j        ¦   «          dS )z¨Setup and draw bannerwin and logwin.

        If `resize`, don't create new windows, just adapt size. This
        function should be invoked with CursesUtils.locked().r   r   TN)rK   ÚgetmaxyxÚheightÚwidthrb   rä   Ú	logheightr   Úis_term_resizedr&  Ú	bannerwinÚresizer¿   r®   rg   ÚnewwinÚdraw_bannerwinÚidlokÚscrollokÚdraw_logwinÚkeysr}   r+  rk   rn   rF   )r   rD  Úposr-  rU   rŠ   s         r   rî   zBlinkenlights.setupwindowsP  s  € ð #'¤+×"6Ò"6Ñ"8Ô"8ÑˆŒ�T”ZØœ¥s¨4¬>Ñ':Ô':Ñ:¸QÑ>ˆŒØð 		JÝÔ% d¤k°4´:Ñ>Ô>ð ;ÝÔ! $¤+¨t¬zÑ:Ô:Ð:ØŒN×!Ò! ! T¤ZÑ0Ô0Ð0ØŒK×Ò˜tœ~¨t¬zÑ:Ô:Ð:ØŒK×ÒÑÔÐØŒK×#Ò#Ñ%Ô%Ð%Ð%å#œ]¨1¨d¬j¸!¸QÑ?Ô?ˆDŒNÝ œ-¨¬¸¼
ÀAÀqÑIÔIˆDŒKà×ÒÑÔÐØŒ×Ò˜$ÑÔÐØŒ×Ò˜TÑ"Ô"Ð"Ø×ÒÑÔÐð œ×+Ò+Ñ-Ô-ˆŒØŒk˜A‰oˆØˆØˆŒØ”}ð 	ð 	ˆGÝ”m A t¤z°3¸Ñ:Ô:ˆGØŒN˜7Ô#×-Ò-¨g°uÑ=Ô=Ð=ØŒL×Ò Ñ(Ô(Ð(Ø�Q‰JˆEØ�1‰HˆCˆCÝŒÑÔÐÐÐr   c                 óT  — t          j        ¦   «         r#t           j        |                      d¦  «        z  }nt           j        }| j                             ¦   «          | j                             d|¦  «         t          j	        ›dt          j
        ›�}dt          d| j        t          t          j        ¦  «        z
  t          |¦  «        z
  dz
  ¦  «        z  }|›|›t          j        ›�}| j                             dd|| j        dz
  |¦  «         | j                             ¦   «          dS )zDraw the top-line banner line.r   ú r   r   N)r   Ú
has_colorsr  r   Ú	A_REVERSErC  r®   Úbkgdr|   Ú__productname__Ú__version__Úmaxr@  rb   Ú__copyright__Úaddnstrrg   )r   rŽ   ÚstringÚspacess       r   rF  zBlinkenlights.draw_bannerwinu  s  € õ ÔÑÔð 	%Ý”M D×$9Ò$9¸(Ñ$CÔ$CÑCˆEˆEåÔ$ˆEØŒ×ÒÑÔÐØŒ×Ò˜C Ñ'Ô'Ð'Ý'Ô7Ð7Ð7Ý'Ô3Ð3ð5ˆà•s˜1˜tœz­CµÔ0IÑ,JÔ,JÑJÝ!$ V¡¤ñ -Ø/0ñ 1ñ 3ô 3ñ 3ˆà#˜V V V­[Ô-FÐ-FÐGˆØŒ×Ò˜q ! V¨T¬Z¸!©^¸UÑCÔCÐCØŒ×"Ò"Ñ$Ô$Ð$Ð$Ð$r   c                 ó>  — t          j        ¦   «         rt          j        d¦  «        }nt           j        }| j                             dd¦  «         | j                             ¦   «          | j                             d|¦  «         | j                             ¦   «          dS )z(Re)draw the current logwindow.r   rM  N)	r   rN  r   ÚA_NORMALr¿   Úmover®   rP  rg   )r   rŽ   s     r   rI  zBlinkenlights.draw_logwin†  sŒ   € õ ÔÑÔð 	$ÝÔ% aÑ(Ô(ˆEˆEå”OˆEØŒ×Ò˜˜AÑÔÐØŒ×ÒÑÔÐØŒ×Ò˜˜eÑ$Ô$Ð$ØŒ×ÒÑ!Ô!Ð!Ð!Ð!r   c                 óú   — | j         5  || j        v r| j        |         cddd¦  «         S t          | |¦  «        | j        |<   |                      d¬¦  «         ddd¦  «         n# 1 swxY w Y   | j        |         S )zpReturn an AccountFrame() corresponding to acc_name.

        Note that the *control thread uses acc_name `None`.NT)rD  )rå   rä   rR   rî   )r   Úacc_names     r   r   zBlinkenlights.getaccountframe’  sÞ   € ð
 Œ[ð 	+ð 	+à˜4œ>Ð)Ð)Ø”~ hÔ/ð	+ð 	+ð 	+ð 	+ñ 	+ô 	+ð 	+ð 	+õ
 (:¸$ÀÑ'IÔ'IˆDŒN˜8Ñ$à×Ò TÐÑ*Ô*Ð*ð	+ð 	+ð 	+ñ 	+ô 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+øøøð 	+ð 	+ð 	+ð 	+ð Œ~˜hÔ'Ð's   ˆA%«.A%Á%A)Á,A)c                 ó’  •— t          j        ¦   «          | j                             d¦  «         t          j        ¦   «          t          j        ¦   «          | j                             | j        ¦  «         t          j
        | ¦  «         t          t          | ¦  «        j        | _         t          t          | ¦  «        j        |i |¤Ž d S r^   )r   ÚnocbreakrK   rè   ÚechorÞ   rÌ   ÚremoveHandlerrí   r   rÏ   r�   rÅ   r  Ú	terminaterÇ   s      €r   ra  zBlinkenlights.terminate¡  s¥   ø€ ÝŒÑÔÐØŒ×Ò˜1ÑÔÐÝŒ‰ŒˆÝŒ‰Œˆð 	Œ×!Ò! $Ô"7Ñ8Ô8Ð8ÝÔ# DÑ)Ô)Ð)å�-¨Ñ.Ô.Ô3ˆŒ	à,��m˜TÑ"Ô"Ô,¨dÐ=°fÐ=Ð=Ð=Ð=Ð=r   c                 ó0   — t          j        | |¦  «         d S r   )r   ÚthreadException)r   r  s     r   rc  zBlinkenlights.threadException¯  s   € åÔ˜t VÑ,Ô,Ð,Ð,Ð,r   rƒ   r   )F)%rN   rO   rP   r„   r   rÏ   rà   rñ   ró   r÷   rú   rþ   r  r  r  r  r
  r  r  r  r  r  r  r¾   rð   rs   rw   r&  r3  r<  rî   rF  rI  r   ra  rc  rµ   r¶   s   @r   rÅ   rÅ   V  sÓ  ø€ € € € € ð
/ð 
/ð"ð "ð "ð "ð "ð
ð ð ð$ð ð ð("&ð "&ð "&ðH/ð /ð /ð /ð /ð5ð 5ð 5ð 5ð 5ð6ð 6ð 6ð 6ð 6ð8ð 8ð 8ð 8ð 8ð9ð 9ð 9ð 9ð 9ð:ð :ð :ð :ð :ð:ð :ð :ð :ð :ð?ð ?ð ?ð ?ð ?ð9ð 9ð 9ð 9ð 9ð;ð ;ð ;ð ;ð ;ð6ð 6ð 6ð 6ð 6ð8ð 8ð 8ð 8ð 8ð3ð 3ð 3ð 3ð 3ð
-ð -ð -ð -ð -ð -ð8ð 8ð 8ð 8ð 8ðð ð ð2<ð <ð <ð,Dð Dð Dð Dð Dð
;ð ;ð ;ð2ð 2ð 2ð
#ð #ð #ðð ð ð ð,#ð #ð #ð #ðJ%ð %ð %ð"
"ð 
"ð 
"ð(ð (ð (ð>ð >ð >ð >ð >ð-ð -ð -ð -ð -ð -ð -r   rÅ   )Ú	threadingr   r   r   r   Úcollectionsr   rr   rÕ   rÙ   r   r»   Úofflineimap.ui.UIBaser   Úofflineimap.threadutilr	   r|   r   rR   rm   r›   r¼   r¸   rÅ   rG   r   r   ú<module>rh     sÆ  ðð$ 8Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø Ð Ð Ð Ð Ð Ø €€€Ø 
€
€
€
Ø 	€	€	€	Ø €€€Ø €€€à (Ð (Ð (Ð (Ð (Ð (Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð ðK'ð K'ð K'ð K'ð K'ñ K'ô K'ð K'ð\U6ð U6ð U6ð U6ð U6ñ U6ô U6ð U6ðp-ð -ð -ð -ð -ñ -ô -ð -ð`Dð Dð Dð Dð DÐ#ñ Dô Dð DðN*ð *ð *ð *ð *�wÔ,ñ *ô *ð *ð4[-ð [-ð [-ð [-ð [-�F˜Jñ [-ô [-ð [-ð [-ð [-r   