def __init__(self, x, y, maxScale=25, **kw): Widget.__init__(self, x, y, **kw) self.h, self.w = 100, 146 self.maxScale = maxScale self.value = 0 self.lastV = self.value self.constructSurface()
def __init__(self, x, y, r, showPercentage=False, valueFormat="%d", colour=Colours.green, units=None, maxScale=25, touched=None, **kw): Widget.__init__(self, x, y, **kw) self.r = r self.h = self.w = (2 * r) + 2 self.value = 0 self.lastV = self.value self.valueFormat = valueFormat self.showPercentage = showPercentage self.colour = colour self.units = units self.maxScale = maxScale self.callback = touched self.constructSurface()
def __init__(self, items, x, y, w, h, callback=None, vertical=True, toggle_colour=Colours.dark_pale_blue, toggle_txt_col=Colours.black, txt_col=Colours.white, bg_colour=Colours.pale_blue, **kw): """Group of buttons """ Widget.__init__(self, x, y, w, h, **kw) self.bg_colour = bg_colour self.txt_col = txt_col self.toggle_colour = toggle_colour self.toggle_txt_col = toggle_txt_col self.vertical = vertical self.items = self.construct(items)
def __init__(self, x, y, w, h, bg_colour=Colours.white, scale=1.0, agr_fn=lambda l: sum(l) / float(len(l)), **kw): """Scope widget """ Widget.__init__(self, x, y, w, h, **kw) self.bg_colour = bg_colour self.data = [] # Starting timebase (miliseconds) self.timebase = 0.001 self.scale = float(scale) self.aggregation = agr_fn self.raw_data = [] self.more_data = False self.grid = self.construct_grid()
def __init__(self, x, y, w, h, image=None, callback=None, **kw): """Sprite widget """ Widget.__init__(self, x, y, w, h, **kw) if image: self.image = pygame.image.load(image).convert() else: self.image = None self.callback = callback
def __init__(self, x, y, w, h, value=0, digits=2, msd=1, colour=Colours.red, digit_pad=5, **kw): Widget.__init__(self, x, y, w, h, **kw) self.digits = digits self.colour = colour self.lastV = self.value = value self.digit_pad = digit_pad self.msd = msd self.constructSurface()
def __init__(self, x, y, w, h, bg_colour=Colours.white, agr_fn=lambda l: max(l), **kw): """Chart widget """ Widget.__init__(self, x, y, w, h, **kw) self.bg_colour = bg_colour self.major_ticks = 10 self.x_ticks = [str(i) for i in range(self.major_ticks)] self.y_ticks = [] self.data = [] self.scale = 1.0 self.aggregation = agr_fn
def __init__(self, text, x, y, w, h, callback=None, toggle=False, toggle_text=None, toggle_colour=Colours.dark_pale_blue, toggle_txt_col=Colours.black, txt_col=Colours.white, state=False, bg_colour=Colours.pale_blue, font=None, **kw): """Button widget """ Widget.__init__(self, x, y, w, h, **kw) self.state = state self.text = text self.txt_col = txt_col self.callback = callback self.bg_colour = bg_colour self.toggle = toggle self.toggle_colour = toggle_colour self.toggle_text = toggle_text self.toggle_txt_col = toggle_txt_col if not font: self.font = self.display.font else: self.font = font
def __init__(self, x, y, w, h, align=0, txt_col=Colours.white, items=[], callback=None, default=0, bg_colour=Colours.pale_blue, font=None, **kw): """Dropdown widget """ Widget.__init__(self, x, y, w, h, **kw) self.orig = (x, y, w, h) self.txt_col = txt_col self.align = align self.bg_colour = bg_colour self.popped = False self.skip_draw = False self.selected = default if not font: self.font = self.display.font else: self.font = font self.callback = callback self.set_items(items)