From 08619531101e73b9a5ab5bb32dd9879ebd7def1a Mon Sep 17 00:00:00 2001 From: Ollivier Date: Tue, 25 Jun 2024 14:29:07 -0400 Subject: [PATCH] BUG: #15 addition of if statements on lines 43 and 52. Prevent crashing of app if any RE button is pressed more than once. --- queueUI/mainwindow.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/queueUI/mainwindow.py b/queueUI/mainwindow.py index a056ff0..1984b34 100644 --- a/queueUI/mainwindow.py +++ b/queueUI/mainwindow.py @@ -39,18 +39,22 @@ def __init__(self): # RE Function: def openRunEngine(self): - """Opens the RunEngine.""" - self.RM.environment_open() - self.RM.wait_for_idle() - - print(f"status = {self.RM.status().get('worker_environment_exists')}") + """Checks the status of the RE. Then opens the RE.""" + if not self.RM.status().get("worker_environment_exists"): + self.RM.environment_open() + self.RM.wait_for_idle() + print(f"status = {self.RM.status().get('worker_environment_exists')}") + else: + pass def closeRunEngine(self): - """Closes the RunEngine.""" - self.RM.environment_close() - self.RM.wait_for_idle() - - print(f"status = {self.RM.status().get('worker_environment_exists')}") + """Checks the status of the RE. Then closes the RunEngine.""" + if self.RM.status().get("worker_environment_exists"): + self.RM.environment_close() + self.RM.wait_for_idle() + print(f"status = {self.RM.status().get('worker_environment_exists')}") + else: + pass def destroyRunEngine(self): """Destroys the RunEngine."""