try to improve speed

This commit is contained in:
chrys 2016-09-30 23:21:30 +02:00
parent 01f28b28f6
commit 2a373306c5
2 changed files with 12 additions and 4 deletions

View File

@ -57,8 +57,8 @@ class driver():
# 1 Keys
# we try to filter out mices and other stuff here
self.iDevices = map(evdev.InputDevice, (evdev.list_devices()))
#self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}
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() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}
#self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()}
self.ledDevices = map(evdev.InputDevice, (evdev.list_devices()))
self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}

View File

@ -128,9 +128,17 @@ class driver():
self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \
self.env['screenData']['newContentText'][:self.env['screenData']['newCursor']['y']] == self.env['screenData']['oldContentText'][:self.env['screenData']['newCursor']['y']]:
diffStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y']
diff = difflib.ndiff(self.env['screenData']['oldContentText'][diffStart:diffStart + self.env['screenData']['columns']],\
self.env['screenData']['newContentText'][diffStart:diffStart + self.env['screenData']['columns']])
oldScreenText = self.env['screenData']['oldContentText'][diffStart:diffStart + self.env['screenData']['columns']]
oldScreenText = ' '.join(oldScreenText.split())
newScreenText = self.env['screenData']['newContentText'][diffStart:diffStart + self.env['screenData']['columns']]
newScreenText = ' '.join(newScreenText.split())
diff = difflib.ndiff(oldScreenText, newScreenText)
else:
oldScreenText = self.env['screenData']['oldContentText'][diffStart:diffStart + self.env['screenData']['columns']]
oldScreenText = ' '.join(oldScreenText.split())
newScreenText = self.env['screenData']['newContentText'][diffStart:diffStart + self.env['screenData']['columns']]
newScreenText = ' '.join(newScreenText.split())
diff = difflib.ndiff(oldScreenText, newScreenText)
diff = difflib.ndiff( oldScreenText[0:].split('\n'),\
newScreenText[0:].split('\n'))