jath03 / openrgb-python

A python client for the OpenRGB SDK
GNU General Public License v3.0
112 stars 22 forks source link

TypeError: set_colors() got multiple values for argument 'fast' #46

Closed subterfugium closed 2 years ago

subterfugium commented 2 years ago

Not sure what I am doing wrong. If possible check and try: https://github.com/subterfugium/rgb

Issue happens at

        for device in client.ee_devices:
            led_count = int(len(device.colors))
            for i in range(led_count):
                device.colors[i] = RGBColor.fromHSV(hue, sat, lig)
        for device in client.ee_devices:
            device.show()

and

    def show(self, fast: bool = False, force: bool = False):
        '''
        Applies changes in the color attribute

        :param fast: Whether or not update the device on each call
        :param force: If True, the function will update every led, regardless of previous state.
        '''
        if len(self.colors) > len(self._colors):
            raise ValueError(f"`self.colors` is longer than expected length `{len(self._colors)}`")
        elif len(self.colors) < len(self._colors):
            raise ValueError(f"`self.colors` is shorter than expected length `{len(self._colors)}`")
        changed = [(i, color) for i, color in enumerate(self.colors) if color != self._colors[i]]
        if force:
            self.set_colors(self.colors, fast=True)
        elif len(changed) == 0:
            return
        elif len(changed) == 1:
            self.leds[changed[0][0]].set_color(changed[0][1], fast=True)
        elif len(changed) > 1:
            start, end = changed[0][0], changed[-1][0] + 1
            colors = self.colors[start:end]
            print(colors)
[RGBColor(red=255, green=255, blue=255), RGBColor(red=255, green=255, blue=255), RGBColor(red=255, green=255, blue=255), RGBColor(red=255, green=255, blue=255)]
            print(start)
0
            print(end)
4
            self.set_colors(colors, start, end, fast=True)
        self._colors = self.colors[:]
        if not fast:
            self.update()

Using latest version

user@pc:$ pip install openrgb-python==0.2.12
Defaulting to user installation because normal site-packages is not writeable
Collecting openrgb-python==0.2.12
  Using cached openrgb_python-0.2.12-py3-none-any.whl (26 kB)
Installing collected packages: openrgb-python
  Attempting uninstall: openrgb-python
    Found existing installation: openrgb-python 0.2.10
    Uninstalling openrgb-python-0.2.10:
      Successfully uninstalled openrgb-python-0.2.10
Successfully installed openrgb-python-0.2.12
user@pc:$ rgb white blue hue
Colors: white, blue

Device ASUS Aura DRAM has 8 leds
- Zone Unknown has 8 leds
Device ASUS Aura DRAM has 8 leds
- Zone Unknown has 8 leds
Device B550 AORUS ELITE has 22 leds
- Zone D_LED1 Bottom has 9 leds
- Zone D_LED2 Top has 9 leds
- Zone Motherboard has 4 leds
Device Logitech G915TKL Wireless RGB Mechanical Gaming Keyboard (Wired) has 95 leds
- Zone Keyboard has 95 leds
Sweep leds hue between ['white', 'blue'] for 60 seconds...
Traceback (most recent call last):
  File "/usr/local/bin/rgb", line 368, in <module>
    device.show()
  File "/home/otto/.local/lib/python3.9/site-packages/openrgb/utils.py", line 702, in show
    self.set_colors(colors, start, end, fast=True)
TypeError: set_colors() got multiple values for argument 'fast'

Issue does not happen with 0.2.10

user@pc:$ pip install openrgb-python==0.2.10
Defaulting to user installation because normal site-packages is not writeable
Collecting openrgb-python==0.2.10
  Using cached openrgb_python-0.2.10-py3-none-any.whl (26 kB)
Installing collected packages: openrgb-python
  Attempting uninstall: openrgb-python
    Found existing installation: openrgb-python 0.2.12
    Uninstalling openrgb-python-0.2.12:
      Successfully uninstalled openrgb-python-0.2.12
Successfully installed openrgb-python-0.2.10
user@pc:$ rgb white blue hue
Colors: white, blue

Device ASUS Aura DRAM has 8 leds
- Zone Unknown has 8 leds
Device ASUS Aura DRAM has 8 leds
- Zone Unknown has 8 leds
Device B550 AORUS ELITE has 22 leds
- Zone D_LED1 Bottom has 9 leds
- Zone D_LED2 Top has 9 leds
- Zone Motherboard has 4 leds
Device Logitech G915TKL Wireless RGB Mechanical Gaming Keyboard (Wired) has 95 leds
- Zone Keyboard has 95 leds
Sweep leds hue between ['white', 'blue'] for 60 seconds...
jath03 commented 2 years ago

Should be fixed in v0.2.13