Exemplo n.º 1
0
    def draw(self):
        if self._hidden:
            return

        w, h = self.getMinSize()
        pos = self._getPixelPos()

        glPushMatrix()
        glTranslatef(pos[0], pos[1], 0)
        glDisable(GL_TEXTURE_2D)
        if self.hasFocus():
            glColor4ub(60, 60, 60, 255)
        else:
            glColor4ub(60, 60, 60, 192)
        glBegin(GL_QUADS)
        glVertex2f(w / 2, -h / 2)
        glVertex2f(-w / 2, -h / 2)
        glVertex2f(-w / 2, h / 2)
        glVertex2f(w / 2, h / 2)
        glEnd()
        scrollLength = h - w
        glTranslate(0.0, scrollLength / 2, 0)
        if self._focus:
            glColor4ub(0, 0, 0, 255)
            glPushMatrix()
            glTranslate(-w / 2,
                        opengl.glGetStringSize(str(self._minValue))[1] / 2, 0)
            opengl.glDrawStringRight(str(self._minValue))
            glTranslate(0, -scrollLength, 0)
            opengl.glDrawStringRight(str(self._maxValue))
            if self._maxValue - self._minValue > 0:
                glTranslate(
                    w, scrollLength - scrollLength *
                    ((self._value - self._minValue) /
                     (self._maxValue - self._minValue)), 0)
            opengl.glDrawStringLeft(str(self._value))
            glPopMatrix()
        glColor4ub(255, 255, 255, 240)
        if self._maxValue - self._minValue != 0:
            glTranslate(
                0.0, -scrollLength * ((self._value - self._minValue) /
                                      (self._maxValue - self._minValue)), 0)
        glBegin(GL_QUADS)
        glVertex2f(w / 2, -w / 2)
        glVertex2f(-w / 2, -w / 2)
        glVertex2f(-w / 2, w / 2)
        glVertex2f(w / 2, w / 2)
        glEnd()
        glPopMatrix()
Exemplo n.º 2
0
    def draw(self):
        if self._hidden:
            return

        w, h = self.getMinSize()
        pos = self._getPixelPos()

        glPushMatrix()
        glTranslatef(pos[0], pos[1], 0)
        glDisable(GL_TEXTURE_2D)
        if self.hasFocus():
            glColor4ub(60, 60, 60, 255)
        else:
            glColor4ub(60, 60, 60, 192)
        glBegin(GL_QUADS)
        glVertex2f(w / 2, -h / 2)
        glVertex2f(-w / 2, -h / 2)
        glVertex2f(-w / 2, h / 2)
        glVertex2f(w / 2, h / 2)
        glEnd()
        scrollLength = h - w
        glTranslate(0.0, scrollLength / 2, 0)
        if self._focus:
            glColor4ub(0, 0, 0, 255)
            glPushMatrix()
            glTranslate(-w / 2, opengl.glGetStringSize(str(self._minValue))[1] / 2, 0)
            opengl.glDrawStringRight(str(self._minValue))
            glTranslate(0, -scrollLength, 0)
            opengl.glDrawStringRight(str(self._maxValue))
            if self._maxValue - self._minValue > 0:
                glTranslate(
                    w,
                    scrollLength - scrollLength * ((self._value - self._minValue) / (self._maxValue - self._minValue)),
                    0,
                )
            opengl.glDrawStringLeft(str(self._value))
            glPopMatrix()
        glColor4ub(255, 255, 255, 240)
        if self._maxValue - self._minValue != 0:
            glTranslate(0.0, -scrollLength * ((self._value - self._minValue) / (self._maxValue - self._minValue)), 0)
        glBegin(GL_QUADS)
        glVertex2f(w / 2, -w / 2)
        glVertex2f(-w / 2, -w / 2)
        glVertex2f(-w / 2, w / 2)
        glVertex2f(w / 2, w / 2)
        glEnd()
        glPopMatrix()
Exemplo n.º 3
0
	def draw(self):
		if self._hidden:
			return
		self._selected = self.hasFocus()
		super(glComboButton, self).draw()
		if not self._selected:
			return

		bs = self._base._buttonSize / 2
		pos = self._getPixelPos()

		glPushMatrix()
		glTranslatef(pos[0]+bs*0.5, pos[1] + bs*0.5, 0)
		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		glScalef(bs, bs, bs)
		for n in xrange(0, len(self._imageIDs)):
			cx = (self._imageIDs[n] % 4) / 4
			cy = int(self._imageIDs[n] / 4) / 4
			glEnable(GL_TEXTURE_2D)
			glTranslatef(0, 1, 0)
			if self._disabled:
				glColor4ub(128,128,128,128)
			else:
				glColor4ub(255,255,255,255)
			glBegin(GL_QUADS)
			glTexCoord2f(cx+0.25, cy)
			glVertex2f( 0.5,-0.5)
			glTexCoord2f(cx, cy)
			glVertex2f(-0.5,-0.5)
			glTexCoord2f(cx, cy+0.25)
			glVertex2f(-0.5, 0.5)
			glTexCoord2f(cx+0.25, cy+0.25)
			glVertex2f( 0.5, 0.5)
			glEnd()
			glDisable(GL_TEXTURE_2D)

			glPushMatrix()
			glColor4ub(0,0,0,255)
			glTranslatef(-0.55, 0.1, 0)
			opengl.glDrawStringRight(self._tooltips[n])
			glPopMatrix()
		glPopMatrix()
Exemplo n.º 4
0
    def draw(self):
        if self._hidden:
            return
        self._selected = self.hasFocus()
        super(glComboButton, self).draw()

        bs = self._base._buttonSize / 2
        pos = self._getPixelPos()

        if not self._selected:
            return

        glPushMatrix()
        glTranslatef(pos[0] + bs * 0.5, pos[1] + bs * 0.5, 0)
        glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
        for n in xrange(0, len(self._imageIDs)):
            glTranslatef(0, bs, 0)
            glColor4ub(255, 255, 255, 255)
            opengl.glDrawTexturedQuad(-0.5 * bs, -0.5 * bs, bs, bs, 0)
            opengl.glDrawTexturedQuad(-0.5 * bs, -0.5 * bs, bs, bs,
                                      self._imageIDs[n])
            glDisable(GL_TEXTURE_2D)

            glPushMatrix()
            glTranslatef(-0.55 * bs, 0.1 * bs, 0)

            glPushMatrix()
            glColor4ub(60, 60, 60, 255)
            glTranslatef(-1, -1, 0)
            opengl.glDrawStringRight(self._tooltips[n])
            glTranslatef(0, 2, 0)
            opengl.glDrawStringRight(self._tooltips[n])
            glTranslatef(2, 0, 0)
            opengl.glDrawStringRight(self._tooltips[n])
            glTranslatef(0, -2, 0)
            opengl.glDrawStringRight(self._tooltips[n])
            glPopMatrix()

            glColor4ub(255, 255, 255, 255)
            opengl.glDrawStringRight(self._tooltips[n])
            glPopMatrix()
        glPopMatrix()
Exemplo n.º 5
0
	def draw(self):
		if self._hidden:
			return
		self._selected = self.hasFocus()
		super(glComboButton, self).draw()

		bs = self._base._buttonSize / 2
		pos = self._getPixelPos()

		if not self._selected:
			return

		glPushMatrix()
		glTranslatef(pos[0]+bs*0.5, pos[1] + bs*0.5, 0)
		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		for n in xrange(0, len(self._imageIDs)):
			glTranslatef(0, bs, 0)
			glColor4ub(255,255,255,255)
			opengl.glDrawTexturedQuad(-0.5*bs,-0.5*bs,bs,bs, 0)
			opengl.glDrawTexturedQuad(-0.5*bs,-0.5*bs,bs,bs, self._imageIDs[n])
			glDisable(GL_TEXTURE_2D)

			glPushMatrix()
			glTranslatef(-0.55*bs, 0.1*bs, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			opengl.glDrawStringRight(self._tooltips[n])
			glTranslatef(0, 2, 0)
			opengl.glDrawStringRight(self._tooltips[n])
			glTranslatef(2, 0, 0)
			opengl.glDrawStringRight(self._tooltips[n])
			glTranslatef(0, -2, 0)
			opengl.glDrawStringRight(self._tooltips[n])
			glPopMatrix()

			glColor4ub(255,255,255,255)
			opengl.glDrawStringRight(self._tooltips[n])
			glPopMatrix()
		glPopMatrix()