From 0c6deec6d618a437a76626a2743cfb02d1852005 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 30 Aug 2016 22:41:14 +0200 Subject: [PATCH] debug trash --- src/fenrir-package/core/inputManager.py | 1 + src/fenrir-package/fenrir.py | 4 +++- src/fenrir-package/screen/linux.py | 11 +++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/fenrir-package/core/inputManager.py b/src/fenrir-package/core/inputManager.py index 21d7e8d6..0c4580d8 100644 --- a/src/fenrir-package/core/inputManager.py +++ b/src/fenrir-package/core/inputManager.py @@ -42,6 +42,7 @@ class inputManager(): except: pass except Exception as e: + environment['runtime']['debug'].writeDebugOut(environment,str(e),0) self.freeDevices() time.sleep(0.01) environment['input']['currShortcutString'] = self.getShortcutString(environment) diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index db24e367..37283f92 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -4,7 +4,7 @@ # Fenrir TTY screen reader # By Chrys, Storm Dragon, and contributers. -import os, sys, signal +import os, sys, signal, time if not os.getcwd() in sys.path: sys.path.append(os.getcwd()) @@ -22,6 +22,8 @@ class fenrir(): #self.threadonInput.start() while(self.environment['generalInformation']['running']): self.handleProcess() + self.environment['runtime']['debug'].writeDebugOut(environment,'happy loop at'+str(time.time()),0) + self.shutdown() def handleProcess(self): diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index b1c7b880..7d6f3308 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -4,8 +4,8 @@ import difflib import time import re +from utils import debug -#import fenrir.utils.debug class screen(): def __init__(self, device='/dev/vcsa'): self.vcsaDevicePath = device @@ -14,6 +14,7 @@ class screen(): return '\n'.join(string[i:i+every] for i in range(0, len(string), every)) def analyzeScreen(self, environment, trigger='updateScreen'): + environment['runtime']['debug'].writeDebugOut(environment,"start-------------"+ str(time.time()),0) newTTY = '' newContentBytes = b'' try: @@ -26,7 +27,8 @@ class screen(): vcsa.close() if len(newContentBytes) < 5: return environment - except: + except Exception as e: + environment['runtime']['debug'].writeDebugOut(environment,str(e),0) return environment screenEncoding = environment['runtime']['settingsManager'].getSetting(environment,'screen', 'encoding') environment['generalInformation']['suspend'] = newTTY in \ @@ -66,6 +68,9 @@ class screen(): environment['screenData']['newDelta'] = '' environment['screenData']['oldNegativeDelta'] = '' environment['screenData']['newNegativeDelta'] = '' + environment['runtime']['debug'].writeDebugOut(environment,'____CONT START_____'),0) + environment['runtime']['debug'].writeDebugOut(environment,environment['screenData']['newContentText']+ str(time.time()),0) + environment['runtime']['debug'].writeDebugOut(environment,'____CONT END____'),0) # changes on the screen if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \ @@ -74,6 +79,7 @@ class screen(): environment['screenData']['newContentText'] != '': environment['screenData']['newDelta'] = environment['screenData']['newContentText'] else: + environment['runtime']['debug'].writeDebugOut(environment,"diff start-------------"+ str(time.time()),0) diffStart = 0 if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \ environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \ @@ -86,6 +92,7 @@ class screen(): environment['screenData']['newContentText'][diffStart:].split('\n')) diffList = list(diff) + environment['runtime']['debug'].writeDebugOut(environment,"diff end-------------"+ str(time.time()),0) 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('- '))