ó
ĝ`9Sc           @   sJ   d  d l  Td  d l Td g Z d e f d     YZ d d d     YZ d S(   i˙˙˙˙(   t   *t   StatusSignalingWidgetc           B   sw   e  Z d  Z e   Z e   Z d
 d  Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z e d	  Z RS(   sĴ  Base class for widgets that may have status messages associated with
    them.

    Status message is a rich text string supplemented with information of the
    widget's current state. Currently, the following states are available:
      - 'completed': the widget has recently completed an action with success.
      - 'info': the widget is normal operational state, but requires user's
        attention to be drawn to it.
      - 'warning', 'error': the widget is not operational, and requires user's
        attention to be drawn to it.
      - 'progress': the widget is busy executing an action.

    Signals:
      - 'statusMessageChanged': status message associated with the widget has
        changed. Use 'getStatusMessage' to obtain the current message.
      - 'repaintRequested': the widget is about to start an action that may
        take noticeable amount of time but nevertheless is executed in the main
        application thread. This is normally preceded by setting an appropriate
        progress status, and thus may be used to repaint the application window
        so that the progress message is visible to the user while the program
        is in the not-responding mode.c         C   s   t  j |  |  d  |  _ d  S(   N(   t   QWidgett   __init__t   Nonet   statusMessage(   t   selft   parent(    (    s$   code\common\StatusSignalingWidget.pyR   4   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s$   code\common\StatusSignalingWidget.pyt   getStatusMessage:   s    c         C   s   | |  _  |  j j   d S(   sİ   This is the basic implementation of any of the other convenience
        status manipulation methods. Redefine it to modify default behaviour
        of these functions.N(   R   t   statusMessageChangedt   emit(   R   R   (    (    s$   code\common\StatusSignalingWidget.pyt   setStatusMessage>   s    	c         C   s   |  j  d   d  S(   N(   R   R   (   R   (    (    s$   code\common\StatusSignalingWidget.pyt   clearStatusMessageG   s    c         C   s   |  j  t d |   d  S(   Nt	   completed(   R   t   StatusMessage(   R   t   text(    (    s$   code\common\StatusSignalingWidget.pyt   setCompletedMessageJ   s    c         C   s   |  j  t d |   d  S(   Nt   info(   R   R   (   R   R   (    (    s$   code\common\StatusSignalingWidget.pyt   setInfoMessageM   s    c         C   s   |  j  t d |   d  S(   Nt   warning(   R   R   (   R   R   (    (    s$   code\common\StatusSignalingWidget.pyt   setWarningMessageP   s    c         C   s   |  j  t d |   d  S(   Nt   error(   R   R   (   R   R   (    (    s$   code\common\StatusSignalingWidget.pyt   setErrorMessageS   s    c         C   s0   |  j  t d |   | r, |  j j   n  d S(   sw   Set a progress status message and then fire the 'repaintRequested'
        signal if 'requestRepaint' is set to 'True'.t   progressN(   R   R   t   repaintRequestedR
   (   R   R   t   requestRepaint(    (    s$   code\common\StatusSignalingWidget.pyt   setProgressMessageV   s    N(   t   __name__t
   __module__t   __doc__t
   pyqtSignalR	   R   R   R   R   R   R   R   R   R   R   t   FalseR   (    (    (    s$   code\common\StatusSignalingWidget.pyR      s   										R   c           B   s8   e  Z d  Z d
 Z d   Z d   Z d   Z d	   Z RS(   sB   A rich text message with a state string informing of its severity.R   R   R   R   R   c         C   s+   | |  j  k s t  | |  _ | |  _ d  S(   N(   t   statusesBySeverityt   AssertionErrort   statusR   (   R   R"   R   (    (    s$   code\common\StatusSignalingWidget.pyR   l   s    	c         C   s   |  j  S(   N(   R"   (   R   (    (    s$   code\common\StatusSignalingWidget.pyt	   getStatuss   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s$   code\common\StatusSignalingWidget.pyt   getTextv   s    c         C   s   |  j  j |  j  S(   s   Return an integer that may be used to assess severity of the message
        state, with greater numbers corresponding to greater severity.(   R    t   indexR"   (   R   (    (    s$   code\common\StatusSignalingWidget.pyt   getSeverityy   s    (   s	   completeds   infos   warnings   errors   progress(   R   R   R   R    R   R#   R$   R&   (    (    (    s$   code\common\StatusSignalingWidget.pyR   `   s   			N(    (   t   PyQt4.QtCoret   PyQt4.QtGuit   __all__R   R   R   (    (    (    s$   code\common\StatusSignalingWidget.pyt   <module>   s   

	H