remove evdev depency from settingsManager

This commit is contained in:
chrys 2016-09-17 17:45:55 +02:00
parent 11289c09cd
commit 515e3b0f7b
5 changed files with 15 additions and 17 deletions

View File

@ -1,15 +1,16 @@
#!/bin/python #!/bin/python
from utils import debug
class command(): class command():
def __init__(self): def __init__(self):
pass pass
def initialize(self, environment): def initialize(self, environment):
return environment pass
def shutdown(self, environment): def shutdown(self, environment):
return environment pass
def getDescription(self, environment): def getDescription(self, environment):
return 'No Description found' return 'No Description found'
def run(self, environment): def run(self, environment):
return environment pass
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -19,7 +19,6 @@ class screenManager():
return environment return environment
def update(self, environment): def update(self, environment):
print(self.isSuspendingScreen(environment))
if not self.isSuspendingScreen(environment): if not self.isSuspendingScreen(environment):
environment = environment['runtime']['screenDriver'].update(environment) environment = environment['runtime']['screenDriver'].update(environment)
environment['screenData']['lastScreenUpdate'] = time.time() environment['screenData']['lastScreenUpdate'] = time.time()

View File

@ -1,5 +1,5 @@
#!/bin/python #!/bin/python
import evdev
import importlib.util import importlib.util
import os import os
from configparser import ConfigParser from configparser import ConfigParser
@ -30,7 +30,7 @@ class settingsManager():
if line.count("=") != 1: if line.count("=") != 1:
continue continue
sepLine = line.split('=') sepLine = line.split('=')
commandName = sepLine[1] commandName = sepLine[1].upper()
sepLine[0] = sepLine[0].replace(" ","") sepLine[0] = sepLine[0].replace(" ","")
sepLine[0] = sepLine[0].replace("'","") sepLine[0] = sepLine[0].replace("'","")
sepLine[0] = sepLine[0].replace('"',"") sepLine[0] = sepLine[0].replace('"',"")
@ -49,13 +49,6 @@ class settingsManager():
environment['bindings'][str(shortcut)] = commandName environment['bindings'][str(shortcut)] = commandName
kbConfig.close() kbConfig.close()
def getCodeForKeyID(self, keyID):
try:
return evdev.ecodes.ecodes[keyID.upper()]
except:
return 0
def loadSoundIcons(self, environment, soundIconPath): def loadSoundIcons(self, environment, soundIconPath):
siConfig = open(soundIconPath + '/soundicons.conf',"r") siConfig = open(soundIconPath + '/soundicons.conf',"r")
while(True): while(True):

View File

@ -33,9 +33,8 @@ class fenrir():
self.shutdown() self.shutdown()
def handleProcess(self): def handleProcess(self):
time.sleep(3)
timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment) timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
timeout = False timeout = True
try: try:
self.environment['runtime']['screenManager'].update(self.environment) self.environment['runtime']['screenManager'].update(self.environment)
except Exception as e: except Exception as e:
@ -45,7 +44,8 @@ class fenrir():
#currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment) #currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
shortcut = "[1, ['KEY_FENRIR', 'KEY_T']]" shortcut = "[1, ['KEY_FENRIR', 'KEY_T']]"
command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut) command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut)
self.environment['runtime']['commandManager'].queueCommand(self.environment, command) print(command)
#self.environment['runtime']['commandManager'].queueCommand(self.environment, command)
if not timeout: if not timeout:
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput') self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged') self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')

View File

@ -18,7 +18,6 @@ class driver():
def getInput(self, environment): def getInput(self, environment):
event = None event = None
r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay')) r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay'))
print(len(list(r)))
if r != []: if r != []:
for fd in r: for fd in r:
event = self.iDevices[fd].read_one() event = self.iDevices[fd].read_one()
@ -33,6 +32,12 @@ class driver():
self.iDevices = map(evdev.InputDevice, (evdev.list_devices())) self.iDevices = map(evdev.InputDevice, (evdev.list_devices()))
self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()} self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()}
def mapEvent(self, event):
try:
return evdev.ecodes.ecodes[keyID.upper()]
except:
return 0
def grabDevices(self): def grabDevices(self):
for fd in self.iDevices: for fd in self.iDevices:
dev = self.iDevices[fd] dev = self.iDevices[fd]