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 ^[[1;3C=review_next_line
# alt+shift+left - beginning of line # alt+shift+left - beginning of line
^[[1;4D=review_line_begin ^[[1;4D=review_line_begin
^[[1;5B=attribute_cursor
# alt+shift+right - end of line # alt+shift+right - end of line
^[[1;4C=review_line_end ^[[1;4C=review_line_end
# control+down - review current word # control+down - review current word
^[[1;5B=review_curr_word #CHRYS##########################^[[1;5B=review_curr_word
# control+left - review previous word # control+left - review previous word
^[[1;5D=review_prev_word ^[[1;5D=review_prev_word
# control+right - review next word # control+right - review next word

View File

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

View File

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

View File

@ -39,8 +39,8 @@ class Terminal:
start = time.time() start = time.time()
for y in range(self.screen.lines): for y in range(self.screen.lines):
line = self.screen.buffer[y] line = self.screen.buffer[y]
attributes = [char[1:] for char in (line[x] for x in range(self.screen.columns)),False, 'default', 'default'] attributes = [list(char[1:]) + [False, 'default', 'default'] for char in (line[x] for x in range(self.screen.columns))]
allAttributes += (attributes) allAttributes.append(attributes)
print(time.time() -start) print(time.time() -start)
self.screen.dirty.clear() self.screen.dirty.clear()
return {"cursor": (cursor.x, cursor.y), return {"cursor": (cursor.x, cursor.y),

View File

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