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
from utils import debug
class command():
def __init__(self):
pass
def initialize(self, environment):
return environment
pass
def shutdown(self, environment):
return environment
pass
def getDescription(self, environment):
return 'No Description found'
def run(self, environment):
return environment
pass
def setCallback(self, callback):
pass

View File

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

View File

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

View File

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

View File

@ -18,7 +18,6 @@ class driver():
def getInput(self, environment):
event = None
r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay'))
print(len(list(r)))
if r != []:
for fd in r:
event = self.iDevices[fd].read_one()
@ -33,6 +32,12 @@ class driver():
self.iDevices = map(evdev.InputDevice, (evdev.list_devices()))
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):
for fd in self.iDevices:
dev = self.iDevices[fd]