Skip to content

Commit 8f68f85

Browse files
abrignoniclaude
andcommitted
GUI: Select All / Deselect All act on the filtered list
When a filter is applied, the module list only shows the modules that match it, but Select All and Deselect All still walked the whole list, so they toggled modules the user could not see. Filtering to "chrome" and pressing Select All selected every module in the tool. Both buttons now act on the modules that match the active filter, which is exactly what is on screen. The matching test used by filter_modules is factored into module_matches_filter so the buttons and the list can never disagree about what is visible. With no filter applied the term is empty and matches every module, so the unfiltered behavior is unchanged. Selections made under one filter are left alone when the filter changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent fd258ee commit 8f68f85

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

‎ileappGUI.py‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,28 @@ def get_selected_modules():
9393
return selected_modules
9494

9595

96+
def module_matches_filter(module_infos, filter_term=None):
97+
'''Return True when a module matches the active filter, meaning it is one of the modules
98+
currently shown in the list. An empty filter matches every module.'''
99+
if filter_term is None:
100+
filter_term = modules_filter_var.get().lower()
101+
return filter_term in f"{module_infos[0]} {module_infos[1]}".lower()
102+
103+
96104
def select_all():
97-
'''Select all modules in the list of available modules and execute get_selected_modules'''
105+
'''Select the modules currently shown in the list and execute get_selected_modules'''
98106
for module_infos in mlist.values():
99-
module_infos[-1].set(True)
107+
if module_matches_filter(module_infos):
108+
module_infos[-1].set(True)
100109

101110
get_selected_modules()
102111

103112

104113
def deselect_all():
105-
'''Unselect all modules in the list of available modules and execute get_selected_modules'''
114+
'''Unselect the modules currently shown in the list and execute get_selected_modules'''
106115
for module_infos in mlist.values():
107-
module_infos[-1].set(False)
116+
if module_matches_filter(module_infos):
117+
module_infos[-1].set(False)
108118

109119
get_selected_modules()
110120

@@ -116,8 +126,7 @@ def filter_modules(*args):
116126
mlist_text.delete('0.0', tk.END)
117127

118128
for artifact_name, module_infos in mlist.items():
119-
filter_modules_info = f"{module_infos[0]} {module_infos[1]}".lower()
120-
if filter_term in filter_modules_info:
129+
if module_matches_filter(module_infos, filter_term):
121130
cb = tk.Checkbutton(mlist_text, name=f'mcb_{artifact_name}',
122131
text=f'{module_infos[0]} [{module_infos[1]} | {module_infos[2]}.py]',
123132
variable=module_infos[-1], onvalue=True, offvalue=False, command=get_selected_modules)

0 commit comments

Comments
 (0)