From 3f3905ff5f33f86d2c48ee7d0cbe1f1a6b092076 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 23:47:41 +0200 Subject: [PATCH] first initial ready to use attribute announcement --- config/keyboard/desktop.conf | 2 +- .../commands/commands/attribute_cursor.py | 4 ++- src/fenrir/screenDriver/vcsaDriver.py | 26 ++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index cd591d22..02c1cae1 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -61,7 +61,7 @@ KEY_FENRIR,KEY_SHIFT,KEY_7=set_bookmark_7 KEY_FENRIR,KEY_7=bookmark_7 KEY_FENRIR,KEY_CTRL,KEY_8=clear_bookmark_8 KEY_FENRIR,KEY_SHIFT,KEY_8=set_bookmark_8 -KEY_FENRIR,KEY_8=bookmark_8 +#KEY_FENRIR,KEY_8=bookmark_8 KEY_FENRIR,KEY_CTRL,KEY_9=clear_bookmark_9 KEY_FENRIR,KEY_SHIFT,KEY_9=set_bookmark_9 KEY_FENRIR,KEY_9=bookmark_9 diff --git a/src/fenrir/commands/commands/attribute_cursor.py b/src/fenrir/commands/commands/attribute_cursor.py index 6b8614f4..86285b1f 100644 --- a/src/fenrir/commands/commands/attribute_cursor.py +++ b/src/fenrir/commands/commands/attribute_cursor.py @@ -5,6 +5,7 @@ # By Chrys, Storm Dragon, and contributers. from core import debug +from utils import screen_utils class command(): def __init__(self): @@ -17,7 +18,8 @@ class command(): return 'No description found' def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - attributes = self.env['screen']['newContentAttrib'][cursorPos['x']][cursorPos['y']] + attributes = screen_utils.splitEvery(self.env['screen']['newContentAttrib'], self.env['screen']['columns']) + attributes = attributes[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) diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 0b0b4113..c79fd3e2 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,7 +35,8 @@ class driver(): self.vcsaDevicePath = '/dev/vcsa' self.ListSessions = None self.charmap = {} - self.colorNames {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('purple'), 6: _('brown/yellow'), 7: _('white')} + self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('purple'), 6: _('brown/yellow'), 7: _('white')} + self.fgColorNames = {8: _('black'), 9: _('blue'), 10: _('green'), 11: _('cyan'), 12: _('red'), 13: _('purple'), 14: _('brown/yellow'), 15: _('white')} self.hichar = None def initialize(self, environment): self.env = environment @@ -210,7 +211,7 @@ class driver(): #ink = 7 #paper = 0 #ch = ' ' - lineAttrib.append((7,7,0,0,0,0)) # attribute, ink, paper, blink, bold, underline + lineAttrib.append((7,15,0,0,0,0)) # attribute, ink, paper, blink, bold, underline lineText += ' ' continue (sh,) = unpack("=H", data) @@ -221,11 +222,11 @@ class driver(): ink = attr & 0x0F paper = (attr>>4) & 0x0F blink = 0 - if attr & 1: - blink = 1 + #if attr & 1: + # blink = 1 bold = 0 - if attr & 16: - bold = 1 + #if attr & 16: + # bold = 1 #if (ink != 7) or (paper != 0): # print(ink,paper) if sh & self.hichar: @@ -240,24 +241,25 @@ class driver(): return str(allText), allAttrib def getFenrirBGColor(self, attribute): try: - return self.colorNames[attribute[1]] - except: + return self.bgColorNames[attribute[2]] + except Exception as e: + print(e) return '' def getFenrirFGColor(self, attribute): try: - return self.colorNames[attribute[0]] + return self.fgColorNames[attribute[1]] except: return '' def getFenrirUnderline(self, attribute): - if attribute[4] == 1: + if attribute[5] == 1: return _('underlined') return '' def getFenrirBold(self, attribute): - if attribute[3] == 1: + if attribute[4] == 1: return _('bold') return '' def getFenrirBlink(self, attribute): - if attribute[2] == 1: + if attribute[3] == 1: return _('blink') return '' def getFenrirFont(self, attribute):