Skip to content

Commit

Permalink
Remove saved preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
kmontag committed Jan 30, 2024
1 parent a4f31aa commit fe25f73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
4 changes: 0 additions & 4 deletions control_surface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,6 @@ class Specification(ControlSurfaceSpecification):


class modeStep(ControlSurface):
# Key for saved preferences.
preferences_key = "modeStep"

def __init__(self, specification=Specification, *a, c_instance=None, **k):
# A new control surface gets constructed when the song is changed, so we can
# load song-dependent configuration.
Expand Down Expand Up @@ -251,7 +248,6 @@ def _get_additional_dependencies(self) -> typing.Any:
deps["component_map"] = const(self.component_map)
deps["configuration"] = const(self._configuration)
deps["hardware"] = const(self.component_map["Hardware"])
deps["preferences"] = const(self.preferences)
deps["specification"] = const(self.specification)

return deps
Expand Down
20 changes: 3 additions & 17 deletions control_surface/session_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,19 @@


class SessionRingComponent(SessionRingComponentBase):
preferences_highlight_scenes_key = "session_ring_highlight_scenes"
preferences_highlight_tracks_key = "session_ring_highlight_tracks"

@depends(preferences={}, set_session_highlight=(const(nop)))
@depends(set_session_highlight=(const(nop)))
def __init__(
self,
*a,
name="Session_Ring",
num_tracks=0,
num_scenes=0,
preferences: Optional[dict] = None,
set_session_highlight: SessionHighlightCallback = nop,
**k,
):
assert preferences
self._preferences = preferences

# Try and sanitize the input just in case anything gets weird.
self._highlight_scenes, self._highlight_tracks = [
clamp(int(preferences[key]), 0, max_value)
if key in preferences
else default
for key, max_value, default in (
(self.preferences_highlight_scenes_key, num_scenes, 1),
(self.preferences_highlight_tracks_key, num_tracks, num_tracks),
)
]
self._highlight_scenes = num_scenes
self._highlight_tracks = num_tracks

def _set_reduced_session_highlight(
track_offset, scene_offset, num_tracks, num_scenes, include_returns
Expand Down

0 comments on commit fe25f73

Please sign in to comment.