def displayText2(self):
		numLines = len(self._textList)

		if self._backgroundColour != None:
			glPopMatrix()
			glColor4ub(128,128,128,128)
			opengl.glDrawQuad(self._x+self._xNudge-6,self._y+1+self._yNudge,self._textSize[0]+11,(-(self._fontsize+2)*len(self._textList))-7)
			glColor4ub(252,244,185,255)
			opengl.glDrawQuad(self._x+self._xNudge-5,self._y+self._yNudge,self._textSize[0]+9,(-(self._fontsize+2)*len(self._textList))-5)
			glPopMatrix()

		glEnable(GL_TEXTURE_2D)
		glPushMatrix()
		glColor4f(1,1,1,1)
		if self.alignment == "left":
			glTranslate(self._x+self._xNudge+self._textWidth+self._textSize[0]/2, self._y+self._yNudge,0)
		elif self.alignment == "right":
			glTranslate(self._x+self._xNudge+self._textWidth+self._textSize[0], self._y+self._yNudge,0)
		else:
			glTranslate(self._x+self._xNudge+self._textWidth, self._y+self._yNudge,0)

		glScale( self._textWidth,self._textHeight,0)
		glBegin(GL_QUADS)
		glTexCoord2f(1, 0)
		glVertex2f(0,-1)
		glTexCoord2f(0, 0)
		glVertex2f(-1,-1)
		glTexCoord2f(0, 1)
		glVertex2f(-1, 0)
		glTexCoord2f(1, 1)
		glVertex2f(0, 0)
		glEnd()
		glDisable(GL_TEXTURE_2D)

		glPopMatrix()
示例#2
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)
		opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		if self._showExpandArrow:
			if self._selected:
				opengl.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:
				opengl.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)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			opengl.glDrawStringCenter(self._tooltip)
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			glColor4ub(60,60,60,255)
			opengl.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			opengl.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)
				opengl.glDrawStringCenter(line)
				glTranslatef(0, 2, 0)
				opengl.glDrawStringCenter(line)
				glTranslatef(2, 0, 0)
				opengl.glDrawStringCenter(line)
				glTranslatef(0, -2, 0)
				opengl.glDrawStringCenter(line)
				glPopMatrix()

				glColor4ub(255,255,255,255)
				opengl.glDrawStringCenter(line)
				glTranslatef(0, 18, 0)
			glPopMatrix()
示例#3
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)
		opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		if self._showExpandArrow:
			if self._selected:
				opengl.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:
				opengl.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)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			opengl.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			opengl.glDrawStringCenter(self._tooltip)
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			glColor4ub(60,60,60,255)
			opengl.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			opengl.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.6*bs*scale, 0, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			opengl.glDrawStringLeft(self._altTooltip)
			glTranslatef(0, 2, 0)
			opengl.glDrawStringLeft(self._altTooltip)
			glTranslatef(2, 0, 0)
			opengl.glDrawStringLeft(self._altTooltip)
			glTranslatef(0, -2, 0)
			opengl.glDrawStringLeft(self._altTooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			opengl.glDrawStringLeft(self._altTooltip)
			glPopMatrix()