³ò
šõÜNc           @   s   d  Z  d d k l Z d d k l Z d d k l Z d d k l Z d d k l	 Z	 d e
 f d „  ƒ  YZ e ƒ  Z d	 e f d
 „  ƒ  YZ d S(   sj   
$Rev: 592 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2011-11-22 16:20:03 -0500 (Tue, 22 Nov 2011) $
iÿÿÿÿ(   t   EventRegistry(   t   AddonInstances(   t   GG_Addon_Loaded(   t   GG_Addon_Unloaded(   t   MessageManagert   _LoadedAddonsc           B   s    e  Z d  Z d „  Z d „  Z RS(   s    Class to store all loaded addonsc         C   s?   | |  j o t  t |  ƒ i | ƒ Sn t | ƒ } |  | <| S(   s3   Method used to get the instance for the given addon(   t   superR   t   __getitem__t   _LoadedAddonInstance(   t   selft   addont   value(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR      s    c         C   sM   | |  j o t  d | d ƒ ‚ n |  | i ƒ  t t |  ƒ i | ƒ d S(   s   Method used to unload an addons   Addon "%s" s.   cannot be unloaded. It is not currently loadedN(   t	   NameErrort   _unload_addonR   R   t   __delitem__(   R	   R
   (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR   ,   s
    
(   t   __name__t
   __module__t   __doc__R   R   (    (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR      s   	R   c           B   sM   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   s:   Class that stores the instance of an included/custom addonc         C   sC   t  | } x( | i D] } |  i | | i | ƒ q W|  i ƒ  d S(   s'   Called when the addon is first importedN(   R   t   __dict__t   __setattr__t   _load_addon(   R	   R
   t   instancet	   attribute(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyt   __init__C   s
    

 c         C   sm   |  i  ƒ  x* |  i i D] } t ƒ  i | |  i ƒ q W|  i d ƒ t d |  i d |  i ƒ } | i	 ƒ  d S(   s   Method that loads the addont   loadR
   t   typeN(
   t   _register_eventst   infot   translationsR   R   t   basenamet   _call_blockR   t
   addon_typet   fire(   R	   t   translationt   gg_addon_loaded(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR   R   s    
 c         C   sm   |  i  ƒ  x* |  i i D] } t ƒ  i | |  i ƒ q W|  i d ƒ t d |  i d |  i ƒ } | i	 ƒ  d S(   s,   Method used to unload the addon and clean upt   unloadR
   R   N(
   t   _unregister_eventsR   R   R   R#   R   R   R   R   R    (   R	   R!   t   gg_addon_unloaded(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR   h   s    
 c         C   s2   x+ |  i  ƒ  D] } t i | |  i | ƒ q Wd S(   s!   Registers all functions as eventsN(   t   _possible_eventsR    t   register_for_eventt   globals(   R	   t   event(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR   ~   s     c         C   s2   x+ |  i  ƒ  D] } t i | |  i | ƒ q Wd S(   s#   Unregisters all functions as eventsN(   R&   R    t   unregister_for_eventR(   (   R	   R)   (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR$   ‡   s     c         O   s@   | |  i  j o, t |  i  | ƒ o |  i  | | | Ž  n d S(   s:   Calls a function for the addon with arguments and keywordsN(   R(   t   callable(   R	   t	   blocknamet   at   kw(    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR      s    $c         c   sy   xr |  i  D]g } t |  i  | ƒ i d j o q
 n | i d ƒ o q
 n |  i  | i |  i j o q
 n | Vq
 Wd S(   s9   Generator used to get all possible events within an addont   functiont   _N(   R(   R   R   t
   startswithR   t   module(   R	   R)   (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR&   ™   s    
 (
   R   R   R   R   R   R   R   R$   R   R&   (    (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pyR   @   s   									N(   R   t   eventsR    R   R   t   gungame51.core.eventsR   R   t   gungame51.core.messagingR   t   dictR   t   LoadedAddonst   objectR   (    (    (    sV   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/loaded.pys   <module>   s   #	