Ejemplo n.º 1
0
    def __init__(self, elements=None, normal_params=None, finish=True):
        """
        Element of an application that have no graphical existence, though its
        children might be graphicals. This is the base class for all the Elements.

        <elements>: list of the children elements.
        """
        self.get_size = self.get_fus_size
        self.surface = display.get_surface()
        if not elements:
            elements = []
        self.normal_params = init_params(normal_params)
        """State can be anything useful for user"""
        self._reactions = []
        self._blit_before = []
        self._blit_after = []
        # elements whose this reacter instance is an element
        self.father = None
        # init elements
        self._elements = []
        self.add_elements(elements)
        # init _states
        self._states = {}
        self._states[constants.STATE_NORMAL] = _GhostState()
        self.current_state = self._states[constants.STATE_NORMAL]
        self.current_state_key = constants.STATE_NORMAL
        # init user function
        self.visible = False
        self.user_func = self.normal_params.params.get("user func")
        self.user_params = self.normal_params.params.get("user params", {})
        self.active = True
        self._finished = False
        self._jail = None
        self._lock_jail = False
        self.rank = constants.DEFAULT_RANK
        self.click_quit = None
        self._lift = None
        self._jail = None
        self._overframe = None  #used for shadows. Indicate that element can clip outside of its parent's clip
        self._is_in_family = True
        self.message = None
        self.id = Ghost._current_id
        Ghost._current_id += 1
        if finish:
            self.finish()
Ejemplo n.º 2
0
    def __init__(self, elements=None, normal_params=None):
        """
        Element of an application that have no graphical existence, though its
        children might be graphicals. This is the base class for all the Elements.

        <elements>: list of the children elements.
        """
        if not elements:
            elements = []
        self.normal_params = init_params(normal_params)
        """State can be anything useful for user"""
        self._reactions = []
        self._blit_before = []
        self._blit_after = []
        # elements whose this reacter instance is an element
        self.father = None
        # init elements
        self._elements = []
        self.add_elements(elements)
        # init _states
        self._states = {}
        self._states[constants.STATE_NORMAL] = _GhostState()
        self.current_state = self._states[constants.STATE_NORMAL]
        self.current_state_key = constants.STATE_NORMAL
        # init user function
        self.visible = False
        self.user_func = self.normal_params.params.get("user func")
        self.user_params = self.normal_params.params.get("user params", {})
        self.active = True
        self._finished = False
        self._jail = None
        self._lock_jail = False
        self.rank = constants.DEFAULT_RANK
        self.click_quit = None
        self._lift = None
        self._jail = None
        self._overframe = None #used for shadows. Indicate that element can clip outside of its parent's clip
        self._is_in_family = True
        self.id = Ghost._current_id
        Ghost._current_id += 1
Ejemplo n.º 3
0
 def __init__(self, elements=None, normal_params=None):
     if not elements:
         elements = []
     self.normal_params = init_params(normal_params)
     """State can be anything useful for user"""
     self._reactions = []
     self._blit_before = []
     self._blit_after = []
     # elements whose this reacter instance is an element
     self.father = None
     # init elements
     self._elements = []
     self.add_elements(elements)
     # init _states
     self._states = {}
     self._states[constants.STATE_NORMAL] = _GhostState()
     self.current_state = self._states[constants.STATE_NORMAL]
     self.current_state_key = constants.STATE_NORMAL
     # init user function
     self.visible = False
     self.user_func = self.normal_params.params.get("user func")
     self.user_params = self.normal_params.params.get("user params", {})
     self._active = True
     self._finished = False
     self._jail = None
     self._lock_jail = False
     self.rank = constants.DEFAULT_RANK
     self.click_quit = None
     self._bar = None
     self._bartarget = None #element of which self is the bar
     self._lift = None
     self._jail = None
     self._overframe = None
     self._is_in_family = True
     self.id = Ghost._current_id
     Ghost._current_id += 1
Ejemplo n.º 4
0
 def __init__(self, elements=None, normal_params=None):
     if not elements:
         elements = []
     self.normal_params = init_params(normal_params)
     """State can be anything useful for user"""
     self._reactions = []
     self._blit_before = []
     self._blit_after = []
     # elements whose this reacter instance is an element
     self.father = None
     # init elements
     self._elements = []
     self.add_elements(elements)
     # init _states
     self._states = {}
     self._states[constants.STATE_NORMAL] = _GhostState()
     self.current_state = self._states[constants.STATE_NORMAL]
     self.current_state_key = constants.STATE_NORMAL
     # init user function
     self.visible = False
     self.user_func = self.normal_params.params.get("user func")
     self.user_params = self.normal_params.params.get("user params", {})
     self._active = True
     self._finished = False
     self._jail = None
     self._lock_jail = False
     self.rank = constants.DEFAULT_RANK
     self.click_quit = None
     self._bar = None
     self._bartarget = None  #element of which self is the bar
     self._lift = None
     self._jail = None
     self._overframe = None
     self._is_in_family = True
     self.id = Ghost._current_id
     Ghost._current_id += 1