From c193f7140b6970c04b1fc97f785ed1b433bcf141 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 22:38:12 +0200 Subject: [PATCH 01/16] add basic settings for attributs --- config/settings/espeak.settings.conf | 8 ++++++++ config/settings/settings.conf | 8 ++++++++ config/settings/settings.conf.storm | 8 ++++++++ src/fenrir/core/settingsData.py | 5 +++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index fd7c3fd1..2d35399c 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -165,6 +165,14 @@ autoSpellCheck=True spellCheckLanguage=en_US scriptPath=/usr/share/fenrir/scripts commandPath= +#fenrirBGColor = the backgroundcolor +#fenrirFGColor = the foregroundcolor +#fenrirUnderline = speak the underline attribute +#fenrirBold = speak the bold attribute +#fenrirBlink = speak the blink attribute +#fenrirFont = the font +#fenrirFontSize = the fontsize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize [focus] cursor=True diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 6fc96a5f..a6d1ca18 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -173,6 +173,14 @@ spellCheckLanguage=en_US scriptPath=/usr/share/fenrir/scripts # overload commands, and create new one without changing Fenrir default commandPath= +#fenrirBGColor = the backgroundcolor +#fenrirFGColor = the foregroundcolor +#fenrirUnderline = speak the underline attribute +#fenrirBold = speak the bold attribute +#fenrirBlink = speak the blink attribute +#fenrirFont = the font +#fenrirFontSize = the fontsize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize [focus] #follow the text cursor diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index efdbfe5f..efde299d 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -120,6 +120,14 @@ spellCheckLanguage=en_US scriptPath=/usr/share/fenrir/scripts # overload commands, and create new one without changing Fenrir default commandPath= +#fenrirBGColor = the backgroundcolor +#fenrirFGColor = the foregroundcolor +#fenrirUnderline = speak the underline attribute +#fenrirBold = speak the bold attribute +#fenrirBlink = speak the blink attribute +#fenrirFont = the font +#fenrirFontSize = the fontsize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize [focus] #follow the text cursor diff --git a/src/fenrir/core/settingsData.py b/src/fenrir/core/settingsData.py index 27c05d24..80d25b93 100644 --- a/src/fenrir/core/settingsData.py +++ b/src/fenrir/core/settingsData.py @@ -67,8 +67,9 @@ settingsData = { 'dateFormat': '%A, %B %d, %Y', 'autoSpellCheck': False, 'spellCheckLanguage': 'en_US', - 'scriptPath':'/usr/share/fenrir/scripts', - 'commandPath':'/usr/share/fenrir/commands', + 'scriptPath': '/usr/share/fenrir/scripts', + 'commandPath': '/usr/share/fenrir/commands', + 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize' }, 'focus':{ 'cursor': True, From da0ffbc3c84dbb875be3b27b36f0b4a37ae3124d Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 23:06:45 +0200 Subject: [PATCH 02/16] attribute structure --- config/keyboard/desktop.conf | 1 + config/keyboard/laptop.conf | 1 + src/fenrir/core/screenManager.py | 16 +++++++++++- src/fenrir/screenDriver/vcsaDriver.py | 36 +++++++++++++++++++++++++-- 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 548327a3..cd591d22 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -85,6 +85,7 @@ KEY_FENRIR,KEY_KPASTERISK=toggle_highlight_tracking KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date +#=attribute_cursor KEY_FENRIR,KEY_S=spell_check 2,KEY_FENRIR,KEY_S=add_word_to_spell_check KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 3a2b28f2..fc836963 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -85,6 +85,7 @@ KEY_FENRIR,KEY_Y=toggle_highlight_tracking KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date +#=attribute_cursor KEY_FENRIR,KEY_S=spell_check 2,KEY_FENRIR,KEY_S=add_word_to_spell_check KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py index 3d159901..fd6f8e8e 100644 --- a/src/fenrir/core/screenManager.py +++ b/src/fenrir/core/screenManager.py @@ -35,7 +35,21 @@ class screenManager(): # or len(self.env['screen']['newDelta']) > 6: # self.env['runtime']['screenDriver'].getCurrApplication() self.env['screen']['lastScreenUpdate'] = time.time() - + def formatAttributes(self, x, y,attribute, attributeFormatString = None): + if not attributeFormatString: + attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') + if not attributeFormatString: + return '' + if attributeFormatString == '': + return '' + attributeFormatString = attributeFormatString.replace('fenrirBGColor', self.env['runtime']['screenDriver'].getFenrirBGColor(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFGColor', self.env['runtime']['screenDriver'].getFenrirFGColor(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirUnderline', self.env['runtime']['screenDriver'].getFenrirUnderline(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirBold', self.env['runtime']['screenDriver'].getFenrirBold(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirBlink', self.env['runtime']['screenDriver'].getFenrirBlink(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) + return attributeFormatString def isSuspendingScreen(self, screen = None): if screen == None: screen = self.env['screen']['newTTY'] diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 0c10eda3..f9e4595f 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,6 +35,7 @@ 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.hichar = None def initialize(self, environment): self.env = environment @@ -219,6 +220,12 @@ class driver(): attr >>= 1 ink = attr & 0x0F paper = (attr>>4) & 0x0F + blink = 0 + if attr & 1: + blink = 1 + bold = 0 + if attr & 16: + bold = 1 #if (ink != 7) or (paper != 0): # print(ink,paper) if sh & self.hichar: @@ -227,11 +234,36 @@ class driver(): lineText += self.charmap[ch] except KeyError: lineText += '?' - lineAttrib.append((attr,ink, paper,0,0,0)) # attribute, ink, paper, blink, bold, underline + lineAttrib.append((attr,ink, paper,blink,bold,0)) # attribute, ink, paper, blink, bold, underline allText += lineText + '\n' allAttrib += lineAttrib return str(allText), allAttrib - + def getFenrirBGColor(self, attribute): + try: + return self.colorNames[attribute[1]] + except: + return '' + def getFenrirFGColor(attribute): + try: + return self.colorNames[attribute[0]] + except: + return '' + def getFenrirUnderline(attribute): + if attribute[4] == 1: + return _('underlined') + return '' + def getFenrirBold(attribute): + if attribute[3] == 1: + return _('bold') + return '' + def getFenrirBlink(attribute): + if attribute[2] == 1: + return _('blink') + return '' + def getFenrirFont(attribute): + return 'System Font' + def getFenrirFontSize(attribute): + return 'System Font Size' def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return From 0c34c2e871321511539ea832eddbfd470ce29d98 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 23:13:05 +0200 Subject: [PATCH 03/16] more attribute work --- .../commands/commands/attribute_cursor.py | 25 +++++++++++++++++++ src/fenrir/core/screenManager.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/fenrir/commands/commands/attribute_cursor.py diff --git a/src/fenrir/commands/commands/attribute_cursor.py b/src/fenrir/commands/commands/attribute_cursor.py new file mode 100644 index 00000000..a843e4c0 --- /dev/null +++ b/src/fenrir/commands/commands/attribute_cursor.py @@ -0,0 +1,25 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() + attributes = self.env['screen']['newContentAttrib'][cursorPos['x']][cursorPos['y']] + attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') + attributeFormatString = self.env['runtime']['screenManager'].formatAttributes(attributeFormatString) + self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py index fd6f8e8e..4f0d9c68 100644 --- a/src/fenrir/core/screenManager.py +++ b/src/fenrir/core/screenManager.py @@ -35,7 +35,7 @@ class screenManager(): # or len(self.env['screen']['newDelta']) > 6: # self.env['runtime']['screenDriver'].getCurrApplication() self.env['screen']['lastScreenUpdate'] = time.time() - def formatAttributes(self, x, y,attribute, attributeFormatString = None): + def formatAttributes(self, attribute, attributeFormatString = None): if not attributeFormatString: attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') if not attributeFormatString: From 0c3238d47a98fa9bc8995516fd4b8f31afb0602c Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 23:14:13 +0200 Subject: [PATCH 04/16] add missing parameter --- src/fenrir/commands/commands/attribute_cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrir/commands/commands/attribute_cursor.py b/src/fenrir/commands/commands/attribute_cursor.py index a843e4c0..6b8614f4 100644 --- a/src/fenrir/commands/commands/attribute_cursor.py +++ b/src/fenrir/commands/commands/attribute_cursor.py @@ -19,7 +19,7 @@ class command(): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() attributes = self.env['screen']['newContentAttrib'][cursorPos['x']][cursorPos['y']] attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') - attributeFormatString = self.env['runtime']['screenManager'].formatAttributes(attributeFormatString) + attributeFormatString = self.env['runtime']['screenManager'].formatAttributes(attributes, attributeFormatString) self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True) def setCallback(self, callback): pass From de51ad9c470b495b65393fc1ccba17dbebda47c7 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 13 Aug 2017 23:15:23 +0200 Subject: [PATCH 05/16] add self parameter --- src/fenrir/screenDriver/vcsaDriver.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index f9e4595f..0b0b4113 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -243,27 +243,27 @@ class driver(): return self.colorNames[attribute[1]] except: return '' - def getFenrirFGColor(attribute): + def getFenrirFGColor(self, attribute): try: return self.colorNames[attribute[0]] except: return '' - def getFenrirUnderline(attribute): + def getFenrirUnderline(self, attribute): if attribute[4] == 1: return _('underlined') return '' - def getFenrirBold(attribute): + def getFenrirBold(self, attribute): if attribute[3] == 1: return _('bold') return '' - def getFenrirBlink(attribute): + def getFenrirBlink(self, attribute): if attribute[2] == 1: return _('blink') return '' - def getFenrirFont(attribute): - return 'System Font' - def getFenrirFontSize(attribute): - return 'System Font Size' + def getFenrirFont(self, attribute): + return _('System Font') + def getFenrirFontSize(self, attribute): + return _('System Font Size') def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return From 3923f8075c67aacf4771127446d28288b0481e6a Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 13 Aug 2017 17:17:19 -0400 Subject: [PATCH 06/16] Added keybinding for desktop cursor atrtributes. --- config/keyboard/desktop.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index cd591d22..8fd57067 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -85,7 +85,7 @@ KEY_FENRIR,KEY_KPASTERISK=toggle_highlight_tracking KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date -#=attribute_cursor +KEY_KPMINUS=attribute_cursor KEY_FENRIR,KEY_S=spell_check 2,KEY_FENRIR,KEY_S=add_word_to_spell_check KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check From d111e59e4632542fa582ac7f48b539fdc2b8a675 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 13 Aug 2017 17:20:47 -0400 Subject: [PATCH 07/16] Added keybinding for laptop cursor atrtributes. --- config/keyboard/laptop.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index fc836963..fe996895 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -85,7 +85,7 @@ KEY_FENRIR,KEY_Y=toggle_highlight_tracking KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date -#=attribute_cursor +KEY_FENRIR Date: Sun, 13 Aug 2017 23:47:41 +0200 Subject: [PATCH 08/16] 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): From 2a2791448a4887667d9cfb462a2d84dd8db03b68 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 00:40:08 +0200 Subject: [PATCH 09/16] fix colors --- play zone/colors.sh | 39 +++++++++++++++++++++++++++ src/fenrir/screenDriver/vcsaDriver.py | 20 +++++++------- 2 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 play zone/colors.sh diff --git a/play zone/colors.sh b/play zone/colors.sh new file mode 100644 index 00000000..7459faf3 --- /dev/null +++ b/play zone/colors.sh @@ -0,0 +1,39 @@ +#!/bin/bash +echo "foreground colors" +echo -e "\e[39mDefault" +echo -e "\e[30mBlack" +echo -e "\e[31mRed" +echo -e "\e[32mGreen" +echo -e "\e[33mYellow" +echo -e "\e[34mBlue" +echo -e "\e[35mMagenta" +echo -e "\e[36mCyan" +echo -e "\e[37mLight gray" +echo -e "\e[90mDark gray" +echo -e "\e[91mLight red" +echo -e "\e[92mLight green" +echo -e "\e[93mLight yellow" +echo -e "\e[94mLight blue" +echo -e "\e[95mLight magenta" +echo -e "\e[96mLight cyan" +echo -e "\e[97mWhite" + +echo "background colors" +echo -e "\e[49mDefault" +echo -e "\e[40mBlack" +echo -e "\e[41mRed" +echo -e "\e[42mGreen" +echo -e "\e[43mYellow" +echo -e "\e[44mBlue" +echo -e "\e[45mMagenta" +echo -e "\e[46mCyan" +echo -e "\e[47mLight gray" +echo -e "\e[100mDark gray" +echo -e "\e[101mLight red" +echo -e "\e[102mLight green" +echo -e "\e[103mLight yellow" +echo -e "\e[104mLight blue" +echo -e "\e[105mLight magenta" +echo -e "\e[106mLight cyan" +echo -e "\e[107mWhite" + diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index c79fd3e2..274ba76d 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,8 +35,8 @@ class driver(): self.vcsaDevicePath = '/dev/vcsa' self.ListSessions = None self.charmap = {} - 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.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} + self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} self.hichar = None def initialize(self, environment): self.env = environment @@ -222,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,15 +240,15 @@ class driver(): allAttrib += lineAttrib return str(allText), allAttrib def getFenrirBGColor(self, attribute): + print(attribute[2]) try: return self.bgColorNames[attribute[2]] except Exception as e: - print(e) return '' def getFenrirFGColor(self, attribute): try: return self.fgColorNames[attribute[1]] - except: + except Exception as e: return '' def getFenrirUnderline(self, attribute): if attribute[5] == 1: @@ -263,9 +263,9 @@ class driver(): return _('blink') return '' def getFenrirFont(self, attribute): - return _('System Font') + return _('') def getFenrirFontSize(self, attribute): - return _('System Font Size') + return _('') def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return From 1be80e3d571846e59f89350dfec9225859508d68 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 00:40:34 +0200 Subject: [PATCH 10/16] remove debug --- src/fenrir/screenDriver/vcsaDriver.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 274ba76d..900d36ea 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -240,7 +240,6 @@ class driver(): allAttrib += lineAttrib return str(allText), allAttrib def getFenrirBGColor(self, attribute): - print(attribute[2]) try: return self.bgColorNames[attribute[2]] except Exception as e: From 05ad4d8efe7567474b82982fd2e448817d2572be Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 00:47:15 +0200 Subject: [PATCH 11/16] adjust --- src/fenrir/screenDriver/vcsaDriver.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 900d36ea..56aab35b 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -222,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: @@ -243,11 +243,13 @@ class driver(): try: return self.bgColorNames[attribute[2]] except Exception as e: + print(e) return '' def getFenrirFGColor(self, attribute): try: return self.fgColorNames[attribute[1]] except Exception as e: + print(e) return '' def getFenrirUnderline(self, attribute): if attribute[5] == 1: @@ -262,9 +264,9 @@ class driver(): return _('blink') return '' def getFenrirFont(self, attribute): - return _('') + return _('Default') def getFenrirFontSize(self, attribute): - return _('') + return _('Default') def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return From 96851f63324fcc8b7f918a98e7c03ab262844cf2 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 00:50:29 +0200 Subject: [PATCH 12/16] fix replacement --- src/fenrir/core/screenManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py index 4f0d9c68..80b45c8b 100644 --- a/src/fenrir/core/screenManager.py +++ b/src/fenrir/core/screenManager.py @@ -47,8 +47,8 @@ class screenManager(): attributeFormatString = attributeFormatString.replace('fenrirUnderline', self.env['runtime']['screenDriver'].getFenrirUnderline(attribute)) attributeFormatString = attributeFormatString.replace('fenrirBold', self.env['runtime']['screenDriver'].getFenrirBold(attribute)) attributeFormatString = attributeFormatString.replace('fenrirBlink', self.env['runtime']['screenDriver'].getFenrirBlink(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) return attributeFormatString def isSuspendingScreen(self, screen = None): if screen == None: From 90fc9fd08dc4d7ff73aa0e4c58cae70b08182070 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 01:00:53 +0200 Subject: [PATCH 13/16] add formats to colors.sh --- play zone/fg.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 play zone/fg.sh diff --git a/play zone/fg.sh b/play zone/fg.sh new file mode 100644 index 00000000..ebf15118 --- /dev/null +++ b/play zone/fg.sh @@ -0,0 +1,48 @@ +#!/bin/bash +echo "foreground colors" +echo -e "\e[39mDefault" +echo -e "\e[30mBlack" +echo -e "\e[31mRed" +echo -e "\e[32mGreen" +echo -e "\e[33mYellow" +echo -e "\e[34mBlue" +echo -e "\e[35mMagenta" +echo -e "\e[36mCyan" +echo -e "\e[37mLight gray" +echo -e "\e[90mDark gray" +echo -e "\e[91mLight red" +echo -e "\e[92mLight green" +echo -e "\e[93mLight yellow" +echo -e "\e[94mLight blue" +echo -e "\e[95mLight magenta" +echo -e "\e[96mLight cyan" +echo -e "\e[97mWhite" +#7: _('Default'), 0: _('Black'), 4: _('Red'), 2: _('Green'), 6: _('Yellow'), 1: _('Blue'), 5: _('Magenta'), 3: _('Cyan'), 7: _('Light gray'), 8: _('Dark gray'), 12: _('Light red'), 10: , ('Light green'), 14: _('Light yellow'), 9: _('Light blue'), 13: _('Light magenta'), 11: _('Light cyan'), 15: _('White') + +echo "background colors" +echo -e "\e[49mDefault" +echo -e "\e[40mBlack" +echo -e "\e[41mRed" +echo -e "\e[42mGreen" +echo -e "\e[43mYellow" +echo -e "\e[44mBlue" +echo -e "\e[45mMagenta" +echo -e "\e[46mCyan" +echo -e "\e[47mLight gray" +echo -e "\e[100mDark gray" +echo -e "\e[101mLight red" +echo -e "\e[102mLight green" +echo -e "\e[103mLight yellow" +echo -e "\e[104mLight blue" +echo -e "\e[105mLight magenta" +echo -e "\e[106mLight cyan" +echo -e "\e[107mWhite" + +echo "format" +echo -e "\e[1mBold" +echo -e "\e[2mDim" +echo -e "\e[4mUnderlined" +echo -e "\e[5mBlink" +echo -e "\e[7minverted" +echo -e "\e[8mHidden" + From 0436dcbd8140ca3070040a12c6a986e2eaa7f586 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 14 Aug 2017 01:04:25 +0200 Subject: [PATCH 14/16] add lable --- config/settings/espeak.settings.conf | 2 +- config/settings/settings.conf | 2 +- config/settings/settings.conf.storm | 2 +- src/fenrir/core/settingsData.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 2d35399c..cda22e19 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -172,7 +172,7 @@ commandPath= #fenrirBlink = speak the blink attribute #fenrirFont = the font #fenrirFontSize = the fontsize -attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize [focus] cursor=True diff --git a/config/settings/settings.conf b/config/settings/settings.conf index a6d1ca18..49babb8e 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -180,7 +180,7 @@ commandPath= #fenrirBlink = speak the blink attribute #fenrirFont = the font #fenrirFontSize = the fontsize -attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize [focus] #follow the text cursor diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index efde299d..9a7d527b 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -127,7 +127,7 @@ commandPath= #fenrirBlink = speak the blink attribute #fenrirFont = the font #fenrirFontSize = the fontsize -attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize +attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize [focus] #follow the text cursor diff --git a/src/fenrir/core/settingsData.py b/src/fenrir/core/settingsData.py index 80d25b93..7cc90e5c 100644 --- a/src/fenrir/core/settingsData.py +++ b/src/fenrir/core/settingsData.py @@ -69,7 +69,7 @@ settingsData = { 'spellCheckLanguage': 'en_US', 'scriptPath': '/usr/share/fenrir/scripts', 'commandPath': '/usr/share/fenrir/commands', - 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink,fenrirFont,fenrirFontSize' + 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize' }, 'focus':{ 'cursor': True, From a81bcb6b2e74cbefa0407099197fd604de3e94ce Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 15 Aug 2017 01:56:28 +0200 Subject: [PATCH 15/16] todo --- TODO v1.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO v1.5 b/TODO v1.5 index 08cbac33..7934e56b 100644 --- a/TODO v1.5 +++ b/TODO v1.5 @@ -7,7 +7,7 @@ Fix Bugs: - Wlan is disabled on Lenovo (LED is not synced?, needs debug bgid) General: -- implement commands +- implement commands (WIP) attributes_curr_char (Easy for contribution) https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -----------DONE---------------- From acccebda18d42047caf7cff9fe6c9f4b6d82242a Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 16 Aug 2017 00:43:06 +0200 Subject: [PATCH 16/16] add attribute stuff todo --- TODO v2.0 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TODO v2.0 b/TODO v2.0 index 2cc875f8..342049ba 100644 --- a/TODO v2.0 +++ b/TODO v2.0 @@ -17,6 +17,12 @@ Cleanups: settingsData -> defaultSettings.py General: +- imporove attribute handling +[] add an attribute sound +[] beep on cursor/ review by char (capital wins) +[] beep on review by word (once for multible, captial wins) +[] configurable (by char, by word, none) + - generic list or see Tutorial mode list (convert clipboard management) (Easy for contribution) next item pref item