From 2a373306c52ae40aabba047ceb4377f2f1e76d10 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 30 Sep 2016 23:21:30 +0200 Subject: [PATCH] try to improve speed --- src/fenrir-package/inputDriver/evdev.py | 4 ++-- src/fenrir-package/screenDriver/linux.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/fenrir-package/inputDriver/evdev.py b/src/fenrir-package/inputDriver/evdev.py index feff6ff8..6817e37a 100644 --- a/src/fenrir-package/inputDriver/evdev.py +++ b/src/fenrir-package/inputDriver/evdev.py @@ -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()} diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index 3f941b29..3e8062dd 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -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'))