aboutsummaryrefslogtreecommitdiffstats
path: root/abcontroller.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-22 22:14:43 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-22 22:14:43 +0100
commit71593d438dff1a54986c94b469faa31c4581f6c7 (patch)
treed9209575ef368d015728937b47c5601ed3268bec /abcontroller.py
parent5f7e75ae1e53d3833114880d20e899629d21e31a (diff)
Fixed additive loading issue
Diffstat (limited to 'abcontroller.py')
-rw-r--r--abcontroller.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/abcontroller.py b/abcontroller.py
index e9eace4..2e08936 100644
--- a/abcontroller.py
+++ b/abcontroller.py
@@ -4,7 +4,7 @@ _AB = namedtuple("_AB", ["a", "b"])
class ABController:
def __init__(self, enabled=True, callback=None):
- self.setPositionCallback = callback
+ self._setPositionCallback = callback
self._limits = dict() # dictionary of all songs
self._songLimits = None # list of limits for selected song
self._currentLimits = None # a/b positions of selected limit
@@ -42,11 +42,14 @@ class ABController:
def positionChanged(self, position):
if not self._currentLimits:
return
- if position > self._currentLimits.b and self.setPositionCallback and self._enabled:
- self.setPositionCallback(self._currentLimits.a)
+ if position > self._currentLimits.b and self._setPositionCallback and self._enabled:
+ self._setPositionCallback(self._currentLimits.a)
def setEnable(self, enable):
self._enabled = enable
def getLimits(self, song):
return self._limits.get(song)
+
+ def clear(self):
+ self.__init__(enabled=self._enabled, callback=self._setPositionCallback)