move key passwd to config

This commit is contained in:
petrucci4prez 2017-06-24 00:39:28 -04:00
parent 2775a9a4b9
commit 501577d153
3 changed files with 7 additions and 2 deletions

View File

@ -14,3 +14,4 @@ secretTable:
INSTANT_ARM: rudess INSTANT_ARM: rudess
LOCK: myung LOCK: myung
INSTANT_LOCK: portnoy INSTANT_LOCK: portnoy
keyPasswd: 123456

View File

@ -43,10 +43,14 @@ class KeypadListener:
wrongPassSound = soundLib.soundEffects['wrongPass'] wrongPassSound = soundLib.soundEffects['wrongPass']
backspaceSound = soundLib.soundEffects['backspace'] backspaceSound = soundLib.soundEffects['backspace']
if not isinstance(passwd, int):
logger.error('KeyPasswd must be int. Check configuration')
raise SystemExit
def checkPasswd(action): def checkPasswd(action):
if self._buf == '': if self._buf == '':
ctrlKeySound.play() ctrlKeySound.play()
elif self._buf == passwd: elif self._buf == str(passwd):
self.resetBuffer() self.resetBuffer()
action() action()
else: else:

View File

@ -179,7 +179,7 @@ class StateMachine:
self._addManaged(PipeListener(callback=secretCallback, name='secret')) self._addManaged(PipeListener(callback=secretCallback, name='secret'))
self._addManaged(KeypadListener(stateMachine=self, passwd='5918462')) self._addManaged(KeypadListener(stateMachine=self, passwd=configFile['keyPasswd']))
def startTimer(t, sound): def startTimer(t, sound):
self._timer = _CountdownTimer(t, self.TIMOUT, sound) self._timer = _CountdownTimer(t, self.TIMOUT, sound)