mirror of
https://github.com/Steve-Tech/YAFI.git
synced 2026-04-20 01:00:37 +00:00
Fix led colours being added multiple times
This commit is contained in:
14
yafi/leds.py
14
yafi/leds.py
@@ -95,12 +95,14 @@ class LedsPage(Gtk.Box):
|
||||
all_colours = ["Red", "Green", "Blue", "Yellow", "White", "Amber"]
|
||||
|
||||
def add_colours(strings, led_id):
|
||||
supported_colours = ec_commands.leds.led_control_get_max_values(
|
||||
app.cros_ec, led_id
|
||||
)
|
||||
for i, colour in enumerate(all_colours):
|
||||
if supported_colours[i]:
|
||||
strings.append(colour)
|
||||
# Auto and Off should already be present
|
||||
if strings.get_n_items() <= 2:
|
||||
supported_colours = ec_commands.leds.led_control_get_max_values(
|
||||
app.cros_ec, led_id
|
||||
)
|
||||
for i, colour in enumerate(all_colours):
|
||||
if supported_colours[i]:
|
||||
strings.append(colour)
|
||||
|
||||
add_colours(
|
||||
led_pwr_colour_strings, ec_commands.leds.EcLedId.EC_LED_ID_POWER_LED
|
||||
|
||||
Reference in New Issue
Block a user