J.A.R.V.I.S icon indicating copy to clipboard operation
J.A.R.V.I.S copied to clipboard

Display the commands on GUI of JARVIS

Open BolisettySujith opened this issue 3 years ago • 2 comments

We can see at now the commands are visible on the terminal but not on the GUI of the JARVIS. The aim is to make the commands visible on the GUI of the JARVIS.

BolisettySujith avatar May 26 '21 06:05 BolisettySujith

This snippet of code will allow you to capture console output

	usage:
	  sys.stdout = Unbuffered(YourOutputStream, sys.stdout, OptionalEchoStream)
		you may pass sys.stdout as both 2nd and 3rd params to capture output as well as
 		have it still output to consolse. You can use on sys.stderr also.
	Restore normal operation:
	  sys.stdout = sys.stdout.restore()
class Unbuffered(object):

    def __init__(self, stream_out, original, echo_out=None):
		self.oout = original
        self.sout = stream_out
        self.eout = echo_out

    def write(self, data):
        if self.sout is not None:
            self.sout.write(data)
        if self.eout is not None:
            self.eout.write(data)

    def writelines(self, datas):
        self.write(''.join(datas))

    def flush(self):
        pass
        
    def restore(self):
		return self.oout

geneReeves avatar May 13 '23 02:05 geneReeves

Thanks for your interest @geneReeves, If you are interested in contributing you can make a PR and attach the working UI image.

BolisettySujith avatar May 13 '23 16:05 BolisettySujith