예제 #1
0
파일: cycler.py 프로젝트: perryizgr8/logiPy
def transition(red, green, blue, new_red, new_green, new_blue):
    """This smoothly transitions from one color to another."""
    while (red != new_red) or (green != new_green) or (blue != new_blue):
        while red != new_red:
            if red > new_red:
                red = red - 1
                break
            else:
                red = red + 1
                break
        while green != new_green:
            if green > new_green:
                green = green - 1
                break
            else:
                green = green + 1
                break
        while blue != new_blue:
            if blue > new_blue:
                blue = blue - 1
                break
            else:
                blue = blue + 1
                break
        logi_led.logi_led_set_lighting(red, green, blue)
        time.sleep(0.01)
    def blink(self):
        count = self.count_unread_msgs()
        print count
        if int(count) > 0:
             logi_led.logi_led_flash_lighting(self.R,self.G,self.B,800*int(count),100)
             sleep(int(count))

        logi_led.logi_led_set_lighting(0,100,0)
예제 #3
0
    def blink(self):
        count = self.count_unread_msgs()
        print count
        if int(count) > 0:
            logi_led.logi_led_flash_lighting(self.R, self.G, self.B,
                                             800 * int(count), 100)
            sleep(int(count))

        logi_led.logi_led_set_lighting(0, 100, 0)
def pytest_runtest_logreport(report):
    """Show status of test on MouseColor plugin"""
    global FIRST_RESULT
    if USE_MOUSE_COLOR:
        if report.failed:
            logi_led.logi_led_set_lighting(100, 0, 0)
            FIRST_RESULT = False
        elif FIRST_RESULT and report.passed:
            logi_led.logi_led_set_lighting(0, 100, 0)
            FIRST_RESULT = False
예제 #5
0
 def facebook_led(self, times, intval):
     logi_led.logi_led_set_lighting(0, 0, 0)
     time.sleep(0.1)
     for i in range(0, times):
         logi_led.logi_led_set_lighting(0, 0, 0)
         time.sleep(intval / 2)
         logi_led.logi_led_set_lighting_from_bitmap(self.facebook_str)
         time.sleep(intval / 2)
     logi_led.logi_led_stop_effects()
     logi_led.logi_led_restore_lighting()
예제 #6
0
 def line_led(self, times, intval):
     logi_led.logi_led_save_current_lighting()
     time.sleep(0.1)
     for i in range(0, times):
         logi_led.logi_led_set_lighting(0, 0, 0)
         time.sleep(intval / 2)
         logi_led.logi_led_set_lighting_from_bitmap(self.line_str)
         time.sleep(intval / 2)
     logi_led.logi_led_stop_effects()
     logi_led.logi_led_restore_lighting()
def pytest_configure(config):
    """Initialization of MouseColor plugin"""
    global USE_MOUSE_COLOR
    if config.getoption("mousecolor_wait") or config.getoption(
            "mousecolor_nowait"):
        USE_MOUSE_COLOR = True
        logi_led.logi_led_init()
        # Give the SDK a second to initialize
        time.sleep(1)
        # Initialize in yellow, i.e. no test
        logi_led.logi_led_set_lighting(150, 100, 0)
예제 #8
0
파일: wrapper.py 프로젝트: tkern0/misc
 def set_colour(self, device, *args):
     self._set_device(device)
     if len(args) == 3:
         r, g, b = args[0], args[1], args[2]
         k = max(r, g, b)
     elif len(args) == 1:
         if self.get_device() == "K":
             r = g = b = args[0]
         else:
             raise ValueError("Must have Keyboard selected to use just one argument for colour")
     else:
         raise ValueError("Invalid number of arguments")
     logi_led.logi_led_set_lighting(r, g, b)
     if self.device == "A":
         self.mouse_colour = {"R": r, "G": g, "B": b}
         self.kb_colour = max(self.mouse_colour.values())
     elif self.device == "K":
         self.kb_colour = max(r, g, b)
     elif self.device == "M": 
         self.mouse_colour = {"R": r, "G": g, "B": b}
예제 #9
0
 def __init__(self):
     logi_led.logi_led_init()
     logi_led.logi_led_set_lighting(0, 0, 0)
     self.dic_keys = {"a":30, "b":48, "c":46, "d":32, "e":18, "f":33, "g":34, "h":35, "i":23, "j":36, "k":37, "l":38, "m":50,
         "n":49, "o":24, "p":25, "q":16, "r":19, "s":31, "t":20, "u":22, "v":47, "w":17, "x":45, "y":21, "z":44,
         "0":11, "1":2, "2":3, "3":4, "4":5, "5":6, "6":7, "7":8, "8":9, "9":10,
         ",":51, ".":52, ";":39, "/":53, " ":57, "'":40, "`":41, "-":12, "=":13, "backsp":14, "ins":338, "home":327, "paup":329,
         "numlo":69, "n/":309, "n*":55, "n-":74, "n+":78, "nenter":284, "ndel":83, "n0":82, "n1":79, "n2":80, "n3":81, "n4":75, "n5":76, "n6":77, "n7":71, "n8":72, "n9":73,
         "capslo":58, "backsla":43, "shiftr":54, "shiftl":42, "ctrlr":285, "ctrll":29, "winr":348, "winl":347, "alt":56, "altgr":312, "text":349, "arrup":328, "arrdo":336, "arrl":331, "arrr":333,
         "tab":15, "[":26, "]":27, "enter":28, "delete":339, "end":335, "padown":337,
         "g1":65521, "g2":65522, "g3":65523, "g4":65524, "g5":65525, "g6":65526, "g7":65527, "g8":65528, "g9":65529,
         "esc":1, "priscr":311, "scrlo":70, "pau":325,
         "f1":59, "f2":60, "f3":61, "f4":62, "f5":63, "f6":64, "f7":65, "f8":66, "f9":67, "f10":68, "f11":87, "f12":88}
     self.all_keys_array = [["+",  "+",      "+",      "g6",  "g7",  "g8", "g9", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+"],
               ["+",  "esc",    "+",      "f1",  "f2",  "f3", "f4", "f5", "f6", "f7", "f8", "+", "f9", "f10", "f11", "f12", "priscr", "scrlo", "pau", "+", "+", "+", "+"],
               ["g1", "`",      "1",      "2",   "3",   "4", "5", "6", "7", "8", "9", "0", "-", "=", "backsp", "ins", "home", "paup", "numlo", "n/", "n*", "n-"],
               ["g2", "tab",    "q",      "w",   "e",   "r", "t", "y", "u", "i", "o", "p", "[", "]", "enter", "delete", "end", "padown", "n7", "n8", "n9", "n+"],
               ["g3", "capslo", "a",      "s",   "d",   "f", "g", "h", "j", "k", "l", ";", "'", "backsla", "enter", "+", "+", "+", "n4", "n5", "n6", "n+"],
               ["g4", "shiftl", "+", "z",   "x",   "c", "v", "b", "n", "m", ",", ".", "/", "+", "shiftr", "+", "arrup", "+", "n1", "n2", "n3", "nenter"],
               ["g5", "ctrll",  "winl",   "+", "alt", "+", "+", " ", "+", "+", "+", "altgr", "winr", "text", "ctrlr", "arrl", "arrdo", "arrr", "n0", "n0", "ndel", "nenter"]]
예제 #10
0
파일: cpu.py 프로젝트: perryizgr8/logiPy
def setcolor(loadclass):
    if loadclass == 'green':
        logi_led.logi_led_set_lighting(0, 100, 0)
    elif loadclass == 'yellow':
        logi_led.logi_led_set_lighting(100, 100, 0)
    elif loadclass == 'red':
        logi_led.logi_led_set_lighting(100, 0, 0)
def ClearBoard():
    global loops, doClear
    logi.logi_led_set_lighting(default[0], default[1], default[2])
    loops += 1
    if loops == 5:
        logi.logi_led_set_lighting(default[0], default[1], default[2])
    if loops == 10:
        logi.logi_led_set_lighting(default[0], default[1], default[2])
        doClear = False
        loops = 0
예제 #12
0
파일: cpu.py 프로젝트: perryizgr8/logiPy
def getclass(load):
    if load < 33:
        return 'green'
    elif load < 67:
        return 'yellow'
    else:
        return 'red'


def setcolor(loadclass):
    if loadclass == 'green':
        logi_led.logi_led_set_lighting(0, 100, 0)
    elif loadclass == 'yellow':
        logi_led.logi_led_set_lighting(100, 100, 0)
    elif loadclass == 'red':
        logi_led.logi_led_set_lighting(100, 0, 0)


logi_led.logi_led_set_lighting(0, 0, 0)
loadclass = 'green'
while True:
    load = getcpu()
    newloadclass = getclass(load)
    if (newloadclass != loadclass):
        loadclass = newloadclass
        setcolor(loadclass)
    time.sleep(0.1)

logi_led.logi_led_shutdown()
예제 #13
0
파일: cycler.py 프로젝트: perryizgr8/logiPy
"""Random colors with smooth transition and a pulse before every change."""
import time
from random import random
from logipy import logi_led

logi_led.logi_led_init()
time.sleep(1)

r = g = b = 0
logi_led.logi_led_set_lighting(r, g, b)
time.sleep(5)


def transition(red, green, blue, new_red, new_green, new_blue):
    """This smoothly transitions from one color to another."""
    while (red != new_red) or (green != new_green) or (blue != new_blue):
        while red != new_red:
            if red > new_red:
                red = red - 1
                break
            else:
                red = red + 1
                break
        while green != new_green:
            if green > new_green:
                green = green - 1
                break
            else:
                green = green + 1
                break
        while blue != new_blue:
예제 #14
0
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))


# LED snippets
##############

# Set all device lighting to red
from logipy import logi_led
import time
import ctypes

print ('Setting all device lighting to red...')
logi_led.logi_led_init()
time.sleep(1) # Give the SDK a second to initialize
logi_led.logi_led_set_lighting(100, 0, 0)
raw_input('Press enter to shutdown SDK...')
logi_led.logi_led_shutdown()

# If you prefer the c/c++ style you can use the DLL directly
print ('Setting all device lighting to green...')
logi_led.led_dll.LogiLedInit()
time.sleep(1) # Give the SDK a second to initialize
logi_led.led_dll.LogiLedSetLighting(ctypes.c_int(0), ctypes.c_int(100), ctypes.c_int(0))
raw_input('Press enter to shutdown SDK...')
logi_led.led_dll.LogiLedShutdown()


# Arx snippets
##############

s0 = point()
s1 = point()
s2 = point()
s3 = point()
s4 = point()
s5 = point()
s6 = point()
s7 = point()
s8 = point()
s9 = point()
s10 = point()
s11 = point()
s12 = point()
s13 = point()
s14 = point()
s15 = point()
keyboard.add_hotkey('esc', setFocus, args=[0])
logi.logi_led_set_lighting(default[0], default[1], default[2])
keyboard.add_hotkey('ctrl+home', PowerMan, args=[b'reboot'])
keyboard.add_hotkey('ctrl+end', PowerMan, args=[b'poweroff'])
keyboard.add_hotkey('ctrl+esc+q', leave)
keyboard.add_hotkey('ctrl+num 5', arm)
while running:
    time.sleep(0.05)
    PingCheck()
    viewStats()
    if armed: armedCD -= 1
    if armedCD <= 0: armed = False
    if doClear: ClearBoard()
예제 #16
0
파일: mouse.py 프로젝트: perryizgr8/logiPy

class POINT(Structure):
    _fields_ = [("x", c_long), ("y", c_long)]


def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return {"x": pt.x, "y": pt.y}


pos = queryMousePosition()
#print(pos)

logi_led.logi_led_init()
time.sleep(2)

r = g = b = 0
while True:
    newpos = queryMousePosition()
    if (newpos != pos):
        pos = newpos
        r = int(random() * 100)
        g = int(random() * 100)
        b = int(random() * 100)
        logi_led.logi_led_set_lighting(r, g, b)
    time.sleep(0.1)

logi_led.logi_led_shutdown()
예제 #17
0
 def enable_nightmode(self):
     logi_led.logi_led_init()
     time.sleep(0.5)
     logi_led.logi_led_set_lighting(0, 0, 0)
예제 #18
0
 def set_all_colour(self, colour):
     return logi_led.logi_led_set_lighting(colour.r, colour.g, colour.b)