speed up attribute collection a lot
This commit is contained in:
parent
a7862c8366
commit
ced6defe40
@ -34,27 +34,15 @@ class Terminal:
|
|||||||
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):
|
||||||
cursor = self.screen.cursor
|
cursor = self.screen.cursor
|
||||||
allAttributes = []
|
|
||||||
text = '\n'.join(self.screen.display)
|
text = '\n'.join(self.screen.display)
|
||||||
start = time.time()
|
|
||||||
buffer = self.screen.buffer
|
buffer = self.screen.buffer
|
||||||
#buffer = [[[1,1],[1,2]], [[2,1],[2,2]], [[3,1],[3,2]]]
|
attributes = [[list(attribute[1:]) + [False, 'default', 'default'] for attribute in line.values()] for line in buffer.values()]
|
||||||
#[buffer[x][y] for x in xrange(0,2) for y in xrange(0,1)]
|
|
||||||
#columns = 2
|
|
||||||
#rows = 3
|
|
||||||
#[buffer[x][0] + [False, 'default', 'default'] for line in (buffer[x] for x in range(columns))]
|
|
||||||
#allAttributes = [[attribute[1:] + [False, 'default', 'default'] for attribute in line] for line in buffer]
|
|
||||||
for y in range(self.screen.lines):
|
|
||||||
line = self.screen.buffer[y]
|
|
||||||
attributes = [list(char[1:]) + [False, 'default', 'default'] for char in (line[x] for x in range(self.screen.columns))]
|
|
||||||
allAttributes.append(attributes)
|
|
||||||
print(time.time() -start)
|
|
||||||
self.screen.dirty.clear()
|
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': allAttributes,
|
'attributes': attributes,
|
||||||
'screen': 'pty'
|
'screen': 'pty'
|
||||||
}.copy()
|
}.copy()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user