diff --git a/queueUI/mainwindow.py b/queueUI/mainwindow.py index d7ed091..340a436 100644 --- a/queueUI/mainwindow.py +++ b/queueUI/mainwindow.py @@ -49,33 +49,55 @@ def __init__(self): # self.REOpenButton.clicked.connect(self.openRunEngine) # self.RECloseButton.clicked.connect(self.closeRunEngine) - self.run_engine_state_change() - self.REOpenButton.clicked.connect(self.openRunEngine) - self.RECloseButton.clicked.connect(self.closeRunEngine) + self.REOpenButton.clicked.connect(self.run_engine_state_change) + self.RECloseButton.clicked.connect(self.run_engine_state_change) # RE Function: - def openRunEngine(self): - self.RM.environment_open() - self.RM.wait_for_idle() - self.run_engine_state_change() - - def closeRunEngine(self): - self.RM.environment_close() - self.RM.wait_for_idle() - self.run_engine_state_change() - + # def openRunEngine(self): + # """Checks the status of the RE. Then opens the RE.""" + # if not self.RM.status().get("worker_environment_exists"): + # # BUG: Status bar in app window does not print the statement below + # self.setStatus("RE Environment is opening.", timeout=0) + # self.RM.environment_open() + # self.RM.wait_for_idle() + # self.REEnvironmentStatusLabel.setText("Open") + # self.RECloseButton.setEnabled(True) + # self.REOpenButton.setEnabled(False) + # self.setStatus("RE Environment is now open.", timeout=0) + + # # print(f"status = {self.RM.status().get('worker_environment_exists')}") + # else: + # pass + + # def closeRunEngine(self): + # """Checks the status of the RE. Then closes the RunEngine.""" + # if self.RM.status().get("worker_environment_exists"): + # self.setStatus("RE Environment is closing.", timeout=0) + # self.RM.environment_close() + # self.RM.wait_for_idle() + # self.REEnvironmentStatusLabel.setText("Closed") + # self.RECloseButton.setEnabled(False) + # self.REOpenButton.setEnabled(True) + # self.setStatus("RE Environment is now closed.", timeout=0) + + # # print(f"status = {self.RM.status().get('worker_environment_exists')}") + # else: + # pass def run_engine_state(self, status, status_string): self.setStatus(f"RE Environment is {status_string}.", timeout=0) + self.RM.environment_close() + self.RM.wait_for_idle() #This is same + self.REEnvironmentStatusLabel.setText(f"{status_string}"+"ed") #This is the same if status is True: - self.RECloseButton.setEnabled(True) - self.REOpenButton.setEnabled(False) - else: self.RECloseButton.setEnabled(False) self.REOpenButton.setEnabled(True) + else: + self.RECloseButton.setEnabled(True) + self.REOpenButton.setEnabled(False) - self.setStatus(f"RE Environment is now {status_string}", timeout=0) + self.setStatus(f"RE Environment is now {status_string}"+"ed.", timeout=0) def run_engine_state_change(self): if self.RM.status().get("worker_environment_exists"): @@ -85,6 +107,7 @@ def run_engine_state_change(self): status_string = "closed" self.run_engine_state(False, status_string) + def destroyRunEngine(self): """Destroys the RunEngine.""" # TODO: Remove this function. @@ -152,4 +175,4 @@ def doClose(self, *args, **kw): # def cancel(self): # """Handle the logic when the user clicks 'Cancel'.""" - # return False \ No newline at end of file + # return False