-
Notifications
You must be signed in to change notification settings - Fork 2
/
manager.py
131 lines (109 loc) · 3.45 KB
/
manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import subprocess
import time
import os
import signal
import sys
runningPID = ''
def checkProcess():
if runningPID == '':
pass
else:
killProcess()
def killProcess():
id = runningPID
#print(id)
os.killpg(id, signal.SIGTERM)
print("killing last effect")
def brightnessLVL(brightlvl):
lvl = str(brightlvl)
p = subprocess.Popen(['python3 set-brightness.py {}'.format(lvl)],stdout=subprocess.PIPE,shell=True, start_new_session=True)
#global runningPID
#runningPID = p.pid
def sectionsRandom():
p = subprocess.Popen(['python3 sections-randomRGB.py'],stdout=subprocess.PIPE,shell=True, start_new_session=True)
global runningPID
runningPID = p.pid
def stripes():
p = subprocess.Popen(['python3 stripes.py'],stdout=subprocess.PIPE,shell=True, start_new_session=True)
global runningPID
runningPID = p.pid
def rainbowRGB():
p = subprocess.Popen(['python3 rainbowRGB.py'],stdout=subprocess.PIPE,shell=True, start_new_session=True)
global runningPID
runningPID = p.pid
def rainDrops():
p = subprocess.Popen(['python3 raindrops.py'],stdout=subprocess.PIPE,shell=True, start_new_session=True)
global runningPID
runningPID = p.pid
def menu():
print(" ")
print("RAZER EFFECT SETTER")
print(" ")
print("1: sections random rgb")
print("2: stripes")
print("3: rainbow rgb")
print("4: rain drops")
print("-")
print("b: Brightness")
print("k: Kill Any Running Effects")
print(" ")
def brightnessMenu():
print("Enter Value between 0-100")
print("to set brightness")
blvl = input("Brightness: ")
brightnessLVL(blvl)
def run():
os.system('cls' if os.name == 'nt' else 'clear')
option = ''
menu()
while option != 'q':
option = input("Select option to run or 'q' and zero to exit: ")
if option == str(1):
os.system('cls' if os.name == 'nt' else 'clear')
checkProcess()
print("starting sections random rgb")
sectionsRandom()
menu()
elif option == str(2):
os.system('cls' if os.name == 'nt' else 'clear')
checkProcess()
print("starting Stipes effect")
stripes()
menu()
elif option == str(3):
os.system('cls' if os.name == 'nt' else 'clear')
checkProcess()
print("starting Rainbow RGB effect")
rainbowRGB()
menu()
elif option == str(4):
os.system('cls' if os.name == 'nt' else 'clear')
checkProcess()
print("starting Rainbow RGB effect")
rainDrops()
menu()
elif option == "b":
os.system('cls' if os.name == 'nt' else 'clear')
test = 10
brightnessMenu()
menu()
elif option == "k":
os.system('cls' if os.name == 'nt' else 'clear')
killProcess()
menu()
elif option == "q":
print(" ")
print("EXITING and SHUTTING DOWN EFFECTS")
checkProcess()
sys.exit(0)
elif option == str(0):
print(" ")
print("EXITING and SHUTTING DOWN EFFECTS")
checkProcess()
sys.exit(0)
else:
os.system('cls' if os.name == 'nt' else 'clear')
print("Please Enter Valid Option")
print(" ")
menu()
run()