Skip to content

Commit 849dde8

Browse files
Macropad Hotkeys: trap import errors, add comments to config files
1 parent 80cd34a commit 849dde8

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

Macropad_Hotkeys/code.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
key sequences.
77
"""
88

9-
# pylint: disable=import-error, unused-import, too-few-public-methods
9+
# pylint: disable=import-error, unused-import, too-few-public-methods, bare-except
1010

1111
import os
1212
import board
@@ -88,8 +88,11 @@ def switch(self):
8888
FILES.sort()
8989
for FILENAME in FILES:
9090
if FILENAME.endswith('.py'):
91-
module = __import__(MACRO_FOLDER + '/' + FILENAME[:-3])
92-
APPS.append(App(module.app))
91+
try:
92+
module = __import__(MACRO_FOLDER + '/' + FILENAME[:-3])
93+
APPS.append(App(module.app))
94+
except:
95+
pass
9396

9497
if not APPS:
9598
GROUP[13].text = 'NO MACRO FILES FOUND'

Macropad_Hotkeys/macros/mac-adobe-illustrator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# MACROPAD Hotkeys example: Adobe Illustrator for Mac
2+
13
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
24

35
app = { # REQUIRED dict, must be named 'app'

Macropad_Hotkeys/macros/mac-adobe-photoshop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# MACROPAD Hotkeys example: Adobe Photoshop for Mac
2+
13
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
24

35
app = { # REQUIRED dict, must be named 'app'

Macropad_Hotkeys/macros/mac-safari.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# MACROPAD Hotkeys example: Safari web browser for Mac
2+
13
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
24

35
app = { # REQUIRED dict, must be named 'app'

0 commit comments

Comments
 (0)