diff --git a/Makefile b/Makefile index 75347da..57f65d5 100644 --- a/Makefile +++ b/Makefile @@ -55,4 +55,4 @@ __ext__/System_MIDIRemoteScripts/.make.decompile: $(SYSTEM_MIDI_REMOTE_SCRIPTS_D .make.install: pyproject.toml poetry.lock @if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi $(POETRY) install - touch $@ \ No newline at end of file + touch $@ diff --git a/control_surface/configuration.py b/control_surface/configuration.py index 5f21502..680a4a4 100644 --- a/control_surface/configuration.py +++ b/control_surface/configuration.py @@ -294,19 +294,22 @@ def override_nav( def _override_elements_with_nav( + # Names of elements representing each direction. left: str, right: str, up: str, down: str, + # Nav to apply in the horizontal/vertical directions, or None if no nav should be specified. horizontal: Optional[NavigationTarget], vertical: Optional[NavigationTarget], ) -> List[ElementOverride]: results: List[ElementOverride] = [] - for down_element, up_element, target in ( + elements_and_targets: Iterable[Tuple[str, str, Optional[NavigationTarget]]] = ( (left, right, horizontal), # The down button increases values - think selected scene. (up, down, vertical), - ): + ) + for down_element, up_element, target in elements_and_targets: # Get a unique control name based on an element name. def background_control_name(element: str): return element.replace("[", "_").replace("]", "_") diff --git a/control_surface/mappings.py b/control_surface/mappings.py index 005ad70..a65efdd 100644 --- a/control_surface/mappings.py +++ b/control_surface/mappings.py @@ -456,12 +456,13 @@ def _navigation_mode( vertical_target: Optional[NavigationTarget], ) -> List[SimpleModeSpecification]: component_mappings: Dict[str, Dict[str, str]] = {} - for navigation_target, down_button, up_button in ( + targets_and_elements: Iterable[Tuple[Optional[NavigationTarget], str, str]] = ( (horizontal_target, "nav_left_button", "nav_right_button"), # The down button generally increases values, e.g. the selected scene index, # session ring position... (vertical_target, "nav_up_button", "nav_down_button"), - ): + ) + for navigation_target, down_button, up_button in targets_and_elements: if navigation_target: component, down_attribute, up_attribute = NAVIGATION_TARGET_MAPPINGS[ navigation_target