Skip to content

Commit

Permalink
Bug fix in directory filter
Browse files Browse the repository at this point in the history
  • Loading branch information
lawhead committed Nov 26, 2024
1 parent 8017f6d commit ce38af7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions bcipy/simulator/ui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def __init__(self,
super().__init__(parent=parent)
vbox = QVBoxLayout()
self.change_event = change_event

self.filters_enabled = False
self.parent_directory_control = ChooseDirectoryInput(
change_event=self.update_directory_tree,
prompt="Select a parent data directory",
Expand All @@ -265,8 +265,8 @@ def __init__(self,

self.parent_directory_control.layout().setContentsMargins(0, 0, 0, 0)
self.directory_filter_control.layout.setContentsMargins(0, 0, 0, 0)
self.directory_filter_control.setEnabled(False)
self.directory_tree.setEnabled(False)
self.directory_filter_control.setEnabled(self.filters_enabled)
self.directory_tree.setEnabled(self.filters_enabled)

form = QFormLayout()
form.setFormAlignment(Qt.AlignmentFlag.AlignLeft
Expand Down Expand Up @@ -320,13 +320,18 @@ def data_directories(self) -> Optional[List[Path]]:

def update_directory_tree(self):
"""Update the directory tree"""
self.directory_filter_control.setEnabled(False)
self.directory_tree.setEnabled(False)

if self.parent_directory():
self.directory_filter_control.setEnabled(True)
self.directory_tree.setEnabled(True)
if not self.filters_enabled:
self.filters_enabled = True
self.directory_filter_control.setEnabled(True)
self.directory_tree.setEnabled(True)
self.directory_tree.update(self.parent_directory(),
self.data_directories())
else:
self.filters_enabled = False
self.directory_filter_control.setEnabled(False)
self.directory_tree.setEnabled(False)
# notify any listeners of the change
if self.change_event:
self.change_event()
Expand Down

0 comments on commit ce38af7

Please sign in to comment.