make pty intial working with attributes

This commit is contained in:
chrys 2018-05-24 01:01:17 +02:00
parent 12e10719c0
commit 4f05d0aefd
5 changed files with 23 additions and 18 deletions

View File

@ -16,10 +16,11 @@
^[[1;3C=review_next_line
# alt+shift+left - beginning of line
^[[1;4D=review_line_begin
^[[1;5B=attribute_cursor
# alt+shift+right - end of line
^[[1;4C=review_line_end
# control+down - review current word
^[[1;5B=review_curr_word
#CHRYS##########################^[[1;5B=review_curr_word
# control+left - review previous word
^[[1;5D=review_prev_word
# control+right - review next word

View File

@ -19,7 +19,7 @@ class command():
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
attributes = screen_utils.splitEvery(self.env['screen']['newContentAttrib'], self.env['screen']['columns'])
attributes = attributes[cursorPos['y']][cursorPos['x']]
attributes = self.env['screen']['newContentAttrib'][cursorPos['y']][cursorPos['x']]
attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString')
attributeFormatString = self.env['runtime']['screenManager'].formatAttributes(attributes, attributeFormatString)
self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True)

View File

@ -185,6 +185,7 @@ class screenManager():
# "fontfamily"
if not attributeFormatString:
attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString')
print('call')
if not attributeFormatString:
return ''
if attributeFormatString == '':
@ -192,6 +193,7 @@ class screenManager():
if not attribute:
return ''
if len(attribute) != 10:
print('out',len(attribute),attribute)
return ''
# 0 FG color (name)
try:
@ -264,7 +266,7 @@ class screenManager():
except Exception as e:
pass
attributeFormatString = attributeFormatString.replace('fenrirFont', _('default'))
print(attributeFormatString)
return attributeFormatString
def isSuspendingScreen(self, screen = None):

View File

@ -39,8 +39,8 @@ class Terminal:
start = time.time()
for y in range(self.screen.lines):
line = self.screen.buffer[y]
attributes = [char[1:] for char in (line[x] for x in range(self.screen.columns)),False, 'default', 'default']
allAttributes += (attributes)
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()
return {"cursor": (cursor.x, cursor.y),

View File

@ -207,7 +207,7 @@ class driver(screenDriver):
#ink = 7
#paper = 0
#ch = ' '
lineAttrib += (
charAttrib = (
self.fgColorValues[15], # fg
self.bgColorValues[0], # bg
False, # bold
@ -218,6 +218,7 @@ class driver(screenDriver):
False, # blink
'default', # fontsize
'default') # fontfamily
lineAttrib.append(charAttrib)
lineText += ' '
continue
(sh,) = unpack("=H", data)
@ -241,19 +242,20 @@ class driver(screenDriver):
lineText += self.charmap[ch]
except KeyError:
lineText += '?'
lineAttrib += (
self.fgColorValues[ink],
self.bgColorValues[paper],
bold == 1, # bold
False, # italics
False, # underscore
False, # strikethrough
False, # reverse
blink == 0, # blink
'default', # fontsize
'default') # fontfamily
charAttrib = (
self.fgColorValues[ink],
self.bgColorValues[paper],
bold == 1, # bold
False, # italics
False, # underscore
False, # strikethrough
False, # reverse
blink == 1, # blink
'default', # fontsize
'default') # fontfamily
lineAttrib.append(charAttrib)
allText += lineText + '\n'
allAttrib += lineAttrib
allAttrib.append(lineAttrib)
return str(allText), allAttrib
def getFenrirBGColor(self, attribute):
try: