add set_window
This commit is contained in:
parent
8fc5472195
commit
10e1bed491
@ -21,8 +21,9 @@ KEY_FENRIR,KEY_KPDOT=exit_review
|
||||
KEY_FENRIR,KEY_KP5=curr_screen
|
||||
KEY_FENRIR,KEY_KP8=curr_screen_before_cursor
|
||||
KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
|
||||
KEY_FENRIR,KEY_1=set_window
|
||||
KEY_FENRIR,KEY_3=clear_bookmark_1
|
||||
KEY_FENRIR,KEY_1=set_bookmark_1
|
||||
#KEY_FENRIR,KEY_1=set_bookmark_1
|
||||
KEY_FENRIR,KEY_2=bookmark_1
|
||||
KEY_KPPLUS=last_incomming
|
||||
KEY_FENRIR,KEY_F2=toggle_braille
|
||||
|
48
src/fenrir-package/commands/commands/bookmark_1.py
Normal file
48
src/fenrir-package/commands/commands/bookmark_1.py
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import mark_utils
|
||||
from utils import line_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
self.ID = '1'
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'read Bookmark ' + self.ID
|
||||
|
||||
def run(self):
|
||||
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
||||
if not self.env['commandBuffer']['bookMarks'][self.ID]:
|
||||
self.env['runtime']['outputManager'].presentText("Bookmark " + self.ID + "not set", interrupt=True)
|
||||
return
|
||||
if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]:
|
||||
self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True)
|
||||
return
|
||||
if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']:
|
||||
self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True)
|
||||
return
|
||||
print('i',self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'])
|
||||
# set marks
|
||||
marked = ''
|
||||
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
|
||||
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
|
||||
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText'])
|
||||
else:
|
||||
x, y, marked = \
|
||||
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText'])
|
||||
if marked.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
41
src/fenrir-package/commands/commands/set_window.py
Normal file
41
src/fenrir-package/commands/commands/set_window.py
Normal file
@ -0,0 +1,41 @@
|
||||
#!/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 'set Window Mode, needs 2 marks '
|
||||
|
||||
def run(self):
|
||||
if not self.env['commandBuffer']['Marks']['1']:
|
||||
self.env['runtime']['outputManager'].presentText("No Mark found", interrupt=True)
|
||||
return
|
||||
if not self.env['commandBuffer']['Marks']['2']:
|
||||
self.env['runtime']['outputManager'].presentText("to few makrs found", interrupt=True)
|
||||
return
|
||||
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
||||
self.env['commandBuffer']['windowArea'][currApp] = {}
|
||||
|
||||
if self.env['commandBuffer']['Marks']['1']['x'] * self.env['commandBuffer']['Marks']['1']['y'] <= \
|
||||
self.env['commandBuffer']['Marks']['2']['x'] * self.env['commandBuffer']['Marks']['2']['y']:
|
||||
self.env['commandBuffer']['windowArea'][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
self.env['commandBuffer']['windowArea'][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
else:
|
||||
self.env['commandBuffer']['windowArea'][currApp]['1'] = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
self.env['commandBuffer']['windowArea'][currApp]['2'] = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
|
||||
self.env['runtime']['outputManager'].presentText('Window Mode set for application ' + currApp, interrupt=True)
|
||||
self.env['commandBuffer']['Marks']['1'] = None
|
||||
self.env['commandBuffer']['Marks']['2'] = None
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -18,6 +18,7 @@ commandBuffer = {
|
||||
'currClipboard': 0,
|
||||
'Marks':{'1':None, '2':None},
|
||||
'bookMarks':{},
|
||||
'windowArea':{},
|
||||
}
|
||||
|
||||
# used by the commandManager
|
||||
|
Loading…
Reference in New Issue
Block a user