|
|
@@ -6,6 +6,7 @@ import time
|
|
|
|
|
|
import socket
|
|
|
import traceback
|
|
|
+from collections import defaultdict
|
|
|
|
|
|
from path import Path
|
|
|
|
|
|
@@ -40,6 +41,8 @@ class Renderer(object):
|
|
|
self._color = textColor
|
|
|
self.setup()
|
|
|
|
|
|
+ self.progress_tracker = defaultdict(lambda: -1)
|
|
|
+
|
|
|
self._brightness = brightness
|
|
|
self.set_brightness(brightness)
|
|
|
|
|
|
@@ -63,7 +66,11 @@ class Renderer(object):
|
|
|
self.canvas = self.matrix.SwapOnVSync(self.canvas)
|
|
|
self.canvas.Clear()
|
|
|
|
|
|
- def progress(self, step=0, total=0):
|
|
|
+ def progress(self, step=0, total=0, id=None):
|
|
|
+ last_step = self.progress_tracker[id]
|
|
|
+ if step < last_step:
|
|
|
+ return
|
|
|
+
|
|
|
c = self.canvas
|
|
|
w, h = c.width, c.height
|
|
|
col = Color('#AACCFF')
|
|
|
@@ -74,9 +81,12 @@ class Renderer(object):
|
|
|
|
|
|
stepsize = max(1, int(w / total))
|
|
|
for x in range(w):
|
|
|
- modulate = asc_desc_modulation(x, stepsize)
|
|
|
+ modulate_x = asc_desc_modulation(x, 32)
|
|
|
+
|
|
|
for y in range(h):
|
|
|
- c.SetPixel(s_len + x, y, *modulate(col))
|
|
|
+ #~ modulate_y = asc_desc_modulation(y, 16)
|
|
|
+ modulate_y = lambda x: x
|
|
|
+ c.SetPixel(s_len + x, y, *modulate_y(modulate_x(col)))
|
|
|
if x > ((step + 1) / total) * w:
|
|
|
break
|
|
|
self.swap()
|