Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement shared settings menu #397

Draft
wants to merge 75 commits into
base: main
Choose a base branch
from

Conversation

chrisib
Copy link
Collaborator

@chrisib chrisib commented Dec 4, 2024

Add a new SettingsMenu inspired by the menu system in Pam's Workout. This should give a more consistent look-and-feel to menu-oriented applications.

SettingsMenu

The SettingsMenu object contains one or more MenuItem objects. MenuItem is a generic class that can be extended as-needed to e.g. add visualizations.

Base MenuItem subclasses are SettingMenuItem, which which acts as a wrapper around a ChoiceConfigPoint, and ActionMenuItem which simply invokes a callback function based on the user's selection.

The SettingsMenu object manages button handlers for the rising & falling edge of the navigation button (b2 by default, and reads values from the navigation knob (k2 by default) as needed.

SettingMenuItems can also be configured to automatically read from ain or the non-navigation menu (k1 by default) at 10Hz and use that to automatically choose from the available choices. Each SettingMenuItem also supports callbacks when its value changes, allowing for inter-option logic, or firing other events as a result of a setting change.

An abstract MenuItem class is provided to add custom items to the menu, including visualizations (see SequentialSwitch and EuclideanRhythms for examples of visualizations implemented as menu items).

Configuration Editor

A frequently-requested feature on Discord has been a way to edit EuroPi_Config on the module itself, rather than manually editing the JSON file. This is implemented by the new tools/config_edit module. The ConfigurationEditor class implements a simple SettingsMenu to categorize the configuration points.

Items that have the potential to cause harm/usability issues if edited (e.g. changing the display SDA, SCL, Channel, or Frequency values) are marked with a new danger flag, which displays a ! warning symbol on SettingMenuItem instances that wrap them.

Modified Contrib Scripts

The following scripts have been modified to use the new SettingsMenu instead of implementing their own menu system:

  • Pam's Workout
  • Euclid
  • Sequential Switch

…sic rendering, callback support, graphics & labels
…g through an editable menu item would change the active item. Fix the key for the graphics in the menu dict
…he constructor with keyword arguments. This allows us to create references to menu items to use in callback functions
… with/without type hints formatted, isn't it?
…(e.g. visualizations). Implement the new menu system in the sequential switch
…n. Refactor the Euclidean generator to use the new menu system
…menus as the config editor. Add a note about 1 decimal place for voltage settings, to account for the editor's float_precision limit
…sensitive items. Show a ! in the corner of the configuration editor for such items
…ding/saving channel settings. Unlike before, don't keep the banks in memory; just load & apply them on-demand. Banks are saved in parallel files, rather than in the main settings.
… to use these as s&h inputs, not autoselects
…tor script as an additional example in the menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft Not yet ready to merge firmware Software related issue new script feature Feature additions or improvements to a contrib script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant