
]c           @  sU  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z e j j d d e	 d e
 d e
 Z i  Z d e j j f d     YZ d	   Z e j e  Z d
 e f d     YZ e Z d   Z d e j j f d     YZ d Z d Z d Z d Z d Z d d d d d g Z d e j j j  f d     YZ! e" a# g  Z$ d   Z% d   Z& i  Z' e j e(  Z) e*   Z+ e" d  Z, d   Z- e
 a. e
 a/ g  a0 i  a1 g  a2 d   Z3 d    Z4 d!   Z5 d"   Z6 d#   Z7 d$   Z8 e" d%  Z9 d&   Z: d'   Z; d(   Z< e" d)  Z= d*   Z> d+   Z? e" d,  Z@ e" e" d-  ZA d.   ZB d/   ZC d0   ZD d S(1   i(   t   print_functionNt   profile_screent	   developert   appendt   flusht   ScreenProfilec           B  s,   e  Z d  Z e e e e e e e d  Z RS(   s?   
    :doc: profile_screen
    :name: renpy.profile_screen

    c	   	      C  s   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | d k	 r| t | t	  r| t
 | j    } |  t | <q| n  d S(   s  
        Requests screen profiling for the screen named `name`, which
        must be a string.

        Apart from `name`, all arguments must be supplied as keyword
        arguments. This function takes three groups of arguments.


        The first group of arguments determines when profiling occurs.

        `predict`
            If true, profiling occurs when the screen is being predicted.

        `show`
            If true, profiling occurs when the screen is first shown.

        `update`
            If true, profiling occurs when the screen is updated.

        `request`
            If true, profiling occurs when requested by pressing F8.

        The second group of arguments controls what profiling output is
        produced when profiling occurs.

        `time`
            If true, Ren'Py will log the amount of time it takes to evaluate
            the screen.

        `debug`
            If true, Ren'Py will log information as to how screens are
            evaluated, including:

            * Which displayables Ren'Py considers constant.
            * Which arguments, if any, needed to be evaluated.
            * Which displayables were reused.

            Producing and saving this debug information takes a noticeable
            amount of time, and so the `time` output should not be considered
            reliable if `debug` is set.

        The last group of arguments controls what output is produced once
        per Ren'Py run.

        `const`
            Displays the variables in the screen that are marked as const and
            not-const.

        All profiling output will be logged to profile_screen.txt in the game
        directory.
        N(   t   predictt   showt   updatet   requestt   timet   debugt   constt   Nonet
   isinstancet
   basestringt   tuplet   splitt   profile(	   t   selft   nameR   R   R   R	   R
   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   __init__,   s    5							(   t   __name__t
   __module__t   __doc__t   FalseR   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR   %   s   c         C  sF   t  |  t  r$ t |  j    }  n  |  t k r8 t |  St d  Sd S(   s   
    Returns the profile object for the screen with `name`, or a default
    profile object if none exists.

    `name`
        A string or tuple.
    N(   R   R   R   R   R   R   R   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   get_profileq   s
    	t   ScreenCachec           B  s   e  Z d  Z d   Z RS(   sh   
    Represents an entry in the screen cache. Upon creation, puts itself into
    the screen cache.
    c         C  sq   | j  d  k r d  S| |  _ | |  _ | |  _ t | } | j |   t |  t j	 j
 k rm | j d  n  d  S(   Ni    (   t   astR   t   argst   kwargst   cachet   predict_cacheR   t   lent   renpyt   configt   screen_cache_sizet   pop(   R   t   screenR   R   R   t   pc(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR      s    			
(   R   R   R   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR      s   c         C  s}   |  j  d k r i  St |  } | s' i  SxL | D]5 } | j | k r. | j | k r. | j |  Pq. q. W| j d  } | j S(   sZ   
    Returns the cache to use when `screen` is accessed with `args` and
    `kwargs`.
    i    N(   R   R   R    R   t   removeR%   R   (   R&   R   R   R'   t   sc(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt	   cache_get   s    
t   Screenc        
   B  s8   e  Z d  Z d Z d d d d d e d d d d 	 Z RS(   s~   
    A screen is a collection of widgets that are displayed together.
    This class stores information about the screen.
    t   TrueR   t   0t   screensc         C  s>  t  | t  r$ t | j    } n  | |  _ | d  k sH t  | t  rT | g } n  x4 | D], } |  t | d | f <|  t | d | <q[ W| |  _ t  | t	 j
 j j  r | |  _ n	 d  |  _ | |  _ | |  _ | p | d |  _ | d  k rt	 j j } n  | |  _ | |  _ |	 |  _ |
 |  _ | |  _ t a t a d  S(   Ni    (   R   R   R   R   R   R   R.   t   screens_by_namet   functionR"   t   sl2t   slastt   SLScreenR   t   modalt   zordert   tagR#   t   predict_screensR   t
   parameterst   locationt   layert	   sensitiveR   t   preparedt   analyzed(   R   R   R0   R4   R5   R6   R   t   variantR8   R9   R:   R;   t   v(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR      s0    										N(   R   R   R   R;   R   R   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR+      s   i    i   i   i   i   t   PREDICTt   SHOWt   UPDATEt   HIDEt   OLDt   ScreenDisplayablec           B  s   e  Z d  Z d d d d d d d d d	 d
 d d d g Z e Z e Z e Z d   Z i  i  e d  Z	 d   Z
 d   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(    s   
    A screen is a collection of widgets that are displayed together. This
    class is responsible for managing the display of a screen.
    R&   t   childt   childrent
   transformst   widgetst   old_widgetst   hidden_widgetst   old_transformsR   t
   miss_cacheR   t   phaset	   use_cachec         C  s   t  |  j d  |  _ d  |  _ g  |  _ i  |  _ i  |  _ d  |  _ d  |  _	 i  |  _
 i  |  _ t |  _ i  |  _ i  |  _ t j |  j d   |  _ d  S(   Ni    (   t   get_screen_variantt   screen_nameR&   R   RF   RG   RH   RI   RJ   RL   RK   R   RB   RN   RO   RM   R   t   get(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   after_setstate9  s    											c   	      K  s  t  t |   j |   | |  _ | |  _ | j |  _ |  j j |  _ t	 j
 |  j d   |  _	 | |  _ | |  _ t j j |  |  _ d  |  _ | |  _ i  |  _ i  |  _ | r | r t | |  } n d  } | d  k	 r | j |  _ n	 i  |  _ | d  k	 r	| j |  _ n	 i  |  _ i  |  _ d  |  _ d  |  _ | oB| j |  j k |  _ d  |  _ i  |  _ t |  _  t |  _! | |  _" t j j# |  j j$ d |  j |  _$ t j j# |  j j% d |  j |  _% t& |  _' d  S(   Nt   locals((   t   superRE   R   t
   propertiesR&   R   RQ   R9   t	   _locationR   RR   R   R6   R:   R"   t   pythont   RevertableDictt   scopeRF   t   widget_propertiesRI   R   t
   get_screenRH   RO   RM   RJ   RL   t   old_transferst   current_transform_eventRK   R   t
   restartingt   hidingt	   transientt   py_evalR4   R5   R@   RN   (	   R   R&   R6   R:   R[   RZ   Ra   RV   t
   old_screen(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR   I  sD    																		$$c         C  s   d j  d j |  j   S(   Ns	   Screen {}t    (   t   formatt   joinRQ   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   __unicode__  s    c         C  s
   |  j  g S(   N(   RF   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   visit  s    c         C  s=   | |   z$ t  |   |  j j | d d  Wd  t   Xd  S(   Nt   seen(   t   push_current_screenRF   t	   visit_allR   t   pop_current_screen(   R   t   callbackRi   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRk     s
    

c         C  s$   t  j j j |  d  |  j   d  S(   Ni    (   R"   t   displayt   rendert   redrawR   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   per_interact  s    c         C  s#   t  t |   j |  | |  _ d  S(   N(   RU   RE   t   set_transform_eventR^   (   R   t   event(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRr     s    c         C  sa   |  j  t k p |  j  t k } z4 t |   |  j rQ | rQ |  j j | |  n  Wd  t   Xd  S(   N(   RN   RD   RC   Rj   RF   t   find_focusableRl   (   R   Rm   t
   focus_nameR`   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRt     s    
c         C  sj   t  |  j |  j |  j |  j |  j |  j  } |  j j   | _ |  j	 j   | _	 t
 | _ |  j | _ | S(   N(   RE   R&   R6   R:   R[   RZ   RV   RH   t   copyRI   R,   R]   RF   (   R   t   rv(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRv     s    -	c         C  s9   |  j  d  k r) |  j r t S|  j   n  |  j  j |  S(   N(   RF   R   Ra   R   R   t   _handles_event(   R   Rs   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRx     s
    	c   
      C  s
  |  j  t k r |  } n |  j d  k	 r> |  j j |  r> d  St j |   |  j   |  j d  k rh d  S|  j d  k r{ d  S|  j j |  s d  S|  j j	 d  k	 r |  j j	 j
 |  j j d i    n  |  j   } x! |  j j D] } | j |  q Wt | _  d  } | j } t | t j j j  s,d  St j j   t j j d d d j |  j   | _ | j g | _ t j j   xa | j D]V } | j | | |  }	 |	 d  k	 rt j j j |	 d  | j j |	  | } qqW| d  k	 rt j j j | d  n  | S(   Ni    t   focust   _screen_t   _(   RN   RC   RF   R   Rx   t   updated_screenst   discardR   R&   R   t   copy_on_changeR   RR   Rv   RG   Rr   R   R"   Rn   t   layoutt   MultiBoxt   uit   detachedt   default_fixedRf   RQ   t   closet   _hideRo   Rp   t   add(
   R   t   stt   att   kindt   hidt   iRw   t	   old_childt   dt   c(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR     sF    	"
%		(c         C  s   |  j  d  k r |  S|  j d  k r& |  St j j s6 |  S|  j  j d  k	 rm |  j  j j |  j j	 d i    n  |  j
   } t | _ |  j j   | _ | S(   Ni    (   R&   R   RF   R"   R#   t   transition_screensR   R~   R   RR   Rv   RD   RN   t   _in_current_store(   R   Rw   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR     s    %	c   	      C  s  |  t  k r d  St  j |   |  j d  k rE t j j j   |  _ i  S|  j	 sl |  j
 t k sl |  j
 t k r |  j s t j j j   |  _ n  |  j St } t } |  j r|  j
 t k r |  j j r t } nH |  j
 t k r |  j j r t } n$ |  j
 t k r|  j j rt } n  t j j j r9|  j j r9t } n  | rt j d t |  j
 d j |  j  t j j    j! d   t" j"   } |  j j# rt } qqn  |  j |  _$ |  j% |  _& i  |  _ i  |  _% t' |   t j( j } |  t j( _ d } |  j) j* | d   } z t j( j+   t j( j, d d d j |  j   |  _ |  j g |  _- |  j. |  j. d <| |  j. d	 <| |  j. d
 <|  j j/ |  j.   t j( j0   Wd  |  j. d =| t j( _ t1   Xd  |  _$ d  |  _& t |  _2 |  j3 r|  j3 j4   n  |  j) j* | d   | k	 r4|  j5 d  k r4|  j
 t k r4d |  _5 n  |  j5 rpx$ |  j j- D] } | j6 |  j5  qJWd  |  _5 n  | rt" j"   } |  j j" rt j d d | |  n  |  j j# rt j d  qn  |  j S(   Ns   %s %s %sRd   s   %H:%M:%S.%fi    Ry   Rz   R{   t   _scopet   _namet   _debugR   s	   * %.2f msi  s   
(7   R|   R   R&   R   R"   Rn   R   t   NullRF   R_   RN   RC   RD   RI   R   R   RB   R   R,   RA   R   R@   R   t	   interfacet   profile_onceR	   t   profile_logt   writet
   phase_nameRf   RQ   t   datetimet   nowt   strftimeR
   R   RJ   RH   RL   Rj   R   R   RR   R   R   RG   RZ   R0   R   Rl   R]   RM   t   clearR^   Rr   (	   R   R   R   t   startt   old_ui_screent   NAMEt	   old_cacheR   t   end(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR   *  s    '							
		
(
				9	c   	      C  s	  |  j  s |  j   n  |  j t k r1 t |  _ n  z2 t |   t j j j |  j  | | | |  } Wd  t	   Xt j j j
 | |  } |  | _ |  j t k p |  j t k } t j j |  j j d |  j } | j | d d | o | d | |  j o | | _ | S(   NRT   i    Ry   t   main(   i    i    (   RF   R   RN   RA   RB   Rj   R"   Rn   Ro   Rl   t   Rendert   focus_screenRD   RC   RX   Rb   R&   R;   RZ   t   blitR4   (	   R   t   wt   hR   R   RF   Rw   R`   R;   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRo     s    	
(	!$c         C  s#   |  j  s |  j   n  |  j  j   S(   N(   RF   R   t   get_placement(   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR     s    	c         C  s   |  j  t k s |  j  t k r" d  St j j |  j j d |  j sU t j	 j
 j } n  z) t |   |  j j | | | |  } Wd  t   X| d  k	 r | S|  j r t j	 j j    n  d  S(   NRT   (   RN   RD   RC   R"   RX   Rb   R&   R;   RZ   Rn   R   t
   time_eventRj   RF   Rs   Rl   R   R4   R   t   IgnoreLayers(   R   t   evt   xt   yR   Rw   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRs     s    !
	c         C  s   t  |  j S(   N(   R   RN   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   get_phase_name  s    N(   R   R   R   t   nosaveR   R_   R`   Ra   RS   R   Rg   Rh   R   Rk   Rq   Rr   Rt   Rv   Rx   R   R   R   Ro   R   Rs   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRE      sD   		^									
	9		o			c         C  s   t  j t  |  a d  S(   N(   t   current_screen_stackR   t   _current_screen(   R&   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRj     s    c           C  s   t  j   a d  S(   N(   R   R%   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRl     s    c         C  sX   | d k r t j j } n  x6 | D]. } t j |  | f d  } | d k	 r" | Sq" Wd S(   si   
    Get a variant screen object for `name`.

    `candidates`
        A list of candidate variants.
    N(   R   R"   R#   t   variantsR.   RR   (   R   t
   candidatesR   Rw   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRP     s    c         C  sQ   g  } xD t  j   D]6 \ } } | d |  k r | j | d | f  q q W| S(   s   
    Gets all variants of the screen with `name`.

    Returns a list of (`variant`, `screen`) tuples, in no particular
    order.
    i    i   (   R.   t	   iteritemsR   (   R   Rw   t   kR?   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   get_all_screen_variants  s
    c            s[  t  t k r t St j t    t j t   d   t D  xc t j   D]U \ }  } |  d     | j sx qK n       f d   } | j j |  qK Wg  } d     j   D } xl | r.| j	    | j
   x?   D]3 }   | } | j   | s | j |  q q W  =q W j   a t j   | a t t  a  | S(   sG   
    Produces a list of SL2 screens in topologically sorted order.
    c         S  s   h  |  ] } | d   q S(   i    (    (   t   .0R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pys	   <setcomp>2  s   	 i    c           s6   |   k r d  S   j  |    |  j    d  S(   N(   R   (   t   uses(   t   dependsR   t   namest   reverse(    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyRm   >  s    c         S  s(   h  |  ] \ } } t  |  s |  q S(    (   R!   (   R   R   R?   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pys	   <setcomp>J  s   	 (   t   screens_at_sortR.   t   sorted_screenst   collectionst   defaultdictt   sett   itemsR   t   used_screensR%   R   R(   R   t   keyst	   use_cyclet   sortt   dict(   R   R?   Rm   Rw   t   worksetR   R   (    (   R   R   R   R   sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   sort_screens   s8    	
		

c          C  s5   g  }  x( t    D] } |  j t | j    q W|  S(   sB   
    Produces a list of screen variants in topological order.
    (   R   t   extendR/   t   values(   Rw   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   sorted_variantsc  s    c          C  sJ   t  r
 d Sx3 t   D]( }  |  j d k r/ q n  |  j j   q Wt a  d S(   s   
    Analyzes all screens.
    N(   R=   R   R   R   t   analyze_screenR,   (   t   s(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   analyze_screensp  s    c          C  s   t  r
 d St j   t s$ t   n  x@ t   D]5 }  |  j d k rI q. n  |  j j   |  j j	   q. Wt
 a  t j j r t r t d d j t  d   n  d S(   s'   
    Prepares all screens for use.
    Ns0   The following screens use each other in a loop: s   , s   . This is not allowed.(   R<   R    R   R=   R   R   R   R   t   unprepare_screent   prepare_screenR,   R"   R#   R   R   t	   ExceptionRf   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   prepare_screens  s    

c          O  s   t  |  |   d S(   s  
    :doc: screens
    :args: (name, function, modal="False", zorder="0", tag=None, variant=None)

    Defines a screen with `name`, which should be a string.

    `function`
        The function that is called to display the screen. The
        function is called with the screen scope as keyword
        arguments. It should ignore additional keyword arguments.

        The function should call the ui functions to add things to the
        screen.

    `modal`
        A string that, when evaluated, determines of the created
        screen should be modal. A modal screen prevents screens
        underneath it from receiving input events.

    `zorder`
        A string that, when evaluated, should be an integer. The integer
        controls the order in which screens are displayed. A screen
        with a greater zorder number is displayed above screens with a
        lesser zorder number.

    `tag`
        The tag associated with this screen. When the screen is shown,
        it replaces any other screen with the same tag. The tag
        defaults to the name of the screen.

    `predict`
        If true, this screen can be loaded for image prediction. If false,
        it can't. Defaults to true.

    `variant`
        String. Gives the variant of the screen to use.

    N(   R+   (   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   define_screen  s    (c         C  sC   t  |  t  s |  d }  n  t |   } | d k r8 d S| j Sd S(   sC   
    Returns the layer that the screen with `name` is part of.
    i    R.   N(   R   R   RP   R   R:   (   R   R&   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   get_screen_layer  s    c         C  s   | d k r t |   } n  t |  t  r6 |  f }  n  t j j   } x0 |  D]( } | j | |  } | d k	 rL | SqL Wx3 |  D]+ } | j | | f  } | d k	 r | Sq Wd S(   s
  
    :doc: screens

    Returns the ScreenDisplayable with the given `name` on layer. `name`
    is first interpreted as a tag name, and then a screen name. If the
    screen is not showing, returns None.

    This can also take a list of names, in which case the first screen
    that is showing is returned.

    This function can be used to check if a screen is showing::

        if renpy.get_screen("say"):
            text "The say screen is showing."
        else:
            text "The say screen is hidden."

    N(	   R   R   R   R   R"   t   exportst   scene_listst   get_displayable_by_tagt   get_displayable_by_name(   R   R:   t   slR6   t   sd(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyR\     s    c         C  sJ   t  |  t  s$ t |  j    }  n  |  s. t St |  d  rB t St Sd S(   s>   
    Returns true if a screen with the given name exists.
    i    N(   R   R   R   R   RP   R,   (   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt
   has_screen  s    c         O  s   | j  d d  } | j  d d  } | j  d i   } | j  d t  } | j  d d  } |  } t | t  s t | j    } n  t | d  }	 |	 d k r t d | d f   n  | d k r t |  } n  | d k r |	 j	 } n  i  }
 |	 j
 r| |
 d <| |
 d	 <n |
 j |  t |	 | | | |
 d
 | } | d k rV| j } n  t | |  } | r| j r| j | _ t |	 | |  | _ t | _ n t |	 | |  | _ t | _ t j j j   } | j | | | d | d
 | d t d | d S(   sE  
    :doc: screens

    The programmatic equivalent of the show screen statement.

    Shows the named screen. This takes the following keyword arguments:

    `_screen_name`
        The name of the screen to show.
    `_layer`
        The layer to show the screen on.
    `_zorder`
        The zorder to show the screen on. If not specified, defaults to
        the zorder associated with the screen. It that's not specified,
        it is 0 by default.
    `_tag`
        The tag to show the screen with. If not specified, defaults to
        the tag associated with the screen. It that's not specified,
        defaults to the name of the screen.
    `_widget_properties`
        A map from the id of a widget to a property name -> property
        value map. When a widget with that id is shown by the screen,
        the specified properties are added to it.
    `_transient`
        If true, the screen will be automatically hidden at the end of
        the current interaction.

    Keyword arguments not beginning with underscore (_) are used to
    initialize the screen's scope.
    t   _layert   _tagt   _widget_propertiest
   _transientt   _zorderi    s   Screen %s is not known.
t   _kwargst   _argsRa   R5   t   keep_stR   N(   R%   R   R   R   R   R   RP   R   R   R6   R8   R   RE   R5   R\   R   R*   RM   RB   RN   RA   R"   Rn   t   coreR   R   R,   (   t   _screen_nameR   R   R   R   R   R   R   R   R&   RZ   R   t   old_dt   sls(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   show_screen  s@     	
	c         O  s  | j  d d  } | j  d d  } | j  d i   } | j  d t  } |  } t j j rs t j j j d |  n  t	 | t
  s t
 | j    } n  t | d  } | d k r d S| d k r t |  } n  i  }	 |	 |	 d <| j r| |	 d	 <| |	 d
 <n |	 j |  z y | d k r;t d | d f   n  | j sHd St | d d | |	  }
 t | | |  |
 _ |
 j   t | | | |
 j  t j j j |
  Wn9 t j j rd d l } t d |   | j   qn XWd |	 d =Xt j j   d S(   s  
    Predicts the displayables that make up the given screen.

    `_screen_name`
        The name of the  screen to show.
    `_widget_properties`
        A map from the id of a widget to a property name -> property
        value map. When a widget with that id is shown by the screen,
        the specified properties are added to it.

    Keyword arguments not beginning with underscore (_) are used to
    initialize the screen's scope.
    R   R   R   R   s   Predict screen %si    NR   R   R   s   Screen %s is not known.
is   While predicting screen(   R%   R   R   R"   R#   t   debug_image_cacheRn   t   ic_logR   R   R   R   RP   R   R8   R   R   R   RE   R*   R   t	   cache_putt   displayablet	   tracebackt   printt	   print_excR   t   reset(   R   R   R   R   R   R   R   R   R&   RZ   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   predict_screenh  sL    
	
 	
c         C  sY   | d k r t |  f  } n  t |  |  } | d k	 rU t j j | j d | n  d S(   s   
    :doc: screens

    The programmatic equivalent of the hide screen statement.

    Hides the screen with `tag` on `layer`.
    R:   N(   R   R   R\   R"   R   t   hideR6   (   R6   R:   R&   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   hide_screen  s
    	c   	      O  s  | j  d d  } | j  d i   } |  } t | t  sN t | j    } n  t | d  } | d  k r t d | f   n  t j } t	 t _ | j
 r i  } | | d <| | d <n | j   } | j |  | | d <| | f | d <z | j |   Wd  | d =X| t _ d  S(   NR   R   i    s   Screen %r is not known.R   R   (    (   R%   R   R   R   RP   R   R   R   R]   R,   R8   Rv   R   R0   (	   R   R   R   R   R   R   R&   R]   RZ   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt
   use_screen  s,    			

c           C  s   t  S(   N(   R   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   current_screen  s    c         C  s   t  |  t  r |  j }  n  |  d k r3 t   }  n* | d k rN t |   } n  t |  |  }  t  |  t  sp d S|  j d k r |  j   n  |  j	 j
 | d  } | S(   s   
    :doc: screens

    From the `screen` on `layer`, returns the widget with
    `id`. Returns None if the screen doesn't exist, or there is no
    widget with that id on the screen.
    N(   R   RE   RQ   R   R   R   R\   RF   R   RI   RR   (   R&   t   idR:   Rw   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt
   get_widget  s    	c         C  s   | d k r t   } n* | d k r3 t |  } n  t | |  } | d k rR i  S| j j |  d  } | d k r| i  } n  | S(   s  
    :doc: screens

    Returns the properties for the widget with `id` in the `screen`
    on `layer`. If `screen` is None, returns the properties for the
    current screen. This can be used from Python or property code inside
    a screen.

    Note that this returns a dictionary containing the widget properties,
    and so to get an individual property, the dictionary must be accessed.
    N(   R   R   R   R\   R[   RR   (   R   R&   R:   R   Rw   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   get_widget_properties
  s    	c          C  sk   xd t  j j j j   D]M \ }  } |  d k r4 q n  x, | j D]! } t | t  r> t	 | _
 q> q> Wq Wd S(   s   
    This is called before Ren'Py restarts to put the screens into restart
    mode, which prevents crashes due to variables being used that are no
    longer defined.
    N(   R"   Rn   R   t	   old_sceneR   R   RG   R   RE   R,   R_   (   R   R:   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   before_restart*  s    "c         C  s   |  } t  j j d k r" | } n! t  j j t k r= t } n t } | r xl t  j j D]% } t |  d k rV t	 |  qV qV Wn6 x3 t  j j D]% } t |  d k	 r t
 |  q q Wd S(   sC   
    Called from interact to show or hide the overlay screens.
    N(   R"   t   storet   _overlay_screensR   R,   R   R#   t   overlay_screensR\   R   R   (   t   suppress_overlayR   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   show_overlay_screens:  s    		c          C  sc   x\ t  j j D]N }  t |   } | d k r1 q n  t j |  t  j j j	 |  | j
   q Wd S(   si   
    Called from interact once per frame to invalidate screens we want to
    update once per frame.
    N(   R"   R#   t   per_frame_screensR\   R   R|   R}   Rn   Ro   t
   invalidateR   (   R   R   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt	   per_frameU  s    (E   t
   __future__R    t   renpy.displayR"   R
   R   R   t   logt   openR,   R   R   R   t   objectt   ObjectR   R   R   t   listR    R   R   R*   R+   R@   RA   RB   RC   RD   R   Rn   R   t	   ContainerRE   R   R   R   Rj   Rl   R.   R   R/   R   R|   RP   R   R=   R<   R   R   R   R   R   R   R   R   R   R\   R   R   R   R   R   R   R   R   R   R   R  (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\screen.pyt   <module>   sr   $L		O	 					C				+	+		R	I	%	 		