updates to options and debug apps allowing them to run side by side.
This commit is contained in:
+5
-8
@@ -16,7 +16,7 @@ class OptionsApp(App):
|
||||
self.send_keyboard_inputs = 0
|
||||
self.lit_keys = [False] * 12
|
||||
self.labels = []
|
||||
self.layout = GridLayout(x=0, y=9, width=128, height=54, grid_size=(4, 1), cell_padding=1)
|
||||
self.layout = GridLayout(x=0, y=9, width=128, height=54, grid_size=(4, 4), cell_padding=1)
|
||||
self.title = label.Label(
|
||||
y=4,
|
||||
font=terminalio.FONT,
|
||||
@@ -28,22 +28,19 @@ class OptionsApp(App):
|
||||
def on_start(self):
|
||||
print("on start from the app!")
|
||||
self.lit_keys = [False] * 4
|
||||
# self.macropad.display.show(self.display_group)
|
||||
for _ in range(4):
|
||||
self.labels.append(label.Label(terminalio.FONT, text=""))
|
||||
|
||||
for index in range(4):
|
||||
x = index % 3 + 1
|
||||
y = index // 3
|
||||
self.layout.add_content(self.labels[index], grid_position=(x, y), cell_size=(1, 1))
|
||||
x = 0
|
||||
y = index
|
||||
self.layout.add_content(self.labels[index], grid_position=(x, y), cell_size=(3, 1))
|
||||
|
||||
def on_resume(self):
|
||||
print("resume from the options app!")
|
||||
self.display_group.append(self.title)
|
||||
self.display_group.append(self.layout)
|
||||
self.macropad.display.show(self.display_group)
|
||||
print(self.display_group)
|
||||
print(id(self.display_group))
|
||||
|
||||
def on_pause(self):
|
||||
print("Pausing")
|
||||
@@ -60,7 +57,7 @@ class OptionsApp(App):
|
||||
def process_key_presses(self):
|
||||
key_event = self.macropad.keys.events.get()
|
||||
if key_event:
|
||||
if key_event.key_number < 4:
|
||||
if key_event.key_number < 12:
|
||||
if key_event.pressed :
|
||||
self.labels[key_event.key_number].text = "KEY{}".format(key_event.key_number)
|
||||
print(self.macropad.keys)
|
||||
|
||||
Reference in New Issue
Block a user