debug trash

This commit is contained in:
chrys 2016-08-30 22:41:14 +02:00
parent 805bb1e910
commit 0c6deec6d6
3 changed files with 13 additions and 3 deletions

View File

@ -42,6 +42,7 @@ class inputManager():
except: except:
pass pass
except Exception as e: except Exception as e:
environment['runtime']['debug'].writeDebugOut(environment,str(e),0)
self.freeDevices() self.freeDevices()
time.sleep(0.01) time.sleep(0.01)
environment['input']['currShortcutString'] = self.getShortcutString(environment) environment['input']['currShortcutString'] = self.getShortcutString(environment)

View File

@ -4,7 +4,7 @@
# Fenrir TTY screen reader # Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import os, sys, signal import os, sys, signal, time
if not os.getcwd() in sys.path: if not os.getcwd() in sys.path:
sys.path.append(os.getcwd()) sys.path.append(os.getcwd())
@ -22,6 +22,8 @@ class fenrir():
#self.threadonInput.start() #self.threadonInput.start()
while(self.environment['generalInformation']['running']): while(self.environment['generalInformation']['running']):
self.handleProcess() self.handleProcess()
self.environment['runtime']['debug'].writeDebugOut(environment,'happy loop at'+str(time.time()),0)
self.shutdown() self.shutdown()
def handleProcess(self): def handleProcess(self):

View File

@ -4,8 +4,8 @@
import difflib import difflib
import time import time
import re import re
from utils import debug
#import fenrir.utils.debug
class screen(): class screen():
def __init__(self, device='/dev/vcsa'): def __init__(self, device='/dev/vcsa'):
self.vcsaDevicePath = device self.vcsaDevicePath = device
@ -14,6 +14,7 @@ class screen():
return '\n'.join(string[i:i+every] for i in range(0, len(string), every)) return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
def analyzeScreen(self, environment, trigger='updateScreen'): def analyzeScreen(self, environment, trigger='updateScreen'):
environment['runtime']['debug'].writeDebugOut(environment,"start-------------"+ str(time.time()),0)
newTTY = '' newTTY = ''
newContentBytes = b'' newContentBytes = b''
try: try:
@ -26,7 +27,8 @@ class screen():
vcsa.close() vcsa.close()
if len(newContentBytes) < 5: if len(newContentBytes) < 5:
return environment return environment
except: except Exception as e:
environment['runtime']['debug'].writeDebugOut(environment,str(e),0)
return environment return environment
screenEncoding = environment['runtime']['settingsManager'].getSetting(environment,'screen', 'encoding') screenEncoding = environment['runtime']['settingsManager'].getSetting(environment,'screen', 'encoding')
environment['generalInformation']['suspend'] = newTTY in \ environment['generalInformation']['suspend'] = newTTY in \
@ -66,6 +68,9 @@ class screen():
environment['screenData']['newDelta'] = '' environment['screenData']['newDelta'] = ''
environment['screenData']['oldNegativeDelta'] = '' environment['screenData']['oldNegativeDelta'] = ''
environment['screenData']['newNegativeDelta'] = '' 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 # changes on the screen
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \ if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
@ -74,6 +79,7 @@ class screen():
environment['screenData']['newContentText'] != '': environment['screenData']['newContentText'] != '':
environment['screenData']['newDelta'] = environment['screenData']['newContentText'] environment['screenData']['newDelta'] = environment['screenData']['newContentText']
else: else:
environment['runtime']['debug'].writeDebugOut(environment,"diff start-------------"+ str(time.time()),0)
diffStart = 0 diffStart = 0
if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \ if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \
environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \ environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \
@ -86,6 +92,7 @@ class screen():
environment['screenData']['newContentText'][diffStart:].split('\n')) environment['screenData']['newContentText'][diffStart:].split('\n'))
diffList = list(diff) 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']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ '))
environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- ')) environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- '))