fenrir/src/fenrirscreenreader/core/inputDriver.py

60 lines
1.6 KiB
Python
Raw Normal View History

#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
class inputDriver():
def __init__(self):
self._initialized = False
def initialize(self, environment):
self.env = environment
2018-03-26 03:10:05 -04:00
self.env['runtime']['inputManager'].setShortcutType('KEY')
self._isInitialized = True
def shutdown(self):
if self._initialized:
2018-05-24 05:22:58 -04:00
self.removeAllDevices()
self._isInitialized = False
def getInputEvent(self):
2018-05-24 05:22:58 -04:00
time.sleep(0.1)
return None
def clearEventBuffer(self):
if not self._initialized:
return
2018-05-26 17:23:58 -04:00
del self.env['input']['eventBuffer'][:]
2018-05-24 21:03:07 -04:00
def updateInputDevices(self, newDevices = None, init = False):
if not self._initialized:
return
def getLedState(self, led = 0):
if not self._initialized:
return False
return False
def toggleLedState(self, led = 0):
if not self._initialized:
2018-05-14 08:58:17 -04:00
return
2018-05-14 08:57:38 -04:00
def grabAllDevices(self):
if not self._initialized:
2018-05-14 08:58:17 -04:00
return
2018-05-14 08:57:38 -04:00
def ungrabAllDevices(self):
if not self._initialized:
2018-05-14 08:58:17 -04:00
return
2018-05-24 05:22:58 -04:00
def hasIDevices(self):
if not self._initialized:
return False
2018-05-26 17:23:58 -04:00
return True
2018-05-14 08:57:38 -04:00
def removeAllDevices(self):
if not self._initialized:
2018-05-14 08:58:17 -04:00
return
2019-01-29 17:07:20 -05:00
def sendKey(self):
if not self._initialized:
return
def __del__(self):
if not self._initialized:
2018-05-24 05:22:58 -04:00
return
try:
self.removeAllDevices()
except:
pass