set/remove window for application
This commit is contained in:
@ -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
|
@ -42,4 +42,33 @@ class cursorManager():
|
||||
def enterReviewModeCurrTextCursor(self):
|
||||
self.env['screenData']['oldCursorReview'] = 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))
|
||||
def isScreenChange(self):
|
||||
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']['newDelta'] = ''
|
||||
# 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 \
|
||||
(self.env['screenData']['newContentText'] != '' ):
|
||||
if self.env['screenData']['oldContentText'] == '' and\
|
||||
|
Reference in New Issue
Block a user