Skip to content

Commit

Permalink
make sure to close the progress
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Sep 9, 2024
1 parent 377a6fa commit cb891dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/asammdf/gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def run(self):
self.error.emit((exctype, value, traceback.format_exc()))
else:
self.result.emit(result)

self.kwargs = self.args = None
finally:
self.kwargs = self.args = None

def requestInterruption(self):
self.stop = True
Expand Down Expand Up @@ -379,6 +379,10 @@ def close(self, reject=False):

self.hide()

def exec(self):
super().exec()
self.hide()

def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key.Key_Escape and event.modifiers() == QtCore.Qt.KeyboardModifier.NoModifier:
event.accept()
Expand Down
7 changes: 7 additions & 0 deletions src/asammdf/gui/widgets/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(

self.files_list.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.InternalMove)

self._progress = None
self.progress = None
self.show()

Expand Down Expand Up @@ -262,6 +263,7 @@ def scramble_thread(self, source_files, progress):
return

def scramble_finished(self):
self._progress.close()
self._progress = None

def scramble(self, event):
Expand All @@ -286,6 +288,7 @@ def extract_bus_logging_finished(self):

self.output_info_bus.setPlainText("\n".join(message))

self._progress.close()
self._progress = None

def extract_bus_logging(self, event):
Expand Down Expand Up @@ -431,6 +434,7 @@ def extract_bus_csv_logging_finished(self):

self.output_info_bus.setPlainText("\n".join(message))

self._progress.close()
self._progress = None

def extract_bus_csv_logging(self, event):
Expand Down Expand Up @@ -664,6 +668,7 @@ def load_lin_database(self, event):
item.setSizeHint(widget.sizeHint())

def concatenate_finished(self):
self._progress.close()
self._progress = None

def concatenate(self, event=None):
Expand Down Expand Up @@ -821,6 +826,7 @@ def stack_thread(
return result

def stack_finished(self):
self._progress.close()
self._progress = None

def stack(self, event):
Expand Down Expand Up @@ -1324,6 +1330,7 @@ def __init__(self, opts):
return Options(options)

def apply_processing_finished(self):
self._progress.close()
self._progress = None

def apply_processing(self, event):
Expand Down
4 changes: 4 additions & 0 deletions src/asammdf/gui/widgets/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,6 +1802,7 @@ def scramble_finished(self):
path = Path(self.file_name)
self.open_new_files.emit([str(path.with_suffix(f".scrambled{path.suffix}"))])

self._progress.close()
self._progress = None

def scramble(self, event):
Expand All @@ -1821,6 +1822,7 @@ def extract_bus_logging_finished(self):
self.output_info_bus.setPlainText("\n".join(message))
self.open_new_files.emit([str(file_name)])

self._progress.close()
self._progress = None

def extract_bus_logging(self, event):
Expand Down Expand Up @@ -1967,6 +1969,7 @@ def extract_bus_csv_logging_finished(self):

self.output_info_bus.setPlainText("\n".join(message))

self._progress.close()
self._progress = None

def extract_bus_csv_logging(self, event):
Expand Down Expand Up @@ -2775,6 +2778,7 @@ def apply_processing(self, event):
)

def apply_processing_finished(self):
self._progress.close()
self._progress = None

def apply_processing_thread(self, file_name, opts, version, needs_filter, channels, progress=None):
Expand Down

0 comments on commit cb891dc

Please sign in to comment.