forked from sblatt/Logitech-G19-Linux-Daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallpaper.py
More file actions
executable file
·66 lines (57 loc) · 1.35 KB
/
wallpaper.py
File metadata and controls
executable file
·66 lines (57 loc) · 1.35 KB
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
from logitech.g19 import G19
import os
import random
import time
import thread
class WALLPAPER:
def __init__(self, lg19):
self.imgPath = 'wallpaper'
self.timeout = 60
self.lg19 = lg19
def reloadImages(self):
self.files = os.listdir(self.imgPath)
random.shuffle(self.files,random.random)
def changeImages(self):
for image in self.files:
self.lg19.load_image(os.path.join(self.imgPath, image))
time.sleep(self.timeout)
def play(self):
while True:
self.reloadImages()
self.changeImages()
class COLOR:
def __init__(self, lg19):
self.lg19 = lg19
def userInput(self):
inp = raw_input()
val = inp.split(' ')
if len(val) != 3:
print 'Syntax Error. Combination is "255 255 255"'
return False
for i in val:
try:
j = int(i)
except:
print 'Needs integer %s' % (i)
return False
if j<0 or j>255:
print 'Wrong value for color %d' % (j)
return False
self.value = val
return True
def setColor(self):
self.lg19.set_bg_color(int(self.value[0]), int(self.value[1]), int(self.value[2]))
def play(self):
print 'Enter color in "255 0 0" format'
while True:
if self.userInput():
self.setColor()
print '[+] Settings applied'
else:
print '[-] Changes not applied'
if __name__=="__main__":
lg19 = G19()
wp = WALLPAPER(lg19)
thread.start_new_thread(wp.play, ())
cl = COLOR(lg19)
cl.play()