make onAppSwitch trigger initial working

This commit is contained in:
chrys 2016-09-22 21:56:37 +02:00
parent bf0c38c912
commit 5454723d1f
7 changed files with 147 additions and 14 deletions

View File

@ -16,9 +16,10 @@ class command():
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('-----------')
#print('new ', self.env['screenData']['newApplication'])
#print('old ', self.env['screenData']['oldApplication'])
#print('-----------')
pass
def setCallback(self, callback):
pass

View File

@ -0,0 +1,33 @@
#!/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 load(self):
print('--------------')
print('agetty')
print('load old',self.env['screenData']['oldApplication'])
print('load new',self.env['screenData']['newApplication'])
print('--------------')
def unload(self):
print('--------------')
print('agetty')
print('unload old',self.env['screenData']['oldApplication'])
print('unload new',self.env['screenData']['newApplication'])
print('--------------')
def setCallback(self, callback):
pass

View File

@ -0,0 +1,33 @@
#!/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 load(self):
print('--------------')
print('bash')
print('load old',self.env['screenData']['oldApplication'])
print('load new',self.env['screenData']['newApplication'])
print('--------------')
def unload(self):
print('--------------')
print('bash')
print('unload old',self.env['screenData']['oldApplication'])
print('unload new',self.env['screenData']['newApplication'])
print('--------------')
def setCallback(self, callback):
pass

View File

@ -0,0 +1,33 @@
#!/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 load(self):
print('--------------')
print('default')
print('load old',self.env['screenData']['oldApplication'])
print('load new',self.env['screenData']['newApplication'])
print('--------------')
def unload(self):
print('--------------')
print('default')
print('unload old',self.env['screenData']['oldApplication'])
print('unload new',self.env['screenData']['newApplication'])
print('--------------')
def setCallback(self, callback):
pass

View File

@ -0,0 +1,33 @@
#!/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 load(self):
print('--------------')
print('vim')
print('load old',self.env['screenData']['oldApplication'])
print('load new',self.env['screenData']['newApplication'])
print('--------------')
def unload(self):
print('--------------')
print('vim')
print('unload old',self.env['screenData']['oldApplication'])
print('unload new',self.env['screenData']['newApplication'])
print('--------------')
def setCallback(self, callback):
pass

View File

@ -67,16 +67,16 @@ class commandManager():
oldScript = ''
if isinstance(unLoadScript, list):
if len(unLoadScript) == 0:
oldScript = 'default'
oldScript = 'DEFAULT'
else:
oldScript = unLoadScript[0]
oldScript = unLoadScript[0].upper()
elif unLoadScript:
oldScript = str(unLoadScript)
oldScript = str(unLoadScript).upper()
if oldScript == '':
oldScript == 'default'
oldScript == 'DEFAULT'
if self.commandExists(oldScript, trigger):
try:
self.env['commands'][trigger][oldScript].unload()
self.env['commands'][trigger][oldScript].unload()
except Exception as e:
print(e)
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + oldScript ,debug.debugLevel.ERROR)
@ -85,16 +85,16 @@ class commandManager():
newScript = ''
if isinstance(loadScript, list):
if len(loadScript) == 0:
newScript = 'default'
newScript = 'DEFAULT'
else:
newScript = loadScript[0]
newScript = loadScript[0].upper()
elif unLoadScript:
newScript = str(loadScript)
newScript = str(loadScript).upper()
if newScript == '':
newScript == 'default'
newScript == 'DEFAULT'
if self.commandExists(newScript, trigger):
try:
self.env['commands'][trigger][newScript].load()
self.env['commands'][trigger][newScript].load()
except Exception as e:
print(e)
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + newScript ,debug.debugLevel.ERROR)

View File

@ -52,7 +52,7 @@ class fenrir():
if self.environment['screenData']['newApplication'] != self.environment['screenData']['oldApplication']:
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
self.environment['runtime']['commandManager'].executeSwitchTrigger(self, 'onSwitchApplicationProfile', \
self.environment['runtime']['commandManager'].executeSwitchTrigger('onSwitchApplicationProfile', \
self.environment['screenData']['oldApplication'], self.environment['screenData']['newApplication'])
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
if self.environment['screenData']['newTTY'] == self.environment['screenData']['oldTTY']: