class CentralManager: def __init__(self, chat_id, token): token = '?' telebot_sender = TelebotSender(token, chat_id) self.commands = [ SendScreenCommand(1, 1, telebot_sender), SendTextCommand(1, 2, '1', telebot_sender), SendTextCommand(1, 3, '2', telebot_sender), SendTextCommand(1, 4, '3', telebot_sender), SendTextCommand(1, 5, '4', telebot_sender), SendTextCommand(1, 6, '5', telebot_sender), SendTextCommand(1, 7, '6', telebot_sender), SendTextCommand(1, 12, 'Хочу', telebot_sender), SendTextCommand(1, 13, 'Решаю', telebot_sender), SendTextCommand(1, 14, 'Уноси', telebot_sender), SendTextCommand(2, 2, 'Да', telebot_sender), SendTextCommand(2, 3, 'Нет', telebot_sender), ] self.command_index = 0 self.keyboard_grid = ChromaGrid('Keyboard') self.show_signs = True self.chroma_app = get_chroma_app() self.blink() def switch_command_up(self): self.command_index += 1 if self.command_index >= len(self.commands): self.command_index = 0 self.update_light() def execute_command(self): self.commands[self.command_index].execute() self.blink() def update_light(self): if not self.show_signs: self.chroma_app.Keyboard.setStatic(Colors.YELLOW) else: command = self.commands[self.command_index] self.keyboard_grid.set(hexcolor="#FFFF00") self.keyboard_grid[command.x][command.y].set(red=0, green=255, blue=0) self.chroma_app.Keyboard.setCustomGrid(self.keyboard_grid) self.chroma_app.Keyboard.applyGrid() def blink(self): self.chroma_app.Keyboard.setNone() sleep(0.3) self.chroma_app.Keyboard.setStatic(Colors.YELLOW) sleep(0.3) self.chroma_app.Keyboard.setNone() sleep(0.3) self.chroma_app.Keyboard.setStatic(Colors.YELLOW) self.update_light()
def __init__(self, chat_id, token): token = '?' telebot_sender = TelebotSender(token, chat_id) self.commands = [ SendScreenCommand(1, 1, telebot_sender), SendTextCommand(1, 2, '1', telebot_sender), SendTextCommand(1, 3, '2', telebot_sender), SendTextCommand(1, 4, '3', telebot_sender), SendTextCommand(1, 5, '4', telebot_sender), SendTextCommand(1, 6, '5', telebot_sender), SendTextCommand(1, 7, '6', telebot_sender), SendTextCommand(1, 12, 'Хочу', telebot_sender), SendTextCommand(1, 13, 'Решаю', telebot_sender), SendTextCommand(1, 14, 'Уноси', telebot_sender), SendTextCommand(2, 2, 'Да', telebot_sender), SendTextCommand(2, 3, 'Нет', telebot_sender), ] self.command_index = 0 self.keyboard_grid = ChromaGrid('Keyboard') self.show_signs = True self.chroma_app = get_chroma_app() self.blink()
from rtmidi.midiutil import open_midiinput from time import sleep import sys #infos Info = ChromaAppInfo() Info.DeveloperName = "RaddedMC" Info.DeveloperContact = "reddit.com/u/raddedmc" Info.Category = "application" Info.SupportedDevices = ['mousepad'] Info.Description = "RaddedMC's MIDI light-show plugin for Razer Chroma. Designed for use with a Razer Firefly and Ableton Live. Source code at github.com/raddedmc/ChromaMidi ." Info.Title = "ChromaMidi" #some other assignments App = ChromaApp(Info) MousepadGrid = ChromaGrid('Mousepad') App.Mousepad.setStatic(Colors.BLUE) #Welcome print("---------------------------------------") print( "Thanks for checking out RaddedMC's ChromaMidi program! Let's get started:" ) print( "Note: This version of ChromaMidi currently only supports Chroma-enabled mousepads. Other devices can be added on request. Open the Chroma Connect app or PM u/RaddedMC if you're interested in support for other devices." ) print("---------------------------------------") #light test print("The mousepad has " + str(len(MousepadGrid)) + " lights.")
print(App.Version()) print('\n') print('Setting Keyboard to green, Mouse to yellow and Mousepad to blue') print(App.Keyboard.setStatic(Colors.GREEN)) print(App.Mousepad.setStatic(Colors.BLUE)) print(App.Mouse.setStatic(Colors.YELLOW)) sleep(2) # Oldschool # KeyboardGrid = [[ChromaColor(red=255, blue=0, green=0) for x in range(22)] for y in range(6)] # MouseGrid = [[ChromaColor(red=255, blue=0, green=0) for x in range(7)] for y in range(9)] # MousepadGrid = [ChromaColor(red=255, blue=0, green=0) for x in range(15)] # New KeyboardGrid = ChromaGrid('Keyboard') MouseGrid = ChromaGrid('Mouse') MousepadGrid = ChromaGrid('Mousepad') print('Setting all devices to red') KeyboardGrid.set(hexcolor="#FF0000") MousepadGrid.set(red=255, blue=0, green=0) MouseGrid.set(hexcolor="0xFF0000") print(App.Mousepad.setCustomGrid(MousepadGrid)) print(App.Mouse.setCustomGrid(MouseGrid)) print(App.Keyboard.setCustomGrid(KeyboardGrid)) print(App.Mouse.applyGrid()) print(App.Mousepad.applyGrid()) print(App.Keyboard.applyGrid()) sleep(2)
from time import sleep import sys import math #infos Info = ChromaAppInfo() Info.DeveloperName = "RaddedMC" Info.DeveloperContact = "reddit.com/u/raddedmc" Info.Category = "application" Info.SupportedDevices = ['keyboard'] Info.Description = "RaddedMC's MIDI light-show plugin for Razer Chroma. Designed for use with a Razer keyboard and Ableton Live. Source code at github.com/raddedmc/ChromaMidi ." Info.Title = "ChromaMidi" #some other assignments App = ChromaApp(Info) KeyboardGrid = ChromaGrid('Keyboard') App.Mousepad.setStatic(Colors.BLUE) #Welcome print("---------------------------------------") print("Thanks for checking out RaddedMC's ChromaMidi program! Let's get started:") print("Note: This version of ChromaMidi currently only supports Chroma-enabled keyboards. Other devices can be added on request. Open the Chroma Connect app or PM u/RaddedMC if you're interested in support for other devices.") print("---------------------------------------") #light test print("The keyboard has " + str(len(KeyboardGrid)) + " lights.") #to change colour: # DeviceGrid[light].set("HEX CODE") # App.[DEVICE].setCustomGrid(DeviceGrid) # App.[DEVICE].applyGrid()
import config if config.chromaEnable: from ChromaPython import ChromaApp, ChromaAppInfo, ChromaColor, Colors, ChromaGrid KeyboardGrid = ChromaGrid("Keyboard") def whiteBright(app): # chroma white app.Keyboard.setStatic(Colors.WHITE) def whiteDim(app): # chroma white app.Keyboard.setStatic(Colors.WHITE) def orange(app): # chroma orange global KeyboardGrid KeyboardGrid.set(hexcolor="#ff9900") app.Keyboard.setCustomGrid(KeyboardGrid) app.Keyboard.applyGrid() def flashGreen(app): # chroma green app.Keyboard.setStatic(Colors.GREEN)
sleep(2) for y in range(keyboard.MaxRow - 1, -1, -1): # goes through all keys one at a time and sets the colour for x in range(keyboard.MaxColumn): keyboard.setPosition(ChromaColor(255, 0, 0), x=x, y=y) keyboard.applyGrid() sleep(0.01) for x in range(keyboard.MaxColumn - 1, -1, -1): # same as before but in a different order for y in range(keyboard.MaxRow): keyboard.setPosition(ChromaColor(0, 255, 0), x=x, y=y) keyboard.applyGrid() sleep(0.01) newGrid = ChromaGrid('Keyboard') newGrid.set( 0, 255, 0 ) # makes the whole grid (all the keys in the grid) green. Basically cycles through them and makes every individual one green for x in range(len(newGrid)): # makes every column red going downwards for y in range(len(newGrid[x])): newGrid[x][y].set( 255, 0, 0 ) # this is how you set the color of a key (key.set(r, g, b)) keys are of the ChromaColor class so basically you're changing the color of a ChromaColor object keyboard.setCustomGrid(newGrid) # tells it which grid to use keyboard.applyGrid() # updates the keyboard to use the grid set sleep(0.1) ymax = keyboard.MaxColumn for y in range(