From 666af3fffa4e60761f77ad57d9ecb542b1af5906 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 22 Oct 2023 16:02:39 +0200 Subject: [PATCH] Fixed colorpicker bug --- .../kivymd/uix/pickers/colorpicker/colorpicker.py | 15 +++++++++------ sbapp/main.py | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sbapp/kivymd/uix/pickers/colorpicker/colorpicker.py b/sbapp/kivymd/uix/pickers/colorpicker/colorpicker.py index 4dfdfd1..c289dd4 100644 --- a/sbapp/kivymd/uix/pickers/colorpicker/colorpicker.py +++ b/sbapp/kivymd/uix/pickers/colorpicker/colorpicker.py @@ -644,12 +644,15 @@ class MDColorPicker(BaseDialog): rgba = [0, 0, 0, 0] if isinstance(selected_color, list): - if selected_color[0] > 1: - rgba = [x / 255.0 for x in selected_color] + [ - self._opacity_value_selected_color - ] - else: - rgba = selected_color + # if selected_color[0] > 1: + # rgba = [x / 255.0 for x in selected_color] + [ + # self._opacity_value_selected_color + # ] + # else: + # rgba = selected_color + rgba = [x / 255.0 for x in selected_color] + [ + self._opacity_value_selected_color + ] elif isinstance(selected_color, str): rgba = get_color_from_hex(selected_color)[:-1] + [ self._opacity_value_selected_color diff --git a/sbapp/main.py b/sbapp/main.py index abe8191..1b8880d 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -3004,12 +3004,12 @@ class SidebandApp(MDApp): color_picker.open() color_picker.bind(on_release=self.telemetry_fg_select) def job(sender=None): - color_picker._rgb = self.sideband.config["telemetry_fg"][:-1] + color_picker._rgb = self.sideband.config["telemetry_fg"][0:3] color_picker.ids.view_headline.on_tab_press() Clock.schedule_once(job, 0) def telemetry_fg_select(self, instance_color_picker: MDColorPicker, type_color: str, selected_color: Union[list, str]): - color = selected_color[:-1] + [1] + s = selected_color; color = [s[0], s[1], s[2], 1] self.telemetry_screen.ids.telemetry_icon_preview.icon_color = color self.sideband.config["telemetry_fg"] = color self.sideband.save_configuration() @@ -3025,12 +3025,12 @@ class SidebandApp(MDApp): color_picker.open() color_picker.bind(on_release=self.telemetry_bg_select) def job(sender=None): - color_picker._rgb = self.sideband.config["telemetry_bg"][:-1] + color_picker._rgb = self.sideband.config["telemetry_bg"][0:3] color_picker.ids.view_headline.on_tab_press() Clock.schedule_once(job, 0) def telemetry_bg_select(self, instance_color_picker: MDColorPicker, type_color: str, selected_color: Union[list, str]): - color = selected_color[:-1] + [1] + s = selected_color; color = [s[0], s[1], s[2], 1] self.telemetry_screen.ids.telemetry_icon_preview.md_bg_color = color self.sideband.config["telemetry_bg"] = color self.sideband.save_configuration()