Beispiel #1
0
 def __init__(self, text="", size=None, elements=None, normal_params=None):
     """Simple text on multiple lines.
     <size>: the size of the area on which the text is displayed.
     """
     Element.__init__(self, text, elements, normal_params)
     self._size = size
     self.visible = False
Beispiel #2
0
    def __init__(self,
                 size,
                 titles,
                 elements=None,
                 normal_params=None,
                 heavy=False,
                 folders=None,
                 margins=None,
                 has_lift=True):
        margins = style.DDL_MARGINS if margins is None else margins
        self._clicked = None
        Element.__init__(self, elements=elements, normal_params=normal_params)
        painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                                 pressed=True,
##                                                 color=style.DEF_COLOR2,
                                                 size=size,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._margins = margins
        self._heavy = heavy
        self._dv = self._get_dirviewer(titles, size, folders)
        reac_motion= Reaction(MOUSEMOTION,
                              self._reaction_motion,
                              reac_name=constants.REAC_MOTION)
        self.add_reaction(reac_motion)
        self._cursor_pos = (-1, -1)
        self._has_lift = has_lift
        self._menu = None
        self._set_selecter()
        self._force_lift = False
Beispiel #3
0
 def __init__(self,
              elements=None,
              normal_params=None,
              storer_params=None,
              size=None,
              put_lift=True,
              finish=True):
     """Box containing other elements.
     <bartext>: the text of the box bar. If no text, no bar is added.
     <size>: if not None, force the size of the box. Else the box
         automatically fit children."""
     Element.__init__(self, "", elements, normal_params, finish=False)
     self.storer_params = storer_params
     if self.storer_params is None:
         self.storer_params = dict()
     self._size = size
     self._has_lift = False
     self._put_lift = put_lift
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius_ext=style.BOX_RADIUS)
     self.set_painter(painter)
     if finish:
         self.finish()
Beispiel #4
0
    def __init__(self,
                 size,
                 titles,
                 elements=None,
                 normal_params=None,
                 heavy=False,
                 folders=None,
                 margins=None,
                 has_lift=True):
        margins = style.DDL_MARGINS if margins is None else margins
        self._clicked = None
        Element.__init__(self, elements=elements, normal_params=normal_params)
        painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                                 pressed=True,
##                                                 color=style.DEF_COLOR2,
                                                 size=size,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._margins = margins
        self._heavy = heavy
        self._dv = self._get_dirviewer(titles, size, folders)
        reac_motion= Reaction(MOUSEMOTION,
                              self._reaction_motion,
                              name=constants.REAC_MOTION)
        self.add_reaction(reac_motion)
        self._cursor_pos = (-1, -1)
        self._has_lift = has_lift
        self._menu = None
        self._set_selecter()
        self._force_lift = False
Beispiel #5
0
 def __init__(self, nx, ny, cell_size):
     Element.__init__(self)
     self.grid = Grid(nx, ny, cell_size)
     self.margins = style.MARGINS
     self.current_coord = None
     self.current_rect = None
     reac_mousemotion = Reaction(pygame.MOUSEMOTION, self.func_mousemotion)
     self.add_reaction(reac_mousemotion)
 def __init__(self, nx, ny, cell_size):
     Element.__init__(self)
     self.grid = Grid(nx, ny, cell_size)
     self.margins = style.MARGINS
     self.current_coord = None
     self.current_rect = None
     reac_mousemotion = Reaction(pygame.MOUSEMOTION, self.func_mousemotion)
     self.add_reaction(reac_mousemotion)
Beispiel #7
0
 def __init__(self,
              text="",
              elements=None,
              normal_params=None,
              finish=True):
     """Simpe text on only one line."""
     Element.__init__(self, text, elements, normal_params, finish=False)
     if finish:
         self.finish()
Beispiel #8
0
 def __init__(self, target, color, elements=None, normal_params=None):
     Element.__init__(self, "", elements, normal_params)
     self.link(target)
     self.shadow_radius = SHADOW_RADIUS
     self.black = BLACK
     self.alpha_factor = ALPHA_FACTOR
     self.decay_mode = DECAY_MODE
     self.capture_state = CAPTURE_STATE_STATIC
     self.offset = OFFSET
     self.color = color
Beispiel #9
0
 def __init__(self, target, color, elements=None, normal_params=None):
     Element.__init__(self, "", elements, normal_params)
     self.link(target)
     self.shadow_radius = SHADOW_RADIUS
     self.black = BLACK
     self.alpha_factor = ALPHA_FACTOR
     self.decay_mode = DECAY_MODE
     self.capture_state = CAPTURE_STATE_STATIC
     self.offset = OFFSET
     self.color = color
Beispiel #10
0
 def __init__(self, size, type_, color=None, pressed=True):
     """Set type_ to 'horizontal' or 'vertical' in order to produce a graphi-
     cal line of desired, color, size [px].
     """
     Element.__init__(self)
     self.size = size
     self.type = type_
     if type_ == "horizontal" or type_ == "h":
         size = (size, 2)
     elif type_ == "vertical" or type_ == "v":
         size = (2, size)
     painter = ClassicFrame(size, color, pressed)
     self.set_painter(painter)
Beispiel #11
0
 def __init__(self, elements=None, normal_params=None, height=None):
     Element.__init__(self, "", elements, normal_params)
     h = max([e.get_storer_rect().height for e in self.get_elements()]) + 2
     store(self, mode="h", x=1, y=h / 2, align="center")
     if self.father:
         w = self.father.get_storer_rect().width
     else:
         w = functions.get_screen_size()[0]
     size = (w, h)
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius=style.BOX_RADIUS)
     self.set_painter(painter)
Beispiel #12
0
 def __init__(self, elements=None, normal_params=None, height=None):
     Element.__init__(self, "", elements, normal_params)
     h = max([e.get_storer_rect().height for e in self.get_elements()]) + 2
     store(self, mode="h", x=1, y=h/2, align="center")
     if self.father:
         w = self.father.get_storer_rect().width
     else:
         w = functions.get_screen_size()[0]
     size = (w, h)
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius=style.BOX_RADIUS)
     self.set_painter(painter)
Beispiel #13
0
    def __init__(self, length, limvals=None, text="", elements=None,
                 normal_params=None):
        limvals = parameters.LIMVALS if limvals is None else limvals
        self._plus = None
        self._minus = None
        Element.__init__(self, text, elements, normal_params)
        _Slider.__init__(self, length, limvals)
        self.current_state.autoghost = False
##        self._set_wheel_reaction(parameters.BUTTON_UNPRESS_EVENT,
##                                {"button": parameters.WHEELUP_BUTTON})
##        self._set_unwheel_reaction(parameters.BUTTON_PRESS_EVENT,
##                                  {"button": parameters.WHEELDOWN_BUTTON})
        self._setup()
        self.active_wheel = False
Beispiel #14
0
    def __init__(self, length, limvals=None, text="", elements=None,
                 normal_params=None):
        limvals = parameters.LIMVALS if limvals is None else limvals
        self._plus = None
        self._minus = None
        Element.__init__(self, text, elements, normal_params)
        _Slider.__init__(self, length, limvals)
        self.current_state.autoghost = False
##        self._set_wheel_reaction(parameters.BUTTON_UNPRESS_EVENT,
##                                {"button": parameters.WHEELUP_BUTTON})
##        self._set_unwheel_reaction(parameters.BUTTON_PRESS_EVENT,
##                                  {"button": parameters.WHEELDOWN_BUTTON})
        self._setup()
        self.active_wheel = False
Beispiel #15
0
 def __init__(self, bartext="", elements=None, normal_params=None,
              storer_params=None, size=None, put_lift=True):
     Element.__init__(self, "", elements, normal_params)
     self.storer_params = storer_params
     if self.storer_params is None:
         self.storer_params = dict()
     self._size = size
     self._has_lift = False
     self._put_lift = put_lift
     self._bartext = bartext
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius=style.BOX_RADIUS)
     self.set_painter(painter)
Beispiel #16
0
 def __init__(self, bartext="", elements=None, normal_params=None,
              storer_params=None, size=None, put_lift=True):
     Element.__init__(self, "", elements, normal_params)
     self.storer_params = storer_params
     if self.storer_params is None:
         self.storer_params = dict()
     self._size = size
     self._has_lift = False
     self._put_lift = put_lift
     self._bartext = bartext
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius=style.BOX_RADIUS)
     self.set_painter(painter)
 def __init__(self,
              titles,
              size="auto",
              elements=None,
              normal_params=None,
              heavy=False,
              folders=None,
              margins=None,
              x=None,
              has_lift=True,
              finish=True):
     """Vertical list of multiple texts that can be selected.
     <titles>: a list of strings containing the different choices to display.
     <heavy>: if True, use more memory but is faster.
     <margins>: the margins of the dropdown list, not taking <x> into
         account.
     <x>: the value at which text starts. If x = 0, folders image will be
     croped!
     """
     margins = style.DDL_MARGINS if margins is None else margins
     size_painter = style.DDL_SIZE if size == "auto" else size
     self._clicked = None
     Element.__init__(self,
                      elements=elements,
                      normal_params=normal_params,
                      finish=False)
     painter = functions.obtain_valid_painter(
         painterstyle.BOX_PAINTER,
         pressed=True,
         ##                                                 color=style.DEF_COLOR2,
         size=size_painter,
         radius=style.BOX_RADIUS)
     self.set_painter(painter)
     self._margins = margins
     self._heavy = heavy
     self._dv = self._get_dirviewer(titles, size_painter, folders, x)
     reac_motion = Reaction(MOUSEMOTION,
                            self._reaction_motion,
                            reac_name=constants.REAC_MOTION)
     self.add_reaction(reac_motion)
     self._cursor_pos = (-1, -1)
     self._has_lift = has_lift
     self._menu = None
     self._set_selecter()
     self._force_lift = False
     self._size = size
     if finish:
         self.finish()
Beispiel #18
0
 def __init__(self, size, type_, color=None, pressed=True):
     """Vertical or horizontal graphical separation Line.
     <size>: the size in pixel (single int value).
     <type>: either 'horizontal', 'h' or 'vertical', 'v'.
     <color>: a 3 or 4-tuple specifying the color.
     <pressed>: if True, the line looks pressed.
     """
     Element.__init__(self)
     self.size = size
     self.type = type_
     if type_ == "horizontal" or type_ == "h":
         size = (size, 2)
     elif type_ == "vertical" or type_ == "v":
         size = (2, size)
     painter = ClassicFrame(size, color, pressed)
     self.set_painter(painter)
Beispiel #19
0
 def __init__(self, target, elements=None, normal_params=None):
     Element.__init__(self, "", elements, normal_params)
     self.link(target)
     self.sun_angle = SUN_ANGLE
     self.sun_angle2 = SUN_ANGLE2
     self.shadow_radius = SHADOW_RADIUS
     self.black = BLACK
     self.alpha_factor = ALPHA_FACTOR
     self.decay_mode = DECAY_MODE
     self.angle_mode = ANGLE_MODE
     self.mode_value = MODE_VALUE
     self.capture_state = CAPTURE_STATE_STATIC
     self.target_altitude = TARGET_ALTITUDE
     self.offset = OFFSET
     self.vertical = VERTICAL  #rpg style : vertical=True
     self.color = SHADOW_COLOR
Beispiel #20
0
 def __init__(self, size, type_, color=None, pressed=True):
     """Vertical or horizontal graphical separation Line.
     <size>: the size in pixel (single int value).
     <type>: either 'horizontal', 'h' or 'vertical', 'v'.
     <color>: a 3 or 4-tuple specifying the color.
     <pressed>: if True, the line looks pressed.
     """
     Element.__init__(self)
     self.size = size
     self.type = type_
     if type_ == "horizontal" or type_ == "h":
         size = (size, 2)
     elif type_ == "vertical" or type_ == "v":
         size = (2, size)
     painter = ClassicFrame(size, color, pressed)
     self.set_painter(painter)
Beispiel #21
0
 def __init__(self, target, elements=None, normal_params=None):
     Element.__init__(self, "", elements, normal_params)
     self.link(target)
     self.sun_angle = SUN_ANGLE
     self.sun_angle2 = SUN_ANGLE2
     self.shadow_radius = SHADOW_RADIUS
     self.black = BLACK
     self.alpha_factor = ALPHA_FACTOR
     self.decay_mode = DECAY_MODE
     self.angle_mode = ANGLE_MODE
     self.mode_value = MODE_VALUE
     self.capture_state = CAPTURE_STATE_STATIC
     self.target_altitude = TARGET_ALTITUDE
     self.offset = OFFSET
     self.vertical = VERTICAL #rpg style : vertical=True
     self.color = SHADOW_COLOR
Beispiel #22
0
 def __init__(self, bartext="", elements=None, normal_params=None,
              storer_params=None, size=None, put_lift=True):
     """Box containing other elements.
     <bartext>: the text of the box bar. If no text, no bar is added.
     <size>: if not None, force the size of the box. Else the box
         automatically fit children."""
     Element.__init__(self, "", elements, normal_params)
     self.storer_params = storer_params
     if self.storer_params is None:
         self.storer_params = dict()
     self._size = size
     self._has_lift = False
     self._put_lift = put_lift
     self._bartext = bartext
     painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                              pressed=True,
                                              size=size,
                                              radius=style.BOX_RADIUS)
     self.set_painter(painter)
Beispiel #23
0
    def __init__(self,
                 titles,
                 size="auto",
                 elements=None,
                 normal_params=None,
                 heavy=False,
                 folders=None,
                 margins=None,
                 x=None,
                 has_lift=True):
        """Vertical list of multiple texts that can be selected.
        <titles>: a list of strings containing the different choices to display.
        <heavy>: if True, use more memory but is faster.
        <margins>: the margins of the dropdown list, not taking <x> into
            account.
        <x>: the value at which text starts. If x = 0, folders image will be
        croped!
        """
        margins = style.DDL_MARGINS if margins is None else margins
        size_painter = style.DDL_SIZE if size == "auto" else size
        self._clicked = None
        Element.__init__(self, elements=elements, normal_params=normal_params)
        painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                                 pressed=True,
##                                                 color=style.DEF_COLOR2,
                                                 size=size_painter,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._margins = margins
        self._heavy = heavy
        self._dv = self._get_dirviewer(titles, size_painter, folders, x)
        reac_motion= Reaction(MOUSEMOTION,
                              self._reaction_motion,
                              reac_name=constants.REAC_MOTION)
        self.add_reaction(reac_motion)
        self._cursor_pos = (-1, -1)
        self._has_lift = has_lift
        self._menu = None
        self._set_selecter()
        self._force_lift = False
        self._size = size
Beispiel #24
0
 def __init__(self, text="", size=None, elements=None, normal_params=None):
     Element.__init__(self, text, elements, normal_params)
     self._size = size
     self.visible = False
Beispiel #25
0
 def __init__(self, text="", elements=None, normal_params=None):
     Element.__init__(self, text, elements, normal_params)
Beispiel #26
0
 def __init__(self, text="", size=None, elements=None, normal_params=None):
     Element.__init__(self, text, elements, normal_params)
     self._size = size
     self.visible = False
Beispiel #27
0
 def __init__(self, text="", elements=None, normal_params=None):
     Element.__init__(self, text, elements, normal_params)
Beispiel #28
0
 def __init__(self, text="", elements=None, normal_params=None):
     """Simpe text on only one line."""
     Element.__init__(self, text, elements, normal_params)