+
    Ki  c                   s@    R t ^ RIHt  ! R R]P                  4      tR# )zWindow used for game installers)Gtkc                   s   a a ] tR t^t oRtRV 3R lltR tRR ltRR ltR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tRtVtV ;t# )NavigationStacka  
This is a Stack widget that supports a back button and
lazy-creation of pages.

Pages should be set up via add_named_factory(), then displayed
with present_page().

However, you are meant to have 'present_X_page' functions
that you pass to navigate_to_page(); this tracks the pages
you visit, and when you navigate back,the presenter function
will be called again.

A presenter function can do more than just call present_page();
it can configure other aspects of the InstallerWindow. Packaging
all this into a presenter function keeps things in sync as you navigate.

A presenter function can return an exit function, called when you navigate away
from the page again.
c                s   < \         SV `  ! R/ VB  Wn        W n        / V n        / V n        . V n        R V n        R V n        R V n	        RV n
        RV n        R # )NT )Zsuper__init__back_buttoncancel_buttonpage_factoriesstack_pagesnavigation_stacknavigation_exit_handlercurrent_page_presenter current_navigated_page_presenterback_allowedcancel_allowed)selfr   r   Zkwargs	__class__s   &&&,H/usr/lib/python3.14/site-packages/lutris/gui/widgets/navigation_stack.pyr   ZNavigationStack.__init__   s_    "6"&*  "'+$&*#04- "    c                s"    W P                   V&   R# )zyThis specifies the factory functioin for the page named;
this function takes no arguments, but returns the page's widget.N)r   )r   namefactorys   &&&r   add_named_factoryZ!NavigationStack.add_named_factory*   s     %,D!r   c                2    Wn         V P                  4        R# z+This turns the back button off, or back on.N)r   _update_back_buttonr   Z
is_allowed   &&r   set_back_allowedZ NavigationStack.set_back_allowed/   s    &  "r   c                r   r   )r   r   r   r   r   set_cancel_allowedZ"NavigationStack.set_cancel_allowed4   s    (  "r   c                s    V P                   ;'       d    V P                  pV P                  P                  V4       V P                  P                  V'       * ;'       d    V P
                  4       R # N)r   r   r   Zset_visibler   r   )r   Zcan_go_back   & r   r   Z#NavigationStack._update_back_button9   sS    ''AAD,A,A$$[1&&;'N'N4;N;NOr   c                s   V P                   '       dG   V P                   V8w  d6   V P                  P                  V P                   4       V P                  4        V P	                  VR\
        P                  P                  4       R# )zNavigates to a page, by invoking 'page_presenter'.

In addition, this updates the navigation state so navigate_back()
and such work, they may call the presenter again.
TN)r   r   Zappendr   _go_to_pager    StackTransitionTypeZ
SLIDE_LEFTr   page_presenterr   r   navigate_to_pageZ NavigationStack.navigate_to_page>   sb     000T5Z5Z^l5l!!(()N)NO$$&s/F/F/Q/QRr   c                s\    V P                  VR\        P                  P                  4       R# )zJumps to a page, without updating navigation state.

This does not disturb the behavior of navigate_back().
This does invoke the exit handler of the current page.
FNr   r    r   ZNONEr    r   r   jump_to_pageZNavigationStack.jump_to_pageJ   s"     	0G0G0L0LMr   c                s,   V P                   '       dm   V P                  '       dY    V P                   P                  4       pV P                  VR\        P
                  P                  4       V P                  4        R# R# R#   T P                  4        i ; i)zThis navigates to the previous page, if any. This will invoke the
current page's exit function, and the previous page's presenter function.
TN)r   r   Zpopr   r    r   SLIDE_RIGHTr   )r   Zback_tor   r   navigate_backZNavigationStack.navigate_backR   sv        T%6%6%6+//335  $0G0G0S0ST((* &7 
 ((*s   AB Bc                sR   V P                   '       d   V P                  '       dl    V P                   ^ ,          pV P                   P                  4        V P                  VR\        P
                  P                  4       V P                  4        R# R# R#   T P                  4        i ; i)zThis navigates to the first page, effectively navigating back until it
can go no further back. It does not actually traverse the intermediate pages
though, but goes directly to the first.TN)r   r   clearr   r    r   r%   r   )r   Zhomer   r   navigate_homeZNavigationStack.navigate_home]   s        T%6%6%6+,,Q/%%++-  tS-D-D-P-PQ((* &7  ((*s   AB B&c                s    V P                   '       dU   V P                  V P                   8w  d8   V P                  V P                   R\        P                  P
                  4       R# R# R# )z[This reverse the effect of jump_to_page(), returning to the last
page actually navigate to.TN)r   r
   r   r    r   r%   r      &r   navigation_resetZ NavigationStack.navigation_reseti   sS     000**d.S.SS  !F!FcNeNeNqNqr T 1r   c                s2    V P                   V P                  3# )zaReturns a tuple containing information about the current page,
to pass to restore_current_page().)r
   r   r)   r*   r   save_current_pageZ!NavigationStack.save_current_pagep   s     ++T-R-RSSr   c                sj    Vw  r#W#8H  pV P                  W$\        P                  P                  4       R# )zxRestores the current page to the one in effect when the state was generated.
This does not disturb the navigation stack.Nr#   )r   Zstater!   Znavigated_presenter	navigateds   &&   r   restore_current_pageZ$NavigationStack.restore_current_pageu   s0     /4+"9	C4K4K4P4PQr   c                s    V P                   pV P                  V4       V! 4       V n         Wn        V'       d   Wn        V'       d   V! 4        V P	                  4        R# )zSwitches to a page. If 'navigated' is True, then when you navigate
away from this page, it can go on the navigation stack. It should be
False for 'temporary' pages that are not part of normal navigation.N)r	   Zset_transition_typer
   r   r   )r   r!   r-   Ztransition_typeZexit_handlers   &&&& r   r   ZNavigationStack._go_to_page|   sK     33  1'5'7$&4#4B1N  "r   c                sZ    V P                   P                  4        V P                  4        R# )zThis throws away the navigation history, so the back
button is disabled. Previous pages before the current become
inaccessible.N)r   r'   r   r)   r*   r   discard_navigationZ"NavigationStack.discard_navigation   s"     	##%  "r   c                s    WP                   9  dJ   V P                  V,          pV! 4       pVP                  4        V P                  W14       W0P                   V&   V P	                  V4       V P                   V,          # )zThis displays the page names, creating it if required. It
also calls show_all() on newly created pages.

This should be called by your presenter functions.)r   r   show_all	add_namedset_visible_child_name)r   r   r   pages   &&  r   present_pageZNavigationStack.present_page   si    
 '''))$/G9DMMONN4&%)T"##D)%%r   c                s    V P                   P                  V4      pW28w  dI   V'       d   V P                  V4       VP                  4        V P	                  W!4       W P                   V&   V P                  V4       V# )aZ  This displays a page that is given, rather than lazy-creating one. It
still needs a name, but if you re-use a name this will replace the old page.

This is useful for pages that need special initialization each time they
appear, but generally such pages can't be returned to via the back
button. The caller must protect against this if required.
)r   ZgetZremover0   r1   r2   )r   r   r3   Zold_pages   &&& r   present_replacement_pageZ(NavigationStack.present_replacement_page   se     ##''-H%MMONN4&%)T"##D)r   )
r   r   r   r   r   r
   r	   r   r   r   r   )T)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   r   r   r   r   r"   r$   r&   r(   r+   r,   r.   r   r/   r4   r5   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r   r   r      se     (#,
#
#
P

SN	+
+sT
R##&  r   r   N)r6   Zgi.repositoryr    ZStackr   r   r   r   <module>r7      s    % ncii nr   