From 227bd99fb45b945a822e2966a1398b93f245384e Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 18 Oct 2016 19:04:04 +0200 Subject: [PATCH] add subprcess_command for external calling --- src/fenrir/commands/commands/subprocess.py | 29 +++++++++++++++++++ .../commands/onScreenChanged/10000-shut_up.py | 1 - 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/fenrir/commands/commands/subprocess.py diff --git a/src/fenrir/commands/commands/subprocess.py b/src/fenrir/commands/commands/subprocess.py new file mode 100644 index 00000000..183c52c9 --- /dev/null +++ b/src/fenrir/commands/commands/subprocess.py @@ -0,0 +1,29 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug +import subprocess, os + +class command(): + def __init__(self): + pass + def initialize(self, environment, scriptPaht=''): + self.env = environment + self.scriptPath = scriptPath + def shutdown(self): + pass + def getDescription(self): + return 'script: '+ self.scriptPath + def run(self): + p = Popen(self.scriptPath , stdout=PIPE, stderr=PIPE, shell=True) + stdout, stderr = p.communicate() + self.env['runtime']['outputManager'].interruptOutput() + if stderr != '': + self.env['runtime']['outputManager'].presentText(stdout , soundIcon='', interrupt=False) + if stdout != '' + self.env['runtime']['outputManager'].presentText(stdout , soundIcon='', interrupt=False) + def setCallback(self, callback): + pass diff --git a/src/fenrir/commands/onScreenChanged/10000-shut_up.py b/src/fenrir/commands/onScreenChanged/10000-shut_up.py index 6e18eb70..884c4264 100644 --- a/src/fenrir/commands/onScreenChanged/10000-shut_up.py +++ b/src/fenrir/commands/onScreenChanged/10000-shut_up.py @@ -17,7 +17,6 @@ class command(): return '' def run(self): - self.env['runtime']['outputManager'].interruptOutput() def setCallback(self, callback):