Exemplo n.º 1
0
	def doRender(self, screen) :
		screen.fill(self.backgroundColor, self.rect);

		borderColor = style.getStyle(self, "border.color");
		borderSize  = style.getStyle(self, "border.size");
		if borderColor and borderSize :
			pygame.draw.rect(screen, borderColor, self.rect, borderSize); # (self.rect[0], self.rect[1], self.rect[2] - borderSize + 1, self.rect[3] - borderSize + 1)
Exemplo n.º 2
0
    def doRender(self, screen):
        super().doRender(screen)
        x, y, w, h = self.getRect()

        if self.data is not None:
            dataLength = len(self.data)

            # Scale the FFT values to the range 0 to 1.
            self.data = -(numpy.array(self.data, dtype=float) +
                          self.minPower) / self.range
            self.data = numpy.pad(self.data,
                                  int((w - (dataLength % w)) / 2),
                                  mode='edge')
            self.data = numpy.reshape(self.data, (w, int(len(self.data) / w)))
            self.data = numpy.mean(self.data, axis=1)

            backgroundColor = style.getStyle(self, "background.color")
            lineColor = style.getStyle(self, "line.color.graph")
            self.graph.lock()
            self.graph.fill(backgroundColor, (0, 0, w, h))
            lasty = self.data[0]
            for gx in range(1, w):
                gy = self.data[gx - 1]
                pygame.draw.line(self.graph, lineColor, (gx - 1, lasty * h),
                                 (gx, gy * h))
                #pygame.draw.line(screen, freqshow.GRID_LINE, (i, y), (i, height))
                lasty = gy
            self.graph.unlock()

        screen.blit(self.graph, (x, y), area=(0, 0, w, h))
        self.data = None
Exemplo n.º 3
0
	def __init__(self, label, value=0, min=0, max=100) :
		super().__init__()
		self.label = label
		self.min = min
		self.max = max
		self.value = value
		self.upIcon = style.getIcon(self, "icon.up")
		self.downIcon = style.getIcon(self, "icon.down")
		self.borderColor = style.getStyle(self, "slider.border.color")
		self.borderSize  = style.getStyle(self, "slider.border.size")
		self.buttonEdge = 20
		self.mouseDownTime = 0
		self.updateHandlers = []
Exemplo n.º 4
0
 def __init__(self, model):
     super().__init__()
     self.model = model
     self.data = None
     self.labels = {}
     self.tickLines = []
     self.midLabel = None
     self.minorLineColor = style.getStyle(self, "line.color.minor")
     self.majorLineColor = style.getStyle(self, "line.color.major")
     self.centerLineColor = style.getStyle(self, "line.color.center")
     self.font = style.getFont(self, "font")
     self.foreground = style.getStyle(self, "foreground.color")
     self.background = style.getStyle(self, "background.color")
Exemplo n.º 5
0
	def __init__(self, id=None) :
		self.dirty = True;
		self.rect = (0, 0, 0, 0);
		self.visible = True;
		self.preferredSize = (0, 0);
		self.drawState = ""
		if id :
			self.id = id;
		else :
			self.id = "UIComponent_{}".format(UIComponent.idCounter);
			UIComponent.idCounter += 1;
		self.foregroundColor = style.getStyle(self, "foreground.color");
		self.backgroundColor = style.getStyle(self, "background.color");
		self.hover = False;
Exemplo n.º 6
0
	def __init__(self, value) :
		super().__init__();
		self.value = None;
		self.digits = 1;
		self.min = 0;
		self.max = 9;
		self.buttonEdge = 20;
		self.upIcon = style.getIcon(self, "icon.up");
		self.downIcon = style.getIcon(self, "icon.down");
		self.textColor = style.getStyle(self, "foreground.color");
		self.placeholderTextColor = style.getStyle(self, "placeholder.color");
		self.maskColor = style.getStyle(self, "mask.color");
		self.focus = False;
		self.mouseDownTime = 0;
		self.updateHandlers = [];
Exemplo n.º 7
0
	def __init__(self, textOrIcon=None):
		super().__init__();
		self.label = None;
		self.text = None;
		self.icon = None;
		self.clickEvents = [];
		self.mouseDownTime = 0;

		if isinstance(textOrIcon, str) :
			self.text = textOrIcon;
			self.label = render_text(self.text, font=style.getFont(self, "font"), fg=style.getStyle(self, "foreground.color"), bg=style.getStyle(self, "background.color"));
		if isinstance(textOrIcon, pygame.Surface):
			self.icon = textOrIcon;
Exemplo n.º 8
0
	def __init__(self, radioGroup, textOrIcon=None):
		super().__init__();
		self.label = None;
		self.text = None;
		self.icon = None;
		self.selectedEvents = [];
		self.mouseDownTime = 0;
		self.selected = False;
		self.radioGroup = radioGroup

		self.radioGroup.add(self);

		if isinstance(textOrIcon, str) :
			self.text = textOrIcon;
			self.label = render_text(self.text, font=style.getFont(self, "font"), fg=style.getStyle(self, "foreground.color"), bg=style.getStyle(self, "background.color"));
		if isinstance(textOrIcon, pygame.Surface):
			self.icon = textOrIcon;

		super().addClickEvent(self.handleClickedEvent)