Macropad Hotkeys: trap import errors, add comments to config files

This commit is contained in:
Phillip Burgess 2021-07-06 14:20:32 -07:00
parent 80cd34a63b
commit 849dde8619
4 changed files with 12 additions and 3 deletions

View file

@ -6,7 +6,7 @@ use dial to select an application macro set, press MACROPAD keys to send
key sequences.
"""
# pylint: disable=import-error, unused-import, too-few-public-methods
# pylint: disable=import-error, unused-import, too-few-public-methods, bare-except
import os
import board
@ -88,8 +88,11 @@ FILES = os.listdir(MACRO_FOLDER)
FILES.sort()
for FILENAME in FILES:
if FILENAME.endswith('.py'):
module = __import__(MACRO_FOLDER + '/' + FILENAME[:-3])
APPS.append(App(module.app))
try:
module = __import__(MACRO_FOLDER + '/' + FILENAME[:-3])
APPS.append(App(module.app))
except:
pass
if not APPS:
GROUP[13].text = 'NO MACRO FILES FOUND'

View file

@ -1,3 +1,5 @@
# MACROPAD Hotkeys example: Adobe Illustrator for Mac
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
app = { # REQUIRED dict, must be named 'app'

View file

@ -1,3 +1,5 @@
# MACROPAD Hotkeys example: Adobe Photoshop for Mac
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
app = { # REQUIRED dict, must be named 'app'

View file

@ -1,3 +1,5 @@
# MACROPAD Hotkeys example: Safari web browser for Mac
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
app = { # REQUIRED dict, must be named 'app'