Example #1
0
    def __init__(self, model="g810"):
        layout_dir = os.path.join(basepath, "layouts")
        layout_file = os.path.join(layout_dir, model + ".json")

        with open(layout_file, 'r') as fh:
            layout = json.load(fh, object_pairs_hook=OrderedDict)

        self.keys = {}
        self.layout = {}
        self.layout["rows"] = {}

        for key, data in layout["keys"].iteritems():
            # Load keycodes from logiPy
            self.keys[key] = {
                "data": KeyData(),
                "keycode": int(getattr(logi_led, key)),
                "rows": data["rows"]
            }

            for row in data["rows"]:
                if row not in self.layout["rows"].keys():
                    self.layout["rows"][row] = []

                self.layout["rows"][row].append(key)

        logi_led.logi_led_init()
        time.sleep(1)
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)
Example #3
0
 def wadupdown(self, delay_time=1/1000, color_life=[0, 100, 0], keys=["w", "a", "d", "arrup", "arrdo"]):
     """give it the number of lives and it displays it"""
     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}
     logi_led.logi_led_init()
     for i in range(len(keys)):
         logi_led.logi_led_set_lighting_for_key_with_key_name(dic_keys[keys[i]], color_life[0] , color_life[1], color_life[2])
     time.sleep(delay_time)
Example #4
0
 def display_string(self, string, display_time=0.7, color_display=[100, 0, 0], color_normal=[0, 0, 0]):
     """dic_keys is dic, string is str, displ is int, color_display and color_normal is [0-100, 0-100, 0-100]"""
     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}
     logi_led.logi_led_init()
     for i in string:
         if i != " ":logi_led.logi_led_set_lighting_for_key_with_key_name(dic_keys[i], color_display[0] , color_display[1], color_display[2])
         time.sleep(display_time*9/10)
         if i != " ":logi_led.logi_led_set_lighting_for_key_with_key_name(dic_keys[i], color_normal[0] , color_normal[1], color_normal[2])
         time.sleep(display_time/10)
Example #5
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"]]
Example #6
0
 def enable_nightmode(self):
     logi_led.logi_led_init()
     time.sleep(0.5)
     logi_led.logi_led_set_lighting(0, 0, 0)
Example #7
0
 def led_init():
     logi_led.logi_led_init()
Example #8
0
 def __init__(self):
     logi_led.logi_led_init()
     sleep(1)
     self.threads = {"K": Thread(), "M": Thread()}
Example #9
0
        except:
            print "Cannot connect to Atom feed"
            return 0

        parsed = parse(feed.read())
        return parsed.feed.fullcount

    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)


logi_led.logi_led_init()
logi_led.logi_led_save_current_lighting()

Accounts = []

Accounts.append(Blinker('username_account1', 'password_account1', 0, 1, 1))
Accounts.append(Blinker('username_account2', 'password_account2', 1, 1, 0))

while True:
    for act in Accounts:
        act.blink()
    sleep(5)
Example #10
0
import sys
import os

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
Example #11
0
    def __init__(self):
        logi_led.logi_led_init()
        self.bitmap_line = [chr(0), chr(0), chr(0), chr(255)] * 21 * 7
        self.bitmap_facebook = [chr(0), chr(0), chr(0), chr(255)] * 21 * 7
        self.line = [
            #L
            logi_led.F2,
            logi_led.TWO,
            logi_led.Q,
            logi_led.CAPS_LOCK,
            logi_led.Z,
            logi_led.LEFT_SHIFT,
            #I
            logi_led.F5,
            logi_led.F6,
            logi_led.F7,
            logi_led.SEVEN,
            logi_led.Y,
            logi_led.G,
            logi_led.C,
            logi_led.V,
            logi_led.B,
            #N
            logi_led.F9,
            logi_led.F12,
            logi_led.ZERO,
            logi_led.O,
            logi_led.K,
            logi_led.M,
            logi_led.MINUS,
            logi_led.OPEN_BRACKET,
            logi_led.FORWARD_SLASH,
            logi_led.APOSTROPHE,
            logi_led.CLOSE_BRACKET,
            logi_led.BACKSPACE,
            #E
            logi_led.NUM_LOCK,
            logi_led.NUM_SLASH,
            logi_led.NUM_ASTERISK,
            logi_led.NUM_SEVEN,
            logi_led.NUM_FOUR,
            logi_led.NUM_FIVE,
            logi_led.NUM_SIX,
            logi_led.NUM_ONE,
            logi_led.NUM_ZERO,
            logi_led.NUM_PERIOD
        ]
        self.facebook = [
            #F
            logi_led.F2,
            logi_led.F3,
            logi_led.F4,
            logi_led.THREE,
            logi_led.D,
            logi_led.C,
            logi_led.E,
            logi_led.R,
            logi_led.T,
            #B
            logi_led.F5,
            logi_led.F6,
            logi_led.F7,
            logi_led.SEVEN,
            logi_led.U,
            logi_led.J,
            logi_led.M,
            logi_led.COMMA,
            logi_led.PERIOD,
            logi_led.FORWARD_SLASH,
            logi_led.NINE,
            logi_led.I,
            logi_led.O,
            logi_led.P,
            logi_led.SEMICOLON,
        ]

        # for i in range(0, 21 * 7 * 4, 4):
        #         self.bitmap_line[i + 0] = chr(0)
        #         self.bitmap_line[i + 1] = chr(0)
        #         self.bitmap_line[i + 2] = chr(255)
        #         self.bitmap_facebook[i + 0] = chr(9)
        #         self.bitmap_facebook[i + 1] = chr(58)
        #         self.bitmap_facebook[i + 2] = chr(255)

        for i in self.line:
            self.bitmap_line[keyTObit[i] + 0] = chr(0)
            self.bitmap_line[keyTObit[i] + 1] = chr(255)
            self.bitmap_line[keyTObit[i] + 2] = chr(0)
            self.bitmap_line[keyTObit[i] + 3] = chr(255)

        for i in self.facebook:
            self.bitmap_facebook[keyTObit[i] + 0] = chr(255)
            self.bitmap_facebook[keyTObit[i] + 1] = chr(0)
            self.bitmap_facebook[keyTObit[i] + 2] = chr(0)
            self.bitmap_facebook[keyTObit[i] + 3] = chr(255)
        self.line_str = "".join(self.bitmap_line)
        self.facebook_str = "".join(self.bitmap_facebook)