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