ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
79 stars 19 forks source link

Adding Action processing into InputProcessor #42

Open CRImier opened 6 years ago

CRImier commented 6 years ago

ZeroPhone, and some other platforms that can run ZPUI, have spare keys that can be used with various ZPUI functions. Currently, the way to bind a function to a key is adding a non-maskable callback in code of the app that contains the desired function - for example, here's how it's currently done for volume buttons and for "Next"/"Previous" MOCP player control app actions. It's an option that works, but it's not easily configurable:

  1. User shouldn't have to edit the code in order to remap a key to another function
  2. Having these mappings in code prevents them from being changeable using ZPUI itself, and having an in-ZPUI menu that'd enable the user to remap their keys would be the most user-friendly solution I can currently think of.

My idea is to have apps register some kind of "actions" into ZPUI, say, app-specific functions, during app import process. ZPUI then would have a list of available actions, and the user could access that list and map actions to keys - the actions would be then registered as non-maskable callbacks. Once a key is pressed, the action would be resolved into a function and executed. Possible problems with this approach:

  1. If an action interacts with the display or changes the keymap, the changes will affect the currently running app. So, a multicontext system ( #8 ) is needed.
  2. More?
CRImier commented 5 years ago

Plan:

create a system for apps and users to set hooks on keypad key press/hold events, essentially, have same behaviour people expect from keypad phones, but also accessible for users, and with ways to change button-to-action mappings.

Optional: