diff --git a/main.py b/main.py index e51e48b..62e33d3 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import sys import os from cmd import Cmd from visma.gui.cli import commandExec @@ -5,7 +6,7 @@ from visma.gui import logger -def init(): +def init(argLength): open(os.path.abspath("log.txt"), "w").close() logger.setLevel(10) logger.setLogName('main') @@ -34,8 +35,10 @@ class VisMa_Prompt(Cmd): "|_________________________________________________________________________________________________|\n"\ prompt = '>>> ' - intro = "Welcome! This is Visual Maths Interactive Shell...\n" + "type 'help' for a User Manual and Ctrl + D to Exit prompt\n" - + if argLength ==3: + intro = "" + else: + intro="Welcome! This is Visual Maths Interactive Shell...\n" + "type 'help' for a User Manual and Ctrl + D to Exit prompt\n" def do_exit(self, inp): '''Exits VisMa Prompt''' print("Exiting VisMa...") @@ -56,7 +59,8 @@ def do_gui(self, inp): print("Initiating GUI...") logger.info("Initiating GUI...") - def default(self, inp): + + def default(self, inp=0): '''Directs to CommandExec and performs operations thereafter''' try: commandExec(inp) @@ -68,6 +72,6 @@ def default(self, inp): VisMa_Prompt().cmdloop() - if __name__ == '__main__': - init() + argLength=len(sys.argv) + init(argLength) diff --git a/visma/gui/window.py b/visma/gui/window.py index 8454172..8303811 100644 --- a/visma/gui/window.py +++ b/visma/gui/window.py @@ -971,6 +971,9 @@ def initGUI(): ex = Window() ex.initUI() logger.setLogName('main') - sys.exit(app.exec_()) + app.exec_() + sys.exit(restart()) finally: logger.info('Existing VisMa...') +def restart(): + os.system("python3 main.py 1 1")