respect grap keyboard setting

This commit is contained in:
chrys 2016-10-01 02:54:56 +02:00
parent 4b5d12c91d
commit dc6a635e1f
4 changed files with 18 additions and 12 deletions

View File

@ -58,7 +58,7 @@ voice=
language=english-us language=english-us
# Read new text as it happens? # Read new text as it happens?
autoReadIncoming=True autoReadIncomming=True
[braille] [braille]
#braille is not implemented yet #braille is not implemented yet
@ -70,7 +70,7 @@ driver=linux
encoding=cp850 encoding=cp850
screenUpdateDelay=0.4 screenUpdateDelay=0.4
suspendingScreen= suspendingScreen=
autodetectSuspendingScreen=True autodetectSuspendingScreen=False
[keyboard] [keyboard]
driver=evdev driver=evdev
@ -79,13 +79,13 @@ device=all
grabDevices=True grabDevices=True
ignoreShortcuts=False ignoreShortcuts=False
# the current shortcut layout located in /etc/fenrir/keyboard # the current shortcut layout located in /etc/fenrir/keyboard
keyboardLayout=desktop keyboardLayout=test
# echo chars while typing. # echo chars while typing.
charEcho=False charEcho=True
# echo deleted chars # echo deleted chars
charDeleteEcho=True charDeleteEcho=True
# echo word after pressing space # echo word after pressing space
wordEcho=False wordEcho=True
# interrupt speech on any keypress # interrupt speech on any keypress
interruptOnKeyPress=False interruptOnKeyPress=False
# timeout for double tap in sec # timeout for double tap in sec
@ -96,7 +96,7 @@ debugLevel=0
punctuationLevel=Some punctuationLevel=Some
numberOfClipboards=10 numberOfClipboards=10
# define the current fenrir key # define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META fenrirKeys=KEY_KP0
timeFormat=%H:%M:%P timeFormat=%H:%M:%P
dateFormat=%A, %B %d, %Y dateFormat=%A, %B %d, %Y
autoSpellCheck=True autoSpellCheck=True

View File

@ -70,7 +70,10 @@ class inputManager():
self.env['runtime']['inputDriver'].grabDevices() self.env['runtime']['inputDriver'].grabDevices()
def releaseDevices(self): def releaseDevices(self):
try:
self.env['runtime']['inputDriver'].releaseDevices() self.env['runtime']['inputDriver'].releaseDevices()
except:
pass
def convertEventName(self, eventName): def convertEventName(self, eventName):
if not eventName: if not eventName:
@ -110,8 +113,9 @@ class inputManager():
def writeEventBuffer(self): def writeEventBuffer(self):
try: try:
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.env['runtime']['inputDriver'].writeEventBuffer() self.env['runtime']['inputDriver'].writeEventBuffer()
time.sleep(0.0005) time.sleep(0.005)
self.clearEventBuffer() self.clearEventBuffer()
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -41,7 +41,6 @@ class fenrir():
self.prepareCommand() self.prepareCommand()
if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen(): if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():
self.environment['runtime']['inputManager'].writeEventBuffer() self.environment['runtime']['inputManager'].writeEventBuffer()
time.sleep(0.005)
if self.environment['runtime']['inputManager'].noKeyPressed(): if self.environment['runtime']['inputManager'].noKeyPressed():
if self.wasCommand: if self.wasCommand:
self.wasCommand = False self.wasCommand = False

View File

@ -25,6 +25,10 @@ class driver():
def shutdown(self): def shutdown(self):
pass pass
def getInputEvent(self): def getInputEvent(self):
if not self.iDevices:
return None
if self.iDevices == {}:
return None
event = None event = None
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay')) r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay'))
if r != []: if r != []:
@ -42,14 +46,13 @@ class driver():
def writeEventBuffer(self): def writeEventBuffer(self):
for iDevice, uDevice, event in self.env['input']['eventBuffer']: for iDevice, uDevice, event in self.env['input']['eventBuffer']:
self.writeUInput(uDevice, event) self.writeUInput(uDevice, event)
uDevice.syn()
def clearEventBuffer(self): def clearEventBuffer(self):
del self.env['input']['eventBuffer'][:] del self.env['input']['eventBuffer'][:]
def writeUInput(self, uDevice, event): def writeUInput(self, uDevice, event):
uDevice.write_event(event) uDevice.write_event(event)
uDevice.syn()
def getInputDevices(self): def getInputDevices(self):
# 3 pos absolute # 3 pos absolute
# 2 pos relative # 2 pos relative