ó o©¿Uc@s<dZddlZddlmZdefd„ƒYZdS(s, UI Component for displaying error messages iÿÿÿÿN(t InnerWindowt ErrorWindowcBsGeZdZdZdddded„Zd„Zd„Zd„Z RS(s´Simple subclass of InnerWindow for displaying and hiding errors This window is only intended for use with text content (adding subwindows to this class is undefined) iúcKst|_|dkr!|j}n|dkr9|j}n|dkrQ|j}ntt|ƒj|||||||j j tj ƒdS(s— See InnerWindow.__init__ color - defaults to color_theme.default highlight_color - defaults to color_theme.error_msg N( tFalsetvisibletNonet color_themetdefaultt error_msgtsuperRt__init__twindowttimeoutt FLASH_TIME(tselftareaR Rtcolorthighlight_colortcenteredtkwargs((serror_window.pyR +s        cCsrtjƒ}|jƒ|j|ƒ|jƒtj|d|dƒtjƒ|jre|jƒnt |_dS(sÜDisplay error 'text'. Will also flash the error text if this box was already visible, to draw the user's attention to the new (or existing) error Restores cursor location after updating iiN( tcursestgetsyxtcleartadd_textt make_activetsetsyxtdoupdateRtflashtTrue(R ttextt cursor_loc((serror_window.pyt display_err>s       cCs[|jrWtjƒ}|jƒ|jƒtj|d|dƒtjƒt|_ndS(shClear error text and mark this window inactive Restores cursor location after updating iiN(RRRRt make_inactiveRRR(R R((serror_window.pyt clear_errPs     cCs‹|jr‡tjƒ}tj|d|dƒtjƒ|jjƒ}|dkrbtj|ƒntj|d|dƒtjƒndS(sFlash this error windowiiiÿÿÿÿN(RRRRRR tgetchtungetch(R Rtgotch((serror_window.pyR]s    N( t__name__t __module__t__doc__R RRR RR R(((serror_window.pyR!s   (R&Rt inner_windowRR(((serror_window.pyts