Beispiel #1
0
 def insert(self, i, control, **kwargs):
     """ Inserts the control, or inserts all controls in the given Layout.
     """
     if isinstance(control, Layout):
         # If the control is actually a Layout (e.g. ordered group of controls), apply it.
         control.apply(**kwargs)
     Layer.insert(self, i, control)
Beispiel #2
0
 def insert(self, i, control):
     """ Inserts the control, or inserts all controls in the given Layout.
     """
     if isinstance(control, Layout):
         # If the control is actually a Layout (e.g. ordered group of controls), apply it.
         control.apply()
     Layer.insert(self, i, control)
Beispiel #3
0
 def __init__(self, **kwargs):
     """ A group of controls with a specific layout.
         Controls can be added with Layout.append().
         The layout will be applied when Layout.apply() is called.
         This happens automatically if a layout is appended to a Panel.
     """
     kwargs["x"] = kwargs["y"] = kwargs["width"] = kwargs["height"] = 0
     Layer.__init__(self, **kwargs)
     self._controls = {} # Lazy cache of (id, control)-children, see nested().
Beispiel #4
0
 def __init__(self, x=0, y=0, **kwargs):
     """ A group of controls with a specific layout.
         Controls can be added with Layout.append().
         The layout will be applied when Layout.apply() is called.
         This happens automatically if a layout is appended to a Panel.
     """
     
     kwargs["width"]  = 0
     kwargs["height"] = 0
     Layer.__init__(self, x=x, y=y, **kwargs)
     self._controls = {} # Lazy cache of (id, control)-children, see nested().
Beispiel #5
0
 def __init__(self, x=0, y=0, id=None, **kwargs):
     """ Base class for GUI controls.
         The Control class inherits from Layer so it must be appended to the canvas (or a container)
         to receive events and get drawn.
         An id can be given to uniquely identify the control.
         If the control is part of a Panel, it can be retrieved with Panel.control_id.
     """
     Layer.__init__(self, x=x, y=y, **kwargs)
     self.id        = id
     self.src       = {}    # Collection of source images.
     self.enabled   = True  # Enable event listener.
     self.duration  = 0     # Disable tweening.
     self._controls = {}    # Lazy index of (id, control) children, see nested().
     self._press    = None
Beispiel #6
0
 def __init__(self, x=0, y=0, id=None, **kwargs):
     """ Base class for GUI controls.
         The Control class inherits from Layer so it must be appended to the canvas (or a container)
         to receive events and get drawn.
         An id can be given to uniquely identify the control.
         If the control is part of a Panel, it can be retrieved with Panel.control_id.
     """
     Layer.__init__(self, x=x, y=y, **kwargs)
     self.id        = id
     self.src       = {}    # Collection of source images.
     self.enabled   = True  # Enable event listener.
     self.duration  = 0     # Disable tweening.
     self._controls = {}    # Lazy index of (id, control) children, see nested().
     self._press    = None
Beispiel #7
0
 def origin(self, x=None, y=None, relative=False):
     return Layer.origin(self, x, y, relative)
Beispiel #8
0
 def layer_at(self, x, y, clipped=False, enabled=False, transformed=True, _covered=False):
     return Layer.layer_at(self, x, y, clipped, enabled, False, _covered)
Beispiel #9
0
 def _draw(self):
     Layer._draw(self)
Beispiel #10
0
 def insert(self, i, control):
     if isinstance(control, Layout):
         # If the control is actually a Layout, apply it.
         control.apply()
     Layer.insert(self, i, control)
Beispiel #11
0
 def origin(self, x=None, y=None, relative=False): 
     return Layer.origin(self, x, y, relative)       
Beispiel #12
0
 def layer_at(self, x, y, clipped=False, enabled=False, transformed=True, _covered=False):
     return Layer.layer_at(self, x, y, clipped, enabled, False, _covered)
Beispiel #13
0
 def _draw(self):
     Layer._draw(self)
Beispiel #14
0
 def insert(self, i, control):
     if isinstance(control, Layout):
         control.apply() # If the control is actually a Layout, apply it.
     Layer.insert(self, i, control)