Example #1
0
 def __init__(self,
              size=style.SIZE,
              color=style.DEF_COLOR,
              pressed=False,
              hovered=False,
              clip="auto",
              dark=None,
              light=None,
              thick=2):
     if clip is "auto":
         inflation = -2 * thick
         clip = (inflation, inflation)
     BasicFrame.__init__(self,
                         size=size,
                         color=color,
                         clip=clip,
                         pressed=pressed,
                         hovered=hovered)
     self.light = style.LIGHT_FACTOR if light is None else light
     self.dark = style.DARK_FACTOR if dark is None else dark
     if isinstance(self.light, float):
         self.light = normalize_color(grow_color(self.light, self.color))
     if isinstance(self.dark, float):
         self.dark = normalize_color(grow_color(self.dark, self.color))
     self.thick = thick
Example #2
0
    def __init__(self,
                 size=None,
                 color=None,
                 pressed=False,
                 dark=None,
                 hovered=False,
                 light=None,
                 thick=1,
                 clip="auto"):
        if clip == "auto":
            inflation = -2 * thick
            clip = (inflation, inflation)
        BasicFrame.__init__(self,
                            size=size,
                            color=color,
                            clip=clip,
                            pressed=pressed,
                            hovered=hovered)
        self.dark = dark
        self.light = light
        self.thick = thick
        self.light = style.LIGHT_FACTOR if light is None else light
        self.dark = style.DARK_FACTOR if dark is None else dark
        ##        if self.light is None:
        ##            white = make_compatible(constants.WHITE, self.color)
        ##            self.light = mid_color(self.color, white)
        if isinstance(self.light, float):
            self.light = normalize_color(grow_color(self.light, self.color))
##        if self.dark is None:
##            black = make_compatible(constants.BLACK, self.color)
##            self.dark = mid_color(self.color, black)
        if isinstance(self.dark, float):
            self.dark = normalize_color(grow_color(self.dark, self.color))
    def __init__(self, size=None, color=None, pressed=False, dark=None,
                 hovered=False, light=None, thick=1, clip="auto"):
        if clip == "auto":
            inflation = -2 * thick
            clip = (inflation, inflation)
        BasicFrame.__init__(self,
                            size=size,
                            color=color,
                            clip=clip,
                            pressed=pressed,
                            hovered=hovered)
        self.dark = dark
        self.light = light
        self.thick = thick
        self.light = style.LIGHT_FACTOR if light is None else light
        self.dark = style.DARK_FACTOR if dark is None else dark
##        if self.light is None:
##            white = make_compatible(constants.WHITE, self.color)
##            self.light = mid_color(self.color, white)
        if isinstance(self.light, float):
            self.light = normalize_color(grow_color(self.light, self.color))
##        if self.dark is None:
##            black = make_compatible(constants.BLACK, self.color)
##            self.dark = mid_color(self.color, black)
        if isinstance(self.dark, float):
            self.dark = normalize_color(grow_color(self.dark, self.color))
Example #4
0
 def __init__(self,
              size=None,
              colorkey=constants.WHITE,
              clip=None,
              color_target=None,
              color_bulk=None,
              subrect=None,
              pressed=False,
              hovered=False,
              factor=1.,
              fadout=10.,
              bulk_alpha=255):
     if size is None: size = style.SIZE
     if color_target is None: color_target = style.DEF_COLOR
     BasicFrame.__init__(self,
                         size=size,
                         color=colorkey,
                         clip=clip,
                         pressed=pressed,
                         hovered=hovered)
     self.color_target = color_target
     self.color_bulk = color_bulk
     self.subrect = subrect
     self.factor = factor
     self.fadout = fadout
     self.bulk_alpha = bulk_alpha
Example #5
0
 def __init__(self, size=None, color=None, clip=None, radius=0.):
     """If radius is in the range [0, 1], self.radius_value is the fraction
     of radius * min(size), else it is interpreted as a raw pixel value.
     """
     BasicFrame.__init__(self, size, color, clip)
     self.radius_value = style.DEF_RADIUS if radius is None else radius
     if 0. <= radius <= 1.:
         self.radius_value = min(self.size) * radius
Example #6
0
 def __init__(self, size, color1, color2, nx, ny):
     BasicFrame.__init__(self, size=size, color=color1)
     self.color2 = color2
     self.color1 = color1
     self.nx = nx
     self.ny = ny
     self.frame = True
     self.xinternal = True
     self.yinternal = True
Example #7
0
 def __init__(self, size=None, color=None, clip=None,
              radius=0.):
     """If radius is in the range [0, 1], self.radius_value is the fraction
     of radius * min(size), else it is interpreted as a raw pixel value.
     """
     BasicFrame.__init__(self, size, color, clip)
     self.radius_value = style.DEF_RADIUS if radius is None else radius
     if 0. <= radius <= 1.:
         self.radius_value = min(self.size) * radius
Example #8
0
 def __init__(self, size, color1, color2, nx, ny):
     BasicFrame.__init__(self, size=size, color=color1)
     self.color2 = color2
     self.color1 = color1
     self.nx = nx
     self.ny = ny
     self.frame = True
     self.xinternal = True
     self.yinternal = True
Example #9
0
 def __init__(self, grid, color1, color2, frame=True, rects=True):
     if frame:
         grid.move((1, 1))
         size = grid.frame.inflate((2, 2)).size
     else:
         size = grid.frame.size
     BasicFrame.__init__(self, size=size, color=color1)
     self.color2 = color2
     self.color1 = color1
     self.grid = grid
     self.frame = frame
     self.rects = rects
Example #10
0
 def __init__(self, grid, color1, color2, frame=True, rects=True):
     if frame:
         grid.move((1,1))
         size = grid.frame.inflate((2,2)).size
     else:
         size = grid.frame.size
     BasicFrame.__init__(self, size=size, color=color1)
     self.color2 = color2
     self.color1 = color1
     self.grid = grid
     self.frame = frame
     self.rects = rects
Example #11
0
 def __init__(self, size=style.SIZE, colorkey=constants.WHITE, clip=None,
              color_target=style.DEF_COLOR, color_bulk=None, subrect=None,
              pressed=False, hovered=False, factor=1., fadout=10., bulk_alpha=255):
     BasicFrame.__init__(self,
                         size=size,
                         color=colorkey,
                         clip=clip,
                         pressed=pressed,
                         hovered=hovered)
     self.color_target = color_target
     self.color_bulk = color_bulk
     self.subrect = subrect
     self.factor = factor
     self.fadout = fadout
     self.bulk_alpha = bulk_alpha
Example #12
0
 def __init__(self, size=style.SIZE, color=style.DEF_COLOR, clip="auto",
              dark=None, light=None, thick=2, pressed=False, hover=False):
     if clip is "auto":
         inflation = -2 * thick
         clip = (inflation, inflation)
     BasicFrame.__init__(self,
                         size=size,
                         color=color,
                         clip=clip,
                         pressed=pressed,
                         hovered=hovered)
     self.light = style.LIGHT_FACTOR if light is None else light
     self.dark = style.DARK_FACTOR if dark is None else dark
     if isinstance(self.light, float):
         self.light = normalize_color(grow_color(self.light, self.color))
     if isinstance(self.dark, float):
         self.dark = normalize_color(grow_color(self.dark, self.color))
     self.thick = thick