Skip to content

Commit cb3ffb7

Browse files
committed
Remove indentation per request
1 parent 001f092 commit cb3ffb7

1 file changed

Lines changed: 41 additions & 43 deletions

File tree

Macropad_Hotkeys/code.py

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -49,51 +49,49 @@ def switch(self):
4949

5050

5151
# INITIALIZATION -----------------------
52-
if True:
53-
# The 'if True:' here is simply to help visually separate the code into logical sections.
54-
macropad = MacroPad()
55-
macropad.display.auto_refresh = False
56-
macropad.pixels.auto_write = False
57-
58-
# Set up displayio group with all the labels
59-
group = displayio.Group()
60-
for key_index in range(12):
61-
x = key_index % 3
62-
y = key_index // 3
63-
group.append(label.Label(terminalio.FONT, text='', color=0xFFFFFF,
64-
anchored_position=((macropad.display.width - 1) * x / 2,
65-
macropad.display.height - 1 -
66-
(3 - y) * 12),
67-
anchor_point=(x / 2, 1.0)))
68-
group.append(Rect(0, 0, macropad.display.width, 12, fill=0xFFFFFF))
69-
group.append(label.Label(terminalio.FONT, text='', color=0x000000,
70-
anchored_position=(macropad.display.width//2, -2),
71-
anchor_point=(0.5, 0.0)))
72-
macropad.display.show(group)
73-
74-
# Load all the macro key setups from .py files in MACRO_FOLDER
75-
apps = []
76-
files = os.listdir(MACRO_FOLDER)
77-
files.sort()
78-
for filename in files:
79-
if filename.endswith('.py'):
80-
try:
81-
module = __import__(MACRO_FOLDER + '/' + filename[:-3])
82-
apps.append(App(module.app))
83-
except (SyntaxError, ImportError, AttributeError, KeyError, NameError,
84-
IndexError, TypeError) as err:
85-
pass
86-
87-
if not apps:
88-
group[13].text = 'NO MACRO FILES FOUND'
89-
macropad.display.refresh()
90-
while True:
52+
macropad = MacroPad()
53+
macropad.display.auto_refresh = False
54+
macropad.pixels.auto_write = False
55+
56+
# Set up displayio group with all the labels
57+
group = displayio.Group()
58+
for key_index in range(12):
59+
x = key_index % 3
60+
y = key_index // 3
61+
group.append(label.Label(terminalio.FONT, text='', color=0xFFFFFF,
62+
anchored_position=((macropad.display.width - 1) * x / 2,
63+
macropad.display.height - 1 -
64+
(3 - y) * 12),
65+
anchor_point=(x / 2, 1.0)))
66+
group.append(Rect(0, 0, macropad.display.width, 12, fill=0xFFFFFF))
67+
group.append(label.Label(terminalio.FONT, text='', color=0x000000,
68+
anchored_position=(macropad.display.width//2, -2),
69+
anchor_point=(0.5, 0.0)))
70+
macropad.display.show(group)
71+
72+
# Load all the macro key setups from .py files in MACRO_FOLDER
73+
apps = []
74+
files = os.listdir(MACRO_FOLDER)
75+
files.sort()
76+
for filename in files:
77+
if filename.endswith('.py'):
78+
try:
79+
module = __import__(MACRO_FOLDER + '/' + filename[:-3])
80+
apps.append(App(module.app))
81+
except (SyntaxError, ImportError, AttributeError, KeyError, NameError,
82+
IndexError, TypeError) as err:
9183
pass
9284

93-
last_position = None
94-
last_encoder_switch = macropad.encoder_switch_debounced.pressed
95-
app_index = 0
96-
apps[app_index].switch()
85+
if not apps:
86+
group[13].text = 'NO MACRO FILES FOUND'
87+
macropad.display.refresh()
88+
while True:
89+
pass
90+
91+
last_position = None
92+
last_encoder_switch = macropad.encoder_switch_debounced.pressed
93+
app_index = 0
94+
apps[app_index].switch()
9795

9896
# MAIN LOOP ----------------------------
9997

0 commit comments

Comments
 (0)