+
    Ki  c                   sX    R t ^ RIHtHtHtHt ^ RIHt  ! R R]P                  4      t	R# )z$Entry box with popup list and search)GdkGLibGObjectGtk)display_errorc                   s   a a ] tR t^t oRtR]P                  R]33/tRV 3R llt	R t
R t]R 4       tR tR	 tR
 tR tR t]R 4       tR tR tRtVtV ;t# )SearchableEntryboxzTEntry box with autocompletion and popup list function.
Well fitted for large lists.
changedNc                s  < \         SV `  \        P                  P                  R 7       W n        \        P                  ! \        \        4      V n        \        P                  ! 4       V n
        \        P                  ! 4       V n        V P                  P                  V P                  4       V P                  P                  ^ 4       V P                  P                  V P                   4       V P                  P#                  V P                  4       \        P$                  ! 4       V n        V P                  P)                  RV P*                  4       V P                  P)                  RV P,                  4       V P                  P)                  RV P.                  4       V P1                  V P                  RR^ 4       \2        P4                  ! V P6                  V4       R# ))Zorientationr   scroll-eventz
icon-pressTN)Zsuper__init__r   ZOrientationZ
HORIZONTALinitialZ	ListStorestr	liststoreZEntryentryZEntryCompletion
completionZ	set_modelZset_text_columnZset_match_funcsearch_storeZset_completionZMenu
popup_menuconnecton_entrybox_change_on_entrybox_scrollon_entrybox_icon_pressZ
pack_startr   Zidle_add_populate_entrybox_choices)selfchoice_funcr	   	__class__s   &&&K/usr/lib/python3.14/site-packages/lutris/gui/widgets/searchable_entrybox.pyr   ZSearchableEntrybox.__init__   s,   S__%?%?@sC0YY[
--/!!$..1''*&&t'8'89

!!$//2((*

9d&=&=>

>4+C+CD

<)D)DE

D$2d55{C    c                s    V P                   # )zProxy to the liststore)r   )r   s   &r   	get_modelZSearchableEntrybox.get_model$   s    ~~r   c                s    V P                   P                  4       pV P                   F  pV^ ,          V8X  g   K  V^,          u # 	  R# )z5Return the ID associated with the current entry text.N)r   get_textr   )r   textrows   &  r   get_active_idZ SearchableEntrybox.get_active_id(   s;    zz""$>>C1v~1v " r   c                 s    R# )z?The entry present is not for editing custom values, only searchF r   r   r   get_has_entryZ SearchableEntrybox.get_has_entry0   s     r   c                sx    V P                   V,          ^ ,          P                  4       pVP                  4       V9   # )z4Return true if the search string is in the row text.)r   lower)r   Z_completionZstringZ_iterZrow_texts   &&&& r   r   ZSearchableEntrybox.search_store5   s/    >>%(+113||~))r   c                s0    V! 4       pV F{  pV P                   P                  V4       \        P                  ! V^ ,          R7      pVP	                  RV P
                  V^,          4       V P                  P                  V4       K}  	  V P                  '       dF   V P                  4        V P                  P                  \        P                  P                  R4       M4V P                  P                  \        P                  P                  R4       V P                  P                  4        R#   \         dZ   pT P                  P                  \        P                  P                  R4       \        YPP!                  4       R7        Rp?R# Rp?ii ; i)z3Populate the liststore and popup menu with choices.)ZlabelZactivateemblem-ok-symbolicsystem-search-symboliczerror-symbolic)ZparentN)r   Zappendr   ZMenuItemr   on_menu_item_activater   r	   _set_initial_textr   set_icon_from_icon_nameEntryIconPositionPRIMARYZshow_allZ	Exceptionr   Zget_toplevel)r   r   ZchoicesZchoice	menu_itemZexs   &&    r   r   Z-SearchableEntrybox._populate_entrybox_choices:   s   	:!mG!%%f-LLvay9	!!*d.H.H&QR)T&&y1	 " |||&&(

2233H3H3P3PRfg

2233H3H3P3PRjkOO$$& 	:JJ..s/D/D/L/LN^_"%6%6%899	:s    BD1 BD1 1F<AFFc                s    V P                   P                  V P                  \        P                  P
                  \        P                  P                  R4       R# )z1Show popup menu when the primary icon is pressed.N)r   Zpopup_at_widgetr   r    ZGravityZSOUTHZNORTH)r   Z_entryZ	_icon_pos_events   &&&&r   r   Z)SearchableEntrybox.on_entrybox_icon_pressO   s3    ''

CKK4E4Es{{GXGXZ^_r   c                s|    V P                   P                  VP                  4       4       V P                  RV4       R# )zDSet the selected item text in the entry and emit the changed signal.r   N)r   set_textZ	get_labelemit)r   r)   	active_ids   &&&r   r$   Z(SearchableEntrybox.on_menu_item_activateS   s+    

I//12		)Y'r   c                s    V P                    F@  pV^,          V P                  8X  g   K  V P                  P                  V^ ,          4        R# 	  R# )z8Set the initial text in the entry if it matches an item.N)r   r	   r   r+   )r   r   s   & r   r%   Z$SearchableEntrybox._set_initial_textX   s9    >>C1v%

##CF+ "r   c                s(    V P                  R4       R# )z\Prevents users from accidentally changing configuration values while scrolling down dialogs.r   F)Zstop_emission_by_name)Zentryboxr*   s   &&r   r   Z&SearchableEntrybox._on_entrybox_scroll_   s     	&&~6r   c                s~    V P                  4       pV P                  4        V'       d   V P                  RV4       R# R# )z.Action triggered on entrybox 'changed' signal.r   N)r   _update_search_iconr,   )r   Z_widgetr-   s   && r   r   Z%SearchableEntrybox.on_entrybox_changee   s2    &&(	  "IIi+ r   c                sH  a V P                   P                  4       oS'       g7   V P                   P                  \        P                  P
                  R4       R	# \        ;QJ d)    V3R lV P                   4       F  '       g   K   RM	  RM! V3R lV P                   4       4      '       d7   V P                   P                  \        P                  P
                  R4       R	# \        ;QJ d)    V3R lV P                   4       F  '       g   K   RM	  RM! V3R lV P                   4       4      '       d7   V P                   P                  \        P                  P
                  R4       R	# V P                   P                  \        P                  P
                  R4       R	# )
z,Updates the icon based on the search result.r#   c              3   s:   <"   T F  q^ ,          S8H  x  K  	  R# 5ii    Nr   Z.0r   r      & r   	<genexpr>9SearchableEntrybox._update_search_icon.<locals>.<genexpr>r   s     :>CQ4>s   TFr"   c              3   st   <"   T F-  pSP                  4       V^ ,          P                  4       9   x  K/  	  R# 5ir/   )r!   r0   r1   r   r2   r3   u   s&     J>CQ/>s   58zcontent-loading-symboliczaction-unavailable-symbolicN)r   r   r&   r   r'   r(   Zanyr   )r   r   s   &@r   r.   Z&SearchableEntrybox._update_search_iconl   s    zz""$JJ..s/D/D/L/LNfgS:4>>:SSS:4>>:::JJ..s/D/D/L/LNbcSJ4>>JSSSJ4>>JJJJJ..s/D/D/L/LNhi JJ..s/D/D/L/LNklr   )r   r   r	   r   r   )N)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   ZSIGNAL_RUN_FIRSTr
   Z__gsignals__r   r   r   Zstaticmethodr    r   r   r   r$   r%   r   r   r.   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r   r   r      s     
 	G,,dSF;LD&  *
:*`(
  
,m mr   r   N)
r4   Zgi.repositoryr    r   r   r   Zlutris.gui.dialogsr   ZBoxr   r   r   r   <module>r5      s%    * 1 1 ,rm rmr   