Coverage for /home/antoine/projects/xpra-git/dist/python3/lib64/python/xpra/client/gl/gl_spinner.py : 20%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of Xpra.
2# Copyright (C) 2019 Antoine Martin <antoine@xpra.org>
3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
4# later version. See the file COPYING for details.
6import math
7from OpenGL.GL import (
8 glBegin, glEnd,
9 glVertex2i, glColor4f,
10 GL_POLYGON,
11 )
13from xpra.os_util import monotonic_time
14from xpra.client.spinner import cv
17def draw_spinner(bw, bh):
18 dim = min(bw/3.0, bh/3.0)
19 t = monotonic_time()
20 count = int(t*4.0)
21 bx = bw//2
22 by = bh//2
23 for i in range(8): #8 lines
24 c = cv.trs[count%8][i]
25 mi1 = math.pi*i/4-math.pi/16
26 mi2 = math.pi*i/4+math.pi/16
27 si1 = math.sin(mi1)
28 si2 = math.sin(mi2)
29 ci1 = math.cos(mi1)
30 ci2 = math.cos(mi2)
31 glBegin(GL_POLYGON)
32 glColor4f(c, c, c, 1)
33 glVertex2i(int(bx+si1*10), int(by+ci1*10))
34 glVertex2i(int(bx+si1*dim), int(by+ci1*dim))
35 glVertex2i(int(bx+si2*dim), int(by+ci2*dim))
36 glVertex2i(int(bx+si2*10), int(by+ci2*10))
37 glEnd()