first initial ready to use attribute announcement

This commit is contained in:
chrys 2017-08-13 23:47:41 +02:00
parent de51ad9c47
commit 3f3905ff5f
3 changed files with 18 additions and 14 deletions

View File

@ -61,7 +61,7 @@ KEY_FENRIR,KEY_SHIFT,KEY_7=set_bookmark_7
KEY_FENRIR,KEY_7=bookmark_7 KEY_FENRIR,KEY_7=bookmark_7
KEY_FENRIR,KEY_CTRL,KEY_8=clear_bookmark_8 KEY_FENRIR,KEY_CTRL,KEY_8=clear_bookmark_8
KEY_FENRIR,KEY_SHIFT,KEY_8=set_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_CTRL,KEY_9=clear_bookmark_9
KEY_FENRIR,KEY_SHIFT,KEY_9=set_bookmark_9 KEY_FENRIR,KEY_SHIFT,KEY_9=set_bookmark_9
KEY_FENRIR,KEY_9=bookmark_9 KEY_FENRIR,KEY_9=bookmark_9

View File

@ -5,6 +5,7 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
from core import debug from core import debug
from utils import screen_utils
class command(): class command():
def __init__(self): def __init__(self):
@ -17,7 +18,8 @@ class command():
return 'No description found' return 'No description found'
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() 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']['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

@ -35,7 +35,8 @@ class driver():
self.vcsaDevicePath = '/dev/vcsa' self.vcsaDevicePath = '/dev/vcsa'
self.ListSessions = None self.ListSessions = None
self.charmap = {} 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 self.hichar = None
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
@ -210,7 +211,7 @@ class driver():
#ink = 7 #ink = 7
#paper = 0 #paper = 0
#ch = ' ' #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 += ' ' lineText += ' '
continue continue
(sh,) = unpack("=H", data) (sh,) = unpack("=H", data)
@ -221,11 +222,11 @@ class driver():
ink = attr & 0x0F ink = attr & 0x0F
paper = (attr>>4) & 0x0F paper = (attr>>4) & 0x0F
blink = 0 blink = 0
if attr & 1: #if attr & 1:
blink = 1 # blink = 1
bold = 0 bold = 0
if attr & 16: #if attr & 16:
bold = 1 # bold = 1
#if (ink != 7) or (paper != 0): #if (ink != 7) or (paper != 0):
# print(ink,paper) # print(ink,paper)
if sh & self.hichar: if sh & self.hichar:
@ -240,24 +241,25 @@ class driver():
return str(allText), allAttrib return str(allText), allAttrib
def getFenrirBGColor(self, attribute): def getFenrirBGColor(self, attribute):
try: try:
return self.colorNames[attribute[1]] return self.bgColorNames[attribute[2]]
except: except Exception as e:
print(e)
return '' return ''
def getFenrirFGColor(self, attribute): def getFenrirFGColor(self, attribute):
try: try:
return self.colorNames[attribute[0]] return self.fgColorNames[attribute[1]]
except: except:
return '' return ''
def getFenrirUnderline(self, attribute): def getFenrirUnderline(self, attribute):
if attribute[4] == 1: if attribute[5] == 1:
return _('underlined') return _('underlined')
return '' return ''
def getFenrirBold(self, attribute): def getFenrirBold(self, attribute):
if attribute[3] == 1: if attribute[4] == 1:
return _('bold') return _('bold')
return '' return ''
def getFenrirBlink(self, attribute): def getFenrirBlink(self, attribute):
if attribute[2] == 1: if attribute[3] == 1:
return _('blink') return _('blink')
return '' return ''
def getFenrirFont(self, attribute): def getFenrirFont(self, attribute):