diff --git a/chipstream/gui/main_window.py b/chipstream/gui/main_window.py index 8b1f602..2567d60 100644 --- a/chipstream/gui/main_window.py +++ b/chipstream/gui/main_window.py @@ -59,7 +59,10 @@ def __init__(self, *arguments): self.setWindowTitle(f"ChipStream {version}") # Disable native menu bar (e.g. on Mac) self.menubar.setNativeMenuBar(False) + # File menu + self.actionAdd.triggered.connect(self.on_action_add) + self.actionClear.triggered.connect(self.on_action_clear) self.actionQuit.triggered.connect(self.on_action_quit) # Help menu self.actionDocumentation.triggered.connect(self.on_action_docs) @@ -168,6 +171,24 @@ def on_action_about(self) -> None: f"ChipStream {version}", about_text) + @QtCore.pyqtSlot() + def on_action_add(self): + """Open dialog to add files and directories""" + pathlist, _ = QtWidgets.QFileDialog.getOpenFileNames( + self, + 'Select DC data', + '', + 'RT-DC data (*.rtdc)') + if pathlist: + # add to list + self.append_paths(pathlist) + + @QtCore.pyqtSlot() + def on_action_clear(self): + """Clear the current table view""" + self.manager.clear() + + @QtCore.pyqtSlot() def on_action_docs(self): webbrowser.open("https://chipstream.readthedocs.io") diff --git a/chipstream/gui/main_window.ui b/chipstream/gui/main_window.ui index 875cea9..49e96b2 100644 --- a/chipstream/gui/main_window.ui +++ b/chipstream/gui/main_window.ui @@ -356,7 +356,7 @@ - Clear forms + Clear list diff --git a/chipstream/manager.py b/chipstream/manager.py index 5298b78..1f5e52a 100644 --- a/chipstream/manager.py +++ b/chipstream/manager.py @@ -43,6 +43,12 @@ def add_path(self, path): # Only append paths if we are currently not busy self._path_list.append([path, "created"]) + def clear(self): + """Clear all data""" + self._path_list.clear() + self._runner_list.clear() + self._worker = None + def is_busy(self): return self.busy_lock.locked()