Skip to content

Commit

Permalink
functionalize file menu
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Dec 20, 2023
1 parent 47e6c77 commit 54970fc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
21 changes: 21 additions & 0 deletions chipstream/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion chipstream/gui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
</action>
<action name="actionClear">
<property name="text">
<string>Clear forms</string>
<string>Clear list</string>
</property>
</action>
</widget>
Expand Down
6 changes: 6 additions & 0 deletions chipstream/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 54970fc

Please sign in to comment.