damn, we get not all information from pyte... we need to work arround this

This commit is contained in:
chrys 2018-05-27 23:25:38 +02:00
parent a334139902
commit 2dd92b7c68
2 changed files with 22 additions and 14 deletions

View File

@ -170,14 +170,15 @@ class attributeManager():
textLines = text.split('\n') textLines = text.split('\n')
if len(textLines) != len(newAttr): if len(textLines) != len(newAttr):
print(len(textLines), len(newAttr))
return result, currCursor return result, currCursor
print(len(textLines), len(newAttr)) #print(len(textLines), len(newAttr))
background = [] #background = []
try: try:
allAttrib = [line for line in newAttr] pass
print(allAttrib) #llAttrib = [line for line in newAttr]
#print(Counter(allAttrib[0]).most_common())
#from collections import Counter #from collections import Counter
#import random #import random
@ -188,7 +189,7 @@ class attributeManager():
#random.shuffle(values) #random.shuffle(values)
#print(values[0]) #print(values[0])
bgStat = Counter(newAttr).most_common(3) #bgStat = Counter(newAttr).most_common(3)
#for i in bgStat: #for i in bgStat:
# print(i) # print(i)
#background.append(bgStat[0][0]) #background.append(bgStat[0][0])
@ -198,16 +199,23 @@ class attributeManager():
# background.append(bgStat[1][0]) # background.append(bgStat[1][0])
except Exception as e: except Exception as e:
print(e) print(e)
print('start')
#background.append((7,7,0,0,0,0)) #background.append((7,7,0,0,0,0))
for line in range(len(newAttr)): for line in range(len(newAttr)):
print(len(textLines[line]))
#print(line,len(newAttr), len(oldAttr))
if oldAttr[line] != newAttr[line]: if oldAttr[line] != newAttr[line]:
for column in range(len(newAttr[line])): for column in range(len(newAttr[line])):
#print(column,len(newAttr[line]))
print(len(oldAttr[line]), len(newAttr[line]))
if oldAttr[line][column] != newAttr[line][column]: if oldAttr[line][column] != newAttr[line][column]:
if not self.isDefaultAttribute(newAttr[line][column]): print('jo')
if not currCursor: #if not self.isDefaultAttribute(newAttr[line][column]):
currCursor = {} #if not currCursor:
currCursor['x'] = column #currCursor = {}
currCursor['y'] = line #currCursor['x'] = column
result += textLines[line][column] #currCursor['y'] = line
#result += textLines[line][column]
result += ' ' result += ' '
print('end')
return result, currCursor return result, currCursor

View File

@ -33,16 +33,16 @@ class Terminal:
self.screen.cursor.x = min(self.screen.cursor.x, self.screen.columns - 1) self.screen.cursor.x = min(self.screen.cursor.x, self.screen.columns - 1)
self.screen.cursor.y = min(self.screen.cursor.y, self.screen.lines - 1) self.screen.cursor.y = min(self.screen.cursor.y, self.screen.lines - 1)
def dump(self): def dump(self):
self.screen.dirty.clear()
cursor = self.screen.cursor cursor = self.screen.cursor
text = '\n'.join(self.screen.display) text = '\n'.join(self.screen.display)
buffer = self.screen.buffer buffer = self.screen.buffer
attributes = [[list(attribute[1:]) + [False, 'default', 'default'] for attribute in line.values()] for line in buffer.values()] attributes = [[list(attribute[1:]) + [False, 'default', 'default'] for attribute in line.values()] for line in buffer.values()]
self.screen.dirty.clear()
return {"cursor": (cursor.x, cursor.y), return {"cursor": (cursor.x, cursor.y),
'lines': self.screen.lines, 'lines': self.screen.lines,
'columns': self.screen.columns, 'columns': self.screen.columns,
"text": text, "text": text,
'attributes': attributes, 'attributes': attributes.copy(),
'screen': 'pty' 'screen': 'pty'
}.copy() }.copy()