Skip to content

Commit

Permalink
Revert "ENH: recoding functionality with RE open and close"
Browse files Browse the repository at this point in the history
This reverts commit daa1f53.
  • Loading branch information
olliviergassant committed Jul 5, 2024
1 parent daa1f53 commit 70427a1
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions queueUI/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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.
Expand Down Expand Up @@ -152,4 +175,4 @@ def doClose(self, *args, **kw):

# def cancel(self):
# """Handle the logic when the user clicks 'Cancel'."""
# return False
# return False

0 comments on commit 70427a1

Please sign in to comment.