Example #1
0
    def draw(self):
        x, y, w, h = self.getSize()

        glPushMatrix()
        glTranslatef(x, y, 0)

        glColor3ub(255, 255, 255)
        if self._value:
            openglHelpers.glDrawTexturedQuad(w / 2 - h / 2, 0, h, h, 28)
        else:
            openglHelpers.glDrawTexturedQuad(w / 2 - h / 2, 0, h, h, 29)

        glPopMatrix()
Example #2
0
	def draw(self):
		x, y, w, h = self.getSize()

		glPushMatrix()
		glTranslatef(x, y, 0)

		glColor3ub(255,255,255)
		if self._value:
			openglHelpers.glDrawTexturedQuad(w/2-h/2,0, h, h, 28)
		else:
			openglHelpers.glDrawTexturedQuad(w/2-h/2,0, h, h, 29)

		glPopMatrix()
Example #3
0
    def draw(self):
        if self._hidden:
            return

        if self._comboStateCallback is not None and self.hasFocus(
        ) != self._selected:
            self._comboStateCallback(self.hasFocus())
        self._selected = self.hasFocus()

        super(glComboButton, self).draw()

        bs = self._base._buttonSize / 1.3
        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)
            openglHelpers.glDrawTexturedQuad(-0.85 * bs, -0.8 * bs, bs, bs, 0)
            openglHelpers.glDrawTexturedQuad(-0.85 * bs, -0.8 * 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)
            #openglHelpers.glDrawStringRight(self._tooltips[n])
            glTranslatef(0, 2, 0)
            #openglHelpers.glDrawStringRight(self._tooltips[n])
            glTranslatef(2, 0, 0)
            #openglHelpers.glDrawStringRight(self._tooltips[n])
            glTranslatef(0, -2, 0)
            #openglHelpers.glDrawStringRight(self._tooltips[n])
            glPopMatrix()

            glColor4ub(255, 255, 255, 255)
            #openglHelpers.glDrawStringRight(self._tooltips[n])
            glPopMatrix()
        glPopMatrix()
Example #4
0
	def draw(self):
		if self._hidden:
			return

		if self._comboStateCallback is not None and self.hasFocus() != self._selected:
			self._comboStateCallback(self.hasFocus())
		self._selected = self.hasFocus()

		super(glComboButton, self).draw()

		bs = self._base._buttonSize / 1.3
		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)
			openglHelpers.glDrawTexturedQuad(-0.85*bs,-0.8*bs,bs,bs, 0)
			openglHelpers.glDrawTexturedQuad(-0.85*bs,-0.8*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)
			#openglHelpers.glDrawStringRight(self._tooltips[n])
			glTranslatef(0, 2, 0)
			#openglHelpers.glDrawStringRight(self._tooltips[n])
			glTranslatef(2, 0, 0)
			#openglHelpers.glDrawStringRight(self._tooltips[n])
			glTranslatef(0, -2, 0)
			#openglHelpers.glDrawStringRight(self._tooltips[n])
			glPopMatrix()

			glColor4ub(255,255,255,255)
			#openglHelpers.glDrawStringRight(self._tooltips[n])
			glPopMatrix()
		glPopMatrix()
Example #5
0
    def draw(self):
        if self._hidden:
            return

        cx = (self._imageID % 4) / 4
        cy = int(self._imageID / 4) / 4
        bs = self.getMinSize()[0]
        pos = self._getPixelPos()

        glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
        scale = 0.8
        if self._selected:
            scale = 1.0
        elif self._focus:
            scale = 0.9
        if self._disabled:
            glColor4ub(128, 128, 128, 128)
        else:
            glColor4ub(255, 255, 255, 255)
        openglHelpers.glDrawTexturedQuad(pos[0] - bs * scale / 2,
                                         pos[1] - bs * scale / 2, bs * scale,
                                         bs * scale, 1)
        openglHelpers.glDrawTexturedQuad(pos[0] - bs * scale / 2,
                                         pos[1] - bs * scale / 2, bs * scale,
                                         bs * scale, self._imageID)
        if self._showExpandArrow:
            if self._selected:
                openglHelpers.glDrawTexturedQuad(
                    pos[0] + bs * scale / 2 - bs * scale / 4 * 1.2,
                    pos[1] - bs * scale / 2 * 1.2, bs * scale / 4,
                    bs * scale / 4, 1)
            else:
                openglHelpers.glDrawTexturedQuad(
                    pos[0] + bs * scale / 2 - bs * scale / 4 * 1.2,
                    pos[1] - bs * scale / 2 * 1.2, bs * scale / 4,
                    bs * scale / 4, 1, 2)
        glPushMatrix()
        glTranslatef(pos[0], pos[1], 0)
        glDisable(GL_TEXTURE_2D)
        if self._focus:
            glTranslatef(0, -0.55 * bs * scale, 0)

            glPushMatrix()
            glColor4ub(150, 0, 0, 10)
            glTranslatef(-1, -1, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(0, 2, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(2, 0, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(0, -2, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glPopMatrix()

            glColor4ub(10, 10, 10, 255)
            openglHelpers.glDrawStringCenter(self._tooltip)
        glPopMatrix()
        progress = self._progressBar
        if progress is not None:
            glColor4ub(60, 60, 60, 255)
            openglHelpers.glDrawQuad(pos[0] - bs / 2, pos[1] + bs / 2, bs,
                                     bs / 4)
            glColor4ub(255, 255, 255, 255)
            openglHelpers.glDrawQuad(pos[0] - bs / 2 + 2, pos[1] + bs / 2 + 2,
                                     (bs - 5) * progress + 1, bs / 4 - 4)
        elif len(self._altTooltip) > 0:
            glPushMatrix()
            glTranslatef(pos[0], pos[1], 0)
            glTranslatef(0, 0.6 * bs, 0)
            glTranslatef(0, 6, 0)
            #glTranslatef(0.6*bs*scale, 0, 0)

            for line in self._altTooltip.split('\n'):
                glPushMatrix()
                glColor4ub(60, 60, 60, 255)
                glTranslatef(-1, -1, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, 2, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(2, 0, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, -2, 0)
                openglHelpers.glDrawStringCenter(line)
                glPopMatrix()

                glColor4ub(255, 255, 255, 255)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, 18, 0)
            glPopMatrix()
Example #6
0
	def draw(self):
		if self._hidden:
			return

		cx = (self._imageID % 4) / 4
		cy = int(self._imageID / 4) / 4
		bs = self.getMinSize()[0]
		pos = self._getPixelPos()

		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		#button sizing		
		scale = 1.0
		if self._selected:
			scale = 1.0
		elif self._focus:
			scale = 1.0
		if self._disabled:
			glColor4ub(128,128,128,128)
		else:
			glColor4ub(255,255,255,255)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		if self._showExpandArrow:
			if self._selected:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1)
			else:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1, 2)
		glPushMatrix()
		glTranslatef(pos[0], pos[1], 0)
		glDisable(GL_TEXTURE_2D)
		'''if self._focus:
			glTranslatef(0, -0.55*bs*scale, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			openglHelpers.glDrawStringCenter(self._tooltip)
		'''
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2+2, pos[1]+bs/2+2, (bs - 5) * progress + 1, bs / 4 - 4)
		elif len(self._altTooltip) > 0:
			glPushMatrix()
			glTranslatef(pos[0], pos[1], 0)
			glTranslatef(0, 0.6*bs, 0)
			glTranslatef(0, 6, 0)
			#glTranslatef(0.6*bs*scale, 0, 0)

			for line in self._altTooltip.split('\n'):
				glPushMatrix()
				glColor4ub(60,60,60,255)
				glTranslatef(-1, -1, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 2, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(2, 0, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, -2, 0)
				openglHelpers.glDrawStringCenter(line)
				glPopMatrix()

				glColor4ub(255,255,255,255)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 18, 0)
			glPopMatrix()
Example #7
0
	def draw(self):
		# if self._hidden: #Comment by dagoma
		# 	return
		try :

			cx = (self._imageID % 4) / 4
			cy = int(self._imageID / 4) / 4
		except :
			pass
		bs = self.getMinSize()[0]
		pos = self._getPixelPos()

		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		scale = 0.8
		if self._selected:
			scale = 1.0
		elif self._focus:
			scale = 0.9
		if self._disabled:
			glColor4ub(128,128,128,128)
		else:
			glColor4ub(255,255,255,255)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		try :
			openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		except :
			pass
		if self._showExpandArrow:
			if self._selected:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1)
			else:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1, 2)
		glPushMatrix()
		glTranslatef(pos[0], pos[1], 0)
		glDisable(GL_TEXTURE_2D)
		if self._focus:
			glTranslatef(0, -0.55*bs*scale, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			openglHelpers.glDrawStringCenter(self._tooltip)
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			bs = 64 #Add by dagoma
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2+2, pos[1]+bs/2+2, (bs - 5) * progress + 1, bs / 4 - 4)
		elif len(self._altTooltip) > 0:
			glPushMatrix()
			glTranslatef(pos[0], pos[1], 0)
			split_tooltip = self._altTooltip.split('\n')
			if self._imageID is None:
				max_line = ''
				for line in split_tooltip:
					if len(line) > len(max_line):
						max_line = line
				#print self._base._buttonSize
				tooltip_translate_x = (self._base._buttonSize - openglHelpers.glGetStringSize(max_line)[0]) / 2
				tooltip_translate_y = 0
				if not self._base._buttonSize == 32:
					tooltip_translate_y = self._base._buttonSize - (len(split_tooltip) + 1) * 18 + (6 - self._base._buttonSize / 16) * 4
				elif len(split_tooltip) > 2:
					tooltip_translate_y = - 18 * (len(split_tooltip) - 2) - 4
				else:
					tooltip_translate_y = -4
				glTranslatef(tooltip_translate_x, tooltip_translate_y, 0)
				#glTranslatef(0.6*bs*scale, 0, 0)
			else:
				glTranslatef(0, 0.6*bs, 0)
				glTranslatef(0, 6, 0)
				#glTranslatef(0.6*bs*scale, 0, 0)

			for line in split_tooltip:
				glPushMatrix()
				glColor4ub(60,60,60,255)
				glTranslatef(-1, -1, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 2, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(2, 0, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, -2, 0)
				openglHelpers.glDrawStringCenter(line)
				glPopMatrix()

				glColor4ub(255,255,255,255)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 18, 0)
			glPopMatrix()