set/remove window for application
This commit is contained in:
parent
10e1bed491
commit
c05382e828
5
TODO
5
TODO
@ -18,6 +18,7 @@ ToDos in Priority order:
|
|||||||
cleanup inputManager
|
cleanup inputManager
|
||||||
split input driver out of the handler
|
split input driver out of the handler
|
||||||
|
|
||||||
|
- respect window mode in differ (getwindow code is already in place)
|
||||||
- dictonary for special chars and string replacements
|
- dictonary for special chars and string replacements
|
||||||
- punctuation
|
- punctuation
|
||||||
|
|
||||||
@ -27,8 +28,6 @@ ToDos in Priority order:
|
|||||||
per application onInput
|
per application onInput
|
||||||
- per application shortcuts
|
- per application shortcuts
|
||||||
- implement commands
|
- implement commands
|
||||||
define_window
|
|
||||||
remove_window
|
|
||||||
attributes_curr_char
|
attributes_curr_char
|
||||||
toggle_highlighted_mode
|
toggle_highlighted_mode
|
||||||
generic list command (convert clipboard management)
|
generic list command (convert clipboard management)
|
||||||
@ -175,6 +174,8 @@ ps a -o tty,comm | grep -e Xorg | grep -v "grep -e Xorg"
|
|||||||
last_clipboard
|
last_clipboard
|
||||||
curr_clipboard
|
curr_clipboard
|
||||||
paste_clipboard
|
paste_clipboard
|
||||||
|
define_window
|
||||||
|
remove_window
|
||||||
reset_review_on_screen_change
|
reset_review_on_screen_change
|
||||||
remove_clipboard_marks
|
remove_clipboard_marks
|
||||||
copy_marked
|
copy_marked
|
||||||
|
@ -24,6 +24,8 @@ KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
|
|||||||
#=clear_bookmark_1
|
#=clear_bookmark_1
|
||||||
#=set_bookmark_1
|
#=set_bookmark_1
|
||||||
#=bookmark_1
|
#=bookmark_1
|
||||||
|
#=set_window_application
|
||||||
|
#=clear_window_application
|
||||||
KEY_KPPLUS=last_incomming
|
KEY_KPPLUS=last_incomming
|
||||||
KEY_FENRIR,KEY_F2=toggle_braille
|
KEY_FENRIR,KEY_F2=toggle_braille
|
||||||
KEY_FENRIR,KEY_F3=toggle_sound
|
KEY_FENRIR,KEY_F3=toggle_sound
|
||||||
|
@ -23,6 +23,8 @@ KEY_FENRIR,KEY_SHIFT,KEY_COMMA=curr_screen_after_cursor
|
|||||||
#=clear_bookmark_1
|
#=clear_bookmark_1
|
||||||
#=set_bookmark_1
|
#=set_bookmark_1
|
||||||
#=bookmark_1
|
#=bookmark_1
|
||||||
|
#=set_window_application
|
||||||
|
#=clear_window_application
|
||||||
2,KEY_FENRIR,KEY_I=indent_curr_line
|
2,KEY_FENRIR,KEY_I=indent_curr_line
|
||||||
KEY_FENRIR,KEY_SEMICOLON=last_incomming
|
KEY_FENRIR,KEY_SEMICOLON=last_incomming
|
||||||
KEY_FENRIR,KEY_F2=toggle_braille
|
KEY_FENRIR,KEY_F2=toggle_braille
|
||||||
|
@ -21,7 +21,8 @@ KEY_FENRIR,KEY_KPDOT=exit_review
|
|||||||
KEY_FENRIR,KEY_KP5=curr_screen
|
KEY_FENRIR,KEY_KP5=curr_screen
|
||||||
KEY_FENRIR,KEY_KP8=curr_screen_before_cursor
|
KEY_FENRIR,KEY_KP8=curr_screen_before_cursor
|
||||||
KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
|
KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
|
||||||
KEY_FENRIR,KEY_1=set_window
|
KEY_FENRIR,KEY_1=set_window_application
|
||||||
|
KEY_FENRIR,KEY_3=clear_window_application
|
||||||
KEY_FENRIR,KEY_3=clear_bookmark_1
|
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_FENRIR,KEY_2=bookmark_1
|
||||||
|
@ -79,7 +79,7 @@ device=all
|
|||||||
grabDevices=True
|
grabDevices=True
|
||||||
ignoreShortcuts=False
|
ignoreShortcuts=False
|
||||||
# the current shortcut layout located in /etc/fenrir/keyboard
|
# the current shortcut layout located in /etc/fenrir/keyboard
|
||||||
keyboardLayout=desktop
|
keyboardLayout=test
|
||||||
# echo chars while typing.
|
# echo chars while typing.
|
||||||
charEcho=False
|
charEcho=False
|
||||||
# echo deleted chars
|
# echo deleted chars
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
#!/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 'Turn off window mode for application'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.env['runtime']['cursorManager'].clearWindowForApplication():
|
||||||
|
self.env['runtime']['outputManager'].presentText('Window Mode off for application ' + currApp, interrupt=True)
|
||||||
|
else:
|
||||||
|
self.env['runtime']['outputManager'].presentText("Not in window Mode", interrupt=True)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -1,41 +0,0 @@
|
|||||||
#!/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
|
|
@ -0,0 +1,27 @@
|
|||||||
|
#!/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 self.env['runtime']['cursorManager'].setWindowForApplication():
|
||||||
|
self.env['runtime']['outputManager'].presentText('Window Mode on for application ' + currApp, interrupt=True)
|
||||||
|
self.env['runtime']['cursorManager'].clearMarks()
|
||||||
|
else:
|
||||||
|
self.env['runtime']['outputManager'].presentText("Set window beginn and end marks", interrupt=True)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -43,3 +43,32 @@ class cursorManager():
|
|||||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||||
if not self.env['screenData']['newCursorReview']:
|
if not self.env['screenData']['newCursorReview']:
|
||||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||||
|
def isApplicationWindowSet(self):
|
||||||
|
try:
|
||||||
|
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
||||||
|
return self.env['commandBuffer']['windowArea'][currApp]['1'] != None
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
def setWindowForApplication(self):
|
||||||
|
if not self.env['commandBuffer']['Marks']['1']:
|
||||||
|
return False
|
||||||
|
if not self.env['commandBuffer']['Marks']['2']:
|
||||||
|
return False
|
||||||
|
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()
|
||||||
|
return True
|
||||||
|
def clearWindowForApplication(self):
|
||||||
|
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
||||||
|
try:
|
||||||
|
del self.env['commandBuffer']['windowArea'][currApp]
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
@ -33,3 +33,14 @@ class screenManager():
|
|||||||
(currScreen in self.autoIgnoreScreens))
|
(currScreen in self.autoIgnoreScreens))
|
||||||
def isScreenChange(self):
|
def isScreenChange(self):
|
||||||
return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']
|
return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']
|
||||||
|
def getWindowAreaInText(self, text):
|
||||||
|
if not self.env['runtime']['cursorManager'].isApplicationWindowSet():
|
||||||
|
return text
|
||||||
|
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
||||||
|
windowText = ''
|
||||||
|
windowList = text.split('\n')
|
||||||
|
windowList = windowList[self.env['commandBuffer']['windowArea'][currApp]['1']['y']:self.env['commandBuffer']['windowArea'][currApp]['2']['y'] + 1]
|
||||||
|
for line in windowList:
|
||||||
|
windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n'
|
||||||
|
return windowText
|
||||||
|
|
||||||
|
@ -122,6 +122,9 @@ class driver():
|
|||||||
self.env['screenData']['newNegativeDelta'] = ''
|
self.env['screenData']['newNegativeDelta'] = ''
|
||||||
self.env['screenData']['newDelta'] = ''
|
self.env['screenData']['newDelta'] = ''
|
||||||
# changes on the screen
|
# changes on the screen
|
||||||
|
oldScreenText = self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['oldContentText'])
|
||||||
|
newScreenText = self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText'])
|
||||||
|
print(newScreenText)
|
||||||
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \
|
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \
|
||||||
(self.env['screenData']['newContentText'] != '' ):
|
(self.env['screenData']['newContentText'] != '' ):
|
||||||
if self.env['screenData']['oldContentText'] == '' and\
|
if self.env['screenData']['oldContentText'] == '' and\
|
||||||
|
Loading…
Reference in New Issue
Block a user