def get_chroma_app():
    info = ChromaAppInfo()
    info.DeveloperName = 'Rick Sanchez'
    info.DeveloperContact = '*****@*****.**'
    info.Category = 'application'
    info.SupportedDevices = ['keyboard']
    info.Description = 'Oh Rick, I don\'t know if that\'s a good idea.'
    info.Title = 'Mr Meeseeks Box'
    app = ChromaApp(info)
    return app
Esempio n. 2
0
from ChromaPython import ChromaApp, ChromaAppInfo, ChromaColor, Colors, ChromaGrid
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.")
from ChromaPython import ChromaApp, ChromaAppInfo, ChromaColor, Colors, ChromaGrid
from time import sleep

Info = ChromaAppInfo()
Info.DeveloperName = 'Rick Sanchez'
Info.DeveloperContact = '*****@*****.**'
Info.Category = 'application'
Info.SupportedDevices = ['keyboard', 'mouse', 'mousepad']
Info.Description = 'Oh Rick, I don\'t know if that\'s a good idea.'
Info.Title = 'Mr Meeseeks Box'

App = ChromaApp(Info)

sleep(2)

print('If you are interested in the API-version:')
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
Esempio n. 4
0
def start():

    processName = "elitedangerous"

    while 1 > 0:
        for proc in psutil.process_iter():
            if processName.lower() not in proc.name().lower():
                print("ED running")

                #Label(main, text = "You can minimize this window...", bg = "#000000", fg = "#f07b05", font = ("sintony", 12)).pack()

                if config.chromaEnable:

                    # app info and creation (chroma)
                    info = ChromaAppInfo()
                    info.DeveloperName = 'Hector Robe'
                    info.DeveloperContact = '*****@*****.**'
                    info.Category = 'application'
                    info.SupportedDevices = ['keyboard']
                    info.Description = 'Reacts to events in Elite Dangerous'
                    info.Title = 'Elite Dangerous Sync'
                    app = ChromaApp(info)
                    print("Chroma App Started")
                else:
                    print("Chroma App Not Started")

            ###########################################################

            # lights

                def whiteBright():
                    print("white bright testing")
                    try:
                        lifx.whiteBright()
                    except:
                        print("Failed LIFX")
                    try:
                        chroma.whiteBright(app)
                    except:
                        print("Failed Chroma")
                    try:
                        cue.whiteBright()
                    except:
                        print("Failed Cue")
                    try:
                        hue.whiteBright()
                    except:
                        print("Failed Hue")

                def whiteDim():

                    try:
                        lifx.whiteDim()
                    except:
                        print("Failed LIFX")
                    try:
                        chroma.whiteDim(app)
                    except:
                        print("Failed Chroma")
                    try:
                        cue.whiteDim()
                    except:
                        print("Failed Cue")
                    try:
                        hue.whiteDim()
                    except:
                        print("Failed Hue")

                # start as dim white
                whiteDim()

                def orange():

                    try:
                        lifx.orange()
                    except:
                        print("Failed LIFX")
                    try:
                        chroma.orange(app)
                    except:
                        print("Failed Chroma")
                    try:
                        cue.orange()
                    except:
                        print("Failed Cue")
                    try:
                        hue.orange()
                    except:
                        print("Failed Hue")

                def flashGreen():

                    try:
                        chroma.flashGreen(app)
                    except:
                        print("Failed Chroma")
                    try:
                        lifx.flashGreen()
                    except:
                        print("Failed LIFX")
                    try:
                        cue.flashGreen()
                    except:
                        print("Failed Cue")
                    try:
                        hue.flashGreen()
                    except:
                        print("Failed Hue")

                def flashRed():

                    # counter
                    a = 0

                    while a < 10:

                        try:
                            chroma.flashRed(app)
                        except:
                            print("Failed Chroma")
                        try:
                            lifx.flashRed()
                        except:
                            print("Failed LIFX")
                        try:
                            cue.flashRed()
                        except:
                            print("Failed Cue")
                        try:
                            hue.flashRed()
                        except:
                            print("Failed Hue")

                        # add to counter
                        a = a + 1

                    # default
                    try:
                        lifx.whiteDim()
                    except:
                        print("Failed LIFX")
                    try:
                        chroma.whiteDim(app)
                    except:
                        print("Failed Chroma")
                    try:
                        cue.whiteDim()
                    except:
                        print("Failed Cue")
                    try:
                        hue.whiteDim()
                    except:
                        print("Failed Hue")

                def flashYellow():

                    try:
                        chroma.flashYellow(app)
                    except:
                        print("Failed Chroma")
                    try:
                        lifx.flashYellow()
                    except:
                        print("Failed LIFX")
                    try:
                        cue.flashYellow()
                    except:
                        print("Failed Cue")
                    try:
                        hue.flashYellow()
                    except:
                        print("Failed Hue")

                def flashBlue():

                    try:
                        chroma.flashBlue(app)
                    except:
                        print("Failed Chroma")
                    try:
                        lifx.flashBlue()
                    except:
                        print("Failed LIFX")
                    try:
                        cue.flashBlue()
                    except:
                        print("Failed Cue")
                    try:
                        hue.flashBlue()
                    except:
                        print("Failed Hue")

            ########################################################

                sleep(20)

                # get latest log
                list_of_files = glob.glob(config.logLocation)
                try:
                    latest_file = max(list_of_files, key=os.path.getctime)

                    print(latest_file)

                    # open latest log
                    currentLog = open(latest_file, 'r')

                    # defines events
                    music = '"event":"Music", "MusicTrack":"NoTrack"'
                    underAttack = '"event":"UnderAttack", "Target":"You"'
                    hullDamage = '"event":"HullDamage"'
                    heatDamage = '"event":"HeatDamage"'
                    heatWarning = '"event":"HeatWarning"'
                    shieldOff = '"event":"ShieldState", "ShieldsUp":false'
                    shieldOn = '"event":"ShieldState", "ShieldsUp":true'
                    docked = '"event":"Docked"'
                    dockedMusic2 = '"event":"Music", "MusicTrack":"Exploration"'
                    dockedMusic = '"event":"Music", "MusicTrack":"Starport"'
                    undocked = '"event":"Undocked"'
                    dockGranted = '"event":"DockingGranted"'
                    kill = '"event":"PVPKill"'
                    supercruiseEnter = '"event":"SupercruiseEntry"'
                    supercruiseExit = '"event":"SupercruiseExit"'
                    dockingMusic = '"event":"Music", "MusicTrack":"DockingComputer"'
                    shutdown = '"event":"Shutdown"'

                    ########################################################

                    # always watching events
                    while 0 < 1:

                        # reads lines
                        reader = currentLog.read().splitlines()

                        # checks if any events exist
                        if len(reader) != 0:

                            # gets last line of log (most recent event)
                            lastLine = reader[-1]

                            # removes music from results
                            if music not in lastLine:

                                # prints last line of file
                                print(lastLine)

                                # checks for different events and runs functions
                                if shieldOff in lastLine:

                                    orange()
                                    sleep(1)

                                elif docked in lastLine or dockedMusic in lastLine or shutdown in lastLine:  # or dockedMusic2 in lastLine:

                                    whiteBright()

                                elif shieldOn in lastLine or undocked in lastLine or dockingMusic in lastLine:

                                    whiteDim()

                                elif dockGranted in lastLine or kill in lastLine:

                                    flashGreen()

                                elif supercruiseEnter in lastLine:

                                    flashYellow()

                                elif supercruiseExit in lastLine:

                                    flashBlue()

                                elif underAttack in lastLine or hullDamage in lastLine or heatDamage in lastLine or heatWarning in lastLine:

                                    flashRed()

                        # does nothing
                        else:
                            pass

                except:
                    print(
                        "Please add your Elite Dangerous log file location to the config.py file before running"
                    )

            else:
                print("ED not running")
Esempio n. 5
0
from time import sleep
from ChromaPython import ChromaApp, ChromaAppInfo, ChromaGrid, ChromaColor

info = ChromaAppInfo()

info.DeveloperName = 'Chrigi2486'
info.DeveloperContact = 'Don\'t contact me lol'
info.Category = 'application'
info.SupportedDevices = ['keyboard']
info.Description = 'ChromaMess'
info.Title = 'Mess'

app = ChromaApp(info)

sleep(2)  # initial sleep to let the application load (takes 2 seconds)

keyboard = app.Keyboard

# grid = ChromaGrid('Keyboard')

# grid.set(0, 255, 0)
# keyboard.setCustomGrid(grid)
# keyboard.applyGrid()
keyboard.setStatic(ChromaColor(0, 0, 0))  # sets color to black/off

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)