mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Fix issue where Stop Job button would never show
This commit is contained in:
@@ -325,7 +325,7 @@ class MainWindow(QMainWindow):
|
|||||||
current_status = self.job_list_view.item(selected_row.row(), 4).text()
|
current_status = self.job_list_view.item(selected_row.row(), 4).text()
|
||||||
|
|
||||||
# show / hide the stop button
|
# show / hide the stop button
|
||||||
show_stop_button = current_status.lower() == 'running'
|
show_stop_button = "%" in current_status
|
||||||
self.topbar.actions_call['Stop Job'].setEnabled(show_stop_button)
|
self.topbar.actions_call['Stop Job'].setEnabled(show_stop_button)
|
||||||
self.topbar.actions_call['Stop Job'].setVisible(show_stop_button)
|
self.topbar.actions_call['Stop Job'].setVisible(show_stop_button)
|
||||||
self.topbar.actions_call['Delete Job'].setEnabled(not show_stop_button)
|
self.topbar.actions_call['Delete Job'].setEnabled(not show_stop_button)
|
||||||
@@ -512,7 +512,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def stop_job(self, event):
|
def stop_job(self, event):
|
||||||
"""
|
"""
|
||||||
Event handler for the "Exit" button. Closes the application.
|
Event handler for the Stop Job button
|
||||||
"""
|
"""
|
||||||
job_ids = self.selected_job_ids()
|
job_ids = self.selected_job_ids()
|
||||||
if not job_ids:
|
if not job_ids:
|
||||||
@@ -522,14 +522,14 @@ class MainWindow(QMainWindow):
|
|||||||
job = next((job for job in self.current_server_proxy.get_all_jobs() if job.get('id') == job_ids[0]), None)
|
job = next((job for job in self.current_server_proxy.get_all_jobs() if job.get('id') == job_ids[0]), None)
|
||||||
if job:
|
if job:
|
||||||
display_name = job.get('name', os.path.basename(job.get('input_path', '')))
|
display_name = job.get('name', os.path.basename(job.get('input_path', '')))
|
||||||
message = f"Are you sure you want to delete the job:\n{display_name}?"
|
message = f"Are you sure you want to stop the job:\n{display_name}?"
|
||||||
else:
|
else:
|
||||||
return # Job not found, handle this case as needed
|
return # Job not found, handle this case as needed
|
||||||
else:
|
else:
|
||||||
message = f"Are you sure you want to delete these {len(job_ids)} jobs?"
|
message = f"Are you sure you want to stop these {len(job_ids)} jobs?"
|
||||||
|
|
||||||
# Display the message box and check the response in one go
|
# Display the message box and check the response in one go
|
||||||
msg_box = QMessageBox(QMessageBox.Icon.Warning, "Delete Job", message,
|
msg_box = QMessageBox(QMessageBox.Icon.Warning, "Stop Job", message,
|
||||||
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, self)
|
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, self)
|
||||||
|
|
||||||
if msg_box.exec() == QMessageBox.StandardButton.Yes:
|
if msg_box.exec() == QMessageBox.StandardButton.Yes:
|
||||||
|
|||||||
Reference in New Issue
Block a user