Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Askannz committed Oct 2, 2018
2 parents 4458cc1 + 5cb5452 commit 40ef859
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 8 deletions.
19 changes: 13 additions & 6 deletions msi_perkeyrgb/msi_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"modifiers": [0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x65, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
"numpad": [0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]}

PRESETS_FILES = [
(["GE63", "GE73", "GS63", "GS73", "GX63", "GT63"], "1.json"),
(["GS65"], "2.json")
]


class MSI_Keyboard:

Expand All @@ -26,12 +31,14 @@ def get_model_keymap(msi_model):

@staticmethod
def get_model_presets(msi_model):
presets_path = os.path.join(os.path.dirname(__file__), 'presets/{}.json'.format(msi_model))
try:
f = open(presets_path)
return json.load(f)
except FileNotFoundError:
return {}

for msi_models, filename in PRESETS_FILES:
if msi_model in msi_models:
presets_path = os.path.join(os.path.dirname(__file__), 'presets', filename)
f = open(presets_path)
msi_presets = json.load(f)
f.close()
return msi_presets

def __init__(self, usb_id, msi_keymap, msi_presets):

Expand Down
2 changes: 1 addition & 1 deletion msi_perkeyrgb/msi_perkeyrgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from msi_perkeyrgb.msi_keyboard import MSI_Keyboard, AVAILABLE_MSI_KEYMAPS
from msi_perkeyrgb.hidapi_wrapping import HIDLibraryError, HIDNotFoundError, HIDOpenError

VERSION = "1.1"
VERSION = "1.2"
DEFAULT_ID = "1038:1122"
DEFAULT_MODEL = "GE63" # Default laptop model if nothing specified

Expand Down
Loading

0 comments on commit 40ef859

Please sign in to comment.