From d61ccb63afe7a70cbfeae77bb73db33d897460df Mon Sep 17 00:00:00 2001 From: Pratyush Harsh Date: Mon, 16 Mar 2020 02:44:03 +0530 Subject: [PATCH 1/2] Fixed the gui restarting error crash fix Now the application won't crash on calling the GUI multiple times --- visma/gui/window.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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") From 643ea00e435eb34243697c4ad8440debd3b3640b Mon Sep 17 00:00:00 2001 From: Pratyush Harsh Date: Mon, 16 Mar 2020 02:46:30 +0530 Subject: [PATCH 2/2] fixed GUI restart error --- main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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)