├── version ├── hue_plus ├── __init__.py ├── things │ └── previous.p ├── picker.py ├── previous.py ├── hue.py ├── webcolors.py ├── hue_ui.py └── hue_gui.py ├── setup.cfg ├── MANIFEST.in ├── custom.png ├── fixed.png ├── output.wav ├── profile.png ├── windows.png ├── version_locations ├── alternating.png ├── installer.cfg ├── setup.py ├── .gitignore ├── appveyor.yml ├── CODE_OF_CONDUCT.md ├── appveyor └── run_with_env.cmd ├── README.md ├── .vscode ├── launch.json └── tags └── LICENSE /version: -------------------------------------------------------------------------------- 1 | 1.4.5 -------------------------------------------------------------------------------- /hue_plus/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md 3 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | recursive-include hue_plus/things * 3 | -------------------------------------------------------------------------------- /custom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/custom.png -------------------------------------------------------------------------------- /fixed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/fixed.png -------------------------------------------------------------------------------- /output.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/output.wav -------------------------------------------------------------------------------- /profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/profile.png -------------------------------------------------------------------------------- /windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/windows.png -------------------------------------------------------------------------------- /version_locations: -------------------------------------------------------------------------------- 1 | setup.py 2 | installer.cfg 3 | hue_ui.py 4 | version 5 | -------------------------------------------------------------------------------- /alternating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/alternating.png -------------------------------------------------------------------------------- /hue_plus/things/previous.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kusti8/hue-plus/HEAD/hue_plus/things/previous.p -------------------------------------------------------------------------------- /hue_plus/picker.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QColorDialog 4 | from PyQt5.QtGui import QIcon 5 | from PyQt5.QtCore import pyqtSlot 6 | from PyQt5.QtGui import QColor 7 | 8 | def pick(n): 9 | app = QApplication(sys.argv) 10 | 11 | w = QWidget() 12 | w.resize(250, 250) 13 | w.move(300, 300) 14 | w.setWindowTitle(n) 15 | w.show() 16 | c = QColorDialog.getColor() 17 | if c.isValid(): 18 | return c.name()[1:].upper() 19 | sys.exit(app.exec_()) 20 | -------------------------------------------------------------------------------- /installer.cfg: -------------------------------------------------------------------------------- 1 | [Application] 2 | name=hue_plus 3 | version=1.4.5 4 | publisher=Gustav Hansen 5 | # How to launch the app - this calls the 'main' function from the 'myapp' package: 6 | entry_point=hue_plus.hue_ui:main 7 | 8 | [Python] 9 | version=3.5.0 10 | format=bundled 11 | 12 | [Include] 13 | # Importable packages that your application requires, one per line 14 | packages = hue_plus 15 | pypi_wheels= PyQt5==5.8.2 16 | pyserial==3.3 17 | sip==4.19.2 18 | appdirs==1.4.3 19 | pyaudio==0.2.11 20 | 21 | # Other files and folders that should be installed 22 | files = LICENSE 23 | hue_plus/things > $INSTDIR\pkgs\hue_plus 24 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from setuptools.command.install import install 3 | from distutils import log # needed for outputting information messages 4 | import os 5 | 6 | setup(name='hue_plus', 7 | version='1.4.5', 8 | description='A utility to control the NZXT Hue+ in Linux', 9 | classifiers=[ 10 | 'Development Status :: 5 - Production/Stable', 11 | 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 12 | 'Programming Language :: Python :: 3 :: Only', 13 | 'Operating System :: POSIX :: Linux', 14 | ], 15 | url='http://github.com/kusti8/hue-plus', 16 | author='Gustav Hansen', 17 | author_email='kusti8@gmail.com', 18 | license='GPL3', 19 | packages=['hue_plus'], 20 | package_data = {'package': ["things/*"]}, 21 | entry_points={ 22 | 'console_scripts': [ 23 | 'hue = hue_plus.hue:main' 24 | ], 25 | 'gui_scripts': [ 26 | 'hue_ui = hue_plus.hue_ui:main' 27 | ] 28 | }, 29 | install_requires=[ 30 | 'pyserial', 31 | 'pyqt5', 32 | 'pyaudio', 33 | 'appdirs' 34 | ], 35 | keywords = 'nzxt hue hue-plus hue_plus hue+', 36 | include_package_data=True, 37 | zip_safe=False) 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | global: 3 | # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the 4 | # /E:ON and /V:ON options are not enabled in the batch script intepreter 5 | # See: http://stackoverflow.com/a/13751649/163740 6 | CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" 7 | 8 | matrix: 9 | - PYTHON: "C:\\Python35" 10 | PYTHON_VERSION: "3.5.0" 11 | PYTHON_ARCH: "32" 12 | 13 | - PYTHON: "C:\\Python35-x64" 14 | PYTHON_VERSION: "3.5.0" 15 | PYTHON_ARCH: "64" 16 | 17 | install: 18 | # If there is a newer build queued for the same PR, cancel this one. 19 | # The AppVeyor 'rollout builds' option is supposed to serve the same 20 | # purpose but it is problematic because it tends to cancel builds pushed 21 | # directly to master instead of just PR builds (or the converse). 22 | # credits: JuliaLang developers. 23 | - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` 24 | https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` 25 | Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` 26 | throw "There are newer queued builds for this pull request, failing early." } 27 | - ECHO "Filesystem root:" 28 | - ps: "ls \"C:/\"" 29 | 30 | - ECHO "Installed SDKs:" 31 | - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" 32 | 33 | 34 | # Prepend newly installed Python to the PATH of this build (this cannot be 35 | # done from inside the powershell script as it would require to restart 36 | # the parent CMD process). 37 | - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" 38 | 39 | # Check that we have the expected version and architecture for Python 40 | - "python --version" 41 | - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" 42 | 43 | # Upgrade to the latest version of pip to avoid it displaying warnings 44 | # about it being out of date. 45 | - "pip install --disable-pip-version-check --user --upgrade pip" 46 | 47 | # Install the build dependencies of the project. If some dependencies contain 48 | # compiled extensions and are not provided as pre-built wheel packages, 49 | # pip will build them from source using the MSVC compiler matching the 50 | # target Python version and architecture 51 | - "%CMD_IN_ENV% pip install pynsist" 52 | 53 | build_script: 54 | # Build the compiled extension 55 | - "%CMD_IN_ENV% pynsist installer.cfg" 56 | 57 | test_script: 58 | 59 | after_test: 60 | 61 | artifacts: 62 | # Archive the generated packages in the ci.appveyor.com build report. 63 | - path: build\nsis\* 64 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kusti8@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /appveyor/run_with_env.cmd: -------------------------------------------------------------------------------- 1 | :: To build extensions for 64 bit Python 3, we need to configure environment 2 | :: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: 3 | :: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) 4 | :: 5 | :: To build extensions for 64 bit Python 2, we need to configure environment 6 | :: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: 7 | :: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) 8 | :: 9 | :: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific 10 | :: environment configurations. 11 | :: 12 | :: Note: this script needs to be run with the /E:ON and /V:ON flags for the 13 | :: cmd interpreter, at least for (SDK v7.0) 14 | :: 15 | :: More details at: 16 | :: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows 17 | :: http://stackoverflow.com/a/13751649/163740 18 | :: 19 | :: Author: Olivier Grisel 20 | :: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ 21 | :: 22 | :: Notes about batch files for Python people: 23 | :: 24 | :: Quotes in values are literally part of the values: 25 | :: SET FOO="bar" 26 | :: FOO is now five characters long: " b a r " 27 | :: If you don't want quotes, don't include them on the right-hand side. 28 | :: 29 | :: The CALL lines at the end of this file look redundant, but if you move them 30 | :: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y 31 | :: case, I don't know why. 32 | @ECHO OFF 33 | 34 | SET COMMAND_TO_RUN=%* 35 | SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows 36 | SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf 37 | 38 | :: Extract the major and minor versions, and allow for the minor version to be 39 | :: more than 9. This requires the version number to have two dots in it. 40 | SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% 41 | IF "%PYTHON_VERSION:~3,1%" == "." ( 42 | SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% 43 | ) ELSE ( 44 | SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2% 45 | ) 46 | 47 | :: Based on the Python version, determine what SDK version to use, and whether 48 | :: to set the SDK for 64-bit. 49 | IF %MAJOR_PYTHON_VERSION% == 2 ( 50 | SET WINDOWS_SDK_VERSION="v7.0" 51 | SET SET_SDK_64=Y 52 | ) ELSE ( 53 | IF %MAJOR_PYTHON_VERSION% == 3 ( 54 | SET WINDOWS_SDK_VERSION="v7.1" 55 | IF %MINOR_PYTHON_VERSION% LEQ 4 ( 56 | SET SET_SDK_64=Y 57 | ) ELSE ( 58 | SET SET_SDK_64=N 59 | IF EXIST "%WIN_WDK%" ( 60 | :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ 61 | REN "%WIN_WDK%" 0wdf 62 | ) 63 | ) 64 | ) ELSE ( 65 | ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" 66 | EXIT 1 67 | ) 68 | ) 69 | 70 | IF %PYTHON_ARCH% == 64 ( 71 | IF %SET_SDK_64% == Y ( 72 | ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture 73 | SET DISTUTILS_USE_SDK=1 74 | SET MSSdk=1 75 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% 76 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release 77 | ECHO Executing: %COMMAND_TO_RUN% 78 | call %COMMAND_TO_RUN% || EXIT 1 79 | ) ELSE ( 80 | ECHO Using default MSVC build environment for 64 bit architecture 81 | ECHO Executing: %COMMAND_TO_RUN% 82 | call %COMMAND_TO_RUN% || EXIT 1 83 | ) 84 | ) ELSE ( 85 | ECHO Using default MSVC build environment for 32 bit architecture 86 | ECHO Executing: %COMMAND_TO_RUN% 87 | call %COMMAND_TO_RUN% || EXIT 1 88 | ) 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hue-plus 2 | ## Now with custom LED, audio mode on Windows, turning on and off based on time, and a custom mode builder and a developer library, plus bug fixes! 3 | Support me on patreon: https://www.patreon.com/kusti8 4 | 5 | [![Build status](https://ci.appveyor.com/api/projects/status/5u1902hw1hqtlldb?svg=true)](https://ci.appveyor.com/project/kusti8/hue-plus) 6 | 7 | A **cross-platform** driver in Python for the NZXT Hue+. Supports **all functionality** except FPS, CPU, and GPU lighting. 8 | 9 | ![Custom](https://github.com/kusti8/hue-plus/raw/master/custom.png) 10 | ![Windows](https://github.com/kusti8/hue-plus/raw/master/windows.png) 11 | ![Profile](https://github.com/kusti8/hue-plus/raw/master/profile.png) 12 | ## Install 13 | ### Windows 14 | There is always an easy exe installer available here: 15 | https://github.com/kusti8/hue-plus/releases/latest 16 | ### Linux 17 | You must have `python3-dev` and `portaudio19-dev` installed! 18 | To install it system wide, simply install using pip: 19 | ``` 20 | sudo pip3 install hue_plus 21 | ``` 22 | Now it will be available as `hue` or `hue_ui` for the GUI. 23 | 24 | ## Quick Start 25 | Each mode accepts different arguments, so it's easiest to just read the usage. 26 | Basic usage is shown below. 27 | ### Set a fixed color on all channels 28 | `sudo hue fixed FFFFFF` where FFFFFF is the color in hex. 29 | 30 | *or* 31 | 32 | `sudo hue -g 1 fixed FFFFFF` will bring up a color picker to choose a color 33 | ### Set a specific channel 34 | `sudo hue -c 1 fixed FFFFFF` where 1 is channel one and 2 is channel two 35 | ## Usage 36 | All help and usage can be found by running ``hue -h`` 37 | 38 | *The default hue.py now includes the color selector, simply set -g to however many colors you want* 39 | ## Limitations 40 | No FPS, CPU temp, or GPU temp, but other than that a perfect replica. 41 | 42 | ## Developers 43 | Hue_plus can easily be integrated into existing software. The entire codebase is separated into simple functions that separate all usage and can be directly called. The script provides a simple argument wrapper around them, but they are easily usable. **I highly suggest you read through the main ``hue.py`` file, specifically ``hue.main()`` to get acquianted with how to use it. Each function is slightly different.** 44 | 45 | ### Quickstart 46 | 47 | ``` 48 | import serial 49 | import hue_plus 50 | 51 | ser = serial.Serial(args.port, 256000) 52 | hue_plus.fixed(ser, 0, 0, 'FF0000') # First argument is ser, second is whether to bring up GUI (0=no), third is channel (0=both) and last is the color 53 | ``` 54 | 55 | ### Common args 56 | 57 | Argument name | Description 58 | --- | --- 59 | ser | The serial object, created as shown above 60 | gui | How many colors to select in the GUI, 0 is none 61 | channel | The channel number to use, 1 or 2, 0 is both 62 | color(s) | The color(s) to use. If accepts more than 1 color, then in a list (`['FF0000', '00FF00']`) 63 | speed | The speed, from 0 (Slowest) to 4 (Fastest). 2 is normal 64 | size | The amount of LEDs to shine, from 0-3, where 0=3, 1=4, 2=5, 3=6 65 | direction | Supports going backwards, where backwards=1 and forwards=0. **Not supported in marquee or cover_marquee** 66 | moving | `true` or `false` if alternating looks like it is moving 67 | state | For power mode, either `'on'` or `'off'` 68 | mode | For custom mode, either `'fixed'`, `'breathing'`, or `'wave'` 69 | 70 | ## Notes 71 | 72 | Hue-plus does not automatically run on startup. This will not be added as a feature, but you should do this manually if you want that. For windows, follow this: http://www.thewindowsclub.com/make-programs-run-on-startup-windows. For Mac/Linux, use cron. 73 | 74 | ## Warning 75 | I (the author) hold no liability for any broken or not working Hue+ by running this script. It is provided as is. It worked for me, but your milage may vary 76 | -------------------------------------------------------------------------------- /hue_plus/previous.py: -------------------------------------------------------------------------------- 1 | """Functions to handle the previous colors 2 | 3 | Obtains previous colors from file and returns them 4 | """ 5 | import sys 6 | import os 7 | import shutil 8 | import pickle 9 | from appdirs import * 10 | from PyQt5.QtCore import QSettings 11 | 12 | package_import = True 13 | if package_import: 14 | from . import webcolors 15 | else: 16 | import webcolors 17 | 18 | settings = QSettings('kusti8', 'hue_plus') 19 | 20 | def write(line1='None', line2='None', profiles='None', times='None', customs='None'): 21 | global settings 22 | if line1 != 'None': 23 | settings.setValue('line1', line1) 24 | if line2 != 'None': 25 | settings.setValue('line2', line2) 26 | if profiles != 'None': 27 | settings.setValue('profiles', profiles) 28 | if times != 'None': 29 | settings.setValue('times', times) 30 | if customs != 'None': 31 | settings.setValue('customs', customs) 32 | 33 | def read(): 34 | global settings 35 | out = {} 36 | for i in ['line1', 'line2', 'profiles', 'times', 'customs']: 37 | out[i] = settings.value(i) 38 | return out 39 | 40 | 41 | def get_colors(channel, changer): 42 | """Get the previous colors stored so channel 2 stays the same""" 43 | if channel == 0: 44 | #print(changer) 45 | # Changer[0] is list of commands for first channel 46 | write(changer[0], changer[1]) 47 | return [changer[0], changer[1]] 48 | elif channel == 1: 49 | line2 = read()['line2'] 50 | write(changer[0], line2) 51 | return [changer[0], line2] # Return the original one channel and the previous second channel 52 | elif channel == 2: 53 | line1 = read()['line1'] 54 | write(line1, changer[0]) 55 | return [line1, changer[0]] 56 | 57 | def get_previous(): 58 | data = [read()['line1'], read()['line2']] 59 | return data 60 | 61 | def add_profile(name): 62 | data = [read()['line1'], read()['line2']] 63 | profiles = read()['profiles'] 64 | profiles[name] = data 65 | write(data[0], data[1], profiles) 66 | 67 | def list_profile(): 68 | profiles = read()['profiles'] 69 | customs = read()['customs'] 70 | if profiles: 71 | p = list(profiles) 72 | if customs: 73 | p.append(customs['name']) 74 | return p 75 | else: 76 | return p 77 | else: 78 | return [] 79 | 80 | def rm_profile(name): 81 | profiles = read()['profiles'] 82 | customs = read()['customs'] 83 | try: 84 | del profiles[name] 85 | except: 86 | if customs: 87 | customs = {} 88 | write(profiles=profiles, customs=customs) 89 | 90 | def apply_profile(name): 91 | profiles = read()['profiles'] 92 | customs = read()['customs'] 93 | try: 94 | return profiles[name] 95 | except: 96 | if customs: 97 | return customs 98 | 99 | def get_times(): 100 | times = read()['times'] 101 | return times 102 | 103 | def apply_times(time): 104 | write(times=time) 105 | 106 | def init(): 107 | global settings 108 | out = read() 109 | if not out['line1']: 110 | write(line1=[bytearray(b'K\x01\x02\x02\x04\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff')]) 111 | if not out['line2']: 112 | write(line2=[bytearray(b'K\x02\x02\x00\x04\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff')]) 113 | if not out['profiles']: 114 | write(profiles={}) 115 | if not out['times']: 116 | write(times=['00:00', '00:00']) 117 | if not out['customs']: 118 | write(customs={}) 119 | 120 | init() 121 | 122 | 123 | if __name__ == '__main__': 124 | sys.exit(0) 125 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Python", 6 | "type": "python", 7 | "request": "launch", 8 | "stopOnEntry": true, 9 | "pythonPath": "${config:python.pythonPath}", 10 | "program": "${file}", 11 | "cwd": "${workspaceRoot}", 12 | "env": {}, 13 | "envFile": "${workspaceRoot}/.env", 14 | "debugOptions": [ 15 | "WaitOnAbnormalExit", 16 | "WaitOnNormalExit", 17 | "RedirectOutput" 18 | ] 19 | }, 20 | { 21 | "name": "PySpark", 22 | "type": "python", 23 | "request": "launch", 24 | "stopOnEntry": true, 25 | "osx": { 26 | "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" 27 | }, 28 | "windows": { 29 | "pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd" 30 | }, 31 | "linux": { 32 | "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" 33 | }, 34 | "program": "${file}", 35 | "cwd": "${workspaceRoot}", 36 | "env": {}, 37 | "envFile": "${workspaceRoot}/.env", 38 | "debugOptions": [ 39 | "WaitOnAbnormalExit", 40 | "WaitOnNormalExit", 41 | "RedirectOutput" 42 | ] 43 | }, 44 | { 45 | "name": "Python Module", 46 | "type": "python", 47 | "request": "launch", 48 | "stopOnEntry": true, 49 | "pythonPath": "${config:python.pythonPath}", 50 | "module": "module.name", 51 | "cwd": "${workspaceRoot}", 52 | "env": {}, 53 | "envFile": "${workspaceRoot}/.env", 54 | "debugOptions": [ 55 | "WaitOnAbnormalExit", 56 | "WaitOnNormalExit", 57 | "RedirectOutput" 58 | ] 59 | }, 60 | { 61 | "name": "Integrated Terminal/Console", 62 | "type": "python", 63 | "request": "launch", 64 | "stopOnEntry": true, 65 | "pythonPath": "${config:python.pythonPath}", 66 | "program": "${file}", 67 | "cwd": "", 68 | "console": "integratedTerminal", 69 | "env": {}, 70 | "envFile": "${workspaceRoot}/.env", 71 | "debugOptions": [ 72 | "WaitOnAbnormalExit", 73 | "WaitOnNormalExit" 74 | ] 75 | }, 76 | { 77 | "name": "External Terminal/Console", 78 | "type": "python", 79 | "request": "launch", 80 | "stopOnEntry": true, 81 | "pythonPath": "${config:python.pythonPath}", 82 | "program": "${file}", 83 | "cwd": "", 84 | "console": "externalTerminal", 85 | "env": {}, 86 | "envFile": "${workspaceRoot}/.env", 87 | "debugOptions": [ 88 | "WaitOnAbnormalExit", 89 | "WaitOnNormalExit" 90 | ] 91 | }, 92 | { 93 | "name": "Django", 94 | "type": "python", 95 | "request": "launch", 96 | "stopOnEntry": true, 97 | "pythonPath": "${config:python.pythonPath}", 98 | "program": "${workspaceRoot}/manage.py", 99 | "cwd": "${workspaceRoot}", 100 | "args": [ 101 | "runserver", 102 | "--noreload" 103 | ], 104 | "env": {}, 105 | "envFile": "${workspaceRoot}/.env", 106 | "debugOptions": [ 107 | "WaitOnAbnormalExit", 108 | "WaitOnNormalExit", 109 | "RedirectOutput", 110 | "DjangoDebugging" 111 | ] 112 | }, 113 | { 114 | "name": "Flask", 115 | "type": "python", 116 | "request": "launch", 117 | "stopOnEntry": false, 118 | "pythonPath": "${config:python.pythonPath}", 119 | "program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter", 120 | "cwd": "${workspaceRoot}", 121 | "env": { 122 | "FLASK_APP": "${workspaceRoot}/quickstart/app.py" 123 | }, 124 | "args": [ 125 | "run", 126 | "--no-debugger", 127 | "--no-reload" 128 | ], 129 | "envFile": "${workspaceRoot}/.env", 130 | "debugOptions": [ 131 | "WaitOnAbnormalExit", 132 | "WaitOnNormalExit", 133 | "RedirectOutput" 134 | ] 135 | }, 136 | { 137 | "name": "Flask (old)", 138 | "type": "python", 139 | "request": "launch", 140 | "stopOnEntry": false, 141 | "pythonPath": "${config:python.pythonPath}", 142 | "program": "${workspaceRoot}/run.py", 143 | "cwd": "${workspaceRoot}", 144 | "args": [], 145 | "env": {}, 146 | "envFile": "${workspaceRoot}/.env", 147 | "debugOptions": [ 148 | "WaitOnAbnormalExit", 149 | "WaitOnNormalExit", 150 | "RedirectOutput" 151 | ] 152 | }, 153 | { 154 | "name": "Pyramid", 155 | "type": "python", 156 | "request": "launch", 157 | "stopOnEntry": true, 158 | "pythonPath": "${config:python.pythonPath}", 159 | "cwd": "${workspaceRoot}", 160 | "env": {}, 161 | "envFile": "${workspaceRoot}/.env", 162 | "args": [ 163 | "${workspaceRoot}/development.ini" 164 | ], 165 | "debugOptions": [ 166 | "WaitOnAbnormalExit", 167 | "WaitOnNormalExit", 168 | "RedirectOutput", 169 | "Pyramid" 170 | ] 171 | }, 172 | { 173 | "name": "Watson", 174 | "type": "python", 175 | "request": "launch", 176 | "stopOnEntry": true, 177 | "pythonPath": "${config:python.pythonPath}", 178 | "program": "${workspaceRoot}/console.py", 179 | "cwd": "${workspaceRoot}", 180 | "args": [ 181 | "dev", 182 | "runserver", 183 | "--noreload=True" 184 | ], 185 | "env": {}, 186 | "envFile": "${workspaceRoot}/.env", 187 | "debugOptions": [ 188 | "WaitOnAbnormalExit", 189 | "WaitOnNormalExit", 190 | "RedirectOutput" 191 | ] 192 | }, 193 | { 194 | "name": "Attach (Remote Debug)", 195 | "type": "python", 196 | "request": "attach", 197 | "localRoot": "${workspaceRoot}", 198 | "remoteRoot": "${workspaceRoot}", 199 | "port": 3000, 200 | "secret": "my_secret", 201 | "host": "localhost" 202 | } 203 | ] 204 | } -------------------------------------------------------------------------------- /.vscode/tags: -------------------------------------------------------------------------------- 1 | !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ 2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ 3 | !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ 4 | !_TAG_PROGRAM_NAME Exuberant Ctags // 5 | !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ 6 | !_TAG_PROGRAM_VERSION 5.8 // 7 | C0 ../hue_plus/hue.py /^def C0(ser):$/;" kind:function line:397 8 | CSS21_HEX_TO_NAMES ../hue_plus/webcolors.py /^CSS21_HEX_TO_NAMES = _reversedict(CSS21_NAMES_TO_HEX)$/;" kind:variable line:292 9 | CSS21_NAMES_TO_HEX ../hue_plus/webcolors.py /^CSS21_NAMES_TO_HEX = dict(HTML4_NAMES_TO_HEX, orange=u'#ffa500')$/;" kind:variable line:113 10 | CSS2_HEX_TO_NAMES ../hue_plus/webcolors.py /^CSS2_HEX_TO_NAMES = HTML4_HEX_TO_NAMES$/;" kind:variable line:290 11 | CSS2_NAMES_TO_HEX ../hue_plus/webcolors.py /^CSS2_NAMES_TO_HEX = HTML4_NAMES_TO_HEX$/;" kind:variable line:110 12 | CSS3_HEX_TO_NAMES ../hue_plus/webcolors.py /^CSS3_HEX_TO_NAMES = _reversedict(CSS3_NAMES_TO_HEX)$/;" kind:variable line:294 13 | CSS3_NAMES_TO_HEX ../hue_plus/webcolors.py /^CSS3_NAMES_TO_HEX = {$/;" kind:variable line:134 14 | HEX_COLOR_RE ../hue_plus/webcolors.py /^HEX_COLOR_RE = re.compile(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$')$/;" kind:variable line:67 15 | HTML4_HEX_TO_NAMES ../hue_plus/webcolors.py /^HTML4_HEX_TO_NAMES = _reversedict(HTML4_NAMES_TO_HEX)$/;" kind:variable line:288 16 | HTML4_NAMES_TO_HEX ../hue_plus/webcolors.py /^HTML4_NAMES_TO_HEX = {$/;" kind:variable line:90 17 | InvalidCommand ../hue_plus/hue.py /^class InvalidCommand(Exception):$/;" kind:class line:19 18 | InvalidUser ../hue_plus/hue.py /^class InvalidUser(Exception):$/;" kind:class line:22 19 | MainWindow ../hue_plus/hue_ui.py /^class MainWindow(QMainWindow, hue_gui.Ui_MainWindow):$/;" kind:class line:99 20 | QApplication ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 21 | QApplication ../hue_plus/picker.py /^from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QColorDialog$/;" kind:namespace line:3 22 | QColor ../hue_plus/picker.py /^from PyQt5.QtGui import QColor$/;" kind:namespace line:6 23 | QColorDialog ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog$/;" kind:namespace line:15 24 | QColorDialog ../hue_plus/picker.py /^from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QColorDialog$/;" kind:namespace line:3 25 | QGridLayout ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog$/;" kind:namespace line:15 26 | QIcon ../hue_plus/picker.py /^from PyQt5.QtGui import QIcon$/;" kind:namespace line:4 27 | QLabel ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog$/;" kind:namespace line:15 28 | QLineEdit ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog$/;" kind:namespace line:15 29 | QListWidgetItem ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 30 | QMainWindow ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 31 | QMessageBox ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog$/;" kind:namespace line:15 32 | QPushButton ../hue_plus/picker.py /^from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QColorDialog$/;" kind:namespace line:3 33 | QSettings ../hue_plus/previous.py /^from PyQt5.QtCore import QSettings$/;" kind:namespace line:10 34 | QTableWidgetItem ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 35 | QTextEdit ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 36 | QTimer ../hue_plus/hue_ui.py /^from PyQt5.QtCore import Qt, QTimer$/;" kind:namespace line:13 37 | QWidget ../hue_plus/hue_ui.py /^from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem$/;" kind:namespace line:16 38 | QWidget ../hue_plus/picker.py /^from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QColorDialog$/;" kind:namespace line:3 39 | Qt ../hue_plus/hue_ui.py /^from PyQt5.QtCore import Qt, QTimer$/;" kind:namespace line:13 40 | QtCore ../hue_plus/hue_gui.py /^from PyQt5 import QtCore, QtGui, QtWidgets$/;" kind:namespace line:9 41 | QtGui ../hue_plus/hue_gui.py /^from PyQt5 import QtCore, QtGui, QtWidgets$/;" kind:namespace line:9 42 | QtWidgets ../hue_plus/hue_gui.py /^from PyQt5 import QtCore, QtGui, QtWidgets$/;" kind:namespace line:9 43 | SPECIFICATION_ERROR_TEMPLATE ../hue_plus/webcolors.py /^supported specifications are: {supported}.'.format($/;" kind:variable line:72 44 | SUPPORTED_SPECIFICATIONS ../hue_plus/webcolors.py /^SUPPORTED_SPECIFICATIONS = (u'html4', u'css2', u'css21', u'css3')$/;" kind:variable line:69 45 | Ui_MainWindow ../hue_plus/hue_gui.py /^class Ui_MainWindow(object):$/;" kind:class line:11 46 | VERSION ../hue_plus/hue_ui.py /^VERSION="1.3.0"$/;" kind:variable line:2 47 | __init__ ../hue_plus/hue_ui.py /^ def __init__(self):$/;" kind:member line:100 48 | __init__.py ../hue_plus/__init__.py 1;" kind:file line:1 49 | __version__ ../hue_plus/webcolors.py /^__version__ = '1.7'$/;" kind:variable line:42 50 | _normalize_integer_rgb ../hue_plus/webcolors.py /^def _normalize_integer_rgb(value):$/;" kind:function line:335 51 | _normalize_percent_rgb ../hue_plus/webcolors.py /^def _normalize_percent_rgb(value):$/;" kind:function line:355 52 | _percent_to_integer ../hue_plus/webcolors.py /^def _percent_to_integer(percent):$/;" kind:function line:587 53 | _reversedict ../hue_plus/webcolors.py /^def _reversedict(d):$/;" kind:function line:58 54 | add_profile ../hue_plus/previous.py /^def add_profile(name):$/;" kind:function line:58 55 | alternating ../hue_plus/hue.py /^def alternating(ser, gui, channel, color, speed, size, moving, direction):$/;" kind:function line:492 56 | alternatingAddFunc ../hue_plus/hue_ui.py /^ def alternatingAddFunc(self):$/;" kind:member line:456 57 | alternatingApply ../hue_plus/hue_ui.py /^ def alternatingApply(self):$/;" kind:member line:472 58 | alternatingDeleteFunc ../hue_plus/hue_ui.py /^ def alternatingDeleteFunc(self):$/;" kind:member line:469 59 | animated ../hue_plus/hue.py /^def animated(ser, channel, colors, speed):$/;" kind:function line:554 60 | animatedAddFunc ../hue_plus/hue_ui.py /^ def animatedAddFunc(self):$/;" kind:member line:697 61 | animatedApply ../hue_plus/hue_ui.py /^ def animatedApply(self):$/;" kind:member line:708 62 | animatedDeleteFunc ../hue_plus/hue_ui.py /^ def animatedDeleteFunc(self):$/;" kind:member line:701 63 | animatedEditFunc ../hue_plus/hue_ui.py /^ def animatedEditFunc(self):$/;" kind:member line:675 64 | animatedGetColors ../hue_plus/hue_ui.py /^ def animatedGetColors(self):$/;" kind:member line:691 65 | animatedRoundChangeFunc ../hue_plus/hue_ui.py /^ def animatedRoundChangeFunc(self):$/;" kind:member line:705 66 | applyFunc ../hue_plus/hue_ui.py /^ def applyFunc(self):$/;" kind:member line:613 67 | apply_profile ../hue_plus/previous.py /^def apply_profile(name):$/;" kind:function line:81 68 | apply_times ../hue_plus/previous.py /^def apply_times(time):$/;" kind:function line:94 69 | argparse ../hue_plus/hue.py /^import argparse$/;" kind:namespace line:7 70 | audioLevelAddFunc ../hue_plus/hue_ui.py /^ def audioLevelAddFunc(self):$/;" kind:member line:547 71 | audioLevelApply ../hue_plus/hue_ui.py /^ def audioLevelApply(self):$/;" kind:member line:560 72 | audioLevelDeleteFunc ../hue_plus/hue_ui.py /^ def audioLevelDeleteFunc(self):$/;" kind:member line:557 73 | audio_level ../hue_plus/hue.py /^def audio_level(ser, gui, channel, colors, tolerance, smooth):$/;" kind:function line:185 74 | author ../setup.py /^ author='Gustav Hansen',$/;" kind:variable line:16 75 | author_email ../setup.py /^ author_email='kusti8@gmail.com',$/;" kind:variable line:17 76 | breathing ../hue_plus/hue.py /^def breathing(ser, gui, channel, color, speed):$/;" kind:function line:422 77 | breathingAddFunc ../hue_plus/hue_ui.py /^ def breathingAddFunc(self):$/;" kind:member line:312 78 | breathingApply ../hue_plus/hue_ui.py /^ def breathingApply(self):$/;" kind:member line:322 79 | breathingDeleteFunc ../hue_plus/hue_ui.py /^ def breathingDeleteFunc(self):$/;" kind:member line:319 80 | candleAddFunc ../hue_plus/hue_ui.py /^ def candleAddFunc(self):$/;" kind:member line:490 81 | candleApply ../hue_plus/hue_ui.py /^ def candleApply(self):$/;" kind:member line:506 82 | candleDeleteFunc ../hue_plus/hue_ui.py /^ def candleDeleteFunc(self):$/;" kind:member line:503 83 | candlelight ../hue_plus/hue.py /^def candlelight(ser, gui, channel, color):$/;" kind:function line:510 84 | checkAudio ../hue_plus/hue_ui.py /^ def checkAudio(self):$/;" kind:member line:209 85 | classifiers ../setup.py /^ classifiers=[$/;" kind:variable line:9 86 | closeEvent ../hue_plus/hue_ui.py /^ def closeEvent(self, event):$/;" kind:member line:189 87 | closest_colour ../hue_plus/hue_ui.py /^def closest_colour(requested_colour):$/;" kind:function line:58 88 | colorsys ../hue_plus/hue.py /^import colorsys$/;" kind:namespace line:16 89 | coverMarqueeAddFunc ../hue_plus/hue_ui.py /^ def coverMarqueeAddFunc(self):$/;" kind:member line:392 90 | coverMarqueeApply ../hue_plus/hue_ui.py /^ def coverMarqueeApply(self):$/;" kind:member line:405 91 | coverMarqueeDeleteFunc ../hue_plus/hue_ui.py /^ def coverMarqueeDeleteFunc(self):$/;" kind:member line:402 92 | cover_marquee ../hue_plus/hue.py /^def cover_marquee(ser, gui, channel, color, speed, direction):$/;" kind:function line:460 93 | create_command ../hue_plus/hue.py /^def create_command(ser, channel, colors, mode, direction, option, group, speed):$/;" kind:function line:325 94 | create_custom ../hue_plus/hue.py /^def create_custom(ser, channel, colors, mode, direction, option, group, speed, strips):$/;" kind:function line:282 95 | ctypes ../hue_plus/hue_ui.py /^import ctypes$/;" kind:namespace line:8 96 | custom ../hue_plus/hue.py /^def custom(ser, gui, channel, colors, mode, speed):$/;" kind:function line:539 97 | customApply ../hue_plus/hue_ui.py /^ def customApply(self):$/;" kind:member line:645 98 | customEditFunc ../hue_plus/hue_ui.py /^ def customEditFunc(self):$/;" kind:member line:625 99 | customGetColors ../hue_plus/hue_ui.py /^ def customGetColors(self):$/;" kind:member line:639 100 | datetime ../hue_plus/hue_ui.py /^import datetime$/;" kind:namespace line:12 101 | description ../setup.py /^ description='A utility to control the NZXT Hue+ in Linux',$/;" kind:variable line:8 102 | entry_points ../setup.py /^ entry_points={$/;" kind:variable line:21 103 | error ../hue_plus/hue_ui.py /^ def error(self, message):$/;" kind:member line:193 104 | fading ../hue_plus/hue.py /^def fading(ser, gui, channel, color, speed):$/;" kind:function line:435 105 | fadingAddFunc ../hue_plus/hue_ui.py /^ def fadingAddFunc(self):$/;" kind:member line:335 106 | fadingApply ../hue_plus/hue_ui.py /^ def fadingApply(self):$/;" kind:member line:348 107 | fadingDeleteFunc ../hue_plus/hue_ui.py /^ def fadingDeleteFunc(self):$/;" kind:member line:345 108 | find_between ../hue_plus/hue_ui.py /^def find_between( s, first, last ):$/;" kind:function line:76 109 | fixed ../hue_plus/hue.py /^def fixed(ser, gui, channel, color):$/;" kind:function line:412 110 | fixedAddFunc ../hue_plus/hue_ui.py /^ def fixedAddFunc(self):$/;" kind:member line:283 111 | fixedApply ../hue_plus/hue_ui.py /^ def fixedApply(self):$/;" kind:member line:299 112 | fixedDeleteFunc ../hue_plus/hue_ui.py /^ def fixedDeleteFunc(self):$/;" kind:member line:296 113 | for ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 114 | functools ../hue_plus/hue_ui.py /^import functools$/;" kind:namespace line:7 115 | getChannel ../hue_plus/hue_ui.py /^ def getChannel(self):$/;" kind:member line:225 116 | getColors ../hue_plus/hue_ui.py /^ def getColors(self, modeList):$/;" kind:member line:235 117 | get_colors ../hue_plus/previous.py /^def get_colors(channel, changer):$/;" kind:function line:38 118 | get_colour_name ../hue_plus/hue_ui.py /^def get_colour_name(requested_colour):$/;" kind:function line:68 119 | get_port ../hue_plus/hue_ui.py /^ def get_port(self):$/;" kind:member line:199 120 | get_previous ../hue_plus/previous.py /^def get_previous():$/;" kind:function line:54 121 | get_times ../hue_plus/previous.py /^def get_times():$/;" kind:function line:90 122 | hex_to_name ../hue_plus/webcolors.py /^def hex_to_name(hex_value, spec=u'css3'):$/;" kind:function line:431 123 | hex_to_rgb ../hue_plus/webcolors.py /^def hex_to_rgb(hex_value):$/;" kind:function line:459 124 | hex_to_rgb_percent ../hue_plus/webcolors.py /^def hex_to_rgb_percent(hex_value):$/;" kind:function line:472 125 | html5_parse_legacy_color ../hue_plus/webcolors.py /^def html5_parse_legacy_color(input):$/;" kind:function line:707 126 | html5_parse_simple_color ../hue_plus/webcolors.py /^def html5_parse_simple_color(input):$/;" kind:function line:633 127 | html5_serialize_simple_color ../hue_plus/webcolors.py /^def html5_serialize_simple_color(simple_color):$/;" kind:function line:682 128 | hue ../hue_plus/hue_ui.py /^from . import hue$/;" kind:namespace line:19 129 | hue.py ../hue_plus/hue.py 1;" kind:file line:1 130 | hue_gui ../hue_plus/hue_ui.py /^from . import hue_gui $/;" kind:namespace line:18 131 | hue_gui.py ../hue_plus/hue_gui.py 1;" kind:file line:1 132 | hue_ui.py ../hue_plus/hue_ui.py 1;" kind:file line:1 133 | include_package_data ../setup.py /^ include_package_data=True,$/;" kind:variable line:36 134 | information ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 135 | init ../hue_plus/hue.py /^def init(ser):$/;" kind:function line:388 136 | init ../hue_plus/previous.py /^def init():$/;" kind:function line:98 137 | inspect ../hue_plus/hue.py /^import inspect$/;" kind:namespace line:6 138 | install ../setup.py /^from setuptools.command.install import install$/;" kind:namespace line:2 139 | install_requires ../setup.py /^ install_requires=[$/;" kind:variable line:29 140 | is_admin ../hue_plus/hue_ui.py /^def is_admin():$/;" kind:function line:31 141 | keywords ../setup.py /^ keywords = 'nzxt hue hue-plus hue_plus hue+',$/;" kind:variable line:35 142 | license ../setup.py /^ license='GPL3',$/;" kind:variable line:18 143 | list_ports ../hue_plus/hue_ui.py /^from serial.tools import list_ports$/;" kind:namespace line:25 144 | list_profile ../hue_plus/previous.py /^def list_profile():$/;" kind:function line:64 145 | log ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 146 | main ../hue_plus/hue.py /^def main():$/;" kind:function line:25 147 | main ../hue_plus/hue_ui.py /^def main():$/;" kind:function line:48 148 | marquee ../hue_plus/hue.py /^def marquee(ser, gui, channel, color, speed, size, direction):$/;" kind:function line:448 149 | marqueeAddFunc ../hue_plus/hue_ui.py /^ def marqueeAddFunc(self):$/;" kind:member line:361 150 | marqueeApply ../hue_plus/hue_ui.py /^ def marqueeApply(self):$/;" kind:member line:377 151 | marqueeDeleteFunc ../hue_plus/hue_ui.py /^ def marqueeDeleteFunc(self):$/;" kind:member line:374 152 | math ../hue_plus/hue.py /^import math$/;" kind:namespace line:15 153 | messages ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 154 | multiprocessing ../hue_plus/hue_ui.py /^import multiprocessing$/;" kind:namespace line:10 155 | name_to_hex ../hue_plus/webcolors.py /^def name_to_hex(name, spec=u'css3'):$/;" kind:function line:381 156 | name_to_rgb ../hue_plus/webcolors.py /^def name_to_rgb(name, spec=u'css3'):$/;" kind:function line:410 157 | name_to_rgb_percent ../hue_plus/webcolors.py /^def name_to_rgb_percent(name, spec=u'css3'):$/;" kind:function line:419 158 | needed ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 159 | normalize_hex ../hue_plus/webcolors.py /^def normalize_hex(hex_value):$/;" kind:function line:319 160 | normalize_integer_triplet ../hue_plus/webcolors.py /^def normalize_integer_triplet(rgb_triplet):$/;" kind:function line:346 161 | normalize_percent_triplet ../hue_plus/webcolors.py /^def normalize_percent_triplet(rgb_triplet):$/;" kind:function line:369 162 | os ../hue_plus/hue.py /^import os$/;" kind:namespace line:8 163 | os ../hue_plus/hue_ui.py /^import os$/;" kind:namespace line:5 164 | os ../hue_plus/previous.py /^import os$/;" kind:namespace line:6 165 | os ../setup.py /^import os$/;" kind:namespace line:4 166 | outputting ../setup.py /^from distutils import log # needed for outputting information messages$/;" kind:namespace line:3 167 | package_data ../setup.py /^ package_data = {'package': ["things\/*"]},$/;" kind:variable line:20 168 | packages ../setup.py /^ packages=['hue_plus'],$/;" kind:variable line:19 169 | pick ../hue_plus/hue_ui.py /^def pick(n):$/;" kind:function line:84 170 | pick ../hue_plus/picker.py /^def pick(n):$/;" kind:function line:8 171 | picker ../hue_plus/hue.py /^from . import picker$/;" kind:namespace line:9 172 | picker.py ../hue_plus/picker.py 1;" kind:file line:1 173 | pickle ../hue_plus/previous.py /^import pickle$/;" kind:namespace line:8 174 | populateAnimated ../hue_plus/hue_ui.py /^ def populateAnimated(self):$/;" kind:member line:658 175 | populateAnimatedColors ../hue_plus/hue_ui.py /^ def populateAnimatedColors(self, colors):$/;" kind:member line:666 176 | populateCustom ../hue_plus/hue_ui.py /^ def populateCustom(self):$/;" kind:member line:617 177 | power ../hue_plus/hue.py /^def power(ser, channel, state):$/;" kind:function line:531 178 | previous ../hue_plus/hue.py /^from . import previous$/;" kind:namespace line:10 179 | previous ../hue_plus/hue_ui.py /^from . import previous$/;" kind:namespace line:20 180 | previous.py ../hue_plus/previous.py 1;" kind:file line:1 181 | profileAddFunc ../hue_plus/hue_ui.py /^ def profileAddFunc(self):$/;" kind:member line:577 182 | profileApply ../hue_plus/hue_ui.py /^ def profileApply(self):$/;" kind:member line:592 183 | profileDeleteFunc ../hue_plus/hue_ui.py /^ def profileDeleteFunc(self):$/;" kind:member line:587 184 | profileListFunc ../hue_plus/hue_ui.py /^ def profileListFunc(self):$/;" kind:member line:607 185 | profile_add ../hue_plus/hue.py /^def profile_add(name):$/;" kind:function line:567 186 | profile_apply ../hue_plus/hue.py /^def profile_apply(ser, name):$/;" kind:function line:577 187 | profile_list ../hue_plus/hue.py /^def profile_list():$/;" kind:function line:573 188 | profile_rm ../hue_plus/hue.py /^def profile_rm(name):$/;" kind:function line:570 189 | pulse ../hue_plus/hue.py /^def pulse(ser, gui, channel, color, speed):$/;" kind:function line:472 190 | pulseAddFunc ../hue_plus/hue_ui.py /^ def pulseAddFunc(self):$/;" kind:member line:419 191 | pulseApply ../hue_plus/hue_ui.py /^ def pulseApply(self):$/;" kind:member line:429 192 | pulseDeleteFunc ../hue_plus/hue_ui.py /^ def pulseDeleteFunc(self):$/;" kind:member line:426 193 | pyaudio ../hue_plus/hue.py /^ import pyaudio$/;" kind:namespace line:205 194 | pyqtSlot ../hue_plus/picker.py /^from PyQt5.QtCore import pyqtSlot$/;" kind:namespace line:5 195 | queue ../hue_plus/hue_ui.py /^import queue$/;" kind:namespace line:11 196 | re ../hue_plus/webcolors.py /^import re$/;" kind:namespace line:37 197 | read ../hue_plus/previous.py /^def read():$/;" kind:function line:30 198 | request ../hue_plus/hue_ui.py /^import urllib.request$/;" kind:namespace line:9 199 | retranslateUi ../hue_plus/hue_gui.py /^ def retranslateUi(self, MainWindow):$/;" kind:member line:587 200 | rgb_percent_to_hex ../hue_plus/webcolors.py /^def rgb_percent_to_hex(rgb_percent_triplet):$/;" kind:function line:571 201 | rgb_percent_to_name ../hue_plus/webcolors.py /^def rgb_percent_to_name(rgb_percent_triplet, spec=u'css3'):$/;" kind:function line:547 202 | rgb_percent_to_rgb ../hue_plus/webcolors.py /^def rgb_percent_to_rgb(rgb_percent_triplet):$/;" kind:function line:600 203 | rgb_to_hex ../hue_plus/webcolors.py /^def rgb_to_hex(rgb_triplet):$/;" kind:function line:508 204 | rgb_to_name ../hue_plus/webcolors.py /^def rgb_to_name(rgb_triplet, spec=u'css3'):$/;" kind:function line:484 205 | rgb_to_rgb_percent ../hue_plus/webcolors.py /^def rgb_to_rgb_percent(rgb_triplet):$/;" kind:function line:521 206 | rm_profile ../hue_plus/previous.py /^def rm_profile(name):$/;" kind:function line:71 207 | runAsAdmin ../hue_plus/hue_ui.py /^def runAsAdmin():$/;" kind:function line:41 208 | serial ../hue_plus/hue.py /^import serial$/;" kind:namespace line:2 209 | serial ../hue_plus/hue_ui.py /^import serial$/;" kind:namespace line:24 210 | settings ../hue_plus/previous.py /^settings = QSettings('kusti8', 'hue_plus')$/;" kind:variable line:15 211 | setup ../setup.py /^from setuptools import setup$/;" kind:namespace line:1 212 | setup.py ../setup.py 1;" kind:file line:1 213 | setupUi ../hue_plus/hue_gui.py /^ def setupUi(self, MainWindow):$/;" kind:member line:12 214 | shutil ../hue_plus/previous.py /^import shutil$/;" kind:namespace line:7 215 | sleep ../hue_plus/hue.py /^from time import sleep$/;" kind:namespace line:4 216 | sleep ../hue_plus/hue_ui.py /^from time import sleep$/;" kind:namespace line:4 217 | spectrum ../hue_plus/hue.py /^def spectrum(ser, channel, speed, direction):$/;" kind:function line:484 218 | spectrumApply ../hue_plus/hue_ui.py /^ def spectrumApply(self):$/;" kind:member line:442 219 | string ../hue_plus/webcolors.py /^import string$/;" kind:namespace line:38 220 | strips_info ../hue_plus/hue.py /^def strips_info(ser, channel):$/;" kind:function line:373 221 | struct ../hue_plus/hue.py /^import struct$/;" kind:namespace line:14 222 | struct ../hue_plus/webcolors.py /^import struct$/;" kind:namespace line:39 223 | sys ../hue_plus/hue.py /^import sys$/;" kind:namespace line:13 224 | sys ../hue_plus/hue.py /^import sys$/;" kind:namespace line:5 225 | sys ../hue_plus/hue_ui.py /^import sys$/;" kind:namespace line:3 226 | sys ../hue_plus/picker.py /^import sys$/;" kind:namespace line:2 227 | sys ../hue_plus/previous.py /^import sys$/;" kind:namespace line:5 228 | time ../hue_plus/hue.py /^import time$/;" kind:namespace line:3 229 | timeDaemon ../hue_plus/hue_ui.py /^ def timeDaemon(self):$/;" kind:member line:244 230 | timeSaveFunc ../hue_plus/hue_ui.py /^ def timeSaveFunc(self):$/;" kind:member line:277 231 | time_in_range ../hue_plus/hue_ui.py /^def time_in_range(start, end, x):$/;" kind:function line:92 232 | types ../hue_plus/hue_ui.py /^import types$/;" kind:namespace line:6 233 | unichr ../hue_plus/webcolors.py /^ unichr = chr # pragma: no cover$/;" kind:variable line:49 234 | unicode ../hue_plus/webcolors.py /^ unicode = str # pragma: no cover$/;" kind:variable line:55 235 | update ../hue_plus/hue_ui.py /^ def update(self):$/;" kind:member line:219 236 | url ../setup.py /^ url='http:\/\/github.com\/kusti8\/hue-plus',$/;" kind:variable line:15 237 | urllib ../hue_plus/hue_ui.py /^import urllib.request$/;" kind:namespace line:9 238 | version ../setup.py /^ version='1.3.0',$/;" kind:variable line:7 239 | versiontuple ../hue_plus/hue_ui.py /^def versiontuple(v):$/;" kind:function line:89 240 | wave ../hue_plus/hue.py /^ import wave$/;" kind:namespace line:206 241 | webcolors ../hue_plus/hue_ui.py /^import webcolors$/;" kind:namespace line:27 242 | webcolors ../hue_plus/previous.py /^from . import webcolors$/;" kind:namespace line:12 243 | webcolors.py ../hue_plus/webcolors.py 1;" kind:file line:1 244 | wings ../hue_plus/hue.py /^def wings(ser, gui, channel, color, speed):$/;" kind:function line:521 245 | wingsAddFunc ../hue_plus/hue_ui.py /^ def wingsAddFunc(self):$/;" kind:member line:518 246 | wingsApply ../hue_plus/hue_ui.py /^ def wingsApply(self):$/;" kind:member line:534 247 | wingsDeleteFunc ../hue_plus/hue_ui.py /^ def wingsDeleteFunc(self):$/;" kind:member line:531 248 | write ../hue_plus/hue.py /^def write(ser, outputs):$/;" kind:function line:404 249 | write ../hue_plus/previous.py /^def write(line1=None, line2=None, profiles=None, times=None, customs=None):$/;" kind:function line:17 250 | write_audio ../hue_plus/hue.py /^def write_audio(ser, channel, colors, tolerance, value, strips):$/;" kind:function line:150 251 | write_previous ../hue_plus/hue.py /^def write_previous(ser):$/;" kind:function line:585 252 | zip_safe ../setup.py /^ zip_safe=False)$/;" kind:variable line:37 253 | -------------------------------------------------------------------------------- /hue_plus/hue.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import serial 3 | import time 4 | from time import sleep 5 | import sys 6 | import inspect 7 | import argparse 8 | import os 9 | package_import = True 10 | if package_import: 11 | from . import picker 12 | from . import previous 13 | else: 14 | import picker 15 | import previous 16 | import sys 17 | import struct 18 | import math 19 | import colorsys 20 | 21 | # Exceptions 22 | class InvalidCommand(Exception): 23 | pass 24 | 25 | class InvalidUser(Exception): 26 | pass 27 | 28 | def main(): 29 | #if os.geteuid() != 0: 30 | # sys.exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'.") 31 | 32 | parser = argparse.ArgumentParser(description="Change NZXT Hue+ LEDs") 33 | parser.add_argument("-p", "--port", default="/dev/ttyACM0", type=str, help="The port, defaults to /dev/ttyACM0. On Windows, it is usually COM3 or COM4") 34 | parser.add_argument("-c", "--channel", type=int, default=0, help="The channel, defaults to 0 (BOTH)") 35 | parser.add_argument("-g", "--gui", type=int, default=0, help="How many colors of GUI picker") 36 | subparsers = parser.add_subparsers(help="The type of color (fixed, breathing)", dest='command') 37 | 38 | parser_fixed = subparsers.add_parser('fixed', help="One single fixed color") 39 | parser_fixed.add_argument("color", type=str, help="Color in hex") 40 | 41 | parser_breathing = subparsers.add_parser('breathing', help="Breathing through a set of colors") 42 | parser_breathing.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 43 | parser_breathing.add_argument("colors", type=str, nargs='+', help="Color(s) in hex") 44 | 45 | parser_fading = subparsers.add_parser('fading', help="Fading through a set of colors") 46 | parser_fading.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 47 | parser_fading.add_argument("colors", type=str, nargs='+', help="Color(s) in hex") 48 | 49 | parser_marquee = subparsers.add_parser('marquee', help="A strip of color running") 50 | parser_marquee.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 51 | parser_marquee.add_argument("-b", "--backwards", action="store_const", const=0, default=0, help="Enable going backwards") 52 | parser_marquee.add_argument("size", type=int, help="The size of the group of runners (0=3, 1=4, 2=5, 3=6)") 53 | parser_marquee.add_argument("color", type=str, help="Foreground color in hex") 54 | 55 | parser_cover_marquee = subparsers.add_parser('cover_marquee', help="A strip of color running (multiple colors)") 56 | parser_cover_marquee.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 57 | parser_cover_marquee.add_argument("-b", "--backwards", action="store_const", const=0, default=0, help="Enable going backwards") 58 | parser_cover_marquee.add_argument("colors", type=str, nargs='+', help="Colors in hex") 59 | 60 | parser_pulse = subparsers.add_parser('pulse', help="Pulsing through a set of colors") 61 | parser_pulse.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 62 | parser_pulse.add_argument("colors", type=str, nargs='+', help="Color(s) in hex") 63 | 64 | parser_spectrum = subparsers.add_parser('spectrum', help="Pulsing through a set of colors") 65 | parser_spectrum.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 66 | parser_spectrum.add_argument("-b", "--backwards", action="store_const", const=1, default=0, help="Enable going backwards") 67 | 68 | parser_alternating = subparsers.add_parser('alternating', help="Two alternating colors") 69 | parser_alternating.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 70 | parser_alternating.add_argument("-m", "--moving", action="store_true", help="Enable movement") 71 | parser_alternating.add_argument("-b", "--backwards", action="store_const", const=1, default=0, help="Enable going backwards (requires movement)") 72 | parser_alternating.add_argument("size", type=int, help="The size of the group of runners (0=2, 1=3, 2=5, 3=10)") 73 | parser_alternating.add_argument("colors", type=str, nargs=2, help="First and second colors in hex") 74 | 75 | parser_candlelight = subparsers.add_parser('candlelight', help="A flickering color") 76 | parser_candlelight.add_argument("color", type=str, help="Color in hex") 77 | 78 | parser_wings = subparsers.add_parser('wings', help="Strips of light meeting in the center") 79 | parser_wings.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 80 | parser_wings.add_argument("color", type=str, help="Color in hex") 81 | 82 | parser_audio_level = subparsers.add_parser('audio_level', help="Light syncronized to music levels") 83 | parser_audio_level.add_argument("tolerance", type=float, help="The maximum audio level ie. when the audio is as loud as tolerance, all LEDs will be lit") 84 | parser_audio_level.add_argument("refresh", type=int, help="The speed of refreshing the LEDs (usually 5 is a good number)") 85 | parser_audio_level.add_argument("colors", type=str, nargs='+', help="Colors in hex, starting from lowest volume to highest") 86 | 87 | parser_custom = subparsers.add_parser('custom', help="Custom light for each individual LED") 88 | parser_custom.add_argument("mode", type=str, help="A choice of modes for custom of fixed, breathing, or wave") 89 | parser_custom.add_argument("speed", type=int, help="Speed from 0(Slowest) to 4(Fastest)") 90 | parser_custom.add_argument("colors", type=str, nargs='+', help="Colors in hex, starting from lowest volume to highest") 91 | 92 | parser_power = subparsers.add_parser('power', help="Control power to the channels") 93 | parser_power.add_argument("state", type=str, help="State (on/off)") 94 | 95 | parser_unitled = subparsers.add_parser('unitled', help="Control power to the unit LED") 96 | parser_unitled.add_argument("state", type=str, help="State (on/off)") 97 | 98 | parser_profile = subparsers.add_parser('profile', help="Add or remove or apply profiles") 99 | subparsers_profile = parser_profile.add_subparsers(help="The type of profile action", dest='profile_command') 100 | 101 | parser_profile_add = subparsers_profile.add_parser('add', help="Add a profile of the current") 102 | parser_profile_add.add_argument("name", type=str, help="Name of the profile") 103 | 104 | parser_profile_remove = subparsers_profile.add_parser('rm', help="Remove a profile of the current") 105 | parser_profile_remove.add_argument("name", type=str, help="Name of the profile") 106 | 107 | parser_profile_list = subparsers_profile.add_parser('list', help="List the profiles") 108 | 109 | parser_profile_apply = subparsers_profile.add_parser('apply', help="Apply a profile") 110 | parser_profile_apply.add_argument("name", type=str, help="Name of the profile") 111 | 112 | args = parser.parse_args() 113 | 114 | ser = serial.Serial(args.port, 256000) 115 | 116 | if args.command == "fixed": 117 | fixed(ser, args.gui, args.channel, args.color) 118 | elif args.command == 'breathing': 119 | breathing(ser, args.gui, args.channel, args.colors, args.speed) 120 | elif args.command == 'fading': 121 | fading(ser, args.gui, args.channel, args.colors, args.speed) 122 | elif args.command == 'marquee': 123 | marquee(ser, args.gui, args.channel, args.color, args.speed, args.size, args.backwards) 124 | elif args.command == 'cover_marquee': 125 | cover_marquee(ser, args.gui, args.channel, args.colors, args.speed, args.backwards) 126 | elif args.command == 'pulse': 127 | pulse(ser, args.gui, args.channel, args.colors, args.speed) 128 | elif args.command == 'spectrum': 129 | spectrum(ser, args.channel, args.speed, args.backwards) 130 | elif args.command == 'alternating': 131 | alternating(ser, args.gui, args.channel, args.colors, args.speed, args.size, args.moving, args.backwards) 132 | elif args.command == 'candlelight': 133 | candlelight(ser, args.gui, args.channel, args.color) 134 | elif args.command == 'wings': 135 | wings(ser, args.gui, args.channel, args.color, args.speed) 136 | elif args.command == 'audio_level': 137 | audio_level(ser, args.gui, args.channel, args.colors, args.tolerance, args.refresh) 138 | elif args.command == 'custom': 139 | custom(ser, args.gui, args.channel, args.colors, args.mode, args.speed) 140 | elif args.command == 'power': 141 | power(ser, args.channel, args.state) 142 | elif args.command == 'unitled': 143 | unitled(ser, args.state) 144 | elif args.command == 'profile': 145 | if args.profile_command == 'add': 146 | profile_add(args.name) 147 | elif args.profile_command == 'rm': 148 | profile_rm(args.name) 149 | elif args.profile_command == 'apply': 150 | profile_apply(ser, args.name) 151 | elif args.profile_command == 'list': 152 | profile_list() 153 | else: 154 | raise InvalidCommand("No such profile command") 155 | else: 156 | raise InvalidCommand("No such mode") 157 | 158 | def write_audio(ser, channel, colors, tolerance, value, strips): 159 | try: 160 | if value >= tolerance: # Prevent index out of range 161 | value = tolerance 162 | elif value < 0.0: 163 | value = 0.0 164 | normal = (value/tolerance)*int(strips[channel-1]*10) 165 | normal_color = (value/tolerance)*len(colors) 166 | size = int(strips[channel-1]*10/len(colors)) 167 | value = normal_color*size-int(normal_color*size) # Get value fraction 168 | dis = colors[:int(normal_color)] 169 | display = [] 170 | for color in dis: 171 | for i in range(int(size)): 172 | display.append(color) 173 | for i in range(int(value*size)): 174 | display.append(colors[int(normal_color)]) 175 | rgb = colors[int(normal_color)] 176 | rgb = (int(rgb[:2], 16)/255.0, int(rgb[2:4], 16)/255.0, int(rgb[4:], 16)/255.0) 177 | h, s, v = colorsys.rgb_to_hsv(*rgb) 178 | v = value*v # Change value of final color 179 | r,g,b = colorsys.hsv_to_rgb(h, s, v) 180 | r = int(r*255) 181 | g = int(g*255) 182 | b = int(b*255) 183 | hexcolor = '%02x%02x%02x' % (r,g,b) # Back to html notation 184 | display.append(hexcolor.upper()) 185 | except KeyboardInterrupt: 186 | raise 187 | except: 188 | return 189 | command = create_custom(ser, channel, display, "audio", 0, 0, 0, 0, strips) 190 | outputs = previous.get_colors(channel, command) 191 | write(ser, outputs) 192 | 193 | def audio_level(ser, gui, channel, colors, tolerance, smooth): 194 | try: 195 | if os.geteuid() == 0: 196 | raise InvalidUser("Audio won't work with root. Login as a normal user, add your user to the group of /dev/ttyACM0 and retry without root") 197 | except: 198 | pass 199 | 200 | if not inspect.isclass(ser): 201 | ser = serial.Serial(ser, 256000) 202 | 203 | if 1 <= gui <= 8: 204 | colors = [] 205 | for i in range(gui): 206 | colors.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 207 | strips = [strips_info(ser, 1), strips_info(ser, 2)] 208 | if channel == 0: 209 | channel = [1, 2] 210 | else: 211 | channel = [channel] 212 | init(ser) 213 | import pyaudio 214 | import wave 215 | 216 | chunk = 2048 217 | FORMAT = pyaudio.paInt16 218 | CHANNELS = 1 219 | RATE = 44100 220 | RECORD_SECONDS = 500000 221 | WAVE_OUTPUT_FILENAME = "output.wav" 222 | p = pyaudio.PyAudio() 223 | if os.name == 'nt': 224 | chunk = 1024 # Windows doesn't like 2048 for some reason 225 | index = p.get_default_input_device_info()['index'] 226 | for i in range(p.get_device_count()): 227 | if 'Stereo Mix' in p.get_device_info_by_index(i)['name']: 228 | index = i 229 | stream = p.open(format = FORMAT, 230 | channels = CHANNELS, 231 | rate = RATE, 232 | input = True, 233 | output = True, 234 | frames_per_buffer = chunk, 235 | input_device_index=index) 236 | else: 237 | stream = p.open(format = FORMAT, 238 | channels = CHANNELS, 239 | rate = RATE, 240 | input = True, 241 | output = True, 242 | frames_per_buffer = chunk) 243 | alls = [] 244 | s = [] 245 | try: 246 | while True: 247 | try: 248 | data = stream.read(chunk) 249 | except IOError: 250 | continue 251 | alls.append(data) 252 | if len(alls)>1: 253 | data = b''.join(alls) 254 | wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb') 255 | wf.setnchannels(CHANNELS) 256 | wf.setsampwidth(p.get_sample_size(FORMAT)) 257 | wf.setframerate(RATE) 258 | wf.writeframes(data) 259 | wf.close() 260 | w = wave.open(WAVE_OUTPUT_FILENAME, 'rb') 261 | summ = 0 262 | value = 1 263 | delta = 1 264 | amps = [ ] 265 | for i in range(0, w.getnframes()): 266 | data = struct.unpack('= smooth: 278 | out = sum(s)/len(s) 279 | for c in channel: 280 | write_audio(ser, c, colors, tolerance, out, strips) 281 | s = [] 282 | delta = value 283 | alls=[] 284 | except: 285 | stream.close() 286 | p.terminate() 287 | os.remove(WAVE_OUTPUT_FILENAME) 288 | raise 289 | 290 | def create_custom(ser, channel, colors, mode, direction, option, group, speed, strips): 291 | if colors == None: 292 | colors = [] 293 | 294 | commands = [] 295 | channel_commands = [] 296 | modes = { 297 | "audio": 14, 298 | "fixed": 0, 299 | "breathing": 7, 300 | "wave": 13 301 | } 302 | if modes[mode] != 14: # Audio flickers when initing, not needed 303 | init(ser) 304 | 305 | strips = [0, strips[0]-1, strips[1]-1] 306 | strips[0] = max(strips) 307 | 308 | if channel == 0: 309 | channels = [1, 2] 310 | else: 311 | channels = [channel] 312 | 313 | for channela in channels: 314 | command = [] 315 | command.append(75) 316 | command.append(channela) 317 | command.append(modes[mode]) 318 | command.append(direction << 4 | option << 3 | strips[channela]) 319 | command.append(0 << 5 | group << 3 | speed) 320 | for color in colors: 321 | command.append(int(color[2:4], 16)) 322 | command.append(int(color[:2], 16)) 323 | command.append(int(color[4:], 16)) 324 | for z in range(40-len(colors)): 325 | command.append(0) 326 | command.append(0) 327 | command.append(0) 328 | command = bytearray(command) 329 | channel_commands.append([command]) 330 | return channel_commands 331 | 332 | 333 | def create_command(ser, channel, colors, mode, direction, option, group, speed): 334 | init(ser) 335 | 336 | commands = [] 337 | channel_commands = [] 338 | modes = { 339 | "fixed": 0, 340 | "breathing": 7, 341 | "fading": 1, 342 | "marquee": 3, 343 | "cover_marquee": 4, 344 | "pulse": 6, 345 | "spectrum": 2, 346 | "alternating": 5, 347 | "candlelight": 9, 348 | "wings": 12, 349 | "wave": 13, 350 | "alert": 8 351 | } 352 | 353 | strips = [0, strips_info(ser, 1)-1, strips_info(ser, 2)-1] 354 | strips[0] = max(strips) 355 | 356 | if channel == 0: 357 | channels = [1, 2] 358 | else: 359 | channels = [channel] 360 | 361 | for channela in channels: 362 | commands = [] 363 | for i, color in enumerate(colors): 364 | command = [] 365 | command.append(75) 366 | command.append(channela) 367 | command.append(modes[mode]) 368 | command.append(direction << 4 | option << 3 | strips[channela]) 369 | command.append(i << 5 | group << 3 | speed) 370 | for z in range(40): 371 | command.append(int(color[2:4], 16)) 372 | command.append(int(color[:2], 16)) 373 | command.append(int(color[4:], 16)) 374 | command = bytearray(command) 375 | commands.append(command) 376 | 377 | channel_commands.append(commands) 378 | return channel_commands 379 | 380 | 381 | def strips_info(ser, channel): 382 | time.sleep(0.2) 383 | out = bytearray.fromhex("8D0" + str(channel)) 384 | ser.write(out) 385 | time.sleep(1) 386 | out = ser.read(ser.in_waiting).hex() 387 | if out: 388 | r = int(out[-1]) 389 | else: 390 | r = -1 391 | if r <= 0: 392 | r = 1 393 | return r 394 | 395 | 396 | def init(ser): 397 | #C0(ser) 398 | # Took out bytearray([70, 0, 192, 0, 0, 0, 255]) 399 | initial = [bytearray.fromhex("4B" + "00"*124)] 400 | for array in initial: 401 | ser.write(array) 402 | time.sleep(0.2) 403 | ser.read(ser.in_waiting) 404 | 405 | def C0(ser): 406 | while True: 407 | ser.write(bytearray.fromhex("C0")) 408 | if ser.in_waiting != 0: 409 | ser.read() 410 | break 411 | 412 | def write(ser, outputs): 413 | for channel in outputs: 414 | for line in channel: 415 | if line: 416 | ser.write(line) 417 | ser.read() 418 | 419 | 420 | def fixed(ser, gui, channel, color): 421 | 422 | if gui != 0: 423 | color = picker.pick("Color") 424 | 425 | command = create_command(ser, channel, [color], "fixed", 0, 0, 0, 2) 426 | outputs = previous.get_colors(channel, command) 427 | write(ser, outputs) 428 | 429 | 430 | def breathing(ser, gui, channel, color, speed): 431 | 432 | if 1 <= gui <= 8: 433 | color = [] 434 | for i in range(gui): 435 | color.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 436 | 437 | command = create_command(ser, channel, color, "breathing", 0, 0, 0, speed) 438 | 439 | outputs = previous.get_colors(channel, command) 440 | write(ser, outputs) 441 | 442 | 443 | def fading(ser, gui, channel, color, speed): 444 | 445 | if 1 <= gui <= 8: 446 | color = [] 447 | for i in range(gui): 448 | color.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 449 | 450 | command = create_command(ser, channel, color, "fading", 0, 0, 0, speed) 451 | 452 | outputs = previous.get_colors(channel, command) 453 | write(ser, outputs) 454 | 455 | 456 | def marquee(ser, gui, channel, color, speed, size, direction): 457 | 458 | if gui != 0: 459 | gui = 1 460 | for i in range(1): 461 | color = picker.pick("Color "+str(i+1) + " of "+str(gui)) 462 | 463 | command = create_command(ser, channel, [color], "marquee", direction, 0, size, speed) 464 | outputs = previous.get_colors(channel, command) 465 | write(ser, outputs) 466 | 467 | 468 | def cover_marquee(ser, gui, channel, color, speed, direction): 469 | 470 | if 1 <= gui <= 8: 471 | color = [] 472 | for i in range(gui): 473 | color.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 474 | 475 | command = create_command(ser, channel, color, "cover_marquee", direction, 0, 0, speed) 476 | outputs = previous.get_colors(channel, command) 477 | write(ser, outputs) 478 | 479 | 480 | def pulse(ser, gui, channel, color, speed): 481 | 482 | if 1 <= gui <= 8: 483 | color = [] 484 | for i in range(gui): 485 | color.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 486 | 487 | command = create_command(ser, channel, color, "pulse", 0, 0, 0, speed) 488 | outputs = previous.get_colors(channel, command) 489 | write(ser, outputs) 490 | 491 | 492 | def spectrum(ser, channel, speed, direction): 493 | 494 | command = create_command(ser, channel, ["0000FF"], "spectrum", direction, 0, 0, speed) 495 | 496 | outputs = previous.get_colors(channel, command) 497 | write(ser, outputs) 498 | 499 | 500 | def alternating(ser, gui, channel, color, speed, size, moving, direction): 501 | 502 | if gui != 0: 503 | color = [] 504 | gui = 2 505 | for i in range(2): 506 | color.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 507 | 508 | if moving: 509 | option = 1 510 | else: 511 | option = 0 512 | 513 | command = create_command(ser, channel, color, "alternating", direction, option, size, speed) 514 | outputs = previous.get_colors(channel, command) 515 | write(ser, outputs) 516 | 517 | 518 | def candlelight(ser, gui, channel, color): 519 | 520 | if gui != 0: 521 | color = picker.pick("Color") 522 | 523 | command = create_command(ser, channel, [color], "candlelight", 0, 0, 0, 0) 524 | 525 | outputs = previous.get_colors(channel, command) 526 | write(ser, outputs) 527 | 528 | 529 | def wings(ser, gui, channel, color, speed): 530 | 531 | if gui != 0: 532 | color = picker.pick("Color") 533 | 534 | command = create_command(ser, channel, [color], "wings", 0, 0, 0, speed) 535 | outputs = previous.get_colors(channel, command) 536 | write(ser, outputs) 537 | 538 | 539 | def power(ser, channel, state): 540 | if state.lower() == 'on': 541 | fixed(ser, 0, channel, "FFFFFF") 542 | elif state.lower() == 'off': 543 | fixed(ser, 0, channel, "000000") 544 | else: 545 | raise InvalidCommand("No such power state") 546 | 547 | def unitled(ser, state): 548 | outputs = [70, 0, 192, 0, 0, 0, 0] 549 | if state.lower() == 'on': 550 | outputs[6] = 255 551 | elif state.lower() == 'off': 552 | outputs[5] = 255 553 | else: 554 | raise InvalidCommand("No such unit led state") 555 | ser.write(bytearray(outputs)) 556 | ser.read() 557 | 558 | def custom(ser, gui, channel, colors, mode, speed): 559 | strips = [strips_info(ser, 1), strips_info(ser, 2)] 560 | 561 | if mode not in ['fixed', 'breathing', 'wave']: 562 | raise InvalidCommand("No such mode for custom") 563 | 564 | if 1 <= gui <= 40: 565 | colors = [] 566 | for i in range(gui): 567 | colors.append(picker.pick("Color "+str(i+1) + " of "+str(gui))) 568 | 569 | command = create_custom(ser, channel, colors, mode, 0, 0, 0, speed, strips) 570 | outputs = previous.get_colors(channel, command) 571 | write(ser, outputs) 572 | 573 | def animated(ser, channel, colors, speed): 574 | if not inspect.isclass(ser): 575 | ser = serial.Serial(ser, 256000) 576 | strips = [strips_info(ser, 1), strips_info(ser, 2)] 577 | init(ser) 578 | while True: 579 | for round in colors: 580 | command = create_custom(ser, channel, round, "audio", 0, 0, 0, 0, strips) 581 | outputs = previous.get_colors(channel, command) 582 | write(ser, outputs) 583 | sleep(speed / 1000.0) 584 | 585 | 586 | def profile_add(name): 587 | previous.add_profile(name) 588 | 589 | def profile_rm(name): 590 | previous.rm_profile(name) 591 | 592 | def profile_apply(ser, name): 593 | commands = previous.apply_profile(name) 594 | if type(commands) is dict: 595 | return commands 596 | init(ser) 597 | write(ser, commands) 598 | return None 599 | 600 | def write_previous(ser): 601 | write(ser, previous.get_previous()) 602 | 603 | if __name__ == '__main__': 604 | main() 605 | -------------------------------------------------------------------------------- /hue_plus/webcolors.py: -------------------------------------------------------------------------------- 1 | """ 2 | Utility functions for working with the color names and color value 3 | formats defined by the HTML and CSS specifications for use in 4 | documents on the Web. 5 | 6 | See documentation (in docs/ directory of source distribution) for 7 | details of the supported formats, conventions and conversions. 8 | 9 | """ 10 | 11 | # Stylistic notes: 12 | # 13 | # The HTML5 algorithms are implemented as direct translations into 14 | # Python of the descriptions in the spec. This produces somewhat 15 | # un-Pythonic code, but correctness of the implementations is more 16 | # important. 17 | # 18 | # Several other style choices in this module enforce usage or Python 19 | # version support (see documentation in docs/ directory for rationale 20 | # behind Python version support and usage requirements): 21 | # 22 | # * The only Python 2.x version supported is 2.7. Use of a dict 23 | # comprehension in the _reversedict() helper function enforces this 24 | # by causing an import-time syntax error on Python 2.6 and earlier. 25 | # 26 | # * The oldest Python 3.x version supported is 3.3. Use of u-prefixed 27 | # string literals enforces this by causing an import-time syntax 28 | # error on Python 3.0, 3.1 and 3.2. 29 | # 30 | # * Use of this module on Python 3 requires str rather than bytes for 31 | # all string arguments to functions. Use of the format() method for 32 | # string formatting enforces this; as of Python 3.5, formatting with 33 | # % is implemented on bytes objects, but the format() method will 34 | # never be implemented on bytes. 35 | 36 | 37 | import re 38 | import string 39 | import struct 40 | 41 | 42 | __version__ = '1.7' 43 | 44 | 45 | # Python 2's unichr() is Python 3's chr(). 46 | try: # pragma: no cover 47 | unichr # pragma: no cover 48 | except NameError: # pragma: no cover 49 | unichr = chr # pragma: no cover 50 | 51 | # Python 2's unicode is Python 3's str. 52 | try: # pragma: no cover 53 | unicode # pragma: no cover 54 | except NameError: # pragma: no cover 55 | unicode = str # pragma: no cover 56 | 57 | 58 | def _reversedict(d): 59 | """ 60 | Internal helper for generating reverse mappings; given a 61 | dictionary, returns a new dictionary with keys and values swapped. 62 | 63 | """ 64 | return {value: key for key, value in d.items()} 65 | 66 | 67 | HEX_COLOR_RE = re.compile(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$') 68 | 69 | SUPPORTED_SPECIFICATIONS = (u'html4', u'css2', u'css21', u'css3') 70 | 71 | SPECIFICATION_ERROR_TEMPLATE = u'{{spec}} is not a supported specification for color name lookups; \ 72 | supported specifications are: {supported}.'.format( 73 | supported=','.join(SUPPORTED_SPECIFICATIONS) 74 | ) 75 | 76 | 77 | # Mappings of color names to normalized hexadecimal color values. 78 | ################################################################# 79 | 80 | # The HTML 4 named colors. 81 | # 82 | # The canonical source for these color definitions is the HTML 4 83 | # specification: 84 | # 85 | # http://www.w3.org/TR/html401/types.html#h-6.5 86 | # 87 | # The file tests/definitions.py in the source distribution of this 88 | # module downloads a copy of the HTML 4 standard and parses out the 89 | # color names to ensure the values below are correct. 90 | HTML4_NAMES_TO_HEX = { 91 | u'aqua': u'#00ffff', 92 | u'black': u'#000000', 93 | u'blue': u'#0000ff', 94 | u'fuchsia': u'#ff00ff', 95 | u'green': u'#008000', 96 | u'gray': u'#808080', 97 | u'lime': u'#00ff00', 98 | u'maroon': u'#800000', 99 | u'navy': u'#000080', 100 | u'olive': u'#808000', 101 | u'purple': u'#800080', 102 | u'red': u'#ff0000', 103 | u'silver': u'#c0c0c0', 104 | u'teal': u'#008080', 105 | u'white': u'#ffffff', 106 | u'yellow': u'#ffff00', 107 | } 108 | 109 | # CSS 2 used the same list as HTML 4. 110 | CSS2_NAMES_TO_HEX = HTML4_NAMES_TO_HEX 111 | 112 | # CSS 2.1 added orange. 113 | CSS21_NAMES_TO_HEX = dict(HTML4_NAMES_TO_HEX, orange=u'#ffa500') 114 | 115 | # The CSS 3/SVG named colors. 116 | # 117 | # The canonical source for these color definitions is the SVG 118 | # specification's color list (which was adopted as CSS 3's color 119 | # definition): 120 | # 121 | # http://www.w3.org/TR/SVG11/types.html#ColorKeywords 122 | # 123 | # CSS 3 also provides definitions of these colors: 124 | # 125 | # http://www.w3.org/TR/css3-color/#svg-color 126 | # 127 | # SVG provides the definitions as RGB triplets. CSS 3 provides them 128 | # both as RGB triplets and as hexadecimal. Since hex values are more 129 | # common in real-world HTML and CSS, the mapping below is to hex 130 | # values instead. The file tests/definitions.py in the source 131 | # distribution of this module downloads a copy of the CSS 3 color 132 | # module and parses out the color names to ensure the values below are 133 | # correct. 134 | CSS3_NAMES_TO_HEX = { 135 | u'aliceblue': u'#f0f8ff', 136 | u'antiquewhite': u'#faebd7', 137 | u'aqua': u'#00ffff', 138 | u'aquamarine': u'#7fffd4', 139 | u'azure': u'#f0ffff', 140 | u'beige': u'#f5f5dc', 141 | u'bisque': u'#ffe4c4', 142 | u'black': u'#000000', 143 | u'blanchedalmond': u'#ffebcd', 144 | u'blue': u'#0000ff', 145 | u'blueviolet': u'#8a2be2', 146 | u'brown': u'#a52a2a', 147 | u'burlywood': u'#deb887', 148 | u'cadetblue': u'#5f9ea0', 149 | u'chartreuse': u'#7fff00', 150 | u'chocolate': u'#d2691e', 151 | u'coral': u'#ff7f50', 152 | u'cornflowerblue': u'#6495ed', 153 | u'cornsilk': u'#fff8dc', 154 | u'crimson': u'#dc143c', 155 | u'cyan': u'#00ffff', 156 | u'darkblue': u'#00008b', 157 | u'darkcyan': u'#008b8b', 158 | u'darkgoldenrod': u'#b8860b', 159 | u'darkgray': u'#a9a9a9', 160 | u'darkgrey': u'#a9a9a9', 161 | u'darkgreen': u'#006400', 162 | u'darkkhaki': u'#bdb76b', 163 | u'darkmagenta': u'#8b008b', 164 | u'darkolivegreen': u'#556b2f', 165 | u'darkorange': u'#ff8c00', 166 | u'darkorchid': u'#9932cc', 167 | u'darkred': u'#8b0000', 168 | u'darksalmon': u'#e9967a', 169 | u'darkseagreen': u'#8fbc8f', 170 | u'darkslateblue': u'#483d8b', 171 | u'darkslategray': u'#2f4f4f', 172 | u'darkslategrey': u'#2f4f4f', 173 | u'darkturquoise': u'#00ced1', 174 | u'darkviolet': u'#9400d3', 175 | u'deeppink': u'#ff1493', 176 | u'deepskyblue': u'#00bfff', 177 | u'dimgray': u'#696969', 178 | u'dimgrey': u'#696969', 179 | u'dodgerblue': u'#1e90ff', 180 | u'firebrick': u'#b22222', 181 | u'floralwhite': u'#fffaf0', 182 | u'forestgreen': u'#228b22', 183 | u'fuchsia': u'#ff00ff', 184 | u'gainsboro': u'#dcdcdc', 185 | u'ghostwhite': u'#f8f8ff', 186 | u'gold': u'#ffd700', 187 | u'goldenrod': u'#daa520', 188 | u'gray': u'#808080', 189 | u'grey': u'#808080', 190 | u'green': u'#008000', 191 | u'greenyellow': u'#adff2f', 192 | u'honeydew': u'#f0fff0', 193 | u'hotpink': u'#ff69b4', 194 | u'indianred': u'#cd5c5c', 195 | u'indigo': u'#4b0082', 196 | u'ivory': u'#fffff0', 197 | u'khaki': u'#f0e68c', 198 | u'lavender': u'#e6e6fa', 199 | u'lavenderblush': u'#fff0f5', 200 | u'lawngreen': u'#7cfc00', 201 | u'lemonchiffon': u'#fffacd', 202 | u'lightblue': u'#add8e6', 203 | u'lightcoral': u'#f08080', 204 | u'lightcyan': u'#e0ffff', 205 | u'lightgoldenrodyellow': u'#fafad2', 206 | u'lightgray': u'#d3d3d3', 207 | u'lightgrey': u'#d3d3d3', 208 | u'lightgreen': u'#90ee90', 209 | u'lightpink': u'#ffb6c1', 210 | u'lightsalmon': u'#ffa07a', 211 | u'lightseagreen': u'#20b2aa', 212 | u'lightskyblue': u'#87cefa', 213 | u'lightslategray': u'#778899', 214 | u'lightslategrey': u'#778899', 215 | u'lightsteelblue': u'#b0c4de', 216 | u'lightyellow': u'#ffffe0', 217 | u'lime': u'#00ff00', 218 | u'limegreen': u'#32cd32', 219 | u'linen': u'#faf0e6', 220 | u'magenta': u'#ff00ff', 221 | u'maroon': u'#800000', 222 | u'mediumaquamarine': u'#66cdaa', 223 | u'mediumblue': u'#0000cd', 224 | u'mediumorchid': u'#ba55d3', 225 | u'mediumpurple': u'#9370db', 226 | u'mediumseagreen': u'#3cb371', 227 | u'mediumslateblue': u'#7b68ee', 228 | u'mediumspringgreen': u'#00fa9a', 229 | u'mediumturquoise': u'#48d1cc', 230 | u'mediumvioletred': u'#c71585', 231 | u'midnightblue': u'#191970', 232 | u'mintcream': u'#f5fffa', 233 | u'mistyrose': u'#ffe4e1', 234 | u'moccasin': u'#ffe4b5', 235 | u'navajowhite': u'#ffdead', 236 | u'navy': u'#000080', 237 | u'oldlace': u'#fdf5e6', 238 | u'olive': u'#808000', 239 | u'olivedrab': u'#6b8e23', 240 | u'orange': u'#ffa500', 241 | u'orangered': u'#ff4500', 242 | u'orchid': u'#da70d6', 243 | u'palegoldenrod': u'#eee8aa', 244 | u'palegreen': u'#98fb98', 245 | u'paleturquoise': u'#afeeee', 246 | u'palevioletred': u'#db7093', 247 | u'papayawhip': u'#ffefd5', 248 | u'peachpuff': u'#ffdab9', 249 | u'peru': u'#cd853f', 250 | u'pink': u'#ffc0cb', 251 | u'plum': u'#dda0dd', 252 | u'powderblue': u'#b0e0e6', 253 | u'purple': u'#800080', 254 | u'red': u'#ff0000', 255 | u'rosybrown': u'#bc8f8f', 256 | u'royalblue': u'#4169e1', 257 | u'saddlebrown': u'#8b4513', 258 | u'salmon': u'#fa8072', 259 | u'sandybrown': u'#f4a460', 260 | u'seagreen': u'#2e8b57', 261 | u'seashell': u'#fff5ee', 262 | u'sienna': u'#a0522d', 263 | u'silver': u'#c0c0c0', 264 | u'skyblue': u'#87ceeb', 265 | u'slateblue': u'#6a5acd', 266 | u'slategray': u'#708090', 267 | u'slategrey': u'#708090', 268 | u'snow': u'#fffafa', 269 | u'springgreen': u'#00ff7f', 270 | u'steelblue': u'#4682b4', 271 | u'tan': u'#d2b48c', 272 | u'teal': u'#008080', 273 | u'thistle': u'#d8bfd8', 274 | u'tomato': u'#ff6347', 275 | u'turquoise': u'#40e0d0', 276 | u'violet': u'#ee82ee', 277 | u'wheat': u'#f5deb3', 278 | u'white': u'#ffffff', 279 | u'whitesmoke': u'#f5f5f5', 280 | u'yellow': u'#ffff00', 281 | u'yellowgreen': u'#9acd32', 282 | } 283 | 284 | 285 | # Mappings of normalized hexadecimal color values to color names. 286 | ################################################################# 287 | 288 | HTML4_HEX_TO_NAMES = _reversedict(HTML4_NAMES_TO_HEX) 289 | 290 | CSS2_HEX_TO_NAMES = HTML4_HEX_TO_NAMES 291 | 292 | CSS21_HEX_TO_NAMES = _reversedict(CSS21_NAMES_TO_HEX) 293 | 294 | CSS3_HEX_TO_NAMES = _reversedict(CSS3_NAMES_TO_HEX) 295 | 296 | 297 | # Aliases of the above mappings, for backwards compatibility. 298 | ################################################################# 299 | (html4_names_to_hex, 300 | css2_names_to_hex, 301 | css21_names_to_hex, 302 | css3_names_to_hex) = (HTML4_NAMES_TO_HEX, 303 | CSS2_NAMES_TO_HEX, 304 | CSS21_NAMES_TO_HEX, 305 | CSS3_NAMES_TO_HEX) 306 | 307 | (html4_hex_to_names, 308 | css2_hex_to_names, 309 | css21_hex_to_names, 310 | css3_hex_to_names) = (HTML4_HEX_TO_NAMES, 311 | CSS2_HEX_TO_NAMES, 312 | CSS21_HEX_TO_NAMES, 313 | CSS3_HEX_TO_NAMES) 314 | 315 | 316 | # Normalization functions. 317 | ################################################################# 318 | 319 | def normalize_hex(hex_value): 320 | """ 321 | Normalize a hexadecimal color value to 6 digits, lowercase. 322 | 323 | """ 324 | match = HEX_COLOR_RE.match(hex_value) 325 | if match is None: 326 | raise ValueError( 327 | u"'{}' is not a valid hexadecimal color value.".format(hex_value) 328 | ) 329 | hex_digits = match.group(1) 330 | if len(hex_digits) == 3: 331 | hex_digits = u''.join(2 * s for s in hex_digits) 332 | return u'#{}'.format(hex_digits.lower()) 333 | 334 | 335 | def _normalize_integer_rgb(value): 336 | """ 337 | Internal normalization function for clipping integer values into 338 | the permitted range (0-255, inclusive). 339 | 340 | """ 341 | return 0 if value < 0 \ 342 | else 255 if value > 255 \ 343 | else value 344 | 345 | 346 | def normalize_integer_triplet(rgb_triplet): 347 | """ 348 | Normalize an integer ``rgb()`` triplet so that all values are 349 | within the range 0-255 inclusive. 350 | 351 | """ 352 | return tuple(_normalize_integer_rgb(value) for value in rgb_triplet) 353 | 354 | 355 | def _normalize_percent_rgb(value): 356 | """ 357 | Internal normalization function for clipping percent values into 358 | the permitted range (0%-100%, inclusive). 359 | 360 | """ 361 | percent = value.split(u'%')[0] 362 | percent = float(percent) if u'.' in percent else int(percent) 363 | 364 | return u'0%' if percent < 0 \ 365 | else u'100%' if percent > 100 \ 366 | else u'{}%'.format(percent) 367 | 368 | 369 | def normalize_percent_triplet(rgb_triplet): 370 | """ 371 | Normalize a percentage ``rgb()`` triplet so that all values are 372 | within the range 0%-100% inclusive. 373 | 374 | """ 375 | return tuple(_normalize_percent_rgb(value) for value in rgb_triplet) 376 | 377 | 378 | # Conversions from color names to various formats. 379 | ################################################################# 380 | 381 | def name_to_hex(name, spec=u'css3'): 382 | """ 383 | Convert a color name to a normalized hexadecimal color value. 384 | 385 | The optional keyword argument ``spec`` determines which 386 | specification's list of color names will be used; valid values are 387 | ``html4``, ``css2``, ``css21`` and ``css3``, and the default is 388 | ``css3``. 389 | 390 | When no color of that name exists in the given specification, 391 | ``ValueError`` is raised. 392 | 393 | """ 394 | if spec not in SUPPORTED_SPECIFICATIONS: 395 | raise ValueError(SPECIFICATION_ERROR_TEMPLATE.format(spec=spec)) 396 | normalized = name.lower() 397 | hex_value = {u'css2': CSS2_NAMES_TO_HEX, 398 | u'css21': CSS21_NAMES_TO_HEX, 399 | u'css3': CSS3_NAMES_TO_HEX, 400 | u'html4': HTML4_NAMES_TO_HEX}[spec].get(normalized) 401 | if hex_value is None: 402 | raise ValueError( 403 | u"'{name}' is not defined as a named color in {spec}".format( 404 | name=name, spec=spec 405 | ) 406 | ) 407 | return hex_value 408 | 409 | 410 | def name_to_rgb(name, spec=u'css3'): 411 | """ 412 | Convert a color name to a 3-tuple of integers suitable for use in 413 | an ``rgb()`` triplet specifying that color. 414 | 415 | """ 416 | return hex_to_rgb(name_to_hex(name, spec=spec)) 417 | 418 | 419 | def name_to_rgb_percent(name, spec=u'css3'): 420 | """ 421 | Convert a color name to a 3-tuple of percentages suitable for use 422 | in an ``rgb()`` triplet specifying that color. 423 | 424 | """ 425 | return rgb_to_rgb_percent(name_to_rgb(name, spec=spec)) 426 | 427 | 428 | # Conversions from hexadecimal color values to various formats. 429 | ################################################################# 430 | 431 | def hex_to_name(hex_value, spec=u'css3'): 432 | """ 433 | Convert a hexadecimal color value to its corresponding normalized 434 | color name, if any such name exists. 435 | 436 | The optional keyword argument ``spec`` determines which 437 | specification's list of color names will be used; valid values are 438 | ``html4``, ``css2``, ``css21`` and ``css3``, and the default is 439 | ``css3``. 440 | 441 | When no color name for the value is found in the given 442 | specification, ``ValueError`` is raised. 443 | 444 | """ 445 | if spec not in SUPPORTED_SPECIFICATIONS: 446 | raise ValueError(SPECIFICATION_ERROR_TEMPLATE.format(spec=spec)) 447 | normalized = normalize_hex(hex_value) 448 | name = {u'css2': CSS2_HEX_TO_NAMES, 449 | u'css21': CSS21_HEX_TO_NAMES, 450 | u'css3': CSS3_HEX_TO_NAMES, 451 | u'html4': HTML4_HEX_TO_NAMES}[spec].get(normalized) 452 | if name is None: 453 | raise ValueError( 454 | u"'{}' has no defined color name in {}".format(hex_value, spec) 455 | ) 456 | return name 457 | 458 | 459 | def hex_to_rgb(hex_value): 460 | """ 461 | Convert a hexadecimal color value to a 3-tuple of integers 462 | suitable for use in an ``rgb()`` triplet specifying that color. 463 | 464 | """ 465 | hex_value = normalize_hex(hex_value) 466 | hex_value = int(hex_value[1:], 16) 467 | return (hex_value >> 16, 468 | hex_value >> 8 & 0xff, 469 | hex_value & 0xff) 470 | 471 | 472 | def hex_to_rgb_percent(hex_value): 473 | """ 474 | Convert a hexadecimal color value to a 3-tuple of percentages 475 | suitable for use in an ``rgb()`` triplet representing that color. 476 | 477 | """ 478 | return rgb_to_rgb_percent(hex_to_rgb(hex_value)) 479 | 480 | 481 | # Conversions from integer rgb() triplets to various formats. 482 | ################################################################# 483 | 484 | def rgb_to_name(rgb_triplet, spec=u'css3'): 485 | """ 486 | Convert a 3-tuple of integers, suitable for use in an ``rgb()`` 487 | color triplet, to its corresponding normalized color name, if any 488 | such name exists. 489 | 490 | The optional keyword argument ``spec`` determines which 491 | specification's list of color names will be used; valid values are 492 | ``html4``, ``css2``, ``css21`` and ``css3``, and the default is 493 | ``css3``. 494 | 495 | If there is no matching name, ``ValueError`` is raised. 496 | 497 | """ 498 | return hex_to_name( 499 | rgb_to_hex( 500 | normalize_integer_triplet( 501 | rgb_triplet 502 | ) 503 | ), 504 | spec=spec 505 | ) 506 | 507 | 508 | def rgb_to_hex(rgb_triplet): 509 | """ 510 | Convert a 3-tuple of integers, suitable for use in an ``rgb()`` 511 | color triplet, to a normalized hexadecimal value for that color. 512 | 513 | """ 514 | return u'#{:02x}{:02x}{:02x}'.format( 515 | *normalize_integer_triplet( 516 | rgb_triplet 517 | ) 518 | ) 519 | 520 | 521 | def rgb_to_rgb_percent(rgb_triplet): 522 | """ 523 | Convert a 3-tuple of integers, suitable for use in an ``rgb()`` 524 | color triplet, to a 3-tuple of percentages suitable for use in 525 | representing that color. 526 | 527 | This function makes some trade-offs in terms of the accuracy of 528 | the final representation; for some common integer values, 529 | special-case logic is used to ensure a precise result (e.g., 530 | integer 128 will always convert to '50%', integer 32 will always 531 | convert to '12.5%'), but for all other values a standard Python 532 | ``float`` is used and rounded to two decimal places, which may 533 | result in a loss of precision for some values. 534 | 535 | """ 536 | # In order to maintain precision for common values, 537 | # special-case them. 538 | specials = {255: u'100%', 128: u'50%', 64: u'25%', 539 | 32: u'12.5%', 16: u'6.25%', 0: u'0%'} 540 | return tuple(specials.get(d, u'{:.02f}%'.format(d / 255.0 * 100)) 541 | for d in normalize_integer_triplet(rgb_triplet)) 542 | 543 | 544 | # Conversions from percentage rgb() triplets to various formats. 545 | ################################################################# 546 | 547 | def rgb_percent_to_name(rgb_percent_triplet, spec=u'css3'): 548 | """ 549 | Convert a 3-tuple of percentages, suitable for use in an ``rgb()`` 550 | color triplet, to its corresponding normalized color name, if any 551 | such name exists. 552 | 553 | The optional keyword argument ``spec`` determines which 554 | specification's list of color names will be used; valid values are 555 | ``html4``, ``css2``, ``css21`` and ``css3``, and the default is 556 | ``css3``. 557 | 558 | If there is no matching name, ``ValueError`` is raised. 559 | 560 | """ 561 | return rgb_to_name( 562 | rgb_percent_to_rgb( 563 | normalize_percent_triplet( 564 | rgb_percent_triplet 565 | ) 566 | ), 567 | spec=spec 568 | ) 569 | 570 | 571 | def rgb_percent_to_hex(rgb_percent_triplet): 572 | """ 573 | Convert a 3-tuple of percentages, suitable for use in an ``rgb()`` 574 | color triplet, to a normalized hexadecimal color value for that 575 | color. 576 | 577 | """ 578 | return rgb_to_hex( 579 | rgb_percent_to_rgb( 580 | normalize_percent_triplet( 581 | rgb_percent_triplet 582 | ) 583 | ) 584 | ) 585 | 586 | 587 | def _percent_to_integer(percent): 588 | """ 589 | Internal helper for converting a percentage value to an integer 590 | between 0 and 255 inclusive. 591 | 592 | """ 593 | return int( 594 | round( 595 | float(percent.split(u'%')[0]) / 100 * 255 596 | ) 597 | ) 598 | 599 | 600 | def rgb_percent_to_rgb(rgb_percent_triplet): 601 | """ 602 | Convert a 3-tuple of percentages, suitable for use in an ``rgb()`` 603 | color triplet, to a 3-tuple of integers suitable for use in 604 | representing that color. 605 | 606 | Some precision may be lost in this conversion. See the note 607 | regarding precision for ``rgb_to_rgb_percent()`` for details. 608 | 609 | """ 610 | return tuple( 611 | map( 612 | _percent_to_integer, 613 | normalize_percent_triplet( 614 | rgb_percent_triplet 615 | ) 616 | ) 617 | ) 618 | 619 | 620 | # HTML5 color algorithms. 621 | ################################################################# 622 | 623 | # These functions are written in a way that may seem strange to 624 | # developers familiar with Python, because they do not use the most 625 | # efficient or idiomatic way of accomplishing their tasks. This is 626 | # because, for compliance, these functions are written as literal 627 | # translations into Python of the algorithms in HTML5. 628 | # 629 | # For ease of understanding, the relevant steps of the algorithm from 630 | # the standard are included as comments interspersed in the 631 | # implementation. 632 | 633 | def html5_parse_simple_color(input): 634 | """ 635 | Apply the simple color parsing algorithm from section 2.4.6 of 636 | HTML5. 637 | 638 | """ 639 | # 1. Let input be the string being parsed. 640 | # 641 | # 2. If input is not exactly seven characters long, then return an 642 | # error. 643 | if not isinstance(input, unicode) or len(input) != 7: 644 | raise ValueError( 645 | u"An HTML5 simple color must be a Unicode string " 646 | u"exactly seven characters long." 647 | ) 648 | 649 | # 3. If the first character in input is not a U+0023 NUMBER SIGN 650 | # character (#), then return an error. 651 | if not input.startswith('#'): 652 | raise ValueError( 653 | u"An HTML5 simple color must begin with the " 654 | u"character '#' (U+0023)." 655 | ) 656 | 657 | # 4. If the last six characters of input are not all ASCII hex 658 | # digits, then return an error. 659 | if not all(c in string.hexdigits for c in input[1:]): 660 | raise ValueError( 661 | u"An HTML5 simple color must contain exactly six ASCII hex digits." 662 | ) 663 | 664 | # 5. Let result be a simple color. 665 | # 666 | # 6. Interpret the second and third characters as a hexadecimal 667 | # number and let the result be the red component of result. 668 | # 669 | # 7. Interpret the fourth and fifth characters as a hexadecimal 670 | # number and let the result be the green component of result. 671 | # 672 | # 8. Interpret the sixth and seventh characters as a hexadecimal 673 | # number and let the result be the blue component of result. 674 | # 675 | # 9. Return result. 676 | result = (int(input[1:3], 16), 677 | int(input[3:5], 16), 678 | int(input[5:7], 16)) 679 | return result 680 | 681 | 682 | def html5_serialize_simple_color(simple_color): 683 | """ 684 | Apply the serialization algorithm for a simple color from section 685 | 2.4.6 of HTML5. 686 | 687 | """ 688 | red, green, blue = simple_color 689 | 690 | # 1. Let result be a string consisting of a single "#" (U+0023) 691 | # character. 692 | result = u'#' 693 | 694 | # 2. Convert the red, green, and blue components in turn to 695 | # two-digit hexadecimal numbers using lowercase ASCII hex 696 | # digits, zero-padding if necessary, and append these numbers 697 | # to result, in the order red, green, blue. 698 | format_string = '{:02x}' 699 | result += format_string.format(red) 700 | result += format_string.format(green) 701 | result += format_string.format(blue) 702 | 703 | # 3. Return result, which will be a valid lowercase simple color. 704 | return result 705 | 706 | 707 | def html5_parse_legacy_color(input): 708 | """ 709 | Apply the legacy color parsing algorithm from section 2.4.6 of 710 | HTML5. 711 | 712 | """ 713 | # 1. Let input be the string being parsed. 714 | if not isinstance(input, unicode): 715 | raise ValueError( 716 | u"HTML5 legacy color parsing requires a Unicode string as input." 717 | ) 718 | 719 | # 2. If input is the empty string, then return an error. 720 | if input == "": 721 | raise ValueError( 722 | u"HTML5 legacy color parsing forbids empty string as a value." 723 | ) 724 | 725 | # 3. Strip leading and trailing whitespace from input. 726 | input = input.strip() 727 | 728 | # 4. If input is an ASCII case-insensitive match for the string 729 | # "transparent", then return an error. 730 | if input.lower() == u"transparent": 731 | raise ValueError( 732 | u'HTML5 legacy color parsing forbids "transparent" as a value.' 733 | ) 734 | 735 | # 5. If input is an ASCII case-insensitive match for one of the 736 | # keywords listed in the SVG color keywords section of the CSS3 737 | # Color specification, then return the simple color 738 | # corresponding to that keyword. 739 | keyword_hex = CSS3_NAMES_TO_HEX.get(input.lower()) 740 | if keyword_hex is not None: 741 | return html5_parse_simple_color(keyword_hex) 742 | 743 | # 6. If input is four characters long, and the first character in 744 | # input is a "#" (U+0023) character, and the last three 745 | # characters of input are all ASCII hex digits, then run these 746 | # substeps: 747 | if len(input) == 4 and \ 748 | input.startswith(u'#') and \ 749 | all(c in string.hexdigits for c in input[1:]): 750 | # 1. Let result be a simple color. 751 | # 752 | # 2. Interpret the second character of input as a hexadecimal 753 | # digit; let the red component of result be the resulting 754 | # number multiplied by 17. 755 | # 756 | # 3. Interpret the third character of input as a hexadecimal 757 | # digit; let the green component of result be the resulting 758 | # number multiplied by 17. 759 | # 760 | # 4. Interpret the fourth character of input as a hexadecimal 761 | # digit; let the blue component of result be the resulting 762 | # number multiplied by 17. 763 | result = (int(input[1], 16) * 17, 764 | int(input[2], 16) * 17, 765 | int(input[3], 16) * 17) 766 | 767 | # 5. Return result. 768 | return result 769 | 770 | # 7. Replace any characters in input that have a Unicode code 771 | # point greater than U+FFFF (i.e. any characters that are not 772 | # in the basic multilingual plane) with the two-character 773 | # string "00". 774 | 775 | # This one's a bit weird due to the existence of multiple internal 776 | # Unicode string representations in different versions and builds 777 | # of Python. 778 | # 779 | # From Python 2.2 through 3.2, Python could be compiled with 780 | # "narrow" or "wide" Unicode strings (see PEP 261). Narrow builds 781 | # handled Unicode strings with two-byte characters and surrogate 782 | # pairs for non-BMP code points. Wide builds handled Unicode 783 | # strings with four-byte characters and no surrogates. This means 784 | # ord() is only sufficient to identify a non-BMP character on a 785 | # wide build. 786 | # 787 | # Starting with Python 3.3, the internal string representation 788 | # (see PEP 393) is now dynamic, and Python chooses an encoding -- 789 | # either latin-1, UCS-2 or UCS-4 -- wide enough to handle the 790 | # highest code point in the string. 791 | # 792 | # The code below bypasses all of that for a consistently effective 793 | # method: encode the string to little-endian UTF-32, then perform 794 | # a binary unpack of it as four-byte integers. Those integers will 795 | # be the Unicode code points, and from there filtering out non-BMP 796 | # code points is easy. 797 | encoded_input = input.encode('utf_32_le') 798 | 799 | # Format string is '<' (for little-endian byte order), then a 800 | # sequence of 'L' characters (for 4-byte unsigned long integer) 801 | # equal to the length of the original string, which is also 802 | # one-fourth the encoded length. For example, for a six-character 803 | # input the generated format string will be ' 0xffff 807 | else unichr(c) 808 | for c in codepoints) 809 | 810 | # 8. If input is longer than 128 characters, truncate input, 811 | # leaving only the first 128 characters. 812 | if len(input) > 128: 813 | input = input[:128] 814 | 815 | # 9. If the first character in input is a "#" (U+0023) character, 816 | # remove it. 817 | if input.startswith(u'#'): 818 | input = input[1:] 819 | 820 | # 10. Replace any character in input that is not an ASCII hex 821 | # digit with the character "0" (U+0030). 822 | if any(c for c in input if c not in string.hexdigits): 823 | input = ''.join(c if c in string.hexdigits else u'0' for c in input) 824 | 825 | # 11. While input's length is zero or not a multiple of three, 826 | # append a "0" (U+0030) character to input. 827 | while (len(input) == 0) or (len(input) % 3 != 0): 828 | input += u'0' 829 | 830 | # 12. Split input into three strings of equal length, to obtain 831 | # three components. Let length be the length of those 832 | # components (one third the length of input). 833 | length = int(len(input) / 3) 834 | red = input[:length] 835 | green = input[length:length*2] 836 | blue = input[length*2:] 837 | 838 | # 13. If length is greater than 8, then remove the leading 839 | # length-8 characters in each component, and let length be 8. 840 | if length > 8: 841 | red, green, blue = (red[length-8:], 842 | green[length-8:], 843 | blue[length-8:]) 844 | length = 8 845 | 846 | # 14. While length is greater than two and the first character in 847 | # each component is a "0" (U+0030) character, remove that 848 | # character and reduce length by one. 849 | while (length > 2) and (red[0] == u'0' and 850 | green[0] == u'0' and 851 | blue[0] == u'0'): 852 | red, green, blue = (red[1:], 853 | green[1:], 854 | blue[1:]) 855 | length -= 1 856 | 857 | # 15. If length is still greater than two, truncate each 858 | # component, leaving only the first two characters in each. 859 | if length > 2: 860 | red, green, blue = (red[:2], 861 | green[:2], 862 | blue[:2]) 863 | 864 | # 16. Let result be a simple color. 865 | # 866 | # 17. Interpret the first component as a hexadecimal number; let 867 | # the red component of result be the resulting number. 868 | # 869 | # 18. Interpret the second component as a hexadecimal number; let 870 | # the green component of result be the resulting number. 871 | # 872 | # 19. Interpret the third component as a hexadecimal number; let 873 | # the blue component of result be the resulting number. 874 | result = (int(red, 16), 875 | int(green, 16), 876 | int(blue, 16)) 877 | 878 | # 20. Return result. 879 | return result 880 | -------------------------------------------------------------------------------- /hue_plus/hue_ui.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | VERSION="1.4.5" 3 | import sys 4 | import io 5 | import traceback 6 | from time import sleep 7 | import os 8 | import types 9 | import functools 10 | import ctypes 11 | import urllib.request 12 | import multiprocessing 13 | import queue 14 | import datetime 15 | from PyQt5.QtCore import Qt, QTimer 16 | from PyQt5.QtGui import * 17 | from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit, QMessageBox, QColorDialog 18 | from PyQt5.QtWidgets import QTextEdit, QWidget, QMainWindow, QApplication, QListWidgetItem, QTableWidgetItem 19 | 20 | package_import = True 21 | if package_import: 22 | from . import hue_gui 23 | from . import hue 24 | from . import previous 25 | from . import webcolors 26 | else: 27 | import hue_gui 28 | import hue 29 | import previous 30 | import webcolors 31 | #from . import hue_gui # REMEMBER TO CHANGE BACK 32 | #from . import hue 33 | 34 | import serial 35 | from serial.tools import list_ports 36 | 37 | 38 | def is_admin(): 39 | if os.name == 'nt': 40 | # WARNING: requires Windows XP SP2 or higher! 41 | try: 42 | return ctypes.windll.shell32.IsUserAnAdmin() 43 | except: 44 | return False 45 | else: 46 | return True 47 | 48 | def runAsAdmin(): 49 | 50 | if os.name != 'nt': 51 | return 52 | else: 53 | ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, "", None, 1) 54 | 55 | def main(): 56 | #if os.geteuid() != 0: 57 | # sys.exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'.") 58 | #if not is_admin(): 59 | # runAsAdmin() 60 | sys.excepthook = excepthook 61 | app = QApplication(sys.argv) 62 | form = MainWindow() 63 | form.show() 64 | sys.exit(app.exec_()) 65 | 66 | def closest_colour(requested_colour): 67 | min_colours = {} 68 | for key, name in webcolors.css3_hex_to_names.items(): 69 | r_c, g_c, b_c = webcolors.hex_to_rgb(key) 70 | rd = (r_c - requested_colour[0]) ** 2 71 | gd = (g_c - requested_colour[1]) ** 2 72 | bd = (b_c - requested_colour[2]) ** 2 73 | min_colours[(rd + gd + bd)] = name 74 | return min_colours[min(min_colours.keys())] 75 | 76 | def get_colour_name(requested_colour): 77 | try: 78 | closest_name = actual_name = webcolors.rgb_to_name(requested_colour) 79 | except ValueError: 80 | closest_name = closest_colour(requested_colour) 81 | actual_name = None 82 | return actual_name, closest_name 83 | 84 | def find_between( s, first, last ): 85 | try: 86 | start = s.index( first ) + len( first ) 87 | end = s.index( last, start ) 88 | return s[start:end] 89 | except ValueError: 90 | return "" 91 | 92 | def pick(n): 93 | c = QColorDialog.getColor() 94 | if c.isValid(): 95 | return c.name()[1:].upper() 96 | 97 | def versiontuple(v): 98 | return tuple(map(int, (v.split(".")))) 99 | 100 | def time_in_range(start, end, x): 101 | """Return true if x is in the range [start, end]""" 102 | if start <= end: 103 | return start <= x <= end 104 | else: 105 | return start <= x or x <= end 106 | 107 | class MainWindow(QMainWindow, hue_gui.Ui_MainWindow): 108 | def __init__(self): 109 | super(MainWindow, self).__init__() 110 | self.setupUi(self) 111 | 112 | self.indexApply = { 113 | 0: self.fixedApply, 114 | 1: self.breathingApply, 115 | 2: self.fadingApply, 116 | 3: self.marqueeApply, 117 | 4: self.coverMarqueeApply, 118 | 5: self.pulseApply, 119 | 6: self.spectrumApply, 120 | 7: self.alternatingApply, 121 | 8: self.candleApply, 122 | 9: self.wingsApply, 123 | 10: self.audioLevelApply, 124 | 11: self.customApply, 125 | 12: self.profileApply, 126 | 13: self.animatedApply 127 | } 128 | 129 | self.animatedColors = [] 130 | 131 | self.unitLEDBtn.clicked.connect(self.toggleUnitLED) 132 | 133 | self.fixedAdd.clicked.connect(self.fixedAddFunc) 134 | self.fixedDelete.clicked.connect(self.fixedDeleteFunc) 135 | self.breathingAdd.clicked.connect(self.breathingAddFunc) 136 | self.breathingDelete.clicked.connect(self.breathingDeleteFunc) 137 | self.fadingAdd.clicked.connect(self.fadingAddFunc) 138 | self.fadingDelete.clicked.connect(self.fadingDeleteFunc) 139 | self.marqueeAdd.clicked.connect(self.marqueeAddFunc) 140 | self.marqueeDelete.clicked.connect(self.marqueeDeleteFunc) 141 | self.coverMarqueeAdd.clicked.connect(self.coverMarqueeAddFunc) 142 | self.coverMarqueeDelete.clicked.connect(self.coverMarqueeDeleteFunc) 143 | self.pulseAdd.clicked.connect(self.pulseAddFunc) 144 | self.pulseDelete.clicked.connect(self.pulseDeleteFunc) 145 | self.alternatingAdd.clicked.connect(self.alternatingAddFunc) 146 | self.alternatingDelete.clicked.connect(self.alternatingDeleteFunc) 147 | self.candleAdd.clicked.connect(self.candleAddFunc) 148 | self.candleDelete.clicked.connect(self.candleDeleteFunc) 149 | self.wingsAdd.clicked.connect(self.wingsAddFunc) 150 | self.wingsDelete.clicked.connect(self.wingsDeleteFunc) 151 | self.audioLevelAdd.clicked.connect(self.audioLevelAddFunc) 152 | self.audioLevelDelete.clicked.connect(self.audioLevelDeleteFunc) 153 | self.customEdit.clicked.connect(self.customEditFunc) 154 | self.profileAdd.clicked.connect(self.profileAddFunc) 155 | self.profileDelete.clicked.connect(self.profileDeleteFunc) 156 | self.profileRefresh.clicked.connect(self.profileListFunc) 157 | self.animatedAdd.clicked.connect(self.animatedAddFunc) 158 | self.animatedDelete.clicked.connect(self.animatedDeleteFunc) 159 | self.animatedEdit.clicked.connect(self.animatedEditFunc) 160 | self.animatedList.itemSelectionChanged.connect(self.animatedRoundChangeFunc) 161 | self.applyBtn.clicked.connect(self.applyFunc) 162 | 163 | self.timeSave.clicked.connect(self.timeSaveFunc) 164 | 165 | self.populateCustom() 166 | self.populateAnimated() 167 | 168 | if os.name == 'nt': 169 | self.portTxt.setText('COM3') 170 | self.update() 171 | port = self.get_port() 172 | if port: 173 | self.portTxt.setText(self.get_port()) 174 | 175 | self.profileListFunc() 176 | 177 | try: 178 | with serial.Serial(self.portTxt.text(), 256000) as ser: 179 | hue.write_previous(ser) 180 | except serial.serialutil.SerialException: 181 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 182 | 183 | times = previous.get_times() 184 | self.offTime.setText(times[0]) 185 | self.onTime.setText(times[1]) 186 | self.offTimeTxt = times[0] 187 | self.onTimeTxt = times[1] 188 | 189 | self.doneOff = False 190 | self.doneOn = False 191 | self.timer = QTimer() 192 | self.timer.timeout.connect(self.timeDaemon) 193 | self.timer.start(1000*60) 194 | 195 | self.audioThread = None 196 | self.animatedThread = None 197 | 198 | self.unitLED = 'on' 199 | 200 | def closeEvent(self, event): 201 | self.checkAudio() 202 | event.accept() 203 | 204 | def error(self, message): 205 | msg = QMessageBox() 206 | msg.setText(message) 207 | msg.setStandardButtons(QMessageBox.Ok) 208 | out = msg.exec_() 209 | 210 | def get_port(self): 211 | ports = [] 212 | for port in list_ports.comports(): 213 | if 'MCP2200' in port[1] or 'USB Serial Device' in port[1] or 'USB Serial Port' in port[1]: 214 | ports.append(port[0]) 215 | if ports: 216 | return ports[0] 217 | else: 218 | return None 219 | 220 | def checkAudio(self): 221 | if self.audioThread: 222 | if self.audioThread.is_alive(): 223 | self.audioThread.terminate() 224 | sleep(0.1) 225 | if self.animatedThread: 226 | if self.animatedThread.is_alive(): 227 | self.animatedThread.terminate() 228 | sleep(0.1) 229 | 230 | def update(self): 231 | with urllib.request.urlopen('https://raw.githubusercontent.com/kusti8/hue-plus/master/version') as response: 232 | version_new = response.read().strip() 233 | if versiontuple(version_new.decode()) > versiontuple(VERSION): 234 | self.error("There is a new update available. Download it from https://github.com/kusti8/hue-plus") 235 | 236 | def getChannel(self): 237 | if self.channel1Check.isChecked() and self.channel2Check.isChecked(): 238 | return 0 239 | elif self.channel1Check.isChecked(): 240 | return 1 241 | elif self.channel2Check.isChecked(): 242 | return 2 243 | else: 244 | return None 245 | 246 | def getColors(self, modeList): 247 | colors = [] 248 | for i in range(modeList.count()): 249 | colors.append(find_between(modeList.item(i).text(), '#', ')').upper()) 250 | if modeList.count() == 0: 251 | self.error("Must have at least one color") 252 | return ['FF0000'] 253 | return colors 254 | 255 | def toggleUnitLED(self): 256 | if self.unitLED == 'on': 257 | self.unitLED = 'off' 258 | else: 259 | self.unitLED = 'on' 260 | 261 | with serial.Serial(self.portTxt.text(), 256000) as ser: 262 | hue.unitled(ser, self.unitLED) 263 | 264 | def timeDaemon(self): 265 | pre = previous.list_profile() 266 | if 'previous' in pre: 267 | pre = 'previous' 268 | else: 269 | return 270 | if self.onTimeTxt != "00:00" and self.offTimeTxt != "00:00": 271 | onTime = datetime.datetime.strptime(self.onTimeTxt, '%H:%M').time() 272 | offTime = datetime.datetime.strptime(self.offTimeTxt, '%H:%M').time() 273 | 274 | 275 | if time_in_range(offTime, onTime, datetime.datetime.now().time()): 276 | if not self.doneOff: 277 | self.checkAudio() 278 | try: 279 | with serial.Serial(self.portTxt.text(), 256000) as ser: 280 | print("Turning off") 281 | hue.power(ser, 0, 'off') 282 | hue.unitled(ser, 'off') 283 | self.doneOff = True 284 | self.doneOn = False 285 | except serial.serialutil.SerialException: 286 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 287 | else: 288 | if not self.doneOn: 289 | self.checkAudio() 290 | try: 291 | with serial.Serial(self.portTxt.text(), 256000) as ser: 292 | print("Turning on") 293 | hue.profile_apply(ser, pre) 294 | hue.unitled(ser, 'on') 295 | self.doneOn = True 296 | self.doneOff = False 297 | except serial.serialutil.SerialException: 298 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 299 | 300 | ## Time 301 | def timeSaveFunc(self): 302 | self.onTimeTxt = self.onTime.text() 303 | self.offTimeTxt = self.offTime.text() 304 | previous.apply_times([self.offTimeTxt, self.onTimeTxt]) 305 | 306 | ## Fixed 307 | def fixedAddFunc(self): 308 | if self.fixedList.count() == 1: 309 | self.error("Fixed cannot have more than one color") 310 | else: 311 | hex_color = pick("Color") 312 | if hex_color is None: 313 | return 314 | color = "#" + hex_color.lower() 315 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 316 | if not actual: 317 | actual = closest 318 | self.fixedList.addItem(QListWidgetItem(actual + "(" + color + ")")) 319 | 320 | def fixedDeleteFunc(self): 321 | self.fixedList.takeItem(self.fixedList.currentRow()) 322 | 323 | def fixedApply(self): 324 | self.checkAudio() 325 | try: 326 | with serial.Serial(self.portTxt.text(), 256000) as ser: 327 | print("Applying") 328 | if self.getChannel() == None: 329 | hue.power(ser, 0, "off") 330 | else: 331 | hue.fixed(ser, 0, self.getChannel(), self.getColors(self.fixedList)[0]) 332 | except serial.serialutil.SerialException: 333 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 334 | 335 | ## Breathing 336 | def breathingAddFunc(self): 337 | color = "#" + pick("Color").lower() 338 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 339 | if not actual: 340 | actual = closest 341 | self.breathingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 342 | 343 | def breathingDeleteFunc(self): 344 | self.breathingList.takeItem(self.breathingList.currentRow()) 345 | 346 | def breathingApply(self): 347 | self.checkAudio() 348 | try: 349 | with serial.Serial(self.portTxt.text(), 256000) as ser: 350 | if self.getChannel() == None: 351 | hue.power(ser, 0, "off") 352 | else: 353 | speed = self.breathingSpeed.value() 354 | hue.breathing(ser, 0, self.getChannel(), self.getColors(self.breathingList), speed) 355 | except serial.serialutil.SerialException: 356 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 357 | 358 | ## Fading 359 | def fadingAddFunc(self): 360 | hex_color = pick("Color") 361 | if hex_color is None: 362 | return 363 | color = "#" + hex_color.lower() 364 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 365 | if not actual: 366 | actual = closest 367 | self.fadingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 368 | 369 | def fadingDeleteFunc(self): 370 | self.fadingList.takeItem(self.fadingList.currentRow()) 371 | 372 | def fadingApply(self): 373 | self.checkAudio() 374 | try: 375 | with serial.Serial(self.portTxt.text(), 256000) as ser: 376 | if self.getChannel() == None: 377 | hue.power(ser, 0, "off") 378 | else: 379 | speed = self.fadingSpeed.value() 380 | hue.fading(ser, 0, self.getChannel(), self.getColors(self.fadingList), speed) 381 | except serial.serialutil.SerialException: 382 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 383 | 384 | ## Marquee 385 | def marqueeAddFunc(self): 386 | if self.marqueeList.count() == 1: 387 | self.error("Marquee cannot have more than one color") 388 | else: 389 | hex_color = pick("Color") 390 | if hex_color is None: 391 | return 392 | color = "#" + hex_color.lower() 393 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 394 | if not actual: 395 | actual = closest 396 | self.marqueeList.addItem(QListWidgetItem(actual + "(" + color + ")")) 397 | 398 | def marqueeDeleteFunc(self): 399 | self.marqueeList.takeItem(self.marqueeList.currentRow()) 400 | 401 | def marqueeApply(self): 402 | self.checkAudio() 403 | try: 404 | with serial.Serial(self.portTxt.text(), 256000) as ser: 405 | if self.getChannel() == None: 406 | hue.power(ser, 0, "off") 407 | else: 408 | speed = self.marqueeSpeed.value() 409 | size = self.marqueeSize.value() 410 | direction = 0 if self.marqueeBackwards.isChecked() else 0 411 | hue.marquee(ser, 0, self.getChannel(), self.getColors(self.marqueeList)[0], speed, size, direction) 412 | except serial.serialutil.SerialException: 413 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 414 | 415 | ## coverMarquee 416 | def coverMarqueeAddFunc(self): 417 | hex_color = pick("Color") 418 | if hex_color is None: 419 | return 420 | color = "#" + hex_color.lower() 421 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 422 | if not actual: 423 | actual = closest 424 | self.coverMarqueeList.addItem(QListWidgetItem(actual + "(" + color + ")")) 425 | 426 | def coverMarqueeDeleteFunc(self): 427 | self.coverMarqueeList.takeItem(self.coverMarqueeList.currentRow()) 428 | 429 | def coverMarqueeApply(self): 430 | self.checkAudio() 431 | try: 432 | with serial.Serial(self.portTxt.text(), 256000) as ser: 433 | if self.getChannel() == None: 434 | hue.power(ser, 0, "off") 435 | else: 436 | speed = self.coverMarqueeSpeed.value() 437 | direction = 0 if self.coverMarqueeBackwards.isChecked() else 0 438 | hue.cover_marquee(ser, 0, self.getChannel(), self.getColors(self.coverMarqueeList), speed, direction) 439 | except serial.serialutil.SerialException: 440 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 441 | 442 | ## pulse 443 | def pulseAddFunc(self): 444 | color = "#" + pick("Color").lower() 445 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 446 | if not actual: 447 | actual = closest 448 | self.pulseList.addItem(QListWidgetItem(actual + "(" + color + ")")) 449 | 450 | def pulseDeleteFunc(self): 451 | self.pulseList.takeItem(self.pulseList.currentRow()) 452 | 453 | def pulseApply(self): 454 | self.checkAudio() 455 | try: 456 | with serial.Serial(self.portTxt.text(), 256000) as ser: 457 | if self.getChannel() == None: 458 | hue.power(ser, 0, "off") 459 | else: 460 | speed = self.pulseSpeed.value() 461 | hue.pulse(ser, 0, self.getChannel(), self.getColors(self.pulseList), speed) 462 | except serial.serialutil.SerialException: 463 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 464 | 465 | ## spectrum 466 | def spectrumApply(self): 467 | self.checkAudio() 468 | try: 469 | with serial.Serial(self.portTxt.text(), 256000) as ser: 470 | if self.getChannel() == None: 471 | hue.power(ser, 0, "off") 472 | else: 473 | speed = self.spectrumSpeed.value() 474 | direction = 1 if self.spectrumBackwards.isChecked() else 0 475 | hue.spectrum(ser, self.getChannel(), speed, direction) 476 | except serial.serialutil.SerialException: 477 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 478 | 479 | ## alternating 480 | def alternatingAddFunc(self): 481 | if self.alternatingList.count() == 2: 482 | self.error("Alternating cannot have more than two colors") 483 | else: 484 | hex_color = pick("Color") 485 | if hex_color is None: 486 | return 487 | color = "#" + hex_color.lower() 488 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 489 | if not actual: 490 | actual = closest 491 | self.alternatingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 492 | 493 | def alternatingDeleteFunc(self): 494 | self.alternatingList.takeItem(self.alternatingList.currentRow()) 495 | 496 | def alternatingApply(self): 497 | self.checkAudio() 498 | try: 499 | if self.alternatingList.count() != 2: 500 | self.error("Alternating must have two colors") 501 | else: 502 | with serial.Serial(self.portTxt.text(), 256000) as ser: 503 | if self.getChannel() == None: 504 | hue.power(ser, 0, "off") 505 | else: 506 | speed = self.alternatingSpeed.value() 507 | size = self.alternatingSize.value() 508 | direction = 1 if self.alternatingBackwards.isChecked() else 0 509 | moving = self.alternatingMoving.isChecked() 510 | hue.alternating(ser, 0, self.getChannel(), self.getColors(self.alternatingList), speed, size, moving, direction) 511 | except serial.serialutil.SerialException: 512 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 513 | ## candle 514 | def candleAddFunc(self): 515 | if self.candleList.count() == 1: 516 | self.error("Candle cannot have more than 1 color") 517 | else: 518 | hex_color = pick("Color") 519 | if hex_color is None: 520 | return 521 | color = "#" + hex_color.lower() 522 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 523 | if not actual: 524 | actual = closest 525 | self.candleList.addItem(QListWidgetItem(actual + "(" + color + ")")) 526 | 527 | def candleDeleteFunc(self): 528 | self.candleList.takeItem(self.candleList.currentRow()) 529 | 530 | def candleApply(self): 531 | self.checkAudio() 532 | try: 533 | with serial.Serial(self.portTxt.text(), 256000) as ser: 534 | if self.getChannel() == None: 535 | hue.power(ser, 0, "off") 536 | else: 537 | hue.candlelight(ser, 0, self.getChannel(), self.getColors(self.candleList)[0]) 538 | except serial.serialutil.SerialException: 539 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 540 | 541 | ## wings 542 | def wingsAddFunc(self): 543 | if self.wingsList.count() == 1: 544 | self.error("Wings cannot have more than 1 color") 545 | else: 546 | hex_color = pick("Color") 547 | if hex_color is None: 548 | return 549 | color = "#" + hex_color.lower() 550 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 551 | if not actual: 552 | actual = closest 553 | self.wingsList.addItem(QListWidgetItem(actual + "(" + color + ")")) 554 | 555 | def wingsDeleteFunc(self): 556 | self.wingsList.takeItem(self.wingsList.currentRow()) 557 | 558 | def wingsApply(self): 559 | self.checkAudio() 560 | try: 561 | with serial.Serial(self.portTxt.text(), 256000) as ser: 562 | if self.getChannel() == None: 563 | hue.power(ser, 0, "off") 564 | else: 565 | speed = self.wingsSpeed.value() 566 | hue.wings(ser, 0, self.getChannel(), self.getColors(self.wingsList)[0], speed) 567 | except serial.serialutil.SerialException: 568 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 569 | 570 | ## audio_level 571 | def audioLevelAddFunc(self): 572 | hex_color = pick("Color") 573 | if hex_color is None: 574 | return 575 | color = "#" + hex_color.lower() 576 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 577 | if not actual: 578 | actual = closest 579 | self.audioLevelList.addItem(QListWidgetItem(actual + "(" + color + ")")) 580 | 581 | def audioLevelDeleteFunc(self): 582 | self.audioLevelList.takeItem(self.audioLevelList.currentRow()) 583 | 584 | def audioLevelApply(self): 585 | if os.name == 'nt': 586 | self.error("To enable audio mode on Windows, right click on the audio icon, go to recording devices, right click and select show disabled devices, and right click on stereo mix and click enable.") 587 | self.checkAudio() 588 | try: 589 | ser = serial.Serial(self.portTxt.text(), 256000) 590 | if self.getChannel() == None: 591 | hue.power(ser, 0, "off") 592 | else: 593 | tolerance = float(self.audioLevelTolerance.value()) 594 | smooth = int(self.audioLevelSmooth.value()) 595 | self.audioThread = multiprocessing.Process(target=hue.audio_level, args=(self.portTxt.text(), 0, self.getChannel(), self.getColors(self.audioLevelList), tolerance, smooth)) 596 | self.audioThread.start() 597 | except serial.serialutil.SerialException: 598 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 599 | 600 | ## profile 601 | def profileAddFunc(self): 602 | if self.animatedThread: 603 | if self.animatedThread.is_alive(): 604 | previous.write(customs={'name': self.profileName.text(),'colors': self.animatedColors, 'speed': self.animatedSpeed.value()}) 605 | else: 606 | hue.profile_add(self.profileName.text()) 607 | else: 608 | hue.profile_add(self.profileName.text()) 609 | self.profileList.addItem(QListWidgetItem(self.profileName.text())) 610 | 611 | def profileDeleteFunc(self): 612 | hue.profile_rm(self.profileList.currentItem().text()) 613 | self.audioLevelList.takeItem(self.profileList.currentRow()) 614 | self.profileListFunc() 615 | 616 | def profileApply(self): 617 | self.checkAudio() 618 | try: 619 | with serial.Serial(self.portTxt.text(), 256000) as ser: 620 | if self.getChannel() == None: 621 | hue.power(ser, 0, "off") 622 | else: 623 | out = hue.profile_apply(ser, self.profileList.currentItem().text()) 624 | except serial.serialutil.SerialException: 625 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 626 | 627 | if out: 628 | self.animatedColors = out['colors'] 629 | self.animatedSpeed.setValue(out['speed']) 630 | self.animatedApply() 631 | 632 | def profileListFunc(self): 633 | self.profileList.clear() 634 | profiles = previous.list_profile() 635 | if profiles: 636 | for p in profiles: 637 | self.profileList.addItem(QListWidgetItem(p)) 638 | 639 | def applyFunc(self): 640 | self.indexApply[self.presetModeWidget.currentIndex()]() 641 | 642 | # custom 643 | def populateCustom(self): 644 | actual, closest = get_colour_name(webcolors.hex_to_rgb('#FFFFFF')) 645 | if not actual: 646 | actual = closest 647 | for i in range(40): 648 | self.customTable.setItem(i, 0, QTableWidgetItem(str(i+1))) 649 | self.customTable.setItem(i, 1, QTableWidgetItem(actual + '(#FFFFFF)')) 650 | 651 | def customEditFunc(self): 652 | hex_color = pick("Color") 653 | if hex_color is None: 654 | return 655 | color = "#" + hex_color.lower() 656 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 657 | if not actual: 658 | actual = closest 659 | 660 | for widgetItem in self.customTable.selectedItems(): 661 | if widgetItem.column() != 0: 662 | widgetItem.setText(actual + "(" + color + ")") 663 | widgetItem.setBackground(QColor(*webcolors.hex_to_rgb(color))) 664 | 665 | def customGetColors(self): 666 | colors = [] 667 | for i in range(40): 668 | colors.append(find_between(self.customTable.item(i, 1).text(), '#', ')').upper()) 669 | return colors 670 | 671 | def customApply(self): 672 | self.checkAudio() 673 | try: 674 | with serial.Serial(self.portTxt.text(), 256000) as ser: 675 | if self.getChannel() == None: 676 | hue.power(ser, 0, "off") 677 | else: 678 | speed = self.customSpeed.value() 679 | hue.custom(ser, 0, self.getChannel(), self.customGetColors(), self.customMode.currentText().lower(), speed) 680 | except serial.serialutil.SerialException: 681 | self.error("Serial port is invalid. Try /dev/ttyACM0 for Linux or COM3 or COM4 for Windows") 682 | 683 | # Animated 684 | def populateAnimated(self): 685 | actual, closest = get_colour_name(webcolors.hex_to_rgb('#FFFFFF')) 686 | if not actual: 687 | actual = closest 688 | for i in range(40): 689 | self.animatedTable.setItem(i, 0, QTableWidgetItem(str(i+1))) 690 | self.animatedTable.setItem(i, 1, QTableWidgetItem(actual + '(#FFFFFF)')) 691 | 692 | def populateAnimatedColors(self, colors): 693 | for index, i in enumerate(colors): 694 | actual, closest = get_colour_name(webcolors.hex_to_rgb('#' + i)) 695 | if not actual: 696 | actual = closest 697 | self.animatedTable.setItem(index, 0, QTableWidgetItem(str(index+1))) 698 | self.animatedTable.setItem(index, 1, QTableWidgetItem(actual + '(#' + i + ')')) 699 | self.animatedTable.item(index, 1).setBackground(QColor(*webcolors.hex_to_rgb('#' + i))) 700 | 701 | def animatedEditFunc(self): 702 | hex_color = pick("Color") 703 | if hex_color is None: 704 | return 705 | color = "#" + hex_color.lower() 706 | actual, closest = get_colour_name(webcolors.hex_to_rgb(color)) 707 | if not actual: 708 | actual = closest 709 | 710 | for widgetItem in self.animatedTable.selectedItems(): 711 | if widgetItem.column() != 0: 712 | widgetItem.setText(actual + "(" + color + ")") 713 | widgetItem.setBackground(QColor(*webcolors.hex_to_rgb(color))) 714 | if self.animatedList.currentRow() != -1: 715 | self.animatedColors[self.animatedList.currentRow()][widgetItem.row()] = color[1:] 716 | 717 | def animatedGetColors(self): 718 | colors = [] 719 | for i in range(40): 720 | colors.append(find_between(self.animatedTable.item(i, 1).text(), '#', ')').upper()) 721 | return colors 722 | 723 | def animatedAddFunc(self): 724 | self.animatedList.addItem(QListWidgetItem(self.animatedRoundName.text())) 725 | self.animatedColors.append(['FFFFFF'] * 40) 726 | 727 | def animatedDeleteFunc(self): 728 | self.animatedList.takeItem(self.animatedList.currentRow()) 729 | self.animatedColors.pop(self.animatedList.currentRow()) 730 | 731 | def animatedRoundChangeFunc(self): 732 | self.populateAnimatedColors(self.animatedColors[self.animatedList.currentRow()]) 733 | 734 | def animatedApply(self): 735 | self.checkAudio() 736 | self.animatedThread = multiprocessing.Process(target=hue.animated, args=(self.portTxt.text(), self.getChannel(), self.animatedColors, self.animatedSpeed.value())) 737 | self.animatedThread.start() 738 | 739 | 740 | def excepthook(excType, excValue, tracebackobj): 741 | """Rewritten "excepthook" function, to display a message box with details about the exception. 742 | @param excType exception type 743 | @param excValue exception value 744 | @param tracebackobj traceback object 745 | """ 746 | separator = '-' * 40 747 | notice = "An unhandled exception has occurred\n" 748 | 749 | tbinfofile = io.StringIO() 750 | traceback.print_tb(tracebackobj, None, tbinfofile) 751 | tbinfofile.seek(0) 752 | tbinfo = tbinfofile.read() 753 | errmsg = '%s: \n%s' % (str(excType), str(excValue)) 754 | sections = [separator, errmsg, separator, tbinfo] 755 | msg = '\n'.join(sections) 756 | 757 | # Create a QMessagebox 758 | error_box = QMessageBox() 759 | 760 | error_box.setText(str(notice)+str(msg)) 761 | error_box.setWindowTitle("Hue-plus - unhandled exception") 762 | error_box.setIcon(QMessageBox.Critical) 763 | error_box.setStandardButtons(QMessageBox.Ok) 764 | error_box.setTextInteractionFlags(Qt.TextSelectableByMouse) 765 | 766 | # Show the window 767 | error_box.exec_() 768 | sys.exit(1) 769 | 770 | if __name__ == '__main__': 771 | main() 772 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /hue_plus/hue_gui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'hue-gui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.8.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | from PyQt5 import QtCore, QtGui, QtWidgets 10 | 11 | class Ui_MainWindow(object): 12 | def setupUi(self, MainWindow): 13 | MainWindow.setObjectName("MainWindow") 14 | MainWindow.resize(1161, 620) 15 | self.centralwidget = QtWidgets.QWidget(MainWindow) 16 | self.centralwidget.setObjectName("centralwidget") 17 | self.channel1Check = QtWidgets.QCheckBox(self.centralwidget) 18 | self.channel1Check.setGeometry(QtCore.QRect(10, 10, 161, 17)) 19 | self.channel1Check.setChecked(True) 20 | self.channel1Check.setObjectName("channel1Check") 21 | self.channel2Check = QtWidgets.QCheckBox(self.centralwidget) 22 | self.channel2Check.setGeometry(QtCore.QRect(10, 30, 151, 17)) 23 | self.channel2Check.setChecked(True) 24 | self.channel2Check.setObjectName("channel2Check") 25 | self.modeWidget = QtWidgets.QTabWidget(self.centralwidget) 26 | self.modeWidget.setGeometry(QtCore.QRect(10, 60, 1131, 451)) 27 | self.modeWidget.setObjectName("modeWidget") 28 | self.presetTab = QtWidgets.QWidget() 29 | self.presetTab.setObjectName("presetTab") 30 | self.presetModeWidget = QtWidgets.QTabWidget(self.presetTab) 31 | self.presetModeWidget.setGeometry(QtCore.QRect(6, 10, 1101, 411)) 32 | self.presetModeWidget.setLayoutDirection(QtCore.Qt.LeftToRight) 33 | self.presetModeWidget.setObjectName("presetModeWidget") 34 | self.fixedTab = QtWidgets.QWidget() 35 | self.fixedTab.setObjectName("fixedTab") 36 | self.groupBox = QtWidgets.QGroupBox(self.fixedTab) 37 | self.groupBox.setGeometry(QtCore.QRect(0, 0, 231, 361)) 38 | self.groupBox.setObjectName("groupBox") 39 | self.fixedList = QtWidgets.QListWidget(self.groupBox) 40 | self.fixedList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 41 | self.fixedList.setObjectName("fixedList") 42 | self.fixedAdd = QtWidgets.QPushButton(self.groupBox) 43 | self.fixedAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 44 | self.fixedAdd.setObjectName("fixedAdd") 45 | self.fixedDelete = QtWidgets.QPushButton(self.groupBox) 46 | self.fixedDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 47 | self.fixedDelete.setObjectName("fixedDelete") 48 | self.presetModeWidget.addTab(self.fixedTab, "") 49 | self.breathingTab = QtWidgets.QWidget() 50 | self.breathingTab.setObjectName("breathingTab") 51 | self.groupBox_2 = QtWidgets.QGroupBox(self.breathingTab) 52 | self.groupBox_2.setGeometry(QtCore.QRect(0, 0, 231, 361)) 53 | self.groupBox_2.setObjectName("groupBox_2") 54 | self.breathingList = QtWidgets.QListWidget(self.groupBox_2) 55 | self.breathingList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 56 | self.breathingList.setObjectName("breathingList") 57 | self.breathingAdd = QtWidgets.QPushButton(self.groupBox_2) 58 | self.breathingAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 59 | self.breathingAdd.setObjectName("breathingAdd") 60 | self.breathingDelete = QtWidgets.QPushButton(self.groupBox_2) 61 | self.breathingDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 62 | self.breathingDelete.setObjectName("breathingDelete") 63 | self.groupBox_11 = QtWidgets.QGroupBox(self.breathingTab) 64 | self.groupBox_11.setGeometry(QtCore.QRect(240, 0, 321, 361)) 65 | self.groupBox_11.setObjectName("groupBox_11") 66 | self.breathingSpeed = QtWidgets.QSlider(self.groupBox_11) 67 | self.breathingSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 68 | self.breathingSpeed.setMaximum(4) 69 | self.breathingSpeed.setProperty("value", 2) 70 | self.breathingSpeed.setOrientation(QtCore.Qt.Vertical) 71 | self.breathingSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 72 | self.breathingSpeed.setObjectName("breathingSpeed") 73 | self.label_2 = QtWidgets.QLabel(self.groupBox_11) 74 | self.label_2.setGeometry(QtCore.QRect(10, 40, 62, 20)) 75 | self.label_2.setObjectName("label_2") 76 | self.label_4 = QtWidgets.QLabel(self.groupBox_11) 77 | self.label_4.setGeometry(QtCore.QRect(70, 60, 62, 20)) 78 | self.label_4.setObjectName("label_4") 79 | self.label_5 = QtWidgets.QLabel(self.groupBox_11) 80 | self.label_5.setGeometry(QtCore.QRect(70, 210, 62, 20)) 81 | self.label_5.setObjectName("label_5") 82 | self.presetModeWidget.addTab(self.breathingTab, "") 83 | self.fadingTab = QtWidgets.QWidget() 84 | self.fadingTab.setObjectName("fadingTab") 85 | self.groupBox_3 = QtWidgets.QGroupBox(self.fadingTab) 86 | self.groupBox_3.setGeometry(QtCore.QRect(0, 0, 231, 361)) 87 | self.groupBox_3.setObjectName("groupBox_3") 88 | self.fadingList = QtWidgets.QListWidget(self.groupBox_3) 89 | self.fadingList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 90 | self.fadingList.setObjectName("fadingList") 91 | self.fadingAdd = QtWidgets.QPushButton(self.groupBox_3) 92 | self.fadingAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 93 | self.fadingAdd.setObjectName("fadingAdd") 94 | self.fadingDelete = QtWidgets.QPushButton(self.groupBox_3) 95 | self.fadingDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 96 | self.fadingDelete.setObjectName("fadingDelete") 97 | self.groupBox_12 = QtWidgets.QGroupBox(self.fadingTab) 98 | self.groupBox_12.setGeometry(QtCore.QRect(240, 0, 321, 361)) 99 | self.groupBox_12.setObjectName("groupBox_12") 100 | self.fadingSpeed = QtWidgets.QSlider(self.groupBox_12) 101 | self.fadingSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 102 | self.fadingSpeed.setMaximum(4) 103 | self.fadingSpeed.setProperty("value", 2) 104 | self.fadingSpeed.setOrientation(QtCore.Qt.Vertical) 105 | self.fadingSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 106 | self.fadingSpeed.setObjectName("fadingSpeed") 107 | self.label_9 = QtWidgets.QLabel(self.groupBox_12) 108 | self.label_9.setGeometry(QtCore.QRect(10, 40, 62, 20)) 109 | self.label_9.setObjectName("label_9") 110 | self.label_10 = QtWidgets.QLabel(self.groupBox_12) 111 | self.label_10.setGeometry(QtCore.QRect(70, 60, 62, 20)) 112 | self.label_10.setObjectName("label_10") 113 | self.label_11 = QtWidgets.QLabel(self.groupBox_12) 114 | self.label_11.setGeometry(QtCore.QRect(70, 210, 62, 20)) 115 | self.label_11.setObjectName("label_11") 116 | self.presetModeWidget.addTab(self.fadingTab, "") 117 | self.marqueeTab = QtWidgets.QWidget() 118 | self.marqueeTab.setObjectName("marqueeTab") 119 | self.groupBox_4 = QtWidgets.QGroupBox(self.marqueeTab) 120 | self.groupBox_4.setGeometry(QtCore.QRect(0, 0, 231, 361)) 121 | self.groupBox_4.setObjectName("groupBox_4") 122 | self.marqueeList = QtWidgets.QListWidget(self.groupBox_4) 123 | self.marqueeList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 124 | self.marqueeList.setObjectName("marqueeList") 125 | self.marqueeAdd = QtWidgets.QPushButton(self.groupBox_4) 126 | self.marqueeAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 127 | self.marqueeAdd.setObjectName("marqueeAdd") 128 | self.marqueeDelete = QtWidgets.QPushButton(self.groupBox_4) 129 | self.marqueeDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 130 | self.marqueeDelete.setObjectName("marqueeDelete") 131 | self.groupBox_13 = QtWidgets.QGroupBox(self.marqueeTab) 132 | self.groupBox_13.setGeometry(QtCore.QRect(240, 0, 321, 361)) 133 | self.groupBox_13.setObjectName("groupBox_13") 134 | self.marqueeSpeed = QtWidgets.QSlider(self.groupBox_13) 135 | self.marqueeSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 136 | self.marqueeSpeed.setMaximum(4) 137 | self.marqueeSpeed.setProperty("value", 2) 138 | self.marqueeSpeed.setOrientation(QtCore.Qt.Vertical) 139 | self.marqueeSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 140 | self.marqueeSpeed.setObjectName("marqueeSpeed") 141 | self.label_15 = QtWidgets.QLabel(self.groupBox_13) 142 | self.label_15.setGeometry(QtCore.QRect(10, 40, 62, 20)) 143 | self.label_15.setObjectName("label_15") 144 | self.label_16 = QtWidgets.QLabel(self.groupBox_13) 145 | self.label_16.setGeometry(QtCore.QRect(70, 60, 62, 20)) 146 | self.label_16.setObjectName("label_16") 147 | self.label_17 = QtWidgets.QLabel(self.groupBox_13) 148 | self.label_17.setGeometry(QtCore.QRect(70, 210, 62, 20)) 149 | self.label_17.setObjectName("label_17") 150 | self.marqueeSize = QtWidgets.QSlider(self.groupBox_13) 151 | self.marqueeSize.setGeometry(QtCore.QRect(185, 70, 31, 160)) 152 | self.marqueeSize.setMaximum(3) 153 | self.marqueeSize.setProperty("value", 2) 154 | self.marqueeSize.setOrientation(QtCore.Qt.Vertical) 155 | self.marqueeSize.setTickPosition(QtWidgets.QSlider.TicksBothSides) 156 | self.marqueeSize.setObjectName("marqueeSize") 157 | self.label_18 = QtWidgets.QLabel(self.groupBox_13) 158 | self.label_18.setGeometry(QtCore.QRect(240, 210, 62, 20)) 159 | self.label_18.setObjectName("label_18") 160 | self.label_19 = QtWidgets.QLabel(self.groupBox_13) 161 | self.label_19.setGeometry(QtCore.QRect(180, 40, 62, 20)) 162 | self.label_19.setObjectName("label_19") 163 | self.label_20 = QtWidgets.QLabel(self.groupBox_13) 164 | self.label_20.setGeometry(QtCore.QRect(240, 60, 62, 20)) 165 | self.label_20.setObjectName("label_20") 166 | self.marqueeBackwards = QtWidgets.QCheckBox(self.groupBox_13) 167 | self.marqueeBackwards.setGeometry(QtCore.QRect(20, 260, 89, 26)) 168 | self.marqueeBackwards.setObjectName("marqueeBackwards") 169 | self.presetModeWidget.addTab(self.marqueeTab, "") 170 | self.coverMarqueeTab = QtWidgets.QWidget() 171 | self.coverMarqueeTab.setObjectName("coverMarqueeTab") 172 | self.groupBox_5 = QtWidgets.QGroupBox(self.coverMarqueeTab) 173 | self.groupBox_5.setGeometry(QtCore.QRect(0, 0, 231, 361)) 174 | self.groupBox_5.setObjectName("groupBox_5") 175 | self.coverMarqueeList = QtWidgets.QListWidget(self.groupBox_5) 176 | self.coverMarqueeList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 177 | self.coverMarqueeList.setObjectName("coverMarqueeList") 178 | self.coverMarqueeAdd = QtWidgets.QPushButton(self.groupBox_5) 179 | self.coverMarqueeAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 180 | self.coverMarqueeAdd.setObjectName("coverMarqueeAdd") 181 | self.coverMarqueeDelete = QtWidgets.QPushButton(self.groupBox_5) 182 | self.coverMarqueeDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 183 | self.coverMarqueeDelete.setObjectName("coverMarqueeDelete") 184 | self.groupBox_15 = QtWidgets.QGroupBox(self.coverMarqueeTab) 185 | self.groupBox_15.setGeometry(QtCore.QRect(240, 0, 321, 361)) 186 | self.groupBox_15.setObjectName("groupBox_15") 187 | self.coverMarqueeSpeed = QtWidgets.QSlider(self.groupBox_15) 188 | self.coverMarqueeSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 189 | self.coverMarqueeSpeed.setMaximum(4) 190 | self.coverMarqueeSpeed.setProperty("value", 2) 191 | self.coverMarqueeSpeed.setOrientation(QtCore.Qt.Vertical) 192 | self.coverMarqueeSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 193 | self.coverMarqueeSpeed.setObjectName("coverMarqueeSpeed") 194 | self.label_27 = QtWidgets.QLabel(self.groupBox_15) 195 | self.label_27.setGeometry(QtCore.QRect(10, 40, 62, 20)) 196 | self.label_27.setObjectName("label_27") 197 | self.label_28 = QtWidgets.QLabel(self.groupBox_15) 198 | self.label_28.setGeometry(QtCore.QRect(70, 60, 62, 20)) 199 | self.label_28.setObjectName("label_28") 200 | self.label_29 = QtWidgets.QLabel(self.groupBox_15) 201 | self.label_29.setGeometry(QtCore.QRect(70, 210, 62, 20)) 202 | self.label_29.setObjectName("label_29") 203 | self.coverMarqueeBackwards = QtWidgets.QCheckBox(self.groupBox_15) 204 | self.coverMarqueeBackwards.setGeometry(QtCore.QRect(20, 260, 89, 26)) 205 | self.coverMarqueeBackwards.setObjectName("coverMarqueeBackwards") 206 | self.presetModeWidget.addTab(self.coverMarqueeTab, "") 207 | self.pulseTab = QtWidgets.QWidget() 208 | self.pulseTab.setObjectName("pulseTab") 209 | self.groupBox_6 = QtWidgets.QGroupBox(self.pulseTab) 210 | self.groupBox_6.setGeometry(QtCore.QRect(0, 0, 231, 361)) 211 | self.groupBox_6.setObjectName("groupBox_6") 212 | self.pulseList = QtWidgets.QListWidget(self.groupBox_6) 213 | self.pulseList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 214 | self.pulseList.setObjectName("pulseList") 215 | self.pulseAdd = QtWidgets.QPushButton(self.groupBox_6) 216 | self.pulseAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 217 | self.pulseAdd.setObjectName("pulseAdd") 218 | self.pulseDelete = QtWidgets.QPushButton(self.groupBox_6) 219 | self.pulseDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 220 | self.pulseDelete.setObjectName("pulseDelete") 221 | self.groupBox_16 = QtWidgets.QGroupBox(self.pulseTab) 222 | self.groupBox_16.setGeometry(QtCore.QRect(240, 0, 321, 361)) 223 | self.groupBox_16.setObjectName("groupBox_16") 224 | self.pulseSpeed = QtWidgets.QSlider(self.groupBox_16) 225 | self.pulseSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 226 | self.pulseSpeed.setMaximum(4) 227 | self.pulseSpeed.setProperty("value", 2) 228 | self.pulseSpeed.setOrientation(QtCore.Qt.Vertical) 229 | self.pulseSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 230 | self.pulseSpeed.setObjectName("pulseSpeed") 231 | self.label_33 = QtWidgets.QLabel(self.groupBox_16) 232 | self.label_33.setGeometry(QtCore.QRect(10, 40, 62, 20)) 233 | self.label_33.setObjectName("label_33") 234 | self.label_34 = QtWidgets.QLabel(self.groupBox_16) 235 | self.label_34.setGeometry(QtCore.QRect(70, 60, 62, 20)) 236 | self.label_34.setObjectName("label_34") 237 | self.label_35 = QtWidgets.QLabel(self.groupBox_16) 238 | self.label_35.setGeometry(QtCore.QRect(70, 210, 62, 20)) 239 | self.label_35.setObjectName("label_35") 240 | self.presetModeWidget.addTab(self.pulseTab, "") 241 | self.spectrumTab = QtWidgets.QWidget() 242 | self.spectrumTab.setObjectName("spectrumTab") 243 | self.groupBox_17 = QtWidgets.QGroupBox(self.spectrumTab) 244 | self.groupBox_17.setGeometry(QtCore.QRect(0, 0, 321, 361)) 245 | self.groupBox_17.setObjectName("groupBox_17") 246 | self.spectrumSpeed = QtWidgets.QSlider(self.groupBox_17) 247 | self.spectrumSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 248 | self.spectrumSpeed.setMaximum(4) 249 | self.spectrumSpeed.setProperty("value", 2) 250 | self.spectrumSpeed.setOrientation(QtCore.Qt.Vertical) 251 | self.spectrumSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 252 | self.spectrumSpeed.setObjectName("spectrumSpeed") 253 | self.label_39 = QtWidgets.QLabel(self.groupBox_17) 254 | self.label_39.setGeometry(QtCore.QRect(10, 40, 62, 20)) 255 | self.label_39.setObjectName("label_39") 256 | self.label_40 = QtWidgets.QLabel(self.groupBox_17) 257 | self.label_40.setGeometry(QtCore.QRect(70, 60, 62, 20)) 258 | self.label_40.setObjectName("label_40") 259 | self.label_41 = QtWidgets.QLabel(self.groupBox_17) 260 | self.label_41.setGeometry(QtCore.QRect(70, 210, 62, 20)) 261 | self.label_41.setObjectName("label_41") 262 | self.spectrumBackwards = QtWidgets.QCheckBox(self.groupBox_17) 263 | self.spectrumBackwards.setGeometry(QtCore.QRect(20, 260, 89, 26)) 264 | self.spectrumBackwards.setObjectName("spectrumBackwards") 265 | self.presetModeWidget.addTab(self.spectrumTab, "") 266 | self.alternatingTab = QtWidgets.QWidget() 267 | self.alternatingTab.setObjectName("alternatingTab") 268 | self.groupBox_7 = QtWidgets.QGroupBox(self.alternatingTab) 269 | self.groupBox_7.setGeometry(QtCore.QRect(0, 0, 231, 361)) 270 | self.groupBox_7.setObjectName("groupBox_7") 271 | self.alternatingList = QtWidgets.QListWidget(self.groupBox_7) 272 | self.alternatingList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 273 | self.alternatingList.setObjectName("alternatingList") 274 | self.alternatingAdd = QtWidgets.QPushButton(self.groupBox_7) 275 | self.alternatingAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 276 | self.alternatingAdd.setObjectName("alternatingAdd") 277 | self.alternatingDelete = QtWidgets.QPushButton(self.groupBox_7) 278 | self.alternatingDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 279 | self.alternatingDelete.setObjectName("alternatingDelete") 280 | self.groupBox_18 = QtWidgets.QGroupBox(self.alternatingTab) 281 | self.groupBox_18.setGeometry(QtCore.QRect(240, 0, 321, 361)) 282 | self.groupBox_18.setObjectName("groupBox_18") 283 | self.alternatingSpeed = QtWidgets.QSlider(self.groupBox_18) 284 | self.alternatingSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 285 | self.alternatingSpeed.setMaximum(4) 286 | self.alternatingSpeed.setProperty("value", 2) 287 | self.alternatingSpeed.setOrientation(QtCore.Qt.Vertical) 288 | self.alternatingSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 289 | self.alternatingSpeed.setObjectName("alternatingSpeed") 290 | self.label_45 = QtWidgets.QLabel(self.groupBox_18) 291 | self.label_45.setGeometry(QtCore.QRect(10, 40, 62, 20)) 292 | self.label_45.setObjectName("label_45") 293 | self.label_46 = QtWidgets.QLabel(self.groupBox_18) 294 | self.label_46.setGeometry(QtCore.QRect(70, 60, 62, 20)) 295 | self.label_46.setObjectName("label_46") 296 | self.label_47 = QtWidgets.QLabel(self.groupBox_18) 297 | self.label_47.setGeometry(QtCore.QRect(70, 210, 62, 20)) 298 | self.label_47.setObjectName("label_47") 299 | self.alternatingSize = QtWidgets.QSlider(self.groupBox_18) 300 | self.alternatingSize.setGeometry(QtCore.QRect(185, 70, 31, 160)) 301 | self.alternatingSize.setMaximum(3) 302 | self.alternatingSize.setProperty("value", 2) 303 | self.alternatingSize.setOrientation(QtCore.Qt.Vertical) 304 | self.alternatingSize.setTickPosition(QtWidgets.QSlider.TicksBothSides) 305 | self.alternatingSize.setObjectName("alternatingSize") 306 | self.label_48 = QtWidgets.QLabel(self.groupBox_18) 307 | self.label_48.setGeometry(QtCore.QRect(240, 210, 62, 20)) 308 | self.label_48.setObjectName("label_48") 309 | self.label_49 = QtWidgets.QLabel(self.groupBox_18) 310 | self.label_49.setGeometry(QtCore.QRect(180, 40, 62, 20)) 311 | self.label_49.setObjectName("label_49") 312 | self.label_50 = QtWidgets.QLabel(self.groupBox_18) 313 | self.label_50.setGeometry(QtCore.QRect(240, 60, 62, 20)) 314 | self.label_50.setObjectName("label_50") 315 | self.alternatingBackwards = QtWidgets.QCheckBox(self.groupBox_18) 316 | self.alternatingBackwards.setGeometry(QtCore.QRect(20, 260, 89, 26)) 317 | self.alternatingBackwards.setObjectName("alternatingBackwards") 318 | self.alternatingMoving = QtWidgets.QCheckBox(self.groupBox_18) 319 | self.alternatingMoving.setGeometry(QtCore.QRect(20, 290, 89, 26)) 320 | self.alternatingMoving.setObjectName("alternatingMoving") 321 | self.presetModeWidget.addTab(self.alternatingTab, "") 322 | self.candleTab = QtWidgets.QWidget() 323 | self.candleTab.setObjectName("candleTab") 324 | self.groupBox_8 = QtWidgets.QGroupBox(self.candleTab) 325 | self.groupBox_8.setGeometry(QtCore.QRect(0, 0, 231, 361)) 326 | self.groupBox_8.setObjectName("groupBox_8") 327 | self.candleList = QtWidgets.QListWidget(self.groupBox_8) 328 | self.candleList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 329 | self.candleList.setObjectName("candleList") 330 | self.candleAdd = QtWidgets.QPushButton(self.groupBox_8) 331 | self.candleAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 332 | self.candleAdd.setObjectName("candleAdd") 333 | self.candleDelete = QtWidgets.QPushButton(self.groupBox_8) 334 | self.candleDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 335 | self.candleDelete.setObjectName("candleDelete") 336 | self.presetModeWidget.addTab(self.candleTab, "") 337 | self.wingsTab = QtWidgets.QWidget() 338 | self.wingsTab.setObjectName("wingsTab") 339 | self.groupBox_9 = QtWidgets.QGroupBox(self.wingsTab) 340 | self.groupBox_9.setGeometry(QtCore.QRect(0, 0, 231, 361)) 341 | self.groupBox_9.setObjectName("groupBox_9") 342 | self.wingsList = QtWidgets.QListWidget(self.groupBox_9) 343 | self.wingsList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 344 | self.wingsList.setObjectName("wingsList") 345 | self.wingsAdd = QtWidgets.QPushButton(self.groupBox_9) 346 | self.wingsAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 347 | self.wingsAdd.setObjectName("wingsAdd") 348 | self.wingsDelete = QtWidgets.QPushButton(self.groupBox_9) 349 | self.wingsDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 350 | self.wingsDelete.setObjectName("wingsDelete") 351 | self.groupBox_20 = QtWidgets.QGroupBox(self.wingsTab) 352 | self.groupBox_20.setGeometry(QtCore.QRect(240, 0, 321, 361)) 353 | self.groupBox_20.setObjectName("groupBox_20") 354 | self.wingsSpeed = QtWidgets.QSlider(self.groupBox_20) 355 | self.wingsSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 356 | self.wingsSpeed.setMaximum(4) 357 | self.wingsSpeed.setProperty("value", 2) 358 | self.wingsSpeed.setOrientation(QtCore.Qt.Vertical) 359 | self.wingsSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 360 | self.wingsSpeed.setObjectName("wingsSpeed") 361 | self.label_57 = QtWidgets.QLabel(self.groupBox_20) 362 | self.label_57.setGeometry(QtCore.QRect(10, 40, 62, 20)) 363 | self.label_57.setObjectName("label_57") 364 | self.label_58 = QtWidgets.QLabel(self.groupBox_20) 365 | self.label_58.setGeometry(QtCore.QRect(70, 60, 62, 20)) 366 | self.label_58.setObjectName("label_58") 367 | self.label_59 = QtWidgets.QLabel(self.groupBox_20) 368 | self.label_59.setGeometry(QtCore.QRect(70, 210, 62, 20)) 369 | self.label_59.setObjectName("label_59") 370 | self.presetModeWidget.addTab(self.wingsTab, "") 371 | self.audioLevelTab = QtWidgets.QWidget() 372 | self.audioLevelTab.setObjectName("audioLevelTab") 373 | self.groupBox_21 = QtWidgets.QGroupBox(self.audioLevelTab) 374 | self.groupBox_21.setGeometry(QtCore.QRect(240, 0, 321, 361)) 375 | self.groupBox_21.setObjectName("groupBox_21") 376 | self.label_60 = QtWidgets.QLabel(self.groupBox_21) 377 | self.label_60.setGeometry(QtCore.QRect(10, 30, 62, 20)) 378 | self.label_60.setObjectName("label_60") 379 | self.label_61 = QtWidgets.QLabel(self.groupBox_21) 380 | self.label_61.setGeometry(QtCore.QRect(10, 80, 81, 20)) 381 | self.label_61.setObjectName("label_61") 382 | self.audioLevelTolerance = QtWidgets.QDoubleSpinBox(self.groupBox_21) 383 | self.audioLevelTolerance.setGeometry(QtCore.QRect(10, 50, 68, 23)) 384 | self.audioLevelTolerance.setDecimals(1) 385 | self.audioLevelTolerance.setProperty("value", 1.0) 386 | self.audioLevelTolerance.setObjectName("audioLevelTolerance") 387 | self.audioLevelSmooth = QtWidgets.QDoubleSpinBox(self.groupBox_21) 388 | self.audioLevelSmooth.setGeometry(QtCore.QRect(10, 100, 68, 23)) 389 | self.audioLevelSmooth.setDecimals(0) 390 | self.audioLevelSmooth.setProperty("value", 3.0) 391 | self.audioLevelSmooth.setObjectName("audioLevelSmooth") 392 | self.groupBox_10 = QtWidgets.QGroupBox(self.audioLevelTab) 393 | self.groupBox_10.setGeometry(QtCore.QRect(0, 0, 231, 361)) 394 | self.groupBox_10.setObjectName("groupBox_10") 395 | self.audioLevelList = QtWidgets.QListWidget(self.groupBox_10) 396 | self.audioLevelList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 397 | self.audioLevelList.setObjectName("audioLevelList") 398 | self.audioLevelAdd = QtWidgets.QPushButton(self.groupBox_10) 399 | self.audioLevelAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 400 | self.audioLevelAdd.setObjectName("audioLevelAdd") 401 | self.audioLevelDelete = QtWidgets.QPushButton(self.groupBox_10) 402 | self.audioLevelDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 403 | self.audioLevelDelete.setObjectName("audioLevelDelete") 404 | self.presetModeWidget.addTab(self.audioLevelTab, "") 405 | self.customTab = QtWidgets.QWidget() 406 | self.customTab.setObjectName("customTab") 407 | self.groupBox_22 = QtWidgets.QGroupBox(self.customTab) 408 | self.groupBox_22.setGeometry(QtCore.QRect(630, 0, 321, 371)) 409 | self.groupBox_22.setObjectName("groupBox_22") 410 | self.customSpeed = QtWidgets.QSlider(self.groupBox_22) 411 | self.customSpeed.setGeometry(QtCore.QRect(15, 70, 31, 160)) 412 | self.customSpeed.setMaximum(4) 413 | self.customSpeed.setProperty("value", 2) 414 | self.customSpeed.setOrientation(QtCore.Qt.Vertical) 415 | self.customSpeed.setTickPosition(QtWidgets.QSlider.TicksBothSides) 416 | self.customSpeed.setObjectName("customSpeed") 417 | self.label_62 = QtWidgets.QLabel(self.groupBox_22) 418 | self.label_62.setGeometry(QtCore.QRect(10, 40, 62, 20)) 419 | self.label_62.setObjectName("label_62") 420 | self.label_63 = QtWidgets.QLabel(self.groupBox_22) 421 | self.label_63.setGeometry(QtCore.QRect(70, 60, 62, 20)) 422 | self.label_63.setObjectName("label_63") 423 | self.label_64 = QtWidgets.QLabel(self.groupBox_22) 424 | self.label_64.setGeometry(QtCore.QRect(70, 210, 62, 20)) 425 | self.label_64.setObjectName("label_64") 426 | self.customMode = QtWidgets.QComboBox(self.groupBox_22) 427 | self.customMode.setGeometry(QtCore.QRect(190, 70, 86, 25)) 428 | self.customMode.setObjectName("customMode") 429 | self.customMode.addItem("") 430 | self.customMode.addItem("") 431 | self.customMode.addItem("") 432 | self.label_65 = QtWidgets.QLabel(self.groupBox_22) 433 | self.label_65.setGeometry(QtCore.QRect(190, 40, 62, 20)) 434 | self.label_65.setObjectName("label_65") 435 | self.groupBox_19 = QtWidgets.QGroupBox(self.customTab) 436 | self.groupBox_19.setGeometry(QtCore.QRect(0, 0, 611, 371)) 437 | self.groupBox_19.setObjectName("groupBox_19") 438 | self.customTable = QtWidgets.QTableWidget(self.groupBox_19) 439 | self.customTable.setGeometry(QtCore.QRect(10, 30, 471, 331)) 440 | self.customTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 441 | self.customTable.setDragDropOverwriteMode(False) 442 | self.customTable.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) 443 | self.customTable.setRowCount(40) 444 | self.customTable.setColumnCount(2) 445 | self.customTable.setObjectName("customTable") 446 | item = QtWidgets.QTableWidgetItem() 447 | self.customTable.setHorizontalHeaderItem(0, item) 448 | item = QtWidgets.QTableWidgetItem() 449 | self.customTable.setHorizontalHeaderItem(1, item) 450 | self.customTable.verticalHeader().setVisible(False) 451 | self.customEdit = QtWidgets.QPushButton(self.groupBox_19) 452 | self.customEdit.setGeometry(QtCore.QRect(500, 40, 83, 28)) 453 | self.customEdit.setObjectName("customEdit") 454 | self.presetModeWidget.addTab(self.customTab, "") 455 | self.profileTab = QtWidgets.QWidget() 456 | self.profileTab.setObjectName("profileTab") 457 | self.groupBox_14 = QtWidgets.QGroupBox(self.profileTab) 458 | self.groupBox_14.setGeometry(QtCore.QRect(0, 0, 421, 361)) 459 | self.groupBox_14.setObjectName("groupBox_14") 460 | self.profileList = QtWidgets.QListWidget(self.groupBox_14) 461 | self.profileList.setGeometry(QtCore.QRect(10, 50, 111, 291)) 462 | self.profileList.setObjectName("profileList") 463 | self.profileAdd = QtWidgets.QPushButton(self.groupBox_14) 464 | self.profileAdd.setGeometry(QtCore.QRect(130, 50, 83, 28)) 465 | self.profileAdd.setObjectName("profileAdd") 466 | self.profileDelete = QtWidgets.QPushButton(self.groupBox_14) 467 | self.profileDelete.setGeometry(QtCore.QRect(130, 90, 83, 28)) 468 | self.profileDelete.setObjectName("profileDelete") 469 | self.profileRefresh = QtWidgets.QPushButton(self.groupBox_14) 470 | self.profileRefresh.setGeometry(QtCore.QRect(130, 130, 83, 28)) 471 | self.profileRefresh.setObjectName("profileRefresh") 472 | self.profileName = QtWidgets.QLineEdit(self.groupBox_14) 473 | self.profileName.setGeometry(QtCore.QRect(300, 50, 113, 28)) 474 | self.profileName.setObjectName("profileName") 475 | self.label_3 = QtWidgets.QLabel(self.groupBox_14) 476 | self.label_3.setGeometry(QtCore.QRect(220, 50, 62, 20)) 477 | self.label_3.setObjectName("label_3") 478 | self.presetModeWidget.addTab(self.profileTab, "") 479 | self.animatedTab = QtWidgets.QWidget() 480 | self.animatedTab.setObjectName("animatedTab") 481 | self.groupBox_23 = QtWidgets.QGroupBox(self.animatedTab) 482 | self.groupBox_23.setGeometry(QtCore.QRect(0, 0, 721, 371)) 483 | self.groupBox_23.setObjectName("groupBox_23") 484 | self.animatedTable = QtWidgets.QTableWidget(self.groupBox_23) 485 | self.animatedTable.setGeometry(QtCore.QRect(230, 30, 361, 331)) 486 | self.animatedTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 487 | self.animatedTable.setDragDropOverwriteMode(False) 488 | self.animatedTable.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) 489 | self.animatedTable.setRowCount(40) 490 | self.animatedTable.setColumnCount(2) 491 | self.animatedTable.setObjectName("animatedTable") 492 | item = QtWidgets.QTableWidgetItem() 493 | self.animatedTable.setHorizontalHeaderItem(0, item) 494 | item = QtWidgets.QTableWidgetItem() 495 | self.animatedTable.setHorizontalHeaderItem(1, item) 496 | self.animatedTable.verticalHeader().setVisible(False) 497 | self.animatedEdit = QtWidgets.QPushButton(self.groupBox_23) 498 | self.animatedEdit.setGeometry(QtCore.QRect(610, 40, 83, 28)) 499 | self.animatedEdit.setObjectName("animatedEdit") 500 | self.animatedList = QtWidgets.QListWidget(self.groupBox_23) 501 | self.animatedList.setGeometry(QtCore.QRect(10, 40, 111, 291)) 502 | self.animatedList.setObjectName("animatedList") 503 | self.animatedDelete = QtWidgets.QPushButton(self.groupBox_23) 504 | self.animatedDelete.setGeometry(QtCore.QRect(130, 80, 83, 28)) 505 | self.animatedDelete.setObjectName("animatedDelete") 506 | self.animatedAdd = QtWidgets.QPushButton(self.groupBox_23) 507 | self.animatedAdd.setGeometry(QtCore.QRect(130, 40, 83, 28)) 508 | self.animatedAdd.setObjectName("animatedAdd") 509 | self.animatedRoundName = QtWidgets.QLineEdit(self.groupBox_23) 510 | self.animatedRoundName.setGeometry(QtCore.QRect(130, 120, 81, 25)) 511 | self.animatedRoundName.setObjectName("animatedRoundName") 512 | self.groupBox_24 = QtWidgets.QGroupBox(self.animatedTab) 513 | self.groupBox_24.setGeometry(QtCore.QRect(740, 0, 331, 371)) 514 | self.groupBox_24.setObjectName("groupBox_24") 515 | self.label_66 = QtWidgets.QLabel(self.groupBox_24) 516 | self.label_66.setGeometry(QtCore.QRect(10, 40, 201, 20)) 517 | self.label_66.setObjectName("label_66") 518 | self.animatedSpeed = QtWidgets.QDoubleSpinBox(self.groupBox_24) 519 | self.animatedSpeed.setGeometry(QtCore.QRect(10, 70, 68, 26)) 520 | self.animatedSpeed.setDecimals(0) 521 | self.animatedSpeed.setMinimum(15.0) 522 | self.animatedSpeed.setMaximum(5000.0) 523 | self.animatedSpeed.setSingleStep(10.0) 524 | self.animatedSpeed.setProperty("value", 50.0) 525 | self.animatedSpeed.setObjectName("animatedSpeed") 526 | self.label_21 = QtWidgets.QLabel(self.groupBox_24) 527 | self.label_21.setGeometry(QtCore.QRect(40, 130, 261, 71)) 528 | self.label_21.setWordWrap(True) 529 | self.label_21.setObjectName("label_21") 530 | self.presetModeWidget.addTab(self.animatedTab, "") 531 | self.modeWidget.addTab(self.presetTab, "") 532 | self.timesTab = QtWidgets.QWidget() 533 | self.timesTab.setObjectName("timesTab") 534 | self.label_7 = QtWidgets.QLabel(self.timesTab) 535 | self.label_7.setGeometry(QtCore.QRect(30, 20, 461, 17)) 536 | self.label_7.setObjectName("label_7") 537 | self.offTime = QtWidgets.QLineEdit(self.timesTab) 538 | self.offTime.setGeometry(QtCore.QRect(30, 40, 113, 25)) 539 | self.offTime.setObjectName("offTime") 540 | self.onTime = QtWidgets.QLineEdit(self.timesTab) 541 | self.onTime.setGeometry(QtCore.QRect(30, 100, 113, 25)) 542 | self.onTime.setObjectName("onTime") 543 | self.label_8 = QtWidgets.QLabel(self.timesTab) 544 | self.label_8.setGeometry(QtCore.QRect(30, 80, 461, 17)) 545 | self.label_8.setObjectName("label_8") 546 | self.label_12 = QtWidgets.QLabel(self.timesTab) 547 | self.label_12.setGeometry(QtCore.QRect(160, 50, 131, 17)) 548 | self.label_12.setObjectName("label_12") 549 | self.label_13 = QtWidgets.QLabel(self.timesTab) 550 | self.label_13.setGeometry(QtCore.QRect(160, 110, 131, 17)) 551 | self.label_13.setObjectName("label_13") 552 | self.label_14 = QtWidgets.QLabel(self.timesTab) 553 | self.label_14.setGeometry(QtCore.QRect(30, 140, 341, 111)) 554 | font = QtGui.QFont() 555 | font.setPointSize(11) 556 | self.label_14.setFont(font) 557 | self.label_14.setWordWrap(True) 558 | self.label_14.setObjectName("label_14") 559 | self.timeSave = QtWidgets.QPushButton(self.timesTab) 560 | self.timeSave.setGeometry(QtCore.QRect(40, 290, 82, 25)) 561 | self.timeSave.setObjectName("timeSave") 562 | self.modeWidget.addTab(self.timesTab, "") 563 | self.applyBtn = QtWidgets.QPushButton(self.centralwidget) 564 | self.applyBtn.setGeometry(QtCore.QRect(490, 530, 101, 41)) 565 | self.applyBtn.setObjectName("applyBtn") 566 | self.label = QtWidgets.QLabel(self.centralwidget) 567 | self.label.setGeometry(QtCore.QRect(940, 20, 62, 20)) 568 | self.label.setObjectName("label") 569 | self.portTxt = QtWidgets.QLineEdit(self.centralwidget) 570 | self.portTxt.setGeometry(QtCore.QRect(1000, 20, 113, 28)) 571 | self.portTxt.setObjectName("portTxt") 572 | self.label_6 = QtWidgets.QLabel(self.centralwidget) 573 | self.label_6.setGeometry(QtCore.QRect(180, -10, 741, 91)) 574 | font = QtGui.QFont() 575 | font.setPointSize(13) 576 | self.label_6.setFont(font) 577 | self.label_6.setWordWrap(True) 578 | self.label_6.setObjectName("label_6") 579 | self.unitLEDBtn = QtWidgets.QPushButton(self.centralwidget) 580 | self.unitLEDBtn.setGeometry(QtCore.QRect(840, 50, 121, 21)) 581 | self.unitLEDBtn.setObjectName("unitLEDBtn") 582 | MainWindow.setCentralWidget(self.centralwidget) 583 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 584 | self.statusbar.setObjectName("statusbar") 585 | MainWindow.setStatusBar(self.statusbar) 586 | 587 | self.retranslateUi(MainWindow) 588 | self.modeWidget.setCurrentIndex(0) 589 | self.presetModeWidget.setCurrentIndex(0) 590 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 591 | MainWindow.setTabOrder(self.channel1Check, self.channel2Check) 592 | MainWindow.setTabOrder(self.channel2Check, self.modeWidget) 593 | 594 | def retranslateUi(self, MainWindow): 595 | _translate = QtCore.QCoreApplication.translate 596 | MainWindow.setWindowTitle(_translate("MainWindow", "hue_plus")) 597 | self.channel1Check.setText(_translate("MainWindow", "Channel 1")) 598 | self.channel2Check.setText(_translate("MainWindow", "Channel 2")) 599 | self.groupBox.setTitle(_translate("MainWindow", "Colors")) 600 | self.fixedAdd.setText(_translate("MainWindow", "Add color")) 601 | self.fixedDelete.setText(_translate("MainWindow", "Delete color")) 602 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.fixedTab), _translate("MainWindow", "Fixed")) 603 | self.groupBox_2.setTitle(_translate("MainWindow", "Colors")) 604 | self.breathingAdd.setText(_translate("MainWindow", "Add color")) 605 | self.breathingDelete.setText(_translate("MainWindow", "Delete color")) 606 | self.groupBox_11.setTitle(_translate("MainWindow", "Other")) 607 | self.label_2.setText(_translate("MainWindow", "Speed")) 608 | self.label_4.setText(_translate("MainWindow", "Fastest")) 609 | self.label_5.setText(_translate("MainWindow", "Slowest")) 610 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.breathingTab), _translate("MainWindow", "Breathing")) 611 | self.groupBox_3.setTitle(_translate("MainWindow", "Colors")) 612 | self.fadingAdd.setText(_translate("MainWindow", "Add color")) 613 | self.fadingDelete.setText(_translate("MainWindow", "Delete color")) 614 | self.groupBox_12.setTitle(_translate("MainWindow", "Other")) 615 | self.label_9.setText(_translate("MainWindow", "Speed")) 616 | self.label_10.setText(_translate("MainWindow", "Fastest")) 617 | self.label_11.setText(_translate("MainWindow", "Slowest")) 618 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.fadingTab), _translate("MainWindow", "Fading")) 619 | self.groupBox_4.setTitle(_translate("MainWindow", "Colors")) 620 | self.marqueeAdd.setText(_translate("MainWindow", "Add color")) 621 | self.marqueeDelete.setText(_translate("MainWindow", "Delete color")) 622 | self.groupBox_13.setTitle(_translate("MainWindow", "Other")) 623 | self.label_15.setText(_translate("MainWindow", "Speed")) 624 | self.label_16.setText(_translate("MainWindow", "Fastest")) 625 | self.label_17.setText(_translate("MainWindow", "Slowest")) 626 | self.label_18.setText(_translate("MainWindow", "Smaller")) 627 | self.label_19.setText(_translate("MainWindow", "Size")) 628 | self.label_20.setText(_translate("MainWindow", "Larger")) 629 | self.marqueeBackwards.setText(_translate("MainWindow", "Backwards")) 630 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.marqueeTab), _translate("MainWindow", "Marquee")) 631 | self.groupBox_5.setTitle(_translate("MainWindow", "Colors")) 632 | self.coverMarqueeAdd.setText(_translate("MainWindow", "Add color")) 633 | self.coverMarqueeDelete.setText(_translate("MainWindow", "Delete color")) 634 | self.groupBox_15.setTitle(_translate("MainWindow", "Other")) 635 | self.label_27.setText(_translate("MainWindow", "Speed")) 636 | self.label_28.setText(_translate("MainWindow", "Fastest")) 637 | self.label_29.setText(_translate("MainWindow", "Slowest")) 638 | self.coverMarqueeBackwards.setText(_translate("MainWindow", "Backwards")) 639 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.coverMarqueeTab), _translate("MainWindow", "Covering Marquee")) 640 | self.groupBox_6.setTitle(_translate("MainWindow", "Colors")) 641 | self.pulseAdd.setText(_translate("MainWindow", "Add color")) 642 | self.pulseDelete.setText(_translate("MainWindow", "Delete color")) 643 | self.groupBox_16.setTitle(_translate("MainWindow", "Other")) 644 | self.label_33.setText(_translate("MainWindow", "Speed")) 645 | self.label_34.setText(_translate("MainWindow", "Fastest")) 646 | self.label_35.setText(_translate("MainWindow", "Slowest")) 647 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.pulseTab), _translate("MainWindow", "Pulse")) 648 | self.groupBox_17.setTitle(_translate("MainWindow", "Other")) 649 | self.label_39.setText(_translate("MainWindow", "Speed")) 650 | self.label_40.setText(_translate("MainWindow", "Fastest")) 651 | self.label_41.setText(_translate("MainWindow", "Slowest")) 652 | self.spectrumBackwards.setText(_translate("MainWindow", "Backwards")) 653 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.spectrumTab), _translate("MainWindow", "Spectrum")) 654 | self.groupBox_7.setTitle(_translate("MainWindow", "Colors")) 655 | self.alternatingAdd.setText(_translate("MainWindow", "Add color")) 656 | self.alternatingDelete.setText(_translate("MainWindow", "Delete color")) 657 | self.groupBox_18.setTitle(_translate("MainWindow", "Other")) 658 | self.label_45.setText(_translate("MainWindow", "Speed")) 659 | self.label_46.setText(_translate("MainWindow", "Fastest")) 660 | self.label_47.setText(_translate("MainWindow", "Slowest")) 661 | self.label_48.setText(_translate("MainWindow", "Smaller")) 662 | self.label_49.setText(_translate("MainWindow", "Size")) 663 | self.label_50.setText(_translate("MainWindow", "Larger")) 664 | self.alternatingBackwards.setText(_translate("MainWindow", "Backwards")) 665 | self.alternatingMoving.setText(_translate("MainWindow", "Moving")) 666 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.alternatingTab), _translate("MainWindow", "Alternating")) 667 | self.groupBox_8.setTitle(_translate("MainWindow", "Colors")) 668 | self.candleAdd.setText(_translate("MainWindow", "Add color")) 669 | self.candleDelete.setText(_translate("MainWindow", "Delete color")) 670 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.candleTab), _translate("MainWindow", "Candle")) 671 | self.groupBox_9.setTitle(_translate("MainWindow", "Colors")) 672 | self.wingsAdd.setText(_translate("MainWindow", "Add color")) 673 | self.wingsDelete.setText(_translate("MainWindow", "Delete color")) 674 | self.groupBox_20.setTitle(_translate("MainWindow", "Other")) 675 | self.label_57.setText(_translate("MainWindow", "Speed")) 676 | self.label_58.setText(_translate("MainWindow", "Fastest")) 677 | self.label_59.setText(_translate("MainWindow", "Slowest")) 678 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.wingsTab), _translate("MainWindow", "Wings")) 679 | self.groupBox_21.setTitle(_translate("MainWindow", "Other")) 680 | self.label_60.setText(_translate("MainWindow", "Tolerance")) 681 | self.label_61.setText(_translate("MainWindow", "Smoothness")) 682 | self.groupBox_10.setTitle(_translate("MainWindow", "Colors")) 683 | self.audioLevelAdd.setText(_translate("MainWindow", "Add color")) 684 | self.audioLevelDelete.setText(_translate("MainWindow", "Delete color")) 685 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.audioLevelTab), _translate("MainWindow", "Audio Level")) 686 | self.groupBox_22.setTitle(_translate("MainWindow", "Other")) 687 | self.label_62.setText(_translate("MainWindow", "Speed")) 688 | self.label_63.setText(_translate("MainWindow", "Fastest")) 689 | self.label_64.setText(_translate("MainWindow", "Slowest")) 690 | self.customMode.setItemText(0, _translate("MainWindow", "Fixed")) 691 | self.customMode.setItemText(1, _translate("MainWindow", "Breathing")) 692 | self.customMode.setItemText(2, _translate("MainWindow", "Wave")) 693 | self.label_65.setText(_translate("MainWindow", "Mode")) 694 | self.groupBox_19.setTitle(_translate("MainWindow", "Colors")) 695 | item = self.customTable.horizontalHeaderItem(0) 696 | item.setText(_translate("MainWindow", "LED #")) 697 | item = self.customTable.horizontalHeaderItem(1) 698 | item.setText(_translate("MainWindow", "Colors")) 699 | self.customEdit.setText(_translate("MainWindow", "Edit Color")) 700 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.customTab), _translate("MainWindow", "Custom")) 701 | self.groupBox_14.setTitle(_translate("MainWindow", "Profiles")) 702 | self.profileAdd.setText(_translate("MainWindow", "Add profile")) 703 | self.profileDelete.setText(_translate("MainWindow", "Delete profile")) 704 | self.profileRefresh.setText(_translate("MainWindow", "Refresh")) 705 | self.profileName.setText(_translate("MainWindow", "profile1")) 706 | self.label_3.setText(_translate("MainWindow", "Name:")) 707 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.profileTab), _translate("MainWindow", "Profiles")) 708 | self.groupBox_23.setTitle(_translate("MainWindow", "Colors")) 709 | item = self.animatedTable.horizontalHeaderItem(0) 710 | item.setText(_translate("MainWindow", "LED #")) 711 | item = self.animatedTable.horizontalHeaderItem(1) 712 | item.setText(_translate("MainWindow", "Colors")) 713 | self.animatedEdit.setText(_translate("MainWindow", "Edit Color")) 714 | self.animatedDelete.setText(_translate("MainWindow", "Delete round")) 715 | self.animatedAdd.setText(_translate("MainWindow", "Add round")) 716 | self.animatedRoundName.setText(_translate("MainWindow", "round1")) 717 | self.groupBox_24.setTitle(_translate("MainWindow", "Other")) 718 | self.label_66.setText(_translate("MainWindow", "Speed between refresh, in ms")) 719 | self.label_21.setText(_translate("MainWindow", "To use, simply set a custom pattern for each round.")) 720 | self.presetModeWidget.setTabText(self.presetModeWidget.indexOf(self.animatedTab), _translate("MainWindow", "Custom Animated")) 721 | self.modeWidget.setTabText(self.modeWidget.indexOf(self.presetTab), _translate("MainWindow", "Preset")) 722 | self.label_7.setText(_translate("MainWindow", "The time to turn off the lights (in 24 hour time, separated by a colon)")) 723 | self.offTime.setText(_translate("MainWindow", "00:00")) 724 | self.onTime.setText(_translate("MainWindow", "00:00")) 725 | self.label_8.setText(_translate("MainWindow", "The time to turn on the lights (in 24 hour time, separated by a colon)")) 726 | self.label_12.setText(_translate("MainWindow", "00:00 means none")) 727 | self.label_13.setText(_translate("MainWindow", "00:00 means none")) 728 | self.label_14.setText(_translate("MainWindow", "This looks for a profile called previous and uses that. If that profile does not exist, the time will not work.")) 729 | self.timeSave.setText(_translate("MainWindow", "Save")) 730 | self.modeWidget.setTabText(self.modeWidget.indexOf(self.timesTab), _translate("MainWindow", "Times")) 731 | self.applyBtn.setText(_translate("MainWindow", "Apply")) 732 | self.label.setText(_translate("MainWindow", "Port:")) 733 | self.portTxt.setText(_translate("MainWindow", "/dev/ttyACM0")) 734 | self.label_6.setText(_translate("MainWindow", "Now with support for turning on and off at specific times, audio on Windows, a way to make your own modes, and more!")) 735 | self.unitLEDBtn.setText(_translate("MainWindow", "Toggle Unit LED")) 736 | 737 | --------------------------------------------------------------------------------