From 4fd69bfe2d28069182bdad7dcf4493b5ba86d74a Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 20 Sep 2016 18:00:22 +0200 Subject: [PATCH] fix mistakes --- src/fenrir-package/fenrir.py | 4 +-- src/fenrir-package/screenDriver/linux.py | 46 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 07e2dc54..55993c9f 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -38,12 +38,12 @@ class fenrir(): if not timeout: self.prepareCommand() if not (self.environment['runtime']['inputManager'].isConsumeInput(self.environment) or \ - self.environment['runtime']['inputManager'].isFenrirKeyPressed(self.environment) and + self.environment['runtime']['inputManager'].isFenrirKeyPressed(self.environment)) and \ not self.environment['runtime']['commandManager'].isCommandQueued(self.environment): self.environment['runtime']['inputManager'].writeEventBuffer(self.environment) elif self.environment['runtime']['inputManager'].noKeyPressed(self.environment): self.environment['runtime']['inputManager'].clearEventBuffer(self.environment) - + try: self.environment['runtime']['screenManager'].update(self.environment) except Exception as e: diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index 210d6349..93c2d057 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -28,6 +28,27 @@ class driver(): environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR) return currScreen + def getCurrApplication(self, screen): + apps = [] + appList = [] + try: + apps = subprocess.Popen('ps a -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') + except Exception as e: + print(e) + return appList + currScreen = str(screen) + for i in apps: + i = i.split() + i[0] = i[0].lower() + i[1] = i[1].lower() + if '+' in i[2]: + if not "grep" == i[0] and \ + not "sh" == i[0] and \ + not "ps" == i[0]: + if "tty"+currScreen in i[1]: + appList.append(i[0]) + return appList + def getIgnoreScreens(self): xlist = [] try: @@ -37,32 +58,12 @@ class driver(): return xlist for i in x: if not "grep" in i and \ - if not "ps" in i: + not "ps" in i: if (i[:3].lower() == 'tty'): xlist.append(i[3]) return xlist -def getCurrApplication(self, screen): - apps = [] - appList = [] - try: - apps = subprocess.Popen('ps a -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') - except Exception as e: - print(e) - return appList - currScreen = str(screen) - for i in apps: - i = i.split() - i[0] = i[0].lower() - i[1] = i[1].lower() - if '+' in i[2]: - if not "grep" == i[0] and \ - not "sh" == i[0] and \ - not "ps" == i[0]: - if "tty"+currScreen in i[1]: - appList.append(i[0]) - return appList - + def update(self, environment, trigger='updateScreen'): newTTY = '' newContentBytes = b'' @@ -138,4 +139,3 @@ def getCurrApplication(self, screen): environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ ')) environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- ')) -