changelog fixes and further updates to cancel running process

This commit is contained in:
2025-10-15 10:48:07 -07:00
parent 87073fb218
commit d6c71e0ab2
2 changed files with 59 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
# Version 1.1.2
- Fixed incorrect colormaps being applied
- Added functionality to utilize external event markers from a file. Fixes [Issue 6](https://git.research.dezeeuw.ca/tyler/flares/issues/6)
# Version 1.1.1 # Version 1.1.1
- Fixed the number of rectangles in the progress bar to 19 - Fixed the number of rectangles in the progress bar to 19

52
main.py
View File

@@ -1179,6 +1179,11 @@ class ProgressBubble(QWidget):
else: else:
rect.setStyleSheet("background-color: white; border: 1px solid gray;") rect.setStyleSheet("background-color: white; border: 1px solid gray;")
def mark_cancelled(self):
if 0 <= self.current_step < len(self.rects):
rect = self.rects[self.current_step]
rect.setStyleSheet("background-color: red; border: 1px solid gray;")
def mousePressEvent(self, event): def mousePressEvent(self, event):
self.clicked.emit(self) self.clicked.emit(self)
super().mousePressEvent(event) super().mousePressEvent(event)
@@ -3606,6 +3611,7 @@ class MainApplication(QMainWindow):
self.param_sections = [] self.param_sections = []
self.folder_paths = [] self.folder_paths = []
self.section_widget = None self.section_widget = None
self.first_run = True
self.init_ui() self.init_ui()
self.create_menu_bar() self.create_menu_bar()
@@ -3875,6 +3881,8 @@ class MainApplication(QMainWindow):
def clear_all(self): def clear_all(self):
self.cancel_task()
self.right_column_widget.hide() self.right_column_widget.hide()
# Clear the bubble layout # Clear the bubble layout
@@ -4284,8 +4292,52 @@ class MainApplication(QMainWindow):
return self.file_metadata return self.file_metadata
def cancel_task(self):
self.button1.clicked.disconnect(self.cancel_task)
self.button1.setText("Stopping...")
if hasattr(self, "result_process") and self.result_process.is_alive():
parent = psutil.Process(self.result_process.pid)
children = parent.children(recursive=True)
for child in children:
try:
child.kill()
except psutil.NoSuchProcess:
pass
self.result_process.terminate()
self.result_process.join()
if hasattr(self, "result_timer") and self.result_timer.isActive():
self.result_timer.stop()
# if hasattr(self, "result_process") and self.result_process.is_alive():
# self.result_process.terminate() # Forcefully terminate the process
# self.result_process.join() # Wait for it to properly close
# # Stop the QTimer if running
# if hasattr(self, "result_timer") and self.result_timer.isActive():
# self.result_timer.stop()
for bubble in self.bubble_widgets.values():
bubble.mark_cancelled()
self.statusbar.showMessage("Processing cancelled.")
self.button1.clicked.connect(self.on_run_task)
self.button1.setText("Process")
'''MODULE FILE''' '''MODULE FILE'''
def on_run_task(self): def on_run_task(self):
self.button1.clicked.disconnect(self.on_run_task)
self.button1.setText("Cancel")
self.button1.clicked.connect(self.cancel_task)
if not self.first_run:
for bubble in self.bubble_widgets.values():
bubble.mark_cancelled()
self.first_run = False
# Collect all selected snirf files in a flat list # Collect all selected snirf files in a flat list
snirf_files = [] snirf_files = []