Remove indentation per request
This commit is contained in:
parent
001f092d50
commit
cb3ffb7754
1 changed files with 39 additions and 41 deletions
|
|
@ -49,51 +49,49 @@ class App:
|
||||||
|
|
||||||
|
|
||||||
# INITIALIZATION -----------------------
|
# INITIALIZATION -----------------------
|
||||||
if True:
|
macropad = MacroPad()
|
||||||
# The 'if True:' here is simply to help visually separate the code into logical sections.
|
macropad.display.auto_refresh = False
|
||||||
macropad = MacroPad()
|
macropad.pixels.auto_write = False
|
||||||
macropad.display.auto_refresh = False
|
|
||||||
macropad.pixels.auto_write = False
|
|
||||||
|
|
||||||
# Set up displayio group with all the labels
|
# Set up displayio group with all the labels
|
||||||
group = displayio.Group()
|
group = displayio.Group()
|
||||||
for key_index in range(12):
|
for key_index in range(12):
|
||||||
x = key_index % 3
|
x = key_index % 3
|
||||||
y = key_index // 3
|
y = key_index // 3
|
||||||
group.append(label.Label(terminalio.FONT, text='', color=0xFFFFFF,
|
group.append(label.Label(terminalio.FONT, text='', color=0xFFFFFF,
|
||||||
anchored_position=((macropad.display.width - 1) * x / 2,
|
anchored_position=((macropad.display.width - 1) * x / 2,
|
||||||
macropad.display.height - 1 -
|
macropad.display.height - 1 -
|
||||||
(3 - y) * 12),
|
(3 - y) * 12),
|
||||||
anchor_point=(x / 2, 1.0)))
|
anchor_point=(x / 2, 1.0)))
|
||||||
group.append(Rect(0, 0, macropad.display.width, 12, fill=0xFFFFFF))
|
group.append(Rect(0, 0, macropad.display.width, 12, fill=0xFFFFFF))
|
||||||
group.append(label.Label(terminalio.FONT, text='', color=0x000000,
|
group.append(label.Label(terminalio.FONT, text='', color=0x000000,
|
||||||
anchored_position=(macropad.display.width//2, -2),
|
anchored_position=(macropad.display.width//2, -2),
|
||||||
anchor_point=(0.5, 0.0)))
|
anchor_point=(0.5, 0.0)))
|
||||||
macropad.display.show(group)
|
macropad.display.show(group)
|
||||||
|
|
||||||
# Load all the macro key setups from .py files in MACRO_FOLDER
|
# Load all the macro key setups from .py files in MACRO_FOLDER
|
||||||
apps = []
|
apps = []
|
||||||
files = os.listdir(MACRO_FOLDER)
|
files = os.listdir(MACRO_FOLDER)
|
||||||
files.sort()
|
files.sort()
|
||||||
for filename in files:
|
for filename in files:
|
||||||
if filename.endswith('.py'):
|
if filename.endswith('.py'):
|
||||||
try:
|
try:
|
||||||
module = __import__(MACRO_FOLDER + '/' + filename[:-3])
|
module = __import__(MACRO_FOLDER + '/' + filename[:-3])
|
||||||
apps.append(App(module.app))
|
apps.append(App(module.app))
|
||||||
except (SyntaxError, ImportError, AttributeError, KeyError, NameError,
|
except (SyntaxError, ImportError, AttributeError, KeyError, NameError,
|
||||||
IndexError, TypeError) as err:
|
IndexError, TypeError) as err:
|
||||||
pass
|
|
||||||
|
|
||||||
if not apps:
|
|
||||||
group[13].text = 'NO MACRO FILES FOUND'
|
|
||||||
macropad.display.refresh()
|
|
||||||
while True:
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
last_position = None
|
if not apps:
|
||||||
last_encoder_switch = macropad.encoder_switch_debounced.pressed
|
group[13].text = 'NO MACRO FILES FOUND'
|
||||||
app_index = 0
|
macropad.display.refresh()
|
||||||
apps[app_index].switch()
|
while True:
|
||||||
|
pass
|
||||||
|
|
||||||
|
last_position = None
|
||||||
|
last_encoder_switch = macropad.encoder_switch_debounced.pressed
|
||||||
|
app_index = 0
|
||||||
|
apps[app_index].switch()
|
||||||
|
|
||||||
# MAIN LOOP ----------------------------
|
# MAIN LOOP ----------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue