diff --git a/TODO b/TODO index 578767ae..350f40be 100644 --- a/TODO +++ b/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 @@ -214,4 +213,8 @@ 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 +- pass environment instance in init and remove it from function calls + +- New Triggers + onScreenChange + rename current onScreenChange to onScreenUpdate diff --git a/src/fenrir-package/commands/onApplicationChange/command_template.py b/src/fenrir-package/commands/onApplicationChange/command_template.py new file mode 100644 index 00000000..422e89e8 --- /dev/null +++ b/src/fenrir-package/commands/onApplicationChange/command_template.py @@ -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 diff --git a/src/fenrir-package/core/commandManager.py b/src/fenrir-package/core/commandManager.py index 0a41bc9d..3527c022 100644 --- a/src/fenrir-package/core/commandManager.py +++ b/src/fenrir-package/core/commandManager.py @@ -16,13 +16,15 @@ class commandManager(): self.env['runtime']['commandManager'].loadCommands('commands') self.env['runtime']['commandManager'].loadCommands('onInput') self.env['runtime']['commandManager'].loadCommands('onScreenUpdate') - self.env['runtime']['commandManager'].loadCommands('onScreenChanged') + 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 +"/" diff --git a/src/fenrir-package/core/commands.py b/src/fenrir-package/core/commands.py index ff1a3b6a..30d32589 100644 --- a/src/fenrir-package/core/commands.py +++ b/src/fenrir-package/core/commands.py @@ -33,7 +33,9 @@ commands = { 'onScreenChanged':{ }, 'onScreenUpdate':{ - }, + }, +'onApplicationChange':{ + }, 'commands':{ - } + }, } diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 9b925b3e..330139a1 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -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') diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index 0e0701bc..5a222c86 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -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'] = ''