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): def getDescription(self):
return 'No description found' return 'No description found'
def run(self): def run(self):
print('new %s', self.env['screenData']['newApplication']) #print('new ', self.env['screenData']['newApplication'])
print('old %s', self.env['screenData']['oldApplication']) #print('old ', self.env['screenData']['oldApplication'])
print('-----------') #print('-----------')
pass
def setCallback(self, callback): def setCallback(self, callback):
pass 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,13 +67,13 @@ class commandManager():
oldScript = '' oldScript = ''
if isinstance(unLoadScript, list): if isinstance(unLoadScript, list):
if len(unLoadScript) == 0: if len(unLoadScript) == 0:
oldScript = 'default' oldScript = 'DEFAULT'
else: else:
oldScript = unLoadScript[0] oldScript = unLoadScript[0].upper()
elif unLoadScript: elif unLoadScript:
oldScript = str(unLoadScript) oldScript = str(unLoadScript).upper()
if oldScript == '': if oldScript == '':
oldScript == 'default' oldScript == 'DEFAULT'
if self.commandExists(oldScript, trigger): if self.commandExists(oldScript, trigger):
try: try:
self.env['commands'][trigger][oldScript].unload() self.env['commands'][trigger][oldScript].unload()
@ -85,13 +85,13 @@ class commandManager():
newScript = '' newScript = ''
if isinstance(loadScript, list): if isinstance(loadScript, list):
if len(loadScript) == 0: if len(loadScript) == 0:
newScript = 'default' newScript = 'DEFAULT'
else: else:
newScript = loadScript[0] newScript = loadScript[0].upper()
elif unLoadScript: elif unLoadScript:
newScript = str(loadScript) newScript = str(loadScript).upper()
if newScript == '': if newScript == '':
newScript == 'default' newScript == 'DEFAULT'
if self.commandExists(newScript, trigger): if self.commandExists(newScript, trigger):
try: try:
self.env['commands'][trigger][newScript].load() self.env['commands'][trigger][newScript].load()

View File

@ -52,7 +52,7 @@ class fenrir():
if self.environment['screenData']['newApplication'] != self.environment['screenData']['oldApplication']: if self.environment['screenData']['newApplication'] != self.environment['screenData']['oldApplication']:
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange') 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['screenData']['oldApplication'], self.environment['screenData']['newApplication'])
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
if self.environment['screenData']['newTTY'] == self.environment['screenData']['oldTTY']: if self.environment['screenData']['newTTY'] == self.environment['screenData']['oldTTY']: