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