initial onApplicationChange trigger
This commit is contained in:
parent
2cd218f3e7
commit
52793528dd
7
TODO
7
TODO
@ -22,8 +22,7 @@ ToDos in Priority order:
|
||||
- punctuation
|
||||
- New Triggers
|
||||
onAppChange
|
||||
onScreenChange
|
||||
rename current onScreenChange to onScreenUpdate
|
||||
|
||||
- add perApplicationTrigger trigger
|
||||
per application commands
|
||||
per application onScreenChange
|
||||
@ -215,3 +214,7 @@ ps a -o tty,comm | grep -e Xorg | grep -v "grep -e Xorg"
|
||||
- add screenManager
|
||||
abstract screen driver
|
||||
- pass environment instance in init and remove it from function calls
|
||||
|
||||
- New Triggers
|
||||
onScreenChange
|
||||
rename current onScreenChange to onScreenUpdate
|
||||
|
@ -0,0 +1,24 @@
|
||||
#!/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 'No description found'
|
||||
def run(self):
|
||||
print('new %s', self.env['screenData']['newApplication'])
|
||||
print('old %s', self.env['screenData']['oldApplication'])
|
||||
print('-----------')
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -17,12 +17,14 @@ class commandManager():
|
||||
self.env['runtime']['commandManager'].loadCommands('onInput')
|
||||
self.env['runtime']['commandManager'].loadCommands('onScreenUpdate')
|
||||
self.env['runtime']['commandManager'].loadCommands('onScreenChanged')
|
||||
self.env['runtime']['commandManager'].loadCommands('onApplicationChange')
|
||||
|
||||
def shutdown(self):
|
||||
self.env['runtime']['commandManager'].shutdownCommands('commands')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onInput')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onScreenUpdate')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onScreenChanged')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onApplicationChange')
|
||||
|
||||
def loadCommands(self, section='commands'):
|
||||
commandFolder = "commands/" + section +"/"
|
||||
|
@ -34,6 +34,8 @@ commands = {
|
||||
},
|
||||
'onScreenUpdate':{
|
||||
},
|
||||
'onApplicationChange':{
|
||||
},
|
||||
'commands':{
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ class fenrir():
|
||||
print(e)
|
||||
self.environment['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
if self.environment['screenData']['newApplication'] != self.environment['screenData']['oldApplication']:
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands('onApplicationChange')
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands('onInput')
|
||||
if self.environment['screenData']['newTTY'] == self.environment['screenData']['oldTTY']:
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands('onScreenUpdate')
|
||||
|
@ -113,7 +113,6 @@ class driver():
|
||||
self.env['screenData']['oldCursor']['y'] = 0
|
||||
self.env['screenData']['oldDelta'] = ''
|
||||
self.env['screenData']['oldNegativeDelta'] = ''
|
||||
self.env['screenData']['oldApplication'] = ''
|
||||
# always clear current deltas
|
||||
self.env['screenData']['newNegativeDelta'] = ''
|
||||
self.env['screenData']['newDelta'] = ''
|
||||
|
Loading…
Reference in New Issue
Block a user