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

View File

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

View File

@ -41,7 +41,6 @@ class fenrir():
self.prepareCommand()
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()
time.sleep(0.005)
if self.environment['runtime']['inputManager'].noKeyPressed():
if self.wasCommand:
self.wasCommand = False

View File

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