led: clenaups

This commit is contained in:
alfrix 2023-10-15 10:36:33 -03:00
parent 82b75a528a
commit a84b91a40b

View File

@ -2,8 +2,8 @@ import logging
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
from math import pi, floor
from gi.repository import Gtk
from math import pi
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
@ -81,9 +81,7 @@ class Panel(ScreenPanel):
logging.error("Error: Color order is None")
self.back()
return
on = []
for i in range(4):
on.append(1 if self.color_available(i) else 0)
on = [1 if self.color_available(i) else 0 for i in range(4)]
self.presets["on"] = on
scale_grid = self._gtk.HomogeneousGrid()
for idx, col_value in enumerate(self.color_data):
@ -217,7 +215,7 @@ class Panel(ScreenPanel):
# The idea here is to use the white channel as a saturation control
# The white channel 'washes' the color
return (
[color[i] + color[3] for i in range(3)] # Special case of only white channel
[color[3] for i in range(3)] # Special case of only white channel
if color[0] == 0 and color[1] == 0 and color[2] == 0
else [color[i] + (1 - color[i]) * color[3] / 3 for i in range(3)]
)