
h]c           @  sq  d  d l  m Z e Z d  d l Z d  d l Z d  d l Z d  d l m	 Z	 m
 Z
 m Z d   Z d  d l Z d  d l m Z m Z d  d l m Z m Z m Z d  d l m Z m Z d  d l m Z d  d	 l m Z m Z m Z m Z d  d
 l m Z m Z m  Z  d  d l m! Z! m" Z" d  d l# m$ Z$ d  d l% m& Z& m' Z' m( Z( m) Z) m* Z* d  d l% m+ Z+ m, Z, m- Z- m. Z/ d  d l% m0 Z0 d  d l1 m2 Z2 d  d l3 m4 Z5 d  d l6 m7 Z7 m7 Z8 m9 Z9 d  d l6 m: Z: m; Z; m< Z< m= Z= d  d l6 m> Z> d  d l? m@ Z@ mA ZA d  d lB mC ZC mD ZD d  d lE mF ZF mG ZG mH ZH d  d lI mJ ZJ mK ZK mL ZL mM ZM mN ZN mO ZO mP ZP mQ ZQ d  d lI mR ZR mS ZS mT ZT mU ZU mV ZV mW ZW d  d lX mY ZZ d  d lX m[ Z\ d  d l] m^ Z^ d  d l_ m` Z` ma Za mb Zb d  d lc md Zd me Ze d  d lf mg Zg mh Zh d  d  li mj Zk d  d! ll mm Zm d  d" ln mo Zo mp Zp mq Zq d  d lr js jt Zt d  d lu js jv Zv d  d# lw mx Zy d  d$ l mz Zz d  d% l{ m| Z| m} Z} m~ Z~ d  d& l m Z m Z m Z m Z d  d' l m Z d  d( l m Z m Z d  d) l m Z d  d* l m Z d  d+ l m Z m Z e d,  e d-  e d.  e d/  e d0  e d1  e d2  e d3  e d4  e d5  d  d l Z d  d l Z d  d l Z d  d l Z d6   Z [ d7   Z d d8  Z d9   Z d:   Z d;   Z d d d<  Z e d=  Z d>   Z d?   Z d@   Z e j j j Z dA   Z dB   Z dC   Z e dD  Z d d dE  Z dF dG  Z dF e dH  Z dF dI  Z d d dJ  Z d d d g  dK  Z g  d d d d g  d e e dL 	 Z d dM  Z dF dN  Z dO d dP d d d dQ  Z d a d a dR   Z d d d dS  Z dT   Z dU   Z dV e f dW     YZ dX e d dY dZ d[ d\ d] i  d d^ d_ e d`  Z da e f db     YZ e   Z dc   Z dd   Z de   Z d e df df d dg  Z d d d e d dh  Z d di e dj  Z e d e dk  Z e e   dl <e dm e e d e d dn  Z do   Z dp   Z e dq    Z e dr    Z d e ds  Z e dt du dv  Z dw   Z dx   Z e di e dy  Z dz   Z d{   Z d|   Z d d}  Z d~   Z e e d   Z e j Z e j Z e j Z e j Z dO Z y2 d  d l Z d j e j   j d  d   Z Wn1 e j rd Z qe j rd Z qd Z n Xd e e d  Z d d  Z d   Z d   Z e d    Z e d    Z d   Z d   Z d   Z e d di d  Z d d  Z d   Z d a d   Z d   Z e d  Z eC e  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Ze d    Zd d  ZdF e d  ZeZd   Ze e d   Zd   Zd   Z	e j
jZe jC jC e j
j Ze j
jZe jC jC e j
j Ze j
jZe d  e d  d   Zeg Zd   Zd   Zd   Zd   Zd   Zd   Ze d    Ze  Zd   Zd d  Zd   ZeZd   Zd d  Z d   Z!d e j"j#f d     YZ$d   Z%d d dF d  Z&e j j'j(Z(e j j'j'Z'e j j j)Z)e j j'j*Z*d e j j j+e j"j#f d     YZ+d e j j j+e j"j#f d     YZ,d   Z-d   Z.d   Z/d   Z0d   Z1d   Z2d   Z3d   Z4d   Z5e e d   Z6d   Z7d   Z8d   Z9d   Z:d   Z;d   Z<e d    Z=d   Z>d   Z?d e d d  Z@d   ZAd   ZBd   ZCe d    ZDe d    ZEd  d lFmGZGd d  ZHd   ZId   ZJe d  ZKd   ZLdi d  ZMd   ZNd   ZOd   ZPd   ZQd   ZRd e d  ZSd d  ZTd   ZUd   ZVd   ZWd   ZXe d  ZYd   ZZd   Z[d   Z\d   Z]d d e d  Z^d   Z_d   Z`d d  Zad   Zbd   Zcd d  Zdd   Zed   Zfd   Zgd   Zhe aid   Zjd   Zkd   Zld S(   i(   t   print_functionN(   t   constt   puret	   not_constc         C  s3   |  } t  | t  s! |  j } n  t d |  |  S(   s.   
    Marks renpy.`fn` as a pure function.
    s   renpy.(   t
   isinstancet
   basestringt   __name__R   (   t   fnt   name(    (    s   renpy/exports.pyt
   renpy_pure(   s
    (   t   ParameterizedTextt   filter_text_tags(   t   register_sfontt   register_mudgefontt   register_bmfont(   t   language_tailort   BASELINE(   t   Keymap(   t   runR   t   run_unhoveredt   run_periodic(   t	   map_eventt   queue_eventt   clear_keymap_cache(   t   is_selectedt   is_sensitive(   t   Minigame(   t   define_screent   show_screent   hide_screent
   use_screent   current_screen(   t
   has_screent
   get_screent
   get_widgett   ScreenProfile(   t   get_widget_properties(   t   focus_coordinates(   t   screen(   t   image_existsR'   t   list_images(   t   get_available_image_tagst   get_available_image_attributest   check_image_attributest   get_ordered_image_attributes(   t   get_registered_image(   t   load_surfacet
   load_image(   t   curryt   partial(   t   movie_start_fullscreent   movie_start_displayablet
   movie_stop(   t   loadt   savet   list_saved_gamest   can_loadt   rename_savet	   copy_savet   unlink_savet   scan_saved_game(   t
   list_slotst   newest_slott
   slot_mtimet	   slot_jsont   slot_screenshott   force_autosave(   t   py_eval(   t   rng(   t
   atl_warper(   t   predictt   displayablet   split_properties(   t   unelide_filenamet   get_parse_errors(   t   change_languaget   known_languages(   t   generic_filter(   t   register_persistent(   t   show_display_sayt   predict_show_display_sayt   display_say(   t   register(   t   check_text_tags(   t   profile_memoryt   diff_memoryt   profile_rollback(   t   TAGt   TEXTt	   PARAGRAPHt   DISPLAYABLE(   t   not_infinite_loop(   t   CustomParsert   register_sl_displayable(   t   eval_who(   t   add_python_directory(   t   try_compilet   try_evalR
   R   R    R'   R0   R1   RI   RL   RS   R   c           C  s  t  t f t t t f t t t t t	 t
 f t t t f t t t t f t t t t t t t t f t t t t t t f t  t! t" t# t$ t% f t& t' t( t) t* t+ t, t- f t. t/ t0 t1 t2 f t3 t4 t5 f t6 t7 f t8 t9 f t: t; f t< t= t> t? t@ t
 tA tB f tC tD tE f tF tG tH f tI tJ tK tL f tM tN tO f tP tQ tR f tS tT tU tV tW tX tY f tZ t[ t\ f t] t^ t_ f d S(   sf   
    :undocumented:

    This does nothing, except to make warnings about unused imports go away.
    N(`   R
   R   R   R   R   R   R   t
   run_actionR   R   R   R   R0   R1   t   playR2   R3   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   t   evalt   randomRE   RO   RP   RQ   t   soundt   musict   timeR   R   R   R   R    R   R!   R"   t   profile_screenR$   R%   RF   t   predict_screenRG   RH   RI   RJ   RK   RL   t   transform_textR   RN   t   register_statementRS   R   R   R   R   R   R'   t	   has_imageR(   R)   R*   R+   R,   R-   R/   R.   RT   RU   RV   t   TEXT_TAGt	   TEXT_TEXTt   TEXT_PARAGRAPHt   TEXT_DISPLAYABLER[   t   register_sl_statementR]   R^   R   R   R_   R`   Ra   (    (    (    s   renpy/exports.pyt
   public_api   s\    








c           C  s&   t  j j   j s d St  j j j   S(   s   
    :doc: rollback

    When in rollback, returns the data that was supplied to :func:`renpy.checkpoint`
    the last time this statement executed. Outside of rollback, returns None.
    N(   t   renpyt   gamet   contextt   rollbackt   Nonet   logt   forward_info(    (    (    s   renpy/exports.pyt   roll_forward_info   s    c         C  sV   |  d k r t   }  n  |  d k r( d St t j j _ t t j _ t t j j _	 |  S(   s|   
    :undocumented:

    To cause a roll_forward to occur, return the value of this function
    from an event handler.
    N(
   Rx   R{   t   TrueRt   Ru   t	   interfacet   suppress_transitiont   after_rollbackRy   t   rolled_forward(   t   value(    (    s   renpy/exports.pyt   roll_forward_core   s    c           C  s   t  j j j   p t  j j S(   sL   
    :doc: rollback

    Returns true if the game has been rolled back.
    (   Rt   Ru   Ry   t   in_rollbackR   (    (    (    s   renpy/exports.pyR      s    c           C  s    t  j j s t St  j j j   S(   s>   
    :doc: rollback

    Returns true if we can rollback.
    (   Rt   t   configt   rollback_enabledt   FalseRu   Ry   t   can_rollback(    (    (    s   renpy/exports.pyR      s    c           C  s   t  j j j   S(   s   
    :doc: blockrollback

    Returns true if rollback is currently occurring and the current
    context is before an executed renpy.fix_rollback() statement.
    (   Rt   Ru   Ry   t   in_fixed_rollback(    (    (    s   renpy/exports.pyR      s    c         C  sn   | d k r t j j } n  t j j j |  d | d t j j t j j rj t j j	 rj t
 t j j _ n  d S(   s  
    :doc: rollback
    :args: (data=None)

    Makes the current statement a checkpoint that the user can rollback to. Once
    this function has been called, there should be no more interaction with the
    user in the current statement.

    This will also clear the current screenshot used by saved games.

    `data`
        This data is returned by :func:`renpy.roll_forward_info` when the
        game is being rolled back.
    t   keep_rollbackt   hardN(   Rx   Rt   R   t   keep_rollback_dataRu   Ry   t
   checkpointt   storet	   _rollbackt   auto_clear_screenshotR|   R}   t   clear_screenshot(   t   dataR   (    (    s   renpy/exports.pyR     s
    %c         C  s   t  j j j d |   d S(   sy   
    :doc: blockrollback
    :args: ()

    Prevents the game from rolling back to before the current
    statement.
    t   purgeN(   Rt   Ru   Ry   t   block(   R   (    (    s   renpy/exports.pyt   block_rollback  s    	c         C  s   t  j j j |   d S(   s   
    :doc: rollback
    :args: (flag)

    Rollback will skip sections of the game where rollback has been
    suspended.

    `flag`:
        When `flag` is true, rollback is suspended. When false,
        rollback is resumed.
    N(   Rt   Ru   Ry   t   suspend_checkpointing(   t   flag(    (    s   renpy/exports.pyt   suspend_rollback*  s    c           C  s   t  j j j   d S(   ss   
    :doc: blockrollback

    Prevents the user from changing decisions made before the current
    statement.
    N(   Rt   Ru   Ry   t   fix_rollback(    (    (    s   renpy/exports.pyR   :  s    c           C  s   t  j j j   d S(   s   
    :doc: retain_after_load

    Causes data modified between the current statement and the statement
    containing the next checkpoint to be retained when a load occurs.
    N(   Rt   Ru   Ry   t   retain_after_load(    (    (    s   renpy/exports.pyR   D  s    c         C  s   t    } t | j |   S(   sB   
    Returns how many displayables are in the supplied layer.
    (   t   scene_listst   lent   layers(   t   layert   sls(    (    s   renpy/exports.pyt   count_displayables_in_layerR  s    	c         C  s   | d k r t d   n  t j j   j s< t d   n  t |  t  s` t |  j    }  n  t j	 j
 |  } t j j j |  |  d S(   sx  
    :doc: se_images

    Defines an image. This function is the Python equivalent of the
    image statement.

    `name`
        The name of the image to display, a string.

    `d`
        The displayable to associate with that image name.

    This function may only be run from inside an init block. It is an
    error to run this function once the game has started.
    s&   Images may not be declared to be None.s/   Images may only be declared inside init blocks.N(   Rx   t	   ExceptionRt   Ru   Rv   t
   init_phaseR   t   tuplet   splitt   easyRG   t   displayt   imaget   register_image(   R   t   d(    (    s   renpy/exports.pyR   \  s    c         C  s   t  |  t  s$ t |  j    }  n  t  | t  sH t | j    } n  t |   } xl t j j j j   D]U \ } } t |  | k  r qj n  | |  |  k rj t j j j	 | | | |  qj qj Wd S(   s  
    :doc: image_func

    Copies images beginning with one prefix to images beginning with
    another. For example::

        renpy.copy_images("eileen", "eileen2")

    will create an image beginning with "eileen2" for every image beginning
    with "eileen". If "eileen happy" exists, "eileen2 happy" will be
    created.

    `old`
        A space-separated string giving the components of the old image
        name.

    `new`
        A space-separated string giving the components of the new image
        name.

    N(
   R   R   R   R   Rt   R   R   t   imagest   itemsR   (   t   oldt   newt   lenoldt   kt   v(    (    s   renpy/exports.pyt   copy_imagesz  s    "c         C  sq   |  d k	 r |  S| r d St | t  r6 | d } n d | k rU | j   d } n  t j j j | t j j  S(   s   
    :undocumented:

    If layer is not None, returns it. Otherwise, interprets `tag` as a name
    or tag, then looks up what the default layer for that tag is, and returns
    the result.
    t   masteri    t    N(	   Rx   R   R   R   Rt   R   t	   tag_layert   gett   default_tag_layer(   R   t   tagt
   expression(    (    s   renpy/exports.pyt   default_layer  s    	c         C  s~   t  |  t  s$ t |  j    }  n  | d k r= |  d } n  t | d  } y# t j j   j j	 | | |   SWn d SXd S(   sI  
    :doc: image_func

    Determines if `name` can be used to show an image. This interprets `name`
    as a tag and attributes. This is combined with the attributes of the
    currently-showing image with `tag` on `layer` to try to determine a unique image
    to show. If a unique image can be show, returns the name of that image as
    a tuple. Otherwise, returns None.

    `tag`
        The image tag to get attributes from. If not given, defaults to the first
        component of `name`.

    `layer`
        The layer to check. If None, uses the default layer for `tag`.
    i    N(
   R   R   R   Rx   R   Rt   Ru   Rv   R   t   apply_attributes(   R   R   R   (    (    s   renpy/exports.pyt   can_show  s    #R   c         C  sO   t  |  t  s$ t |  j    }  n  t | |   } t j j   j j | |   S(   sv  
    :doc: image_func

    Returns true if an image with the same tag as `name` is showing on
    `layer`.

    `image`
        May be a string giving the image name or a tuple giving each
        component of the image name. It may also be a string giving
        only the image tag.


    `layer`
        The layer to check. If None, uses the default layer for `tag`.
    (	   R   R   R   R   Rt   Ru   Rv   R   t   showing(   R   R   (    (    s   renpy/exports.pyR     s    c         C  s/   | r t    j |   St j j   j j |   S(   s   
    :doc: image_func

    Returns the set of image tags that are currently being shown on `layer`. If
    sort is true, returns a list of the tags from back to front.
    (   R   t   get_sorted_tagsRt   Ru   Rv   R   t   get_showing_tags(   R   t   sort(    (    s   renpy/exports.pyR     s    c         C  s   t  j j   j j |   S(   s   
    :doc: image_func

    Returns the set of image tags on `layer` that are currently hidden, but
    still have attribute information associated with them.
    (   Rt   Ru   Rv   R   t   get_hidden_tags(   R   (    (    s   renpy/exports.pyR     s    c         C  s.   t  | |   } t j j   j j | |  |  S(   s*  
    :doc: image_func

    Return a tuple giving the image attributes for the image `tag`. If
    the image tag has not had any attributes associated since the last
    time it was hidden, returns `if_hidden`.

    `layer`
        The layer to check. If None, uses the default layer for `tag`.
    (   R   Rt   Ru   Rv   R   t   get_attributes(   R   R   t	   if_hidden(    (    s   renpy/exports.pyR   
  s    c   
      C  s  | p |  d } t  | |  } | d k r4 |  } n$ t | t  rX t | j    } n  t | t j j j	  r} | } } n t j
 j r t j j   j j | | |   } | d k	 r | } | f | d }  q n  t j j j | d d } } | j   sd SxN | D]F }	 t |	 t j j j  r9|	 d |  } n |	 |  } | j   q	Wt j j   j j | |  t  t j j j |  d S(   s}  
    :undocumented:

    Predicts a scene or show statement.

    `name`
        The name of the image to show, a string.

    `layer`
        The layer the image is being shown on.

    `what`
        What is being show - if given, overrides `name`.

    `tag`
        The tag of the thing being shown.

    `at_list`
        A list of transforms to apply to the displayable.
    i    i   t   stylet   image_placementNt   child(   R   Rx   R   R   R   R   Rt   R   t   coret   DisplayableR   t   image_attributesRu   Rv   R   R   R   t   ImageReferencet   find_targett   motiont	   Transformt   _uniquet   predict_showR|   RF   RG   (
   R   R   t   whatR   t   at_listt   keyt   baset   imgt   new_whatt   i(    (    s   renpy/exports.pyR     s.    	!c
         C  s  t  j j }
 t  j j   j r- t d   n  t |  t  sQ t |  j	    }  n  | d k rs t  j j rs d } n  t   } | p |  d } t | |  } t  j j r | r | | j | k r | j | | } q n  | s/t  j j j | d  } | d k	 r/t | t  s| g } q,t |  } q/n  | d k rD|  } n$ t | t  rht | j	    } n  t | t  j j j  rt  j j rt | t  j j j  rt  j j j | d d } } d }
 q| } } n t  j j r/t  j j   j j | | |   } | d k	 r/| } | f | d }  q/n  t  j j j | d d } } | j   rt  j j  rt  j j  |  | |  } t | t  j j j  r| } } q| rd Sn  xN | D]F } t | t  j j j  r| d |  } n | |  } | j!   qWt" t  j j# j$ |  <| r5|	 r5| f |  d }  n  t  j j% rWt  j j% |  |  n  | j& | | | | | d | d	 |  d
 | d |
 d | d S(   s  
    :doc: se_images
    :args: (name, at_list=[ ], layer='master', what=None, zorder=0, tag=None, behind=[ ])

    Shows an image on a layer. This is the programmatic equivalent of the show
    statement.

    `name`
        The name of the image to show, a string.

    `at_list`
        A list of transforms that are applied to the image.
        The equivalent of the ``at`` property.

    `layer`
        A string, giving the name of the layer on which the image will be shown.
        The equivalent of the ``onlayer`` property. If None, uses the default
        layer associated with the tag.

    `what`
        If not None, this is a displayable that will be shown in lieu of
        looking on the image. (This is the equivalent of the show expression
        statement.) When a `what` parameter is given, `name` can be used to
        associate a tag with the image.

    `zorder`
        An integer, the equivalent of the ``zorder`` property. If None, the
        zorder is preserved if it exists, and is otherwise set to 0.

    `tag`
        A string, used to specify the image tag of the shown image. The
        equivalent of the ``as`` property.

    `behind`
        A list of strings, giving image tags that this image is shown behind.
        The equivalent of the ``behind`` property.
    s%   Show may not run while in init phase.i    R   R   i   NR   R   R   t   atlt   default_transformt	   transient('   Rt   R   R   Ru   Rv   R   R   R   R   R   Rx   t   preserve_zorderR   R   t   sticky_positionsR   t   tag_transformR   t   listR   R   R   R   t   wrap_shown_transformsR   R   R   R   R   R   R   R   t   missing_showR   R|   t
   persistentt   _seen_imagest   missing_hidet   add(   R   R   R   R   t   zorderR   t   behindR   R   t
   munge_nameR   R   R   t   ttR   R   R   t   resultR   (    (    s   renpy/exports.pyt   showU  sf    '			$	!c         C  s   t  j j   j r! t d   n  t |  t  sE t |  j    }  n  t   } |  d } t	 | |  } | j
 | |  t  j j r t  j j |  |  n  d S(   s  
    :doc: se_images

    Hides an image from a layer. The Python equivalent of the hide statement.

    `name`
         The name of the image to hide. Only the image tag is used, and
         any image with the tag is hidden (the precise name does not matter).

    `layer`
         The layer on which this function operates. If None, uses the default
         layer associated with the tag.
    s%   Hide may not run while in init phase.i    N(   Rt   Ru   Rv   R   R   R   R   R   R   R   t   removeR   R   (   R   R   R   R   (    (    s   renpy/exports.pyt   hide  s    	
c         C  so   |  d k r d }  n  t j j   j r6 t d   n  t   } | j |   t j j	 rk t j j	 |   n  d S(   s  
    :doc: se_images

    Removes all displayables from `layer`. This is equivalent to the scene
    statement, when the scene statement is not given an image to show.

    A full scene statement is equivalent to a call to renpy.scene followed by a
    call to :func:`renpy.show`. For example::

        scene bg beach

    is equivalent to::

        $ renpy.scene()
        $ renpy.show("bg beach")
    R   s&   Scene may not run while in init phase.N(
   Rx   Rt   Ru   Rv   R   R   R   t   clearR   t   missing_scene(   R   R   (    (    s   renpy/exports.pyt   scene  s    		t    s   {}c         C  s  t  j j r | St  j j d  t  j j   } t | t  sG d } n  | d k	 r\ | } n  t	   } t
 d  r i  }	 t d | d | d | d | d | d |  |	 d <t d d t d	 |	 d
 |  n t  j j d d  t  j j   t  j j |  d d t  j j | d | d d d | d | }
 | r;|
 j   n  t  j j   t  j j   t  j j stt  j j t  n  | rt  j j   n  t  j j d d
 d d d |  } t  j j |  | d k rt  j j } n  | rt  j j j d d  n  | S(   so  
    :doc: input

    Calling this function pops up a window asking the player to enter some
    text. It returns the entered text.

    `prompt`
        A string giving a prompt to display to the player.

    `default`
        A string giving the initial text that will be edited by the player.

    `allow`
        If not None, a string giving a list of characters that will
        be allowed in the text.

    `exclude`
        If not None, if a character is present in this string, it is not
        allowed in the text.

    `length`
        If not None, this must be an integer giving the maximum length
        of the input string.

    `pixel_width`
        If not None, the input is limited to being this many pixels wide,
        in the font used by the input to display text.

    If :var:`config.disable_input` is True, this function only returns
    `default`.
    t   inputt   defaultt   lengtht   allowt   excludet   editablet   pixel_widtht
   _transientt   _widget_propertiest   promptR   t   input_windowt   input_promptt
   input_textt   mouset   typet   roll_forwardN(    Rt   R   t   disable_inputt   exportst   modeR{   R   R   Rx   R   R    t   dictR   R|   t   uit   windowt   vboxt   textR   t   disablet   closet   shown_windowRu   R   t   loadsaveRB   t   saybehaviort   interactR   t   implicit_with_noneR}   t   do_with(   R   R   R   R   R   t	   with_noneR   R   t   fixedt   widget_propertiest   inputwidgett   rv(    (    s   renpy/exports.pyR     s@    !			2*!c           C  s&   t  d k r t   t   f St  t f S(   s   
    :other:

    Returns a tuple giving the arguments (as a tuple) and the keyword arguments
    (as a dict) passed to the current menu statement.
    N(   t	   menu_argsRx   R   R  t   menu_kwargs(    (    (    s   renpy/exports.pyt   get_menu_argsn  s    c         C  sd  | p t    } | p t   } | j d t  } t j j d k	 r` t j j | |   \ } } n  t j j rx d   } n	 d   } | d k r t    t   f g t	 |   } n  | r/t j
 j |  } g  } g  }	 xJ t |  |  D]9 \ }
 } |
 d | k r | j |
  |	 j |  q q W| }  |	 } n d } t j j rt j j   j } g  } x t |  |  D] \ \ } } } \ } } | |  } t j
 j |  } t j j r| rqin  | d k	 r| j | t j j | | | d | d | d | f  qi| j | d f  qiWn@ g  |  D]3 \ } } } t j
 j |  r#| |  | f ^ q#} g  | D] \ } } | d k	 rc| ^ qc} | sd SzI t } t } | a | a | rt j j |  } n t j j |  } Wd | a | } X| d k	 r`| d k	 r`x[ |  D]P \ } } } | | k r	y | j |  WqYt k
 rU| j |  qYXq	q	Wn  | S(	   s   
    :undocumented:

    Displays a menu, and returns to the user the value of the selected
    choice. Also handles conditions and the menuset.
    t   nvlc         S  s   |  t  S(   N(   t   tag_quoting_dict(   t   s(    (    s   renpy/exports.pyt
   substitute  s    c         S  s   |  S(   N(    (   R  (    (    s   renpy/exports.pyR    s    i    t	   sensitivet   argst   kwargsN(   R   R  t   popR   Rt   R   t   menu_arguments_callbackRx   t   old_substitutionsR   t   pythonRC   t   zipt   appendt   menu_actionsRu   Rv   t   currentt   menu_include_disabledR  t   ChoiceReturnR  R  R   t   nvl_menut   menut   AttributeErrorR   (   R   t   set_exprR  R  t   item_argumentsR  R  t   sett	   new_itemst   new_item_argumentsR   t   iat   locationt   labelt	   conditionR   t	   item_argst   item_kwargst   choicest   old_menu_argst   old_menu_kwargsR  (    (    s   renpy/exports.pyR(  |  sp    	"	+:*+c           C  s[   t  j j r+ t  j j j r+ d t  j _ n  t  j j rW t  j j rW t  j	 j
 t  n  d S(   s
  
    :doc: other

    Tells Ren'Py that a choice is coming up soon. This currently has
    two effects:

    * If Ren'Py is skipping, and the Skip After Choices preferences is set
      to stop skipping, skipping is terminated.

    * An auto-save is triggered.
    N(   Rt   R   t   skippingRu   t   preferencest   skip_after_choicesRx   t   autosave_on_choiceR   R	  RB   R|   (    (    (    s   renpy/exports.pyt   choice_for_skipping  s    c          C  s6   t  j j s d Sd t t f g }  t d d |  d S(   sI   
    :undocumented:

    Predicts widgets that are used by the menu.
    Ns   Menu Predictiont   choiceR   (   Rt   R   t   choice_screen_chosenR|   R   Rj   (   R   (    (    s   renpy/exports.pyt   predict_menu  s    t	   MenuEntryc           B  s   e  Z d  Z RS(   s3   
    The object passed into the choice screen.
    (   R   t
   __module__t   __doc__(    (    (    s   renpy/exports.pyR@    s   t   menu_windowt   menu_captiont   menu_choicet   menu_choice_chosent   menu_choice_buttont   menu_choice_chosen_buttonR=  R(  c   !      K  sv  t    \ } } | j d |  } | j d |  } | j d |  } | re t j j |  t   n  g  } xT |  D]L \ } } t | t j j  r | j	 } n  | d k r qr n  | j |  qr Wt j j   } | | k r d } n  t j j rt j j t j j t j |   n  t j j   j } t   rNt j j rNt j j   n  t |	  }	 |	 j |  t |  rg  } |
 d k ri  } n |
 } x|  D]L\ } } | sd } n  t | t j j  r| } | j   } | j } | j } nW | d k	 r1t j j | | |  } | j   } d } i  } n d } t } d } i  } t j j rmt  | | | f  } n t  | | f  } | | _! | | _" | | _# | | _ | | _ | j |  t$ | d | d | d t% d t j j& | |	 qWnh t j j' d | d	 d
  t j j( |  d t j j   j d	 d d t% d | d | d | d | d | | t j j) rrt j j*   n  x; |  D]3 \ } } | d k	 rt+ d |  qyt+ |  qyWt+ d  | rrt j j, d d
 d | d |  }  x< |  D]* \ } } |  | k rt+ d |  PqqWt+ d  t+ d  t- |   | d k rOt j j. } n  | rnt j j/ j0 d d  n  |  Sd S(   s  
    :doc: se_menu
    :name: renpy.display_menu
    :args: (items, interact=True, screen="choice")

    This displays a menu to the user. `items` should be a list of 2-item tuples.
    In each tuple, the first item is a textual label, and the second item is
    the value to be returned if that item is selected. If the value is None,
    the first item is used as a menu caption.

    This function takes many arguments, of which only a few are documented.
    Except for `items`, all arguments should be given as keyword arguments.

    `interact`
        If false, the menu is displayed, but no interaction is performed.

    `screen`
        The name of the screen used to display the menu.

    Note that most Ren'Py games do not use menu captions, but use narration
    instead. To display a menu using narration, write::

        $ narrator("Which direction would you like to go?", interact=False)
        $ result = renpy.display_menu([ ("East", "east"), ("West", "west") ])

    R&   t
   _with_nonet   _modeR   R   R   t   _layerR   t   focusR(  R0  R5  R   t   caption_stylet   choice_stylet   choice_chosen_stylet   choice_button_stylet   choice_chosen_button_styles   Choice: R   R   R   R   s   User chose: s   No choice chosen.N(    (    (1   R  R  Rt   R   R   R<  R   R  R&  R   Rx   R"  R{   R   t   auto_choice_delayt   pausebehaviorRe   R=  Ru   Rv   R$  R   t   fix_rollback_without_choiceR
  R  t   updateR    t
   get_chosenR  R  R   R>  R@  t   captiont   actiont   chosenR   R|   t   choice_layerR  R(  t   menu_showed_windowR  Ry   R  R   R  R}   R  (!   R   t   window_styleR  R  RM  RN  RO  RP  RQ  t   scopeR  R&   R   t   predict_onlyR  R  R  R   R5  t   _t   valR   R0  t   item_actionst   propsR1  R   RX  RY  R3  R4  t   meR  (    (    s   renpy/exports.pyt   display_menu  s    *
											
!


t   TagQuotingDictc           B  s   e  Z d    Z RS(   c         C  s   t  j j } | | k rP | | } t | t t f  rL | j d d  } n  | St  j j ro t	 d |   n  d | d Sd  S(   Nt   {s   {{s:   During an interpolation, '%s' was not found as a variable.t   <s	    unbound>(
   Rt   R   t   __dict__R   t   strt   unicodet   replaceR   t   debugR   (   t   selfR   R   R  (    (    s   renpy/exports.pyt   __getitem__  s    
(   R   RA  Rn  (    (    (    s   renpy/exports.pyRe    s   c         C  sl   |  d k r t j j }  n  t |  t t f  rC t j j |  |  St |  d d  } | rh | |  n  d S(   sU   
    :undocumented:

    This is called to predict the results of a say command.
    RF   N(	   Rx   Rt   R   t   narratorR   Ri  Rj  t   predict_sayt   getattr(   t   whoR   RF   (    (    s   renpy/exports.pyRp    s    c         C  s*   y |  j    | _ Wn t | _ n Xd S(   sr   
    :undocumented:

    Called when scry is called on a say statement. Needs to set
    the interacts field.
    N(   t   will_interactt	   interactsR|   (   Rr  t   scry(    (    s   renpy/exports.pyt   scry_say  s    c         O  s   t  j j r | t } n  |  d k r4 t  j j }  n  t  j j ra t  j j |  | |  \ } } n  t |  t	 t
 f  r t  j j |  | | |  n |  | | |  d S(   s,  
    :doc: se_say

    The equivalent of the say statement.

    `who`
        Either the character that will say something, None for the narrator,
        or a string giving the character name. In the latter case, the
        :func:`say` is used to create the speaking character.

    `what`
        A string giving the line to say. Percent-substitutions are performed
        in this string.

    `interact`
        If true, Ren'Py waits for player input when displaying the dialogue. If
        false, Ren'Py shows the dialogue, but does not perform an interaction.
        (This is passed in as a keyword argument.)

    This function is rarely necessary, as the following three lines are
    equivalent. ::

        e "Hello, world."
        $ renpy.say(e, "Hello, world.")
        $ e("Hello, world.")
    N(   Rt   R   R  R  Rx   R   Ro  t   say_arguments_callbackR   Ri  Rj  t   say(   Rr  R   R  R  (    (    s   renpy/exports.pyRx    s    !t   imagemapc      	   K  s  t  j j d  t  j j |  | | d | d | | t  j j   }	 |	 g  | D] \ }
 } } } } | ^ qN k r{ d }	 n  t   r t  j j	 r t  j j
   n  t  j j d | d d d | d |	  } t  j j |  | d k r t  j j } n  | rt  j j j d d  n  | S(	   s}  
    :undocumented: Use screens already.

    Displays an imagemap. An image map consists of two images and a
    list of hotspots that are defined on that image. When the user
    clicks on a hotspot, the value associated with that hotspot is
    returned.

    @param ground: The name of the file containing the ground
    image. The ground image is displayed for areas that are not part
    of any hotspots.

    @param selected: The name of the file containing the selected
    image. This image is displayed in hotspots when the mouse is over
    them.

    @param hotspots: A list of tuples defining the hotspots in this
    image map. Each tuple has the format (x0, y0, x1, y1, result).
    (x0, y0) gives the coordinates of the upper-left corner of the
    hotspot, (x1, y1) gives the lower-right corner, and result gives
    the value returned from this function if the mouse is clicked in
    the hotspot.

    @param unselected: If provided, then it is the name of a file
    containing the image that's used to fill in hotspots that are not
    selected as part of any image. If not provided, the ground image
    is used instead.

    @param overlays: If True, overlays are displayed when this imagemap
    is active. If False, the overlays are suppressed.

    @param with_none: If True, performs a with None after the input. If None,
    takes the value from config.implicit_with_none.
    Ry  t
   unselectedR   t   suppress_overlayR   R   R   N(   Rt   R   R   R  t   imagemap_compatR{   Rx   R   R   RT  R
  R  R   R  Ru   R}   R  (   t   groundt   selectedt   hotspotsRz  t   overlaysR   R   R  t
   propertiesR   t   _x0t   _y0t   _x1t   _y1R   R  (    (    s   renpy/exports.pyRy  ;  s$    %
.		c   	      C  s  | d k r* |  d k	 r! t } q* t } n  t j j d k r@ t St j j   } | t t g k rj d } n  t j j d  | d k	 r t j	 j
 j |  } | d k	 r | }  q n  |  d k	 r t j j r | d k r d }  n  |  d k r d } n d } | st j j r*t j j d | d d  n t j j d |  |  d k	 r_t j j |  t  n  t j j d d d	 d d
 |  } | rt j j | d t n  | d k rt j j } n  | rt j j j d d  n  | S(   s~  
    :doc: other
    :args: (delay=None, hard=False)

    Causes Ren'Py to pause. Returns true if the user clicked to end the pause,
    or false if the pause timed out or was skipped.

    `delay`
        If given, the number of seconds Ren'Py should pause for.

    `hard`
        This must be given as a keyword argument. When True, Ren'Py may prevent
        the user from clicking to interrupt the pause. If the player enables
        skipping, the hard pause will be skipped. There may be other circumstances
        where the hard pause ends early or prevents Ren'Py from operating properly,
        these will not be treated as bugs.

        In general, using hard pauses is rude. When the user clicks to advance
        the game, it's an explicit request - the user wishes the game to advance.
        To override that request is to assume you understand what the player
        wants more than the player does.

        Calling renpy.pause guarantees that whatever is on the screen will be
        displayed for at least one frame, and hence has been shown to the
        player.

        tl;dr - Don't use renpy.pause with hard=True.
    t   fastt   pausei    R   t   afmt   dismisst   dismiss_hard_pauseR   R   R   R   N(   Rx   R   R|   Rt   R   R8  R   R{   R   t   audioRg   t	   get_delayRu   R   R   t   _dismiss_pauseR  R
  RS  R  R   R  R}   R  (	   t   delayRg   R  R   R   R   t   newdelayR  R  (    (    s   renpy/exports.pyR  |  s@    			$		!i    c         C  s   t  j j d  | r/ t  j j j d t  n  t |  d | t  j j   | d k sd | d k  rw t  j j
 d  n t  j j | t  t  j j j r t } n d } t  j j d t d |  } t   | r t  j j j d t  n  | S(   s  
    :doc: movie_cutscene

    This displays a movie cutscene for the specified number of
    seconds. The user can click to interrupt the cutscene.
    Overlays and Underlays are disabled for the duration of the cutscene.

    `filename`
        The name of a file containing any movie playable by Ren'Py.

    `delay`
        The number of seconds to wait before ending the cutscene.
        Normally the length of the movie, in seconds. If None, then the
        delay is computed from the number of loops (that is, loops + 1) *
        the length of the movie. If -1, we wait until the user clicks.

    `loops`
        The number of extra loops to show, -1 to loop forever.

    Returns True if the movie was terminated by the user, or False if the
    given delay elapsed uninterrupted.
    t   movieRg   t   loopsi    R{  R   N(   Rt   R   R   R  t   set_force_stopR|   R2   R  R
  Rx   t   soundstopbehaviorRS  R   Ru   Ry   t   forwardR  R4   (   t   filenameR  R  t
   stop_musicR   R  (    (    s   renpy/exports.pyt   movie_cutscene  s"    		c         C  s1  t  j j   j r! t d   n  t  j j r6 d }  n  t  j j j	 pH | sT d }  n  t  j
 j d  t | t  r | j d d  } |  d k r | d k r d Sn  t |  t  rxB |  j   D]4 \ } } | d k r q n  t  j
 j | d | q Wd |  k rd S|  d }  n  t  j j j |  | d | S(   s  
    :doc: se_with
    :name: renpy.with_statement
    :args: (trans, always=False)

    Causes a transition to occur. This is the Python equivalent of the
    with statement.

    `trans`
        The transition.

    `always`
        If True, the transition will always occur, even if the user has
        disabled transitions.

    This function returns true if the user chose to interrupt the transition,
    and false otherwise.
    s0   With statements may not run while in init phase.t   withNR   R   (   Rt   Ru   Rv   R   R   R   R8  Rx   R9  t   transitionsR   R   R   R  R   R   t
   transitionR}   R  (   t   transt   alwayst   pairedR   R   R   (    (    s   renpy/exports.pyt   with_statement  s(    		R  i   c         C  s   | r; t  t j j  d k r; |  | f t j j d _ d S|  sz t j j sQ d St j j   j sg d St j	 j
 sz d Sn  d t j	 _ t j j j   t j j j | d | d | d |  t k d | d | d S(	   sX  
    :doc: rollback
    :args: (force=False, checkpoints=1, defer=False, greedy=True, label=None, abnormal=True)

    Rolls the state of the game back to the last checkpoint.

    `force`
        If true, the rollback will occur in all circumstances. Otherwise,
        the rollback will only occur if rollback is enabled in the store,
        context, and config.

    `checkpoints`
        Ren'Py will roll back through this many calls to renpy.checkpoint. It
        will roll back as far as it can, subject to this condition.

    `defer`
        If true, the call will be deferred until control returns to the main
        context.

    `greedy`
        If true, rollback will finish just after the previous checkpoint.
        If false, rollback finish just before the current checkpoint.

    `label`
        If not None, a label that is called when rollback completes.

    `abnormal`
        If true, the default, script executed after the transition is run in
        an abnormal mode that skips transitions that would have otherwise
        occured. Abnormal mode ends when an interaction begins.
    i   i    Nt   greedyR1  t   forcet   abnormalt   current_label(   R   Rt   Ru   t   contextst   defer_rollbackR   R   Rv   Rw   R   R   Rx   R8  Ry   t   completeR|   (   R  t   checkpointst   deferR  R1  R  R  (    (    s   renpy/exports.pyRw   >  s    !c           C  s   t  j j j t  j j _ d S(   s9   
    :undocumented:
    Toggles the fullscreen mode.
    N(   Rt   Ru   R9  t
   fullscreen(    (    (    s   renpy/exports.pyt   toggle_fullscreens  s    c           C  s   d S(   s*   
    :undocumented:
    Does nothing.
    N(    (    (    (    s   renpy/exports.pyt   toggle_music|  s    c         C  s   t  j j j |   S(   s  
    :doc: label

    Returns true if `name` is a valid label the program, or false otherwise.

    `name`
        Should be a string to check for the existence of a label. It can
        also be an opaque tuple giving the name of a non-label statement.
    (   Rt   Ru   t   scriptt	   has_label(   R   (    (    s   renpy/exports.pyR    s    c          C  sU   g  }  x< t  j j j j   D]% } t | t  r |  j |  q q Wt  j j	 |   S(   s   
    :doc: label

    Returns the set of all labels defined in the program, including labels
    defined for internal use in the libraries.
    (
   Rt   Ru   R  t   namemapt   iterkeysR   R   R"  R   t   RevertableSet(   R  R   (    (    s   renpy/exports.pyt   get_all_labels  s
    c         C  sD   |  d k r' t j j t j j f }  n  t j j j |  d | d S(   sx   
    :doc: loadsave

    Causes a screenshot to be taken. This screenshot will be saved as part of
    a save game.
    t
   backgroundN(   Rx   Rt   R   t   thumbnail_widtht   thumbnail_heightRu   R}   t   take_screenshot(   t   scaleR  (    (    s   renpy/exports.pyR    s    t   _invoke_main_menut
   _main_menuc         C  s:   |  t  k r t j j }  n  t j j |  | | f   d S(   s   
    :doc: other

    Causes Ren'Py to restart, returning the user to the main menu.

    `transition`
        If given, the transition to run, or None to not run a transition.
        False uses :var:`config.end_game_transition`.
    N(   R   Rt   R   t   end_game_transitionRu   t   FullRestartException(   R  R1  t   target(    (    s   renpy/exports.pyt   full_restart  s    c           C  s   t  j j    d S(   s   
    :undocumented: Used in the implementation of shift+R.

    Causes an utter restart of Ren'Py. This reloads the script and
    re-runs initialization.
    N(   Rt   Ru   t   UtterRestartException(    (    (    s   renpy/exports.pyt   utter_restart  s    c          C  s
  t  d  }  t j d d  t j d d  t j d d  t j j s |  d k	 r |  j d t d <|  j j	 d d  t d <|  j j	 d i   t d <n  t j
 j d  nY |  d k	 r |  j d t d	 <|  j j	 d d  t d
 <|  j j	 d i   t d <n  t   d S(   si   
    :doc: other

    Causes Ren'Py to save the game, reload the script, and then load the
    save.
    R(  t   _reload_screent   _reload_screen_argst   _reload_screen_kwargsi    t   _argst   _kwargst   _save_reload_gamet   _main_menu_screent   _main_menu_screen_argst   _main_menu_screen_kwargsN(    (    (   R!   t   sessionR  Rx   Rt   R   t	   main_menut   screen_nameR]  R   Ru   t   call_in_new_contextR  (   R  (    (    s   renpy/exports.pyt   reload_script  s    c         C  s{   | rC t  j j d k	 rC t  j j t  j j t t  j d d   n  t d  r\ t d  n  t  j	 j
 d |  d |   d S(   s  
    :doc: other

    This causes Ren'Py to exit entirely.

    `relaunch`
        If true, Ren'Py will run a second copy of itself before quitting.

    `status`
        The status code Ren'Py will return to the operating system.
        Generally, 0 is success, and positive integers are failure.

    `save`
        If true, the game is saved in :var:`_quit_slot` before Ren'Py
        terminates.
    t	   save_nameR   t   quitt   relauncht   statusN(   Rt   R   t
   _quit_slotRx   R	  R6   Rq  R  R  Ru   t   QuitException(   R  R  R6   (    (    s   renpy/exports.pyR    s
    +c         C  s   t  j j |    d S(   sm   
    :doc: se_jump

    Causes the current statement to end, and control to jump to the given
    label.
    N(   Rt   Ru   t   JumpException(   R1  (    (    s   renpy/exports.pyt   jump	  s    c         C  s   t  j j |    d S(   s   
    :doc: label

    Causes control to leave the current context, and then to be
    transferred in the parent context to the given label.
    N(   Rt   Ru   t   JumpOutException(   R1  (    (    s   renpy/exports.pyt   jump_out_of_context  s    c         O  s4   | j  d t  } t j j |  | | d |  d S(   s  
    :doc: se_call

    Causes the current Ren'Py statement to terminate, and a jump to a
    `label` to occur. When the jump returns, control will be passed
    to the statement following the current statement.

    `from_current`
        If true, control will return to the current statement, rather than
        the statement following the current statement. (This will lead to
        the current statement being run twice. This must be passed as a
        keyword argument.)
    t   from_currentN(   R  R   Rt   Ru   t   CallException(   R1  R  R  R  (    (    s   renpy/exports.pyt   call  s    c         C  s   |  t  j _ t d  d S(   sX   
    :doc: se_call

    Causes Ren'Py to return from the current Ren'Py-level call.
    t   _renpy_returnN(   Rt   R   t   _returnR  (   R   (    (    s   renpy/exports.pyt   return_statement2  s    c         C  s   t  j j j |   S(   s   
    :doc: other

    Saves a screenshot in `filename`.

    Returns True if the screenshot was saved successfully, False if saving
    failed for some reason.
    (   Rt   Ru   R}   t   save_screenshot(   R  (    (    s   renpy/exports.pyt
   screenshot=  s    
c         C  s   |  r t  j St  j S(   s   
    :doc: renpy_version

    If `tuple` is false, returns a string containing "Ren'Py ", followed by
    the current version of Ren'Py.

    If `tuple` is true, returns a tuple giving each component of the
    version as an integer.
    (   Rt   t   version_tuplet   version(   R   (    (    s   renpy/exports.pyR  J  s    t   -i   t   Androidt   iOSt   Unknownc      	   C  s   t  |  t  rL x6 |  j   D]( \ } } t | d | d | d | q Wd S| rl t j j j rl d }  n  t j j	 j
 |  | d | d S(   sy  
    :doc: other
    :args: (trans, layer=None, always=False)

    Sets the transition that will be used during the next interaction.

    `layer`
        The layer the transition applies to. If None, the transition
        applies to the entire scene.

    `always`
        If false, this respects the transition preference. If true, the
        transition is always run.
    R   R  R  N(   R   R  R   R  Rt   Ru   R9  R  Rx   R}   t   set_transition(   R  R   R  R  t   t(    (    s   renpy/exports.pyR  n  s     	c         C  s   t  j j j j |  d  S(   s   
    :doc: other

    Gets the transition for `layer`, or the entire scene if
    `layer` is None. This returns the transition that is queued up
    to run during the next interaction, or None if no such
    transition exists.
    N(   Rt   Ru   R}   R  R   Rx   (   R   (    (    s   renpy/exports.pyt   get_transition  s    
c           C  s   d t  j j d _ d S(   s;   
    :doc: other

    Resets the game runtime counter.
    i    N(   Rt   Ru   R  t   runtime(    (    (    s   renpy/exports.pyt   clear_game_runtime  s    c           C  s   t  j j d j S(   s  
    :doc: other

    Returns the game runtime counter.

    The game runtime counter counts the number of seconds that have
    elapsed while waiting for user input in the top-level context.
    (It does not count time spent in the main or game menus.)
    i    (   Rt   Ru   R  R  (    (    (    s   renpy/exports.pyt   get_game_runtime  s    c         C  s   t  j j |   S(   s   
    :doc: file

    Returns True if the given filename is loadable, meaning that it
    can be loaded from the disk or from inside an archive. Returns
    False if this is not the case.
    (   Rt   t   loadert   loadable(   R  (    (    s   renpy/exports.pyR    s    
c         C  s'   y t  j j |   t SWn t SXd S(   s2  
    :doc: file_rare

    Returns true if the given filename can be found in the
    searchpath. This only works if a physical file exists on disk. It
    won't find the file if it's inside of an archive.

    You almost certainly want to use :func:`renpy.loadable` in preference
    to this function.
    N(   Rt   R  t   transfnR|   R   (   R  (    (    s   renpy/exports.pyt   exists  s
    c           C  s!   y t  t j j _ Wn n Xd S(   sZ  
    :doc: other

    Restarts the current interaction. Among other things, this displays
    images added to the scene, re-evaluates screens, and starts any
    queued transitions.

    This only does anything when called from within an interaction (for
    example, from an action). Outside an interaction, this function has
    no effect.
    N(   R|   Rt   Ru   R}   t   restart_interaction(    (    (    s   renpy/exports.pyR    s    c           C  s   t  j j   j S(   s   
    :doc: context

    Returns an object that is unique to the current context. The object
    is copied when entering a new context, but changes to the copy do
    not change the original.

    The object is saved and participates in rollback.
    (   Rt   Ru   Rv   t   info(    (    (    s   renpy/exports.pyRv     s    c           C  s   t  t j j  d S(   s   
    :doc: context

    Returns the nesting level of the current context. This is 0 for the
    outermost context (the context that is saved, loaded, and rolled-back),
    and is non-zero in other contexts, such as menu and replay contexts.
    i   (   R   Rt   Ru   R  (    (    (    s   renpy/exports.pyt   context_nesting_level  s    	c         C  s)   t  j j j |  d | d | d | d S(   sv   
    Deprecated music start function, retained for compatibility. Use
    renpy.music.play() or .queue() instead.
    t   loopt   fadeoutt   fadeinN(   Rt   R  Rg   Rc   (   R  R  R  R  (    (    s   renpy/exports.pyt   music_start  s    c         C  s   t  j j j d |   d S(   sv   
    Deprecated music start function, retained for compatibility. Use
    renpy.music.play() or .queue() instead.
    R  N(   Rt   R  Rg   t   stop(   R  (    (    s   renpy/exports.pyt
   music_stop  s    c          C  sK   t  j j j j t  j j   j d  }  |  d k r7 d S|  j |  j	 f Sd S(   sk   
    :doc: debug

    Returns a pair giving the filename and line number of the current
    statement.
    t   unknowni    N(   s   unknowni    (
   Rt   Ru   R  R  R   Rv   R$  Rx   R  t
   linenumber(   t   n(    (    s   renpy/exports.pyt   get_filename_line  s    'c         C  s   t  j j s d S|  d k r  d Sy t sl d d l } t t  j j d  a t j   sl t j | j	  ql n  d d l
 } t | j |  t  j j  j d  d t t j   Wn d t  j _ n Xd S(   s   
    :doc: debug

    If :var:`config.log` is not set, this does nothing. Otherwise, it opens
    the logfile (if not already open), formats the message to :var:`config.log_width`
    columns, and prints it to the logfile.
    Nit   as   utf-8t   file(   Rt   R   Ry   Rx   t   logfilet   codecst   _filet   tellt   writet   BOM_UTF8t   textwrapt   printt   fillt	   log_widtht   encodet   flush(   t   msgR  R  (    (    s   renpy/exports.pyRy   "  s    +c           C  s   t  t j j _ d S(   s   
    :doc: other

    Forces the screen to be redrawn in full. Call this after using pygame
    to redraw the screen directly.
    N(   R|   Rt   Ru   R}   t   full_redraw(    (    (    s   renpy/exports.pyt   force_full_redrawE  s    c         O  s>   |  d  k	 r! t j j |   }  n  t |  | d | | | d  S(   NR  (   Rx   Rt   R   RC   Rx  (   Rr  R   R  R  R  (    (    s   renpy/exports.pyt   do_reshow_sayP  s    c          K  sD   t  t j j  } | j |   t t j j t j j t j j |  S(   N(	   R  Rt   R   t   _last_say_kwargsRU  t   curried_do_reshow_sayt   _last_say_whot   _last_say_whatt   _last_say_args(   R  t   kw(    (    s   renpy/exports.pyt   get_reshow_say[  s    			c          K  s   t    |    d  S(   N(   R  (   R  (    (    s   renpy/exports.pyt
   reshow_sayf  s    c           C  s   t  t j j   j d d   S(   Nt   _current_interact_type(   Rq  Rt   Ru   Rv   R  Rx   (    (    (    s   renpy/exports.pyt   current_interact_typej  s    c           C  s   t  t j j   j d d   S(   Nt   _last_interact_type(   Rq  Rt   Ru   Rv   R  Rx   (    (    (    s   renpy/exports.pyt   last_interact_typen  s    c          G  s   t  j j   j |   d S(   s+  
    :doc: other

    This can be given one or more variable names as arguments. This makes
    the variables dynamically scoped to the current call. The variables will
    be reset to their original value when the call returns.

    An example call is::

        $ renpy.dynamic("x", "y", "z")
    N(   Rt   Ru   Rv   t   make_dynamic(   t   vars(    (    s   renpy/exports.pyt   dynamicr  s    c          G  s    t  j j   j |  d t d S(   s6  
    :doc: other

    This can be given one or more variable names as arguments. This makes
    the variables dynamically scoped to the current context. The variables will
    be reset to their original value when the call returns.

    An example call is::

        $ renpy.context_dynamic("x", "y", "z")
    Rv   N(   Rt   Ru   Rv   R  R|   (   R  (    (    s   renpy/exports.pyt   context_dynamic  s    c         C  s   |  t  j j j k S(   s   
    :doc: label

    Returns true if the named label has executed at least once on the current user's
    system, and false otherwise. This can be used to unlock scene galleries, for
    example.
    (   Rt   Ru   R   t
   _seen_ever(   R1  (    (    s   renpy/exports.pyt
   seen_label  s    c         C  s(   t  j d d |   }  |  t j j j k S(   s}   
    :doc: audio

    Returns True if the given filename has been played at least once on the current
    user's system.
    s   ^<.*?>R   (   t   ret   subRt   Ru   R   t   _seen_audio(   R  (    (    s   renpy/exports.pyt
   seen_audio  s    c         C  s7   t  |  t  s$ t |  j    }  n  |  t j j j k S(   so  
    :doc: image_func

    Returns True if the named image has been seen at least once on the user's
    system. An image has been seen if it's been displayed using the show statement,
    scene statement, or :func:`renpy.show` function. (Note that there are cases
    where the user won't actually see the image, like a show immediately followed by
    a hide.)
    (   R   R   R   Rt   Ru   R   R   (   R   (    (    s   renpy/exports.pyt
   seen_image  s    
c         C  s   t  j j |   S(   s  
    :doc: file

    Returns a read-only file-like object that accesses the file named `fn`. The file is
    accessed using Ren'Py's standard search method, and may reside in an RPA archive.
    or as an Android asset.

    The object supports a wide subset of the fields and methods found on Python's
    standard file object, opened in binary mode. (Basically, all of the methods that
    are sensible for a read-only file.)
    (   Rt   R  R5   (   R   (    (    s   renpy/exports.pyR    s    c         C  s   t  j j |  d t S(   sS   
    :undocumented:

    Like file, but doesn't search the translation prefix.
    t   tl(   Rt   R  R5   R   (   R   (    (    s   renpy/exports.pyt	   notl_file  s    c         C  s\   t  j j   t  j j |   }  t |  t  j j j  sF t	 d   n  |  j
   } | j   S(   s   
    :doc: file_rare

    Given an image manipulator, loads it and returns a (``width``,
    ``height``) tuple giving its size.

    This reads the image in from disk and decompresses it, without
    using the image cache. This can be slow.
    s6   renpy.image_size expects it's argument to be an image.(   Rt   R  t   index_archivesR   RG   R   R   t   imt   ImageR   R5   t   get_size(   R'  t   surf(    (    s   renpy/exports.pyt
   image_size  s    c         C  s`   t  |  t  r$ t |  j    }  n  |  d } t | |  } t j j   j j	 | j
 | d  S(   s  
    :doc: se_images

    Returns the list of transforms being applied to the image with tag `name`
    on `layer`. Returns an empty list if no transofrms are being applied, or
    None if the image is not shown.

    If `layer` is None, uses the default layer for the given tag.
    i    N(   R   R   R   R   R   Rt   Ru   Rv   R   R   R   Rx   (   R   R   R   (    (    s   renpy/exports.pyt   get_at_list  s
    
c         C  sA   t  |  t  s |  g }  n  t j j   j j | |  d | d S(   sX  
    :doc: se_images
    :name: renpy.show_layer_at

    The Python equivalent of the ``show layer`` `layer` ``at`` `at_list`
    statement.

    `reset`
        If true, the transform state is reset to the start when it is shown.
        If false, the transform state is persisted, allowing the new transform
        to update that state.
    t   resetN(   R   R   Rt   Ru   Rv   R   t   set_layer_at_list(   R   R   R-  (    (    s   renpy/exports.pyt   show_layer_at  s    c           C  s+   t    t j j j   t j j j   d S(   sn   
    :doc: other

    Attempts to free some memory. Useful before running a renpygame-based
    minigame.
    N(   R  Rt   R   R}   t   kill_textures_and_surfacesR  t   fontt   free_memory(    (    (    s   renpy/exports.pyR2  	  s    c         C  s*   | r t  j j |   St  j j |   Sd S(   s   
    :undocumented:
    N(   Rt   R   RG   t   displayable_or_none(   R   t   none(    (    s   renpy/exports.pyt   easy_displayable"	  s    c           C  s   t  j j j   d S(   st   
    :doc: other

    Triggers a quit event, as if the player clicked the quit button in the
    window chrome.
    N(   Rt   Ru   R}   t
   quit_event(    (    (    s   renpy/exports.pyR6  .	  s    c           C  s   t  j j j   d S(   s.   
    :doc: other

    Iconifies the game.
    N(   Rt   Ru   R}   t   iconify(    (    (    s   renpy/exports.pyR7  9	  s    t   curried_call_in_new_contextt   curried_invoke_in_new_contextc         C  s   t  |    d  S(   N(   R   (   R	  (    (    s   renpy/exports.pyt   _errorO	  s    c         C  s   t  j |   d  S(   N(   t   _error_handlersR"  (   t   eh(    (    s   renpy/exports.pyt   push_error_handlerV	  s    c           C  s   t  j   d  S(   N(   R;  R  (    (    (    s   renpy/exports.pyt   pop_error_handlerZ	  s    c         C  s   t  d |   d S(   s   
    :doc: lint

    Reports `msg`, a string, as as error for the user. This is logged as a
    parse or lint error when approprate, and otherwise it is raised as an
    exception.
    iN(   R;  (   R	  (    (    s   renpy/exports.pyt   error^	  s    	c         C  s   t  j j j |   d S(   s   
    :doc: udd_utility

    Causes an event to be generated before `seconds` seconds have elapsed.
    This ensures that the event method of a user-defined displayable will be
    called.
    N(   Rt   Ru   R}   t   timeout(   t   seconds(    (    s   renpy/exports.pyR@  j	  s    	c         C  s)   |  d k r d St j j j |    d S(   s  
    :doc: udd_utility

    If `value` is not None, immediately ends the current interaction, causing
    the interaction to return `value`. If `value` is None, does nothing.

    This can be called from inside the render and event methods of a
    creator-defined displayable.
    N(   Rx   Rt   R   R   t   EndInteraction(   R   (    (    s   renpy/exports.pyt   end_interactionv	  s    c          C  s1   t  j j   j }  t  j j j |   } | j   S(   s[  
    :doc: other

    Returns the scry object for the current statement.

    The scry object tells Ren'Py about things that must be true in the
    future of the current statement. Right now, the scry object has one
    field:

    ``nvl_clear``
        Is true if an ``nvl clear`` statement will execute before the
        next interaction.
    (   Rt   Ru   Rv   R$  R  t   lookupRu  (   R   t   node(    (    s   renpy/exports.pyRu  	  s    c           C  s   t  j j t   d  S(   Ni    (   Rt   t   parsert   munge_filenameR  (    (    (    s   renpy/exports.pyt   munged_filename	  s    c         K  s/  t  j j   j s! t d   n  |  t k r1 d St j |   t  j j } t	 t  j _ t  j j
 j |   } t  j j t	  } t | _ t  j j j |  | j |  t  j j j |  xI | D]A \ } } t | t  j j  r t  j j   j |  q |   q W| j   t  j j j   | t  j _ d S(   sO  
    :doc: other

    This loads the Ren'Py module named name. A Ren'Py module consists of Ren'Py script
    that is loaded into the usual (store) namespace, contained in a file named
    name.rpym or name.rpymc. If a .rpym file exists, and is newer than the
    corresponding .rpymc file, it is loaded and a new .rpymc file is created.

    All of the init blocks (and other init-phase code) in the module are run
    before this function returns. An error is raised if the module name cannot
    be found, or is ambiguous.

    Module loading may only occur from inside an init block.
    s,   Module loading is only allowed in init code.N(   Rt   Ru   Rv   R   R   t   loaded_modulesR   R   t   lockedR   R  t   load_modulet	   executiont   ContextR|   R  R"  R  R   Rh  RU  R   t   astt   NodeR   t   pop_all_dynamicR  (   R   R  t
   old_lockedt   initcodeRv   t   prioRE  (    (    s   renpy/exports.pyRK  	  s(    	
s   <string>c   	      C  s+  t  j j } zt  j j } t t  j _ t  j j j | t |    \ } } | d k r[ d St  j
 j t  } t | _ t  j j j |  xI | D]A \ } } t | t  j j  r t  j j   j |  q |   q W| j   t  j j j   | t  j _ t  j j j   | d j SWd | t  j _ Xd S(   s   
    :doc: other

    Loads `s` as Ren'Py script that can be called.

    Returns the name of the first statement in s.

    `filename` is the name of the filename that statements in the string will
    appear to be from.
    i    N(   Rt   Ru   t   exception_infoR   RJ  R   R  t   load_stringRj  Rx   RL  RM  R|   R   R  R"  R   RN  RO  Rv   R   RP  R  t   analyzeR   (	   R  R  t   old_exception_infoRQ  t   stmtsRR  Rv   RS  RE  (    (    s   renpy/exports.pyRU  	  s(    $	
c           C  s   t  j j   j   d S(   s   
    :doc: other
    :name: renpy.pop_call

    Pops the current call from the call stack, without returning to
    the location.

    This can be used if a label that is called decides not to return
    to its caller.
    N(   Rt   Ru   Rv   t   pop_call(    (    (    s   renpy/exports.pyRY  
  s    c           C  s   t  t j j   j  S(   s   
    :doc: other

    Returns the depth of the call stack of the current context - the number
    of calls that have run without being returned from or popped from the
    call stack.
    (   R   Rt   Ru   Rv   t   return_stack(    (    (    s   renpy/exports.pyt   call_stack_depth
  s    	c         C  s-   |  d k r t d  n t d d |  d S(   sR   
    :undocumented: Probably not what we want in the presence of
    screens.
    t
   _game_menut   _game_menu_screenN(   Rx   R  (   R&   (    (    s   renpy/exports.pyt	   game_menu#
  s    c           C  s   t  t j j   j _ d S(   s   
    :doc: other

    Call this to indicate that the window has been shown. This interacts
    with the "window show" statement, which shows an empty window whenever
    this functions has not been called during an interaction.
    N(   R|   Rt   Ru   Rv   R   R  (    (    (    s   renpy/exports.pyR  /
  s    	t	   placementc           B  s>   e  Z d    Z e d    Z e d    Z e d    Z RS(   c         C  sr   t  t |   j   | d |  _ | d |  _ | d |  _ | d |  _ | d |  _ | d |  _ | d |  _	 d  S(   Ni    i   i   i   i   i   i   (
   t   superR_  t   __init__t   xpost   ypost   xanchort   yanchort   xoffsett   yoffsett   subpixel(   Rm  t   p(    (    s   renpy/exports.pyRa  =
  s    c         C  s   |  j  |  j f S(   N(   Rb  Rc  (   Rm  (    (    s   renpy/exports.pyt   posH
  s    c         C  s   |  j  |  j f S(   N(   Rd  Re  (   Rm  (    (    s   renpy/exports.pyt   anchorL
  s    c         C  s   |  j  |  j f S(   N(   Rf  Rg  (   Rm  (    (    s   renpy/exports.pyt   offsetP
  s    (   R   RA  Ra  t   propertyRj  Rk  Rl  (    (    (    s   renpy/exports.pyR_  ;
  s   	c         C  s   |  j    } t |  S(   s  
    :doc: image_func

    This gets the placement of displayable d. There's very little warranty on this
    information, as it might change when the displayable is rendered, and might not
    exist until the displayable is first rendered.

    This returns an object with the following fields, each corresponding to a style
    property:

    * pos
    * xpos
    * ypos
    * anchor
    * xanchor
    * yanchor
    * offset
    * xoffset
    * yoffset
    * subpixel

    (   t   get_placementR_  (   R   Ri  (    (    s   renpy/exports.pyRn  U
  s    c         C  sn   |  j    d }  t | |   } | d k r: t j j } n  | d k rU t j j } n  t   j | |  | |  S(   s  
    :doc: image_func

    If an image with `tag` exists on `layer`, returns the bounding box of
    that image. Returns None if the image is not found.

    The bounding box is an (x, y, width, height) tuple. The components of
    the tuples are expressed in pixels, and may be floating point numbers.

    `width`, `height`
        The width and height of the area that contains the image. If None,
        defaults the width and height of the screen, respectively.

    `layer`
        If None, uses the default layer for `tag`.
    i    N(	   R   R   Rx   Rt   R   t   screen_widtht   screen_heightR   t   get_image_bounds(   R   t   widtht   heightR   (    (    s   renpy/exports.pyRq  q
  s    R   c           B  s   e  Z RS(    (   R   RA  (    (    (    s   renpy/exports.pyR   
  s   t	   Containerc           B  s   e  Z e j j Z RS(    (   R   RA  Rt   R   t   RevertableListt
   _list_type(    (    (    s   renpy/exports.pyRt  
  s   c           C  s   t  j j j S(   N(   Rt   Ru   R}   R  (    (    (    s   renpy/exports.pyt   get_roll_forward
  s    c          G  s   t  j j   } xX |  D]P } t  j j |  } t | t  j j j  sY t	 d |   n  | j
 |  q W| t  j j Bt  j _ d S(   s1   
    :undocumented: Cache pin is deprecated.
    s#   Cannot pin non-image-manipulator %rN(   Rt   R   R  R   RG   R   R   R'  t	   ImageBaseR   R   R   t   _cache_pin_set(   R  t   new_pinsR   R'  (    (    s   renpy/exports.pyt	   cache_pin
  s    c          G  s   t  j j   } xX |  D]P } t  j j |  } t | t  j j j  sY t	 d |   n  | j
 |  q Wt  j j | t  j _ d S(   s1   
    :undocumented: Cache pin is deprecated.
    s%   Cannot unpin non-image-manipulator %rN(   Rt   R   R  R   RG   R   R   R'  Rx  R   R   R   Ry  (   R  Rz  R   R'  (    (    s   renpy/exports.pyt   cache_unpin
  s    c         C  s]   t  |  t  s |  g Sd |  k r) |  g Sd |  k rD t t  } n	 t   } t j | |   S(   se   
    :undocumented:

    Use the fnmatch function to expland `d` for the purposes of prediction.
    t   *t   .(   R   R   t
   list_filesR   R(   t   fnmatcht   filter(   R   t   l(    (    s   renpy/exports.pyt   expand_predict
  s    	c          G  so   t  j j t  j j  } xD |  D]< } x3 t |  D]% } t  j j |  } | j |  q2 Wq W| t  j _ d S(   s  
    :doc: image_func

    This function takes one or more displayables as arguments. It causes
    Ren'Py to predict those displayables during every interaction until
    the displayables are removed by :func:`renpy.stop_predict`.

    If a displayable name is a string containing one or more \*
    characters, the asterisks are used as a wildcard pattern. If there
    is at least one . in the string, the pattern is matched against
    filenames, otherwise it is matched against image names.

    For example::

        $ renpy.start_predict("eileen *")

    starts predicting all images with the name eileen, while::

        $ renpy.start_predict("images/concert*.*")

    matches all files starting with concert in the images directory.
    N(	   Rt   R   R  R   t   _predict_setR  R   RG   R   (   R  t   new_predictR   R   (    (    s   renpy/exports.pyt   start_predict
  s    c          G  so   t  j j t  j j  } xD |  D]< } x3 t |  D]% } t  j j |  } | j |  q2 Wq W| t  j _ d S(   s   
    :doc: image_func

    This function takes one or more displayables as arguments. It causes
    Ren'Py to stop predicting those displayables during every interaction.

    Wildcard patterns can be used as described in :func:`renpy.start_predict`.
    N(	   Rt   R   R  R   R  R  R   RG   t   discard(   R  R  R   R   (    (    s   renpy/exports.pyt   stop_predict
  s    
c         O  s8   t  j j t  j j  } | | f | |  <| t  j _ d S(   s  
    :doc: screens

    Causes Ren'Py to start predicting the screen named `_screen_name`
    will be shown with the given arguments. This replaces  any previous prediction
    of `_screen_name`. To stop predicting a screen, call :func:`renpy.stop_predict_screen`.
    N(   Rt   R   t   RevertableDictR   t   _predict_screen(   t   _screen_nameR  R  R  (    (    s   renpy/exports.pyt   start_predict_screen  s    	c         C  s8   t  j j t  j j  } | j |  d  | t  j _ d S(   sd   
    :doc: screens

    Causes Ren'Py to stop predicting the screen named `name` will be shown.
    N(   Rt   R   R  R   R  R  Rx   (   R   R  (    (    s   renpy/exports.pyt   stop_predict_screen!  s    c         O  s3  d } d | k r$ | j  d  } n  t j j |  t j j } d | k r^ | j  d  } n  t |  d t | | t j j   } y% t j	 j
 d d d d d |  } Wn+ t j j t j j f k
 r } | } n Xt j j |  | rt j j j d d  n  t | t j j t j j f  r/|  n  | S(	   s[  
    :doc: screens

    The programmatic equivalent of the call screen statement.

    This shows `_screen_name` as a screen, then causes an interaction
    to occur. The screen is hidden at the end of the interaction, and
    the result of the interaction is returned.

    Keyword arguments not beginning with _ are passed to the scope of
    the screen.

    If the keyword argument `_with_none` is false, "with None" is not
    run at the end of end of the interaction.

    If the keyword argument `_mode` in kwargs, it will be mode of this
    interaction, otherwise it will be "screen" mode.
    R&   RJ  RI  R   R   R   R   N(   R  Rt   R   R   R   R  R   R|   R{   R  R  Ru   R  R  R   R}   R  Rx   R   (   R  R  R  R   R  R   R  t   e(    (    s   renpy/exports.pyt   call_screen-  s&    %!
!	c         C  sY   g  } xB t  j j |   D]. \ } } | j d  r: q n  | j |  q W| j   | S(   s   
    :doc: file

    Lists the files in the game directory and archive files. Returns
    a list of files, with / as the directory separator.

    `common`
        If true, files in the common directory are included in the
        listing.
    s   saves/(   Rt   R  t   listdirfilest
   startswithR"  R   (   t   commonR  t   dirR   (    (    s   renpy/exports.pyR  _  s    
c           C  s   t  j j j S(   s  
    :doc: other

    Returns a dictionary, giving information about the renderer Ren'Py is
    currently using. The dictionary has one required key:

    ``"renderer"``
        One of ``"gl"`` or ``"sw"``, corresponding to the OpenGL and
        software renderers, respectively.

    ``"resizable"``
        True if and only if the window is resizable.

    ``"additive"``
        True if and only if the renderer supports additive blending.

    Other, renderer-specific, keys may also exist. The dictionary should
    be treated as immutable. This should only be called once the display
    has been started (that is, after the init phase has finished).
    (   Rt   R   t   drawR  (    (    (    s   renpy/exports.pyt   get_renderer_infoy  s    c           C  s   t  t j j _ d S(   sw   
    :undocumented: Used internally.

    Causes the display to be restarted at the start of the next interaction.
    N(   R|   Rt   R   R}   t   display_reset(    (    (    s   renpy/exports.pyR    s    c         C  s   t  j j   } | j s d S| j } zD t | _ |  | d k rh x$ t  j j D] } | |  |  qN Wn  Wd t | _ X|  | k r | j	 |   n  | j
 d |   d S(   sq   
    :doc: modes

    Causes Ren'Py to enter the named mode, or stay in that mode if it's
    already in it.
    Ni    (   Rt   Ru   Rv   t	   use_modest   modesR   R   t   mode_callbacksR|   R   t   insert(   R   t   ctxR  t   c(    (    s   renpy/exports.pyR     s    			
c          C  s-   t  j j   }  |  j s d S|  j } | d S(   sR   
    :doc: modes

    Returns the current mode, or None if it is not defined.
    i    N(   Rt   Ru   Rv   R  Rx   R  (   R  R  (    (    s   renpy/exports.pyt   get_mode  s
    		c         C  s   t  j j |   d S(   sS  
    :doc: other

    Causes Ren'Py to display the `message` using the notify screen. By
    default, this will cause the message to be dissolved in, displayed
    for two seconds, and dissolved out again.

    This is useful for actions that otherwise wouldn't produce feedback,
    like screenshots or quicksaves.

    Only one notification is displayed at a time. If a second notification
    is displayed, the first notification is replaced.

    This function just calls :var:`config.notify`, allowing its implementation
    to be replaced by assigning a new function to that variable.
    N(   Rt   R   t   notify(   t   message(    (    s   renpy/exports.pyR    s    c         C  s%   t  d  t d d |  t   d S(   sN   
    :doc: other

    The default implementation of :func:`renpy.notify`.
    R  R  N(   R   R   R  (   R  (    (    s   renpy/exports.pyt   display_notify  s    
c         C  sN   t  |  t  r |  t j j k Sx$ |  D] } | t j j k r& t Sq& Wt Sd S(   s  
    :doc: screens

    Returns true if a `name` is a screen variant that can be chosen
    by Ren'Py. See :ref:`screen-variants` for more details. This function
    can be used as the condition in a Python if statement to set up the
    appropriate styles for the selected screen variant.

    `name` can also be a list of variants, in which case this function
    returns True if any of the variants is selected.
    N(   R   R   Rt   R   t   variantsR|   R   (   R   R  (    (    s   renpy/exports.pyt   variant  s    c         C  s+   y d d l  } | j |   Wn n Xd S(   s   
    :doc: other

    Causes the device to vibrate for `duration` seconds. Currently, this
    is only supported on Android.
    iN(   t   androidt   vibrate(   t   durationR  (    (    s   renpy/exports.pyR    s
    c           C  s   t  j j   j S(   s   
    :doc: other

    Gets the attributes associated with the current say statement, or
    None if no attributes are associated with this statement.

    This is only valid when executing or predicting a say statement.
    (   Rt   Ru   Rv   t   say_attributes(    (    (    s   renpy/exports.pyt   get_say_attributes  s    
c   
      C  s   t  j j   j } | d k	 rI t | |  } | f | j | |  } n t  j j } | s_ d St | |  } | r | j	 | | d f  r d St
   } t
 |  }	 | j |  | |	 d  S(   s[  
    :doc: other

    This attempts to find an image to show as the side image.

    It begins by determining a set of image attributes. If `image_tag` is
    given, it gets the image attributes from the tag. Otherwise, it gets
    them from the currently showing character.

    It then looks up an image with the tag `prefix_tag` and those attributes,
    and returns it if it exists.

    If not_showing is True, this only returns a side image if the image the
    attributes are taken from is not on the screen.

    If `layer` is None, uses the default layer for the currently showing
    tag.
    i    N(   Rt   Ru   Rv   R   Rx   R   R   R   t   _side_image_attributesR   R,  t   choose_image(
   t
   prefix_tagt	   image_tagt   not_showingR   R   t   image_layert   attrst
   attr_layert   requiredt   optional(    (    s   renpy/exports.pyt   get_side_image!  s    	c           C  s   t  j j j   S(   sC   
    :doc: other

    Returns the size of the physical window.
    (   Rt   R   R  t   get_physical_size(    (    (    s   renpy/exports.pyR  K  s    c         C  sE   t  t j j _ t   d rA t j j j |   |  t j j _	 n  d S(   s   
    :doc: other

    Attempts to set the size of the physical window to `size`. This has the
    side effect of taking the screen out of fullscreen mode.
    t	   resizableN(
   R   Rt   Ru   R9  R  R  R   R}   t   set_modet   last_resize(   t   size(    (    s   renpy/exports.pyt   set_physical_sizeU  s    c           C  sH   t  t j j _ t   d rD t j j j t j	 j
 t j	 j f  n  d S(   s   
    :doc: other

    Attempts to set the size of the physical window to the specified values
    in renpy.config. (That is, screen_width and screen_height.) This has the
    side effect of taking the screen out of fullscreen mode.
    R  N(   R   Rt   Ru   R9  R  R  R   R}   R  R   Ro  Rp  (    (    (    s   renpy/exports.pyt   reset_physical_sized  s    	c         C  s5   t  |  t  s |  St j   p" d } |  j | d  S(   sl   
    :doc: file_rare
    :name: renpy.fsencode

    Converts s from unicode to the filesystem encoding.
    s   utf-8Rk  (   R   Rj  t   syst   getfilesystemencodingR  (   R  t
   fsencoding(    (    s   renpy/exports.pyt   fsencodes  s    	c         C  s2   t  |  t  s |  St j   p" d } |  j |  S(   sh   
    :doc: file_rare
    :name: renpy.fsdecode

    Converts s from filesystem encoding to unicode.
    s   utf-8(   R   Ri  R  R  t   decode(   R  R  (    (    s   renpy/exports.pyt   fsdecode  s    	(   t   launch_editorc         c  s_   |  d k	 r t j   |  } n d } x3 t j j j j D] } | d | k  rR Pn  | Vq8 Wd S(   sG  
    :doc: other

    A generator that yields a log of image loading activity. For the last 100
    image loads, this returns:

    * The time the image was loaded (in seconds since the epoch).
    * The filename of the image that was loaded.
    * A boolean that is true if the image was preloaded, and false if the
      game stalled to load it.

    The entries are ordered from newest to oldest.

    `age`
        If not None, only images that have been loaded in the past `age`
        seconds are included.

    The image load log is only kept if config.developer = True.
    i    N(   Rx   Rh   Rt   R   R'  t   cachet   load_log(   t   aget   deadlineR   (    (    s   renpy/exports.pyt   get_image_load_log  s    c           C  s"   t  j j r t  j j    n  d S(   sk   
    :doc: replay

    If we're in a replay, ends the replay immediately. Otherwise, does
    nothing.
    N(   Rt   R   t
   _in_replayRu   t	   EndReplay(    (    (    s   renpy/exports.pyt
   end_replay  s    c           C  s   t  j j t  d S(   sB   
    :doc: persistent

    Saves the persistent data to disk.
    N(   Rt   R   RU  R|   (    (    (    s   renpy/exports.pyt   save_persistent  s    c         C  s   t  j j   j |   S(   s   
    :doc: other

    Returns true if the current line has been seen by the player.

    If `ever` is true, we check to see if the line has ever been seen by the
    player. If false, we check if the line has been seen in the current
    play-through.
    (   Rt   Ru   Rv   t   seen_current(   t   ever(    (    s   renpy/exports.pyt   is_seen  s    c           C  s   t  j j j   S(   s   
    :doc: other

    Returns an (x, y) tuple giving the location of the mouse pointer or the
    current touch location. If the device does not support a mouse and is not
    currently being touched, x and y are numbers, but not meaningful.
    (   Rt   R   R  t   get_mouse_pos(    (    (    s   renpy/exports.pyR    s    c         C  s   t  j j j |  | |  d S(   s)  
    :doc: other

    Jump the mouse pointer to the location given by arguments x and y.
    If the device does not have a mouse pointer, this does nothing.

    `duration`
        The time it will take to perform the move, in seconds.
        During this time, the mouse may be unresponsive.
    N(   Rt   R   R}   t   set_mouse_pos(   t   xt   yR  (    (    s   renpy/exports.pyR    s    c         C  s   |  t  _ d S(   s   
    :doc: other

    Sets the autoreload flag, which determines if the game will be
    automatically reloaded after file changes. Autoreload will not be
    fully enabled until the game is reloaded with :func:`renpy.utter_restart`.
    N(   Rt   t
   autoreload(   R  (    (    s   renpy/exports.pyt   set_autoreload  s    	c           C  s   t  j S(   s4   
    :doc: other

    Gets the autoreload flag.
    (   Rt   R  (    (    (    s   renpy/exports.pyt   get_autoreload  s    c           C  s   t  j j j j   S(   sa   
    :doc: other

    Returns the number of dialogue blocks in the game's original language.
    (   Rt   Ru   R  t
   translatort   count_translates(    (    (    s   renpy/exports.pyt   count_dialogue_blocks  s    c           C  s
   t  j j S(   s   
    :doc: other

    Returns the number of dialogue blocks the user has seen in any play-through
    of the current game.
    (   Rt   Ru   t   seen_translates_count(    (    (    s   renpy/exports.pyt   count_seen_dialogue_blocks  s    c           C  s
   t  j j S(   s~   
    :doc: other

    Returns the number of dialogue blocks the user has seen for the first time
    during this session.
    (   Rt   Ru   t   new_translates_count(    (    (    s   renpy/exports.pyt    count_newly_seen_dialogue_blocks   s    c         C  s    t  j j |  d | d | d S(   s8  
    :doc: other

    Applies translation and new-style formatting to the string `s`.

    `scope`
        If not None, a scope which is used in formatting, in addition to the
        default store.

    `translate`
        Determines if translation occurs.

    Returns the translated and formatted string.
    R]  t	   translatei    (   Rt   t   substitutionsR  (   R  R]  R  (    (    s   renpy/exports.pyR  +  s    c         C  sb   | d k r$ t j d  j j } n  |  j d  s7 |  S|  j d  rJ |  St j j	 |  |  d S(   s   
    :doc: other

    Munges `name`, which must begin with __.

    `filename`
        The filename the name is munged into. If None, the name is munged
        into the filename containing the call to this function.
    i   t   __i   N(
   Rx   R  t	   _getframet   f_codet   co_filenameR  t   endswithRt   RF  RG  (   R   R  (    (    s   renpy/exports.pyt   munge>  s    c           C  s   t  j j   j   S(   s   
    :doc: label

    Returns a list giving the current return stack. The return stack is a
    list of statement names.

    The statement names will be strings (for labels), or opaque tuples (for
    non-label statements).
    (   Rt   Ru   Rv   t   get_return_stack(    (    (    s   renpy/exports.pyR  U  s    c         C  s   t  j j   j |   d S(   s   
    :doc: label

    Sets the current return stack. The return stack is a list of statement
    names.

    Statement names may be strings (for labels) or opaque tuples (for
    non-label statements).
    N(   Rt   Ru   Rv   t   set_return_stack(   t   stack(    (    s   renpy/exports.pyR  c  s    c           s>       f d   } t  j d |  } t | _ | j   d S(   s1  
    :doc: other

    Invokes the function `fn` in a background thread, passing it the
    provided arguments and keyword arguments. Restarts the interaction
    once the thread returns.

    This function creates a daemon thread, which will be automatically
    stopped when Ren'Py is shutting down.
    c            s<   y       Wn d d  l  }  |  j   n Xt   d  S(   Ni(   t	   tracebackt	   print_excR  (   R  (   R  R   R  (    s   renpy/exports.pyR   }  s    R  N(   t	   threadingt   ThreadR|   t   daemont   start(   R   R  R  R   R  (    (   R  R   R  s   renpy/exports.pyt   invoke_in_threadq  s    		c           C  s   t  j j j j   d S(   s   
    :doc: gesture

    Cancels the current gesture, preventing the gesture from being recognized.
    This should be called by displayables that have gesture-like behavior.
    N(   Rt   R   t   gesturet
   recognizert   cancel(    (    (    s   renpy/exports.pyt   cancel_gesture  s    c         C  s(   x! t  j j D] } | j |   q Wd S(   s=   
    :undocumented:

    Executes the default statement.
    N(   Rt   RN  t   default_statementst   set_default(   R  R   (    (    s   renpy/exports.pyt   execute_default_statement  s    c         G  s   t  j j j |  |  d S(   s0   
    :undocumented:

    Writes to log.txt.
    N(   Rt   R   Ry   R  (   R  R  (    (    s   renpy/exports.pyt	   write_log  s    c           C  s   t  j j j S(   sW   
    :doc: screens

    Returns true if Ren'Py is currently predicting the screen.
    (   Rt   R   RF   t
   predicting(    (    (    s   renpy/exports.pyR    s    c           C  s   t  j j   j S(   s   
    :undocumented:

    Returns the list of lines that have been shown since the last time
    :func:`renpy.clear_line_log` was called.
    (   Rt   Ru   Rv   t   line_log(    (    (    s   renpy/exports.pyt   get_line_log  s    c           C  s   g  t  j j   _ d S(   s2   
    :undocumented:

    Clears the line log.
    N(   Rt   Ru   Rv   R  (    (    (    s   renpy/exports.pyt   clear_line_log  s    c         C  s  t  j j } |  t  j j k r" d S| d k	 rI | d k	 rI t d   n | d k	 r y | j |  d } Wq t k
 r t d |   q XnR | d k	 r y | j |  } Wq t k
 r t d |   q Xn t d   | j | |   | rt  j j j	 |   n  d S(   sZ  
    :doc: other

    Adds a new layer to the screen. If the layer already exists, this
    function does nothing.

    One of `behind` or `above` must be given.

    `layer`
        A string giving the name of the new layer to add.

    `above`
        If not None, a string giving the name of a layer the new layer will
        be placed above.

    `below`
        If not None, a string giving the name of a layer the new layer will
        be placed below.

    `menu_clear`
        If true, this layer will be cleared when entering the game menu
        context, and restored when leaving the
    NsH   The above and below arguments to renpy.add_layer are mutually exclusive.i   s   Layer '%s' does not exist.sI   The renpy.add_layer function requires either the above or below argument.(
   Rt   R   R   Rx   R   t   indext
   ValueErrorR  t   menu_clear_layersR"  (   R   t   abovet   belowt
   menu_clearR   R  (    (    s   renpy/exports.pyt	   add_layer  s&    c         C  sk   t  j j d k	 r( t  j j j |   n? |  d k rF d t  j j _ n! t t  j j j |   t  j j _ d S(   s   
    :doc: other

    Forces Ren'Py to draw the screen at the maximum framerate for `t` seconds.
    If `t` is None, cancels the maximum framerate request.
    i    N(   Rt   R   R}   Rx   t   maximum_framerateR   t   initial_maximum_frameratet   max(   R  (    (    s   renpy/exports.pyR      s
    c           C  s   t  j j j S(   s   
    :doc: other

    Returns true if restart_interaction has not been called during the current
    interaction. This can be used to determine if the interaction is just being
    started, or has been restarted.
    (   Rt   R   R}   t   start_interact(    (    (    s   renpy/exports.pyt   is_start_interact  s    	c         K  sQ   |  d k r d S| d k r+ t j j } n  t j j j |  d | d t | d S(   s   
    :doc: audio

    Plays a sound effect. If `channel` is None, it defaults to
    :var:`config.play_channel`. This is used to play sounds defined in
    styles, :propref:`hover_sound` and :propref:`activate_sound`.
    Nt   channelR  (   Rx   Rt   R   t   play_channelR  Rg   Rc   R   (   R  R  R  (    (    s   renpy/exports.pyRc     s
    	c           C  s   t  j j j t  j j j f S(   s   
    :undocumented:

    Returns the current input value, and a flag that is true if it is editable.
    and false otherwise.
    (   Rt   R   t   behaviort   current_input_valuet   input_value_active(    (    (    s   renpy/exports.pyt   get_editable_input_value/  s    c         C  s"   |  t  j j _ | t  j j _ d S(   sp   
    :undocumented:

    Sets the currently active input value, and if it should be marked as
    editable.
    N(   Rt   R   R  R  R	  (   t   input_valueR   (    (    s   renpy/exports.pyt   set_editable_input_value:  s    i   c         C  s:   |  d 9}  t  j j   } | j } t | |   |  } | S(   s  
    :doc: other

    Returns the refresh rate of the current screen, as a floating-point
    number of frames per second.

    `precision`
        The raw data Ren'Py gets is number of frames per second, rounded down.
        This means that a monitor that runs at 59.95 frames per second will
        be reported at 59 fps. The precision argument reduces the precision
        of this reading, such that the only valid readings are multiples of
        the precision.

        Since all monitor framerates tend to be multiples of 5 (25, 30, 60,
        75, and 120), this likely will improve accuracy. Setting precision
        to 1 disables this.
    g      ?(   Rt   R   t   get_infot   refresh_ratet   round(   t	   precisionR  R  (    (    s   renpy/exports.pyt   get_refresh_rateF  s
    
	c         C  s   t  j j j |   S(   s  
    :doc: rollback

    Given a rollback_identifier from a HistoryEntry object, returns the number
    of checkpoints that need to be passed to :func:`renpy.rollback` to reach
    that identifier. Returns None of the identifier is not in the rollback
    history.
    (   Rt   Ru   Ry   t   get_identifier_checkpoints(   t
   identifier(    (    s   renpy/exports.pyR  b  s    
c         C  s
   |  j    S(   s,  
    :doc: other

    Given `bar_value`, a  :class:`BarValue`, returns the :func:`ui.adjustment`
    if uses. The adjustment has the following to attributes defined:

    .. attribute:: value

        The current value of the bar.

    .. attribute:: range

        The current range of the bar.
    (   t   get_adjustment(   t	   bar_value(    (    s   renpy/exports.pyR  o  s    c           C  s
   t  j j S(   s   
    :doc: other

    Returns true if the Ren'Py is skipping, "fast" if Ren'Py is fast skipping,
    and false if it is not skipping.
    (   Rt   R   R8  (    (    (    s   renpy/exports.pyt   get_skipping  s    c           C  s   t  j j j   S(   s   
    :undocumented:

    Returns the number of bytes of memory locked up in OpenGL textures and the
    number of textures that are defined.
    (   Rt   R   R  t   get_texture_size(    (    (    s   renpy/exports.pyR    s    c          C  sO   t  j j   }  |  j t  j k r% t S|  j t  j k rA t a t St a t Sd S(   s   
    :other:

    Returns True if Ren'Py is running on a device that is powered by an internal
    battery, or False if the device is being charged by some external source.
    N(	   t   pygame_sdl2t   powert   get_power_infot   statet   POWERSTATE_UNKNOWNt   old_batteryt   POWERSTATE_ON_BATTERYR|   R   (   t   pi(    (    s   renpy/exports.pyt   get_on_battery  s    
c           C  s$   t  j j d k r d St  j j d S(   s  
    :doc: image_func

    Returns the tag corresponding to the currently speaking character (the
    `image` argument given to that character). Returns None if no character
    is speaking or the current speaking character does not have a corresponding
    image tag.
    i    N(   Rt   R   R  Rx   (    (    (    s   renpy/exports.pyt   get_say_image_tag  s    
c           C  s   t  j j S(   s|   
    :doc: other

    Returns True if Ren'Py is currently skipping (in fast or slow skip mode),
    or False otherwise.
    (   Rt   R   R8  (    (    (    s   renpy/exports.pyt   is_skipping  s    (m  t
   __future__R    R  R  R  t   renpy.displayRt   t   renpy.audiot   renpy.pyanalysisR   R   R   R	   R  t   renpy.text.extrasR
   R   t   renpy.text.fontR   R   R   t   renpy.text.textR   R   t   renpy.display.behaviorR   R   Rb   R   R   R   R   R   R   R   t   renpy.display.minigameR   t   renpy.display.screenR   R   R   R   R   R    R!   R"   R#   Ri   R$   t   renpy.display.focusR%   t   renpy.display.predictR&   Rj   t   renpy.display.imageR'   Rm   R(   R)   R*   R+   R,   R-   t   renpy.display.imR.   R/   t   renpy.curryR0   R1   t   renpy.display.videoR2   R3   R4   t   renpy.loadsaveR5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   t   renpy.pythonRC   Rd   RD   Re   t	   renpy.atlRE   t
   renpy.easyRF   RG   RH   t   renpy.parserRI   RJ   t   renpy.translationRK   RL   t   renpy.translation.generationRM   Rk   t   renpy.persistentRN   t   renpy.characterRO   RP   RQ   t   renpy.audio.soundR  Rf   t   renpy.audio.musicRg   t   renpy.statementsRR   Rl   RS   t   renpy.memoryRT   RU   RV   t   renpy.text.textsupportRW   Rn   RX   Ro   RY   Rp   RZ   Rq   t   renpy.executionR[   t   renpy.sl2.slparserR\   Rr   R]   t	   renpy.astR^   t   renpy.loaderR_   t
   renpy.lintR`   Ra   Rh   R  R  R  Rs   R{   Rx   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R|   R   R   R   R   R  R  R  R(  R<  R?  R   R@  Rd  t   objectRe  R  Rp  Rv  Rx  Ry  R  R  R  t   globalsRw   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  t   version_stringt   version_onlyt   version_nameR  t   licenset   platformt	   _platformt   joinR   R  t   iosR  R  R  R  R  R  R  Rv   R  R  R  R  R  Ry   R  R  R  R  R  R  R  R  R  R  R"  R#  R%  R+  R,  R/  t   layer_at_listR2  R5  R6  R7  Ru   R  R8  t   invoke_in_new_contextR9  t   call_replayR:  R;  R=  R>  R?  R@  RC  Ru  RH  R,  RI  RK  RU  RY  t
   pop_returnR[  R^  R  R   t   RevertableObjectR_  Rn  Rq  t   rendert   Rendert   IgnoreEventt   redrawR   Rt  Rw  R{  R|  R  R  R  R  R  R  R  R  R  R   R  R  R  R  R  R  R  R  R  R  R  R  t   renpy.editorR  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  Rc   R
  R  R  R  R  R  R  R  R   R!  R"  (    (    (    s   renpy/exports.pyt   <module>   s:  	"("":."









	6		
				
		
		' ;${ [	m						,@Q955					!								&				
	
								#																

										1/				((					"				2		
						*	
		!		
			
	
							
	
		
6										