(self, parent, group_title, options, row, columns)
| 1479 | |
| 1480 | class CheckboxGroup: |
| 1481 | def __init__(self, parent, group_title, options, row, columns): |
| 1482 | self.frame = ttk.LabelFrame(parent, text=group_title, padding=10) |
| 1483 | self.frame.grid(row=row, column=0, columnspan=3, pady=10, sticky="ew") |
| 1484 | |
| 1485 | self.options = options # Store option labels |
| 1486 | self.vars = [] |
| 1487 | self.select_all_var1 = tk.BooleanVar() |
| 1488 | self.select_all_var2 = tk.BooleanVar() |
| 1489 | |
| 1490 | label = "Select All" |
| 1491 | if group_title == "File Types": |
| 1492 | chk = ttk.Checkbutton(self.frame, text=label, variable=self.select_all_var2, |
| 1493 | command=self.toggle_all_and_disable, bootstyle="primary-round-toggle") |
| 1494 | |
| 1495 | |
| 1496 | else: |
| 1497 | chk = ttk.Checkbutton(self.frame, text=label, variable=self.select_all_var1, |
| 1498 | command=self.toggle_all, bootstyle="primary-round-toggle") |
| 1499 | chk.grid(row=0, column=0, padx=5, pady=2, sticky="w") |
| 1500 | |
| 1501 | for i, label in enumerate(options): |
| 1502 | var = tk.BooleanVar() |
| 1503 | self.vars.append(var) |
| 1504 | row, col = divmod(i, columns) |
| 1505 | |
| 1506 | chk = ttk.Checkbutton(self.frame, text=label, variable=var, bootstyle="primary-round-toggle") |
| 1507 | chk.grid(row=row + 1, column=col, padx=5, pady=2, sticky="w") |
| 1508 | |
| 1509 | def toggle_all(self): |
| 1510 | state1 = self.select_all_var1.get() |
nothing calls this directly
no outgoing calls
no test coverage detected