+
    Qi~=  c                  sL  a  0 t $ R t^ RIHt RtRtRtRtRt^ RI	t	^ RI
HtHt ^ RIt]P                  ! R	R
4       ^ RIHt ^ RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ]'       d   ^RIHt  ! R R4      t ! R R4      t]! 4       tR]R&   R R lt R# )z Module for notification messages)annotationsz$Id$z
$Revision$z$Date$zLCopyright (c) 2023 Igalia, S.L.Copyright (c) 2010 Informal Informatica LTDA.ZLGPLN)CallableTYPE_CHECKINGGtkz3.0)GObject)r   )cmdnames)dbus_service)debug)	guilabels)input_event)keybindings)messages)defaultc                  sF   ] tR t^<tRtR R ltRR R lltRR R lltR R	 ltR
 R lt	R R lt
R R ltR R lt]P                  R R R ll4       t]P                  R R R ll4       t]P                  R R R ll4       t]P                  R R R ll4       tR R ltRtR# )!NotificationPresenterz,Provides access to the notification history.c                   V ^8  d   QhRR/#    returnNone Zformat   "@/usr/lib/python3.14/site-packages/orca/notification_presenter.py__annotate__"NotificationPresenter.__annotate__?   s     L L$ L    c                	s<   R V n         V P                  R4      V n        \        P                  ! 4       V n        ^7V n        . V n        RV n        Rp\        P                  ! \        P                  VR4       \        P                  ! 4       pVP                  RV 4       R # )NTz3NOTIFICATION PRESENTER: Registering D-Bus commands.r   )_guiget_handlers	_handlersr
   KeyBindings	_bindings	_max_size_notifications_current_indexr   print_message
LEVEL_INFOr   Zget_remote_controllerZregister_decorated_module)selfmsgZ
controllers   &  r   __init__ZNotificationPresenter.__init__?   s    04	CGCTCTUYCZ2=2I2I2K  8:#%CE,,c48!779
,,-DdKr   c               s$    V ^8  d   QhRRRRRR/# )r   refreshbool
is_desktopr   zkeybindings.KeyBindingsr   r   r   r   r   r   Q   s$      59$r   c                sN   V'       dc   RV 2p\         P                  ! \         P                  VR4       V P                  P	                  R4       V P                  4        V P                  # V P                  P                  4       '       d   V P                  4        V P                  # )z/Returns the notification-presenter keybindings.z9NOTIFICATION PRESENTER: Refreshing bindings. Is desktop: Tz,NOTIFICATION PRESENTER: Refreshing bindings.)r   r#   r$   r   Zremove_key_grabs_setup_bindingsZis_empty)r%   r(   r*   r&   s   &&& r   get_bindingsZ"NotificationPresenter.get_bindingsQ   s    
 Mj\ZC 0 0#t<NN++,Z[  " ~~ ^^$$&&  "~~r   c                    V ^8  d   QhRRRR/# )r   r(   r)   r   z(dict[str, input_event.InputEventHandler]r   r   r   r   r   r   `   s      D 5] r   c                s    V'       d9   Rp\         P                  ! \         P                  VR4       V P                  4        V P                  # )z,Returns the notification-presenter handlers.z,NOTIFICATION PRESENTER: Refreshing handlers.T)r   r#   r$   _setup_handlersr   )r%   r(   r&   s   && r   r   Z"NotificationPresenter.get_handlers`   s:     @C 0 0#t<  "~~r   c               r-   )r   messagestrr   r   r   r   r   r   r   r   j   s     ; ; ; ;r   c                sR   RVR.p\         P                  ! \         P                  VR4       \        \	        V P
                  4      V P                  ,
          ^,           ^ 4      pV P
                  VR V n        V P
                  P                  V\        P                  ! 4       34       R# )z2Adds message to the list of notification messages.z NOTIFICATION PRESENTER: Adding 'z'.TN)	r   print_tokensr$   Zmaxlenr!   r    appendtime)r%   r/   tokensZ	to_removes   &&  r   save_notificationZ'NotificationPresenter.save_notificationj   s     5gtD5++VT:D//04>>AAEqI	"11)*=""GTYY[#9:r   c               r   r   r   r   r   r   r   r   s   s     ! !D !r   c                sr    Rp\         P                  ! \         P                  VR4       . V n        RV n        R# )zClears the notifications list.z&NOTIFICATION PRESENTER: Clearing list.TNr   )r   r#   r$   r!   r"   r%   r&      & r   
clear_listZ NotificationPresenter.clear_lists   s1     7E,,c48  r   c               r   r   r   r   r   r   r   r   {   s     9 9 9r   c                sD   / V n         \        P                  ! V P                  \        P
                  4      V P                   R&   \        P                  ! V P                  \        P                  4      V P                   R&   \        P                  ! V P                  \        P                  4      V P                   R&   \        P                  ! V P                  \        P                  4      V P                   R&   Rp\        P                  ! \        P                  VR4       R# )z8Sets up the notification-presenter input event handlers.present_last_notificationpresent_next_notificationpresent_previous_notificationshow_notification_listz(NOTIFICATION PRESENTER: Handlers set up.TN)r   r	   ZInputEventHandlerr:   r   ZNOTIFICATION_MESSAGES_LASTr;   ZNOTIFICATION_MESSAGES_NEXTr<   ZNOTIFICATION_MESSAGES_PREVIOUSr=   ZNOTIFICATION_MESSAGES_LISTr   r#   r$   r7   r8   r   r.   Z%NotificationPresenter._setup_handlers{   s      ))..335 	23 ))..335 	23 ))22779 	67 ))++335 	/0
 9E,,c48r   c               r   r   r   r   r   r   r   r      s     "9 "9 "9r   c           	     s   \         P                  ! 4       V n        V P                  P                  \         P                  ! R\         P
                  \         P                  V P                  R,          4      4       V P                  P                  \         P                  ! R\         P
                  \         P                  V P                  R,          4      4       V P                  P                  \         P                  ! R\         P
                  \         P                  V P                  R,          4      4       V P                  P                  \         P                  ! R\         P
                  \         P                  V P                  R,          4      4       Rp\        P                  ! \        P                  VR4       R# )	z0Sets up the notification-presenter key bindings. r:   r;   r<   r=   z(NOTIFICATION PRESENTER: Bindings set up.TN)r
   r   r   addZ
KeyBindingZDEFAULT_MODIFIER_MASKZNO_MODIFIER_MASKr   r   r#   r$   r7   r8   r   r+   Z%NotificationPresenter._setup_bindings   sC    %002""11,,:;	=	> 	""11,,:;	=	> 	""11,,>?	A	B 	""11,,78	:	; 9E,,c48r   c               r-   )r   	timestampZfloatr   r0   r   r   r   r   r   r      s     ' 'e ' 'r   c                	s   \         P                   ! 4       V,
          pV^<8  d   \        P                  ! V4      # VR8  d)   \        V^<,          4      p\        P                  ! V4      # VR8  d)   \        VR,          4      p\        P
                  ! V4      # \        VR,          4      p\        P                  ! V4      # )i<   i  iQ )r4   r   Zseconds_agoZroundZminutes_agoZ	hours_agoZdays_ago)r%   r@   ZdiffZminutesZhoursZdayss   &&    r   _timestamp_to_stringZ*NotificationPresenter._timestamp_to_string   s    yy{Y&"9''--$;D2I&G''00%<$+&E%%e,,TE\"  &&r   Nc               (    V ^8  d   QhRRRRRRRR/# r   scriptdefault.Scripteventzinput_event.InputEvent | Nonenotify_userr)   r   r   r   r   r   r   r      s2       - 	
 
r   c                s^   RVRVRV.p\         P                  ! \         P                  VR4       V P                  '       g*   V'       d    VP	                  \
        P                  4       R# V P                  R,          w  rVV RV P                  V4       2pVP	                  V4       RV n        R# )zPresents the last notification.z:NOTIFICATION PRESENTER: present_last_notification. Script:Event:notify_user:T r   )	r   r1   r$   r!   present_messager   NOTIFICATION_NO_MESSAGESrA   r"   )r%   rD   rF   rG   r5   r/   r@   strings   &&&&    r   r:   Z/NotificationPresenter.present_last_notification   s     OPVE>;@5++VT:"""&&x'H'HI!0049Ad77	BCDv& r   c               rB   rC   r   r   r   r   r   r      2     # ## -# 	#
 
#r   c                sP   RVRVRVRV P                   .p\        P                  ! \        P                  VR4       V P                  '       g*   V'       d    VP                  \        P                  4       R# V P                   ^ 8X  d@   VP                  \        P                  4       V P                  V P                   ,          w  rVMB V P                   ^,
          pV P                  V,          w  rVV ;P                   ^,          un         V RV P                  V4       2p	VP                  V	4       R#   \         dj    Rp\        P                  ! \        P                  TR4       TP                  \        P                  4       T P                  T P                   ,          w  rV Li ; i)z#Presents the previous notification.z>NOTIFICATION PRESENTER: present_previous_notification. Script:rH   rI   Current index:T6NOTIFICATION PRESENTER: Handling IndexError exception.rJ   )r"   r   r1   r$   r!   rK   r   rL   ZNOTIFICATION_LIST_TOP
IndexErrorr#   rA   
r%   rD   rF   rG   r5   r/   r@   Zindexr&   rM   
   &&&&      r   r<   Z3NotificationPresenter.present_previous_notification   sn    STZE>;@P%%' 	5++VT:"""&&x'H'HI !#""8#A#AB!%!4!4T5H5H!IGYN++a/%)%8%8%?"##q(# 9Ad77	BCDv&  NN##E$4$4c4@&&x'E'EF%)%8%89L9L%M"	N   AD1 1A1F%$F%c               rB   rC   r   r   r   r   r   r   
  rN   r   c                sP   RVRVRVRV P                   .p\        P                  ! \        P                  VR4       V P                  '       g*   V'       d    VP                  \        P                  4       R# V P                   R8X  d@   VP                  \        P                  4       V P                  V P                   ,          w  rVMB V P                   ^,           pV P                  V,          w  rVV ;P                   ^,          un         V RV P                  V4       2p	VP                  V	4       R#   \         dj    Rp\        P                  ! \        P                  TR4       TP                  \        P                  4       T P                  T P                   ,          w  rV Li ; i)	zPresents the next notification.z:NOTIFICATION PRESENTER: present_next_notification. Script:rH   rI   rO   TrP   rJ   r   )r"   r   r1   r$   r!   rK   r   rL   ZNOTIFICATION_LIST_BOTTOMrQ   r#   rA   rR   rS   r   r;   Z/NotificationPresenter.present_next_notification	  sn    OPVE>;@P%%' 	5++VT:"""&&x'H'HI "$""8#D#DE!%!4!4T5H5H!IGYN++a/%)%8%8%?"##q(# 9Ad77	BCDv&  NN##E$4$4c4@&&x'H'HI%)%8%89L9L%M"	NrT   c               rB   rC   r   r   r   r   r   r   0  s2       - 	
 
r   c                s   RVRVRV.p\         P                  ! \         P                  VR4       V P                  '       g*   V'       d    VP	                  \
        P                  4       R# V P                  '       dE   Rp\         P                  ! \         P                  VR4       V P                  P                  4        R# \        V P                  4       UUu. uF  w  rgW`P                  V4      3NK  	  ppp\        P                  ! \        V P                  4      4      p	\        P                  \        P                   .p
\#        WWV P$                  4      V n        V P                  P                  4        R# u uppi )z0Opens a dialog with a list of the notifications.z7NOTIFICATION PRESENTER: show_notification_list. Script:rH   rI   TzBNOTIFICATION PRESENTER: Notification list already exists. Showing.)r   r1   r$   r!   rK   r   rL   r   r#   show_guiZreversedrA   r   Znotifications_countr2   ZNOTIFICATIONS_COLUMN_HEADERZNOTIFICATIONS_RECEIVED_TIMENotificationListGUIon_dialog_destroyed)r%   rD   rF   rG   r5   r&   r/   r@   rowstitlecolumn_headerss   &&&&       r   r=   Z,NotificationPresenter.show_notification_list/  s:    LVE>;@5++VT:"""&&x'H'HI999VC 0 0#t<II  /7t7J7J.KM.K* 33I>?.K 	 M--c$2E2E.FG#??#??A'>1I1IK			Ms   E9c               r-   )r   _dialog
Gtk.Dialogr   r   r   r   r   r   r   r   Q  s      : $ r   c                s    RV n         R# )z1Handler for the 'destroyed' signal of the dialog.N)r   )r%   r[   s   &&r   rW   Z)NotificationPresenter.on_dialog_destroyedQ  s     	r   )r   r"   r   r   r    r!   )FT)F)NT)__name__
__module____qualname____firstlineno____doc__r'   r,   r   r6   r9   r.   r+   rA   r   Zcommandr:   r<   r;   r=   rW   __static_attributes__r   r   r   r   r   <   s    6L$;!98"9H'   . # #J # #J  B r   r   c                  sJ    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltRt	R# )rV   iV  z-The dialog containing the notifications list.c          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )r   rD   rE   rY   r0   rZ   	list[str]rX   list[tuple[str, str]]destroyed_callbackzCallable[[Gtk.Dialog], None]r   r   r   r   r    NotificationListGUI.__annotate__Y  s<     9 99 9 "	9
 $9 99r   c                	s    Wn         R V n        V P                  W#V4      V n        V P                  P	                  RV4       R # )Ndestroy)_script_model_create_dialogr   connect)r%   rD   rY   rZ   rX   re   s   &&&&&&r   r'   ZNotificationListGUI.__init__Y  s9     (.,0 $ 3 3E4 P			)%78r   c               s(    V ^8  d   QhRRRRRRRR/# )	r   rY   r0   rZ   rc   rX   rd   r   r\   r   r   r   r   r   rf   f  s2     ) )) &) (	)
 )r   c           	     	s   \         P                  ! VR \         P                  P                  \         P                  \         P
                  P                  \         P                  \         P
                  P                  34      pVP                  RR4       \         P                  ! 4       pVP                  4       pVP                  V4       \         P                  ! 4       pVP                  V4       \         P                  ! 4       pVP                  R4       VP!                  R4       VP                  V4       \#        V4      \$        P&                  .,          p	\)        V4       F^  w  r\         P*                  ! 4       p\         P,                  ! WV
R7      pVP/                  V4       V'       g   KM  VP1                  V
4       K`  	  \         P2                  ! V	!  V n        V FN  pV P4                  P7                  R 4      p\)        V4       F!  w  rV P4                  P9                  WV4       K#  	  KP  	  VP;                  V P4                  4       VP=                  RV P>                  4       V# )NiX  i  T)Ztextresponse) r   ZDialogZDialogFlagsZMODALZSTOCK_CLEARResponseTypeAPPLYZSTOCK_CLOSECLOSEZset_default_sizeZGridZget_content_arear?   ZScrolledWindowZTreeViewZset_hexpandZset_vexpandr2   r   ZTYPE_STRINGZ	enumerateZCellRendererTextZTreeViewColumnZappend_columnZset_sort_column_idZ	ListStoreri   r3   Z	set_valueZ	set_modelrk   on_response)r%   rY   rZ   rX   ZdialogZgridZcontent_areaZscrolled_windowZtreeZcolsZiZheaderZcellZcolumnZrowZrow_iters   &&&&            r   rj   Z"NotificationListGUI._create_dialogf  s    E OO11 __c.>.>.D.D __c.>.>.D.DFG
 	S)xxz..0,,.!||~D!>"g&9&9%::">2IA'')D''1=Fv&v))!, 3 mmT*C{{))$/H$S>%%h48 * 
 	t{{#z4#3#34r   c               s$    V ^8  d   QhRRRRRR/# )r   r[   r\   rl   Zintr   r   r   r   r   r   r   rf     s!        :      r   c                s   V\         P                  P                  8X  d   V P                  P	                  4        R# V\         P                  P
                  8X  d   V P                  e   V P                  P                  4        \        4       P                  4        V P                  P                  \        P                  4       \        P                  ! ^4       V P                  P	                  4        R# R# R# )z&The handler for the 'response' signal.N)r   rm   ro   r   rg   rn   ri   Zclearget_presenterr9   rh   rK   r   rL   r4   Zsleep)r%   r[   rl   s   &&&r   rp   ZNotificationListGUI.on_response  s     s''---IIs''---$++2IKKO&&(LL(()J)JKJJqMII 3J-r   c               r   r   r   r   r   r   r   rf     s     1 1$ 1r   c                s    V P                   P                  4        V P                   P                  \        P                  ! 4       4       R# )z$Shows the notifications list dialog.N)r   Zshow_allZpresent_with_timer4   )r%   s   &r   rU   ZNotificationListGUI.show_gui  s,     					##DIIK0r   )r   ri   rh   N)
r]   r^   r_   r`   ra   r'   rj   rp   rU   rb   r   r   r   rV   rV   V  s    79)V 1 1r   rV   
_presenterc               r   )r   r   r   r   r   r   r   r   r     s      , r   c                 s    \         # )z"Returns the Notification Presenter)rr   r   r   r   rq   rq     s
     r   )!__conditional_annotations__ra   Z
__future__r    Z__id__Z__version__Z__date__Z__copyright__Z__license__r4   Ztypingr   r   ZgiZrequire_versionZgi.repositoryr   r   r>   r   r   r   r   r	   r
   r   Zscriptsr   r   rV   rr   Z__annotations__rq   )rs   s   @r   <module>rt      s   : ' #@  * 	   5%   !         X XtM1 M1^ %:$;
! ;r   