def draw(self): # select color from number of touch if len(self._touches) == 0: set_color(*self.style.get('bg-color')) elif len(self._touches) == 1: set_color(*self.style.get('bg-color-move')) else: set_color(*self.style.get('bg-color-full')) # draw border scaled_border = self.get_scaled_border() self.update_controls() drawRoundedRectangle(pos=(-scaled_border, -scaled_border), size=(self.width + scaled_border * 2, self.height + scaled_border * 2), radius=15. / self.scale) # draw control background control_width = self.btn_fullscreen.width + self.btn_close.width drawRoundedRectangle( pos=((self.width / 2) - (scaled_border + control_width / 2), -scaled_border * 2), size=(scaled_border * 2 + control_width, scaled_border), radius=15. / self.scale, corners=(True, True, False, False))
def draw(self): # select color from number of touch if len(self._touches) == 0: set_color(*self.style.get('bg-color')) elif len(self._touches) == 1: set_color(*self.style.get('bg-color-move')) else: set_color(*self.style.get('bg-color-full')) # draw border scaled_border = self.get_scaled_border() self.update_controls() drawRoundedRectangle( pos=(-scaled_border, -scaled_border), size=(self.width+scaled_border*2, self.height+scaled_border*2), radius=15. / self.scale ) # draw control background control_width = self.btn_fullscreen.width + self.btn_close.width drawRoundedRectangle( pos=((self.width/2)-(scaled_border + control_width / 2), -scaled_border * 2), size=(scaled_border*2 + control_width, scaled_border), radius=15. / self.scale, corners=(True, True, False, False) )
def draw(self): # extract relative position rx, ry = self.relpos # calculate triangle mx = self.x + rx + self.width * 0.5 + self.trirelpos[0] my = self.y + ry + self.height * 0.5 + self.trirelpos[1] angle = Vector(1, 0).angle(Vector(mx - self.x, my - self.y)) vpos = Vector(mx, my) v1 = Vector(self.trisize, 0).rotate(angle) + vpos v2 = Vector(-self.trisize, 0).rotate(angle) + vpos # draw border if self.bordersize > 0: drawRoundedRectangle( pos=(self.x - self.padding - self.bordersize + rx, self.y - self.padding - self.bordersize + ry), size=(self.width + self.padding * 2 + self.bordersize * 2, self.height + self.padding * 2 + self.bordersize * 2), radius=self.radius, color=self.bordercolor ) glEnable(GL_LINE_SMOOTH) glLineWidth(self.bordersize * 2) drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y), style=GL_LINE_LOOP) # draw background drawRoundedRectangle( pos=(self.x - self.padding + rx, self.y - self.padding + ry), size=(self.width + self.padding * 2, self.height + self.padding * 2), radius=self.radius, color=self.bgcolor ) drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y)) # hack to translate label position with gx_matrix: glTranslatef(rx, ry, 0) super(MTSpeechBubble, self).draw()
def draw(self): # extract relative position rx, ry = self.relpos # calculate triangle mx = self.x + rx + self.width * 0.5 + self.trirelpos[0] my = self.y + ry + self.height * 0.5 + self.trirelpos[1] angle = Vector(1, 0).angle(Vector(mx - self.x, my - self.y)) vpos = Vector(mx, my) v1 = Vector(self.trisize, 0).rotate(angle) + vpos v2 = Vector(-self.trisize, 0).rotate(angle) + vpos # draw border if self.bordersize > 0: drawRoundedRectangle( pos=(self.x - self.padding - self.bordersize + rx, self.y - self.padding - self.bordersize + ry), size=(self.width + self.padding * 2 + self.bordersize * 2, self.height + self.padding * 2 + self.bordersize * 2), radius=self.radius, color=self.bordercolor) glEnable(GL_LINE_SMOOTH) glLineWidth(self.bordersize * 2) drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y), style=GL_LINE_LOOP) # draw background drawRoundedRectangle(pos=(self.x - self.padding + rx, self.y - self.padding + ry), size=(self.width + self.padding * 2, self.height + self.padding * 2), radius=self.radius, color=self.bgcolor) drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y)) # hack to translate label position with gx_matrix: glTranslatef(rx, ry, 0) super(MTSpeechBubble, self).draw()