Moving apps to a shared folder and refactoring naming

This commit is contained in:
Lucas Oskorep
2022-09-15 17:05:25 -04:00
parent bc7a7c0168
commit 4f1ea7d416
6 changed files with 1 additions and 2 deletions
+54
View File
@@ -0,0 +1,54 @@
{
"profileName" : "",
"sortOrder" : 99,
"key1" : {
"text" : [""],
"value" : [""]
},
"key2" : {
"text" : [""],
"value" : [""]
},
"key3" : {
"text" : [""],
"value" : [""]
},
"key4" : {
"text" : [""],
"value" : [""]
},
"key5" : {
"text" : [""],
"value" : [""]
},
"key6" : {
"text" : [""],
"value" : [""]
},
"key7" : {
"text" : [""],
"value" : [""]
},
"key8" : {
"text" : [""],
"value" : [""]
},
"key9" : {
"text" : [""],
"value" : [""]
},
"key10" : {
"text" : [""],
"value" : [""]
},
"key11" : {
"text" : [""],
"value" : [""]
},
"key12" : {
"text" : [""],
"value" : [""]
}
}
+55
View File
@@ -0,0 +1,55 @@
{
"profileName" : "Gamepad",
"sortOrder" : 1,
"key1" : {
"text" : ["ESC"],
"value" : ["ESCAPE"]
},
"key2" : {
"text" : ["Tab"],
"value" : ["TAB"]
},
"key3" : {
"text" : ["R"],
"value" : ["R"]
},
"key4" : {
"text" : ["Q"],
"value" : ["Q"]
},
"key5" : {
"text" : ["W"],
"value" : ["W"]
},
"key6" : {
"text" : ["E"],
"value" : ["E"]
},
"key7" : {
"text" : ["A"],
"value" : ["A"]
},
"key8" : {
"text" : ["S"],
"value" : ["S"]
},
"key9" : {
"text" : ["D"],
"value" : ["D"]
},
"key10" : {
"text" : ["Shift"],
"value" : [""]
},
"key11" : {
"text" : ["C"],
"value" : ["C"]
},
"key12" : {
"text" : ["Space"],
"value" : ["SPACEBAR"]
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"profileName" : "NumPad",
"sortOrder" : 0,
"key1" : {
"text" : ["7"],
"value" : ["SEVEN"]
},
"key2" : {
"text" : ["8"],
"value" : ["EIGHT"]
},
"key3" : {
"text" : ["9"],
"value" : ["NINE"]
},
"key4" : {
"text" : ["4"],
"value" : ["FOUR"]
},
"key5" : {
"text" : ["5"],
"value" : ["FIVE"]
},
"key6" : {
"text" : ["6"],
"value" : ["SIX"]
},
"key7" : {
"text" : ["1"],
"value" : ["ONE"]
},
"key8" : {
"text" : ["2"],
"value" : ["TWO"]
},
"key9" : {
"text" : ["3"],
"value" : ["THREE"]
},
"key10" : {
"text" : ["0"],
"value" : ["ZERO"]
},
"key11" : {
"text" : ["."],
"value" : ["PERIOD"]
},
"key12" : {
"text" : ["ENT"],
"value" : ["RETURN"]
}
}
+1
View File
@@ -0,0 +1 @@
from .numpad import NumpadApp
+85
View File
@@ -0,0 +1,85 @@
import terminalio
from adafruit_display_text.bitmap_label import Label
from adafruit_display_text.scrolling_label import ScrollingLabel
from adafruit_displayio_layout.layouts.grid_layout import GridLayout
from rainbowio import colorwheel
from macropad_os import App
from macropad_os.app_utils import rgb_from_int
labels = [
"7", "8", "9",
"4", "5", "6",
"1", "2", "3",
"0", ".", "SHIFT"
]
modified_labels = [
"<", ">", "&",
"(", ")", "%",
"/", "+", "-",
"*", "=", "SHIFT"
]
class NumpadApp(App):
def __init__(self, macropad, config):
super().__init__(macropad, config)
self.name = "Numpad"
self.wheel_offset = 0
self.lit_keys = [False] * 12
self.labels = []
self.title = "Numpad"
self.modifier_pressed = False
def on_start(self):
print("on start from the app!")
self.set_layout(GridLayout(x=0, y=9, width=128, height=54, grid_size=(3, 4), cell_padding=1))
self.set_title(self.title)
self.lit_keys = [True] * 12
for i in range(12):
self.labels.append(Label(terminalio.FONT, text=labels[i]))
for index in range(12):
x = index % 3
y = index // 3
self._layout.add_content(self.labels[index], grid_position=(x, y), cell_size=(1, 1))
self.register_on_key_pressed(self.process_keys_pressed_callback)
self.register_on_key_released(self.process_keys_released_callback)
self.register_on_encoder_changed(self.process_enbcoder_changed)
def on_resume(self):
print("resume from the debug app!")
def on_pause(self):
print("Pausing")
def on_stop(self):
print("Stopping")
def on_loop(self):
self.update_key_colors()
def update_key_colors(self):
self.wheel_offset += 1
colors = []
for pixel in range(12):
if self.lit_keys[pixel]:
(r, g, b) = rgb_from_int(colorwheel((pixel / 12 * 256) + self.wheel_offset))
colors.append((r, g, b))
else:
colors.append((0, 0, 0))
self.set_colors(colors)
def process_keys_pressed_callback(self, keyevent):
print("PROCESS KEYS CALLBACK FROM DEBUG")
print(keyevent)
def process_keys_released_callback(self, keyevent):
print("PROCESS KEYS RELEASED CALLBACK FROM DEBUG")
print(keyevent)
def process_enbcoder_changed(self, keyevent):
print("PROCESS Encoder Changed Callback FROM DEBUG")
print(keyevent)