fix typo and copy paste in dummyDrivers

This commit is contained in:
chrys 2017-01-30 19:40:24 +01:00
parent a9381d87d4
commit 04459e8eb7
4 changed files with 33 additions and 31 deletions

View File

@ -10,7 +10,7 @@ class driver():
def __init__(self): def __init__(self):
self._isInitialized = False self._isInitialized = False
self._brl = None self._brl = None
self._deviceSize = 0
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
try: try:
@ -26,6 +26,8 @@ class driver():
def getDeviceSize(self): def getDeviceSize(self):
if not self._isInitialized: if not self._isInitialized:
return (0,0) return (0,0)
if not self._deviceSize:
return (0,0)
return self._deviceSize return self._deviceSize
def flush(self): def flush(self):

View File

@ -13,35 +13,35 @@ class driver():
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self._isInitialized = True self._isInitialized = True
pirnt('BrailleDummyDriver: Initialize') print('BrailleDummyDriver: Initialize')
def getDeviceSize(self): def getDeviceSize(self):
if not self._isInitialized: if not self._isInitialized:
return (0,0) return (0,0)
pirnt('BrailleDummyDriver: getDeviceSize 20') print('BrailleDummyDriver: getDeviceSize 20')
return (20,0) return (20,0)
def writeText(self,text): def writeText(self,text):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('BrailleDummyDriver: writeText:' + str(text)) print('BrailleDummyDriver: writeText:' + str(text))
pirnt('BrailleDummyDriver: -----------------------------------') print('BrailleDummyDriver: -----------------------------------')
def connectDevice(self): def connectDevice(self):
pirnt('BrailleDummyDriver: connectDevice') print('BrailleDummyDriver: connectDevice')
def enterScreen(self, screen): def enterScreen(self, screen):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('BrailleDummyDriver: enterScreen') print('BrailleDummyDriver: enterScreen')
def leveScreen(self): def leveScreen(self):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('BrailleDummyDriver: leveScreen') print('BrailleDummyDriver: leveScreen')
def shutdown(self): def shutdown(self):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('BrailleDummyDriver: Shutdown') print('BrailleDummyDriver: Shutdown')

View File

@ -14,42 +14,42 @@ class driver():
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self._initialized = True self._initialized = True
pirnt('SoundDummyDriver: Initialize') print('SoundDummyDriver: Initialize')
def shutdown(self): def shutdown(self):
if not self._initialized: if not self._initialized:
return return
self.cancel() self.cancel()
pirnt('SoundDummyDriver: Shutdown') print('SoundDummyDriver: Shutdown')
def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0):
if not self._initialized: if not self._initialized:
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
pirnt('SoundDummyDriver: playFrequence:' + ' freq:' + str(frequence) + ' duration:' + str(duration) + ' adjustVolume:' + str(adjustVolume) ) print('SoundDummyDriver: playFrequence:' + ' freq:' + str(frequence) + ' duration:' + str(duration) + ' adjustVolume:' + str(adjustVolume) )
pirnt('SoundDummyDriver: -----------------------------------')') print('SoundDummyDriver: -----------------------------------')')
def playSoundFile(self, filePath, interrupt = True): def playSoundFile(self, filePath, interrupt = True):
if not self._initialized: if not self._initialized:
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
pirnt('SoundDummyDriver: playSoundFile:' + str(filePath)) print('SoundDummyDriver: playSoundFile:' + str(filePath))
pirnt('SoundDummyDriver: -----------------------------------') print('SoundDummyDriver: -----------------------------------')
def cancel(self): def cancel(self):
if not self._initialized: if not self._initialized:
return return
pirnt('SoundDummyDriver: Cancel') print('SoundDummyDriver: Cancel')
def setCallback(self, callback): def setCallback(self, callback):
if not self._initialized: if not self._initialized:
return return
pirnt('SoundDummyDriver: setCallback') print('SoundDummyDriver: setCallback')
def setVolume(self, volume): def setVolume(self, volume):
if not self._initialized: if not self._initialized:
return return
self.volume = volume self.volume = volume
pirnt('SoundDummyDriver: setVolume:' + str(self.volume)) print('SoundDummyDriver: setVolume:' + str(self.volume))

View File

@ -13,58 +13,58 @@ class driver():
def initialize(self, environment): def initialize(self, environment):
self._isInitialized = True self._isInitialized = True
self.env = environment self.env = environment
pirnt('SpeechDummyDriver: Iitialize') print('SpeechDummyDriver: Iitialize')
def shutdown(self): def shutdown(self):
pirnt('SpeechDummyDriver: Shutdown') print('SpeechDummyDriver: Shutdown')
def speak(self,text, queueable=True): def speak(self,text, queueable=True):
if not self._isInitialized: if not self._isInitialized:
return return
if not queueable: if not queueable:
self.cancel() self.cancel()
pirnt('SpeechDummyDriver: Speak:'+text) print('SpeechDummyDriver: Speak:'+text)
pirnt('SpeechDummyDriver: -----------------------------------') print('SpeechDummyDriver: -----------------------------------')
def cancel(self): def cancel(self):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: Cancel') print('SpeechDummyDriver: Cancel')
def setCallback(self, callback): def setCallback(self, callback):
pirnt('SpeechDummyDriver: setCallback') print('SpeechDummyDriver: setCallback')
def clear_buffer(self): def clear_buffer(self):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: clear_buffer') print('SpeechDummyDriver: clear_buffer')
def setVoice(self, voice): def setVoice(self, voice):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setVoice:' + str(voice)) print('SpeechDummyDriver: setVoice:' + str(voice))
def setPitch(self, pitch): def setPitch(self, pitch):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setPitch:' + str(pitch)) print('SpeechDummyDriver: setPitch:' + str(pitch))
def setRate(self, rate): def setRate(self, rate):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setRate:' + str(rate)) print('SpeechDummyDriver: setRate:' + str(rate))
def setModule(self, module): def setModule(self, module):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setModule:' + str(module)) print('SpeechDummyDriver: setModule:' + str(module))
def setLanguage(self, language): def setLanguage(self, language):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setLanguage:' + str(language)) print('SpeechDummyDriver: setLanguage:' + str(language))
def setVolume(self, volume): def setVolume(self, volume):
if not self._isInitialized: if not self._isInitialized:
return return
pirnt('SpeechDummyDriver: setVolume:' + str(volume)) print('SpeechDummyDriver: setVolume:' + str(volume))