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---------------- 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 diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 548327a3..7a21bfff 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 @@ -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 +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 diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 3a2b28f2..fe996895 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 +KEY_FENRIR 6: # self.env['runtime']['screenDriver'].getCurrApplication() self.env['screen']['lastScreenUpdate'] = time.time() - + def formatAttributes(self, 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('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) + return attributeFormatString def isSuspendingScreen(self, screen = None): if screen == None: screen = self.env['screen']['newTTY'] diff --git a/src/fenrir/core/settingsData.py b/src/fenrir/core/settingsData.py index 27c05d24..7cc90e5c 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, Font fenrirFont,Fontsize fenrirFontSize' }, 'focus':{ 'cursor': True, diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 0c10eda3..56aab35b 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,6 +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: _('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 @@ -209,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) @@ -219,6 +221,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 +235,38 @@ 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.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: + return _('underlined') + return '' + def getFenrirBold(self, attribute): + if attribute[4] == 1: + return _('bold') + return '' + def getFenrirBlink(self, attribute): + if attribute[3] == 1: + return _('blink') + return '' + def getFenrirFont(self, attribute): + return _('Default') + def getFenrirFontSize(self, attribute): + return _('Default') def update(self, trigger='onUpdate'): if trigger == 'onInput': # no need for an update on input for VCSA return