From bbdbaadb9207cf17507dddf704c16ee040a15a9c Mon Sep 17 00:00:00 2001 From: sroth Date: Sun, 27 Apr 2025 12:22:25 +0200 Subject: [PATCH] filtering inactive records --- src/brovski-adress-etiketten-verwaltung.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/brovski-adress-etiketten-verwaltung.py b/src/brovski-adress-etiketten-verwaltung.py index a3a2e10..3754d98 100644 --- a/src/brovski-adress-etiketten-verwaltung.py +++ b/src/brovski-adress-etiketten-verwaltung.py @@ -33,6 +33,7 @@ class Application: self.current_record: int | None = None self.sort_order = False self.last_sort_field = "#3" + self.filter_active = tk.BooleanVar(value=False) # init paths to json and csv file self.json_file_name = "brovski-adress-etiketten-verwaltung.json" @@ -70,6 +71,7 @@ class Application: tk.Button(top_frame, text="Delete", command=self.delete_record, width=button_width).pack(side=tk.LEFT) tk.Button(top_frame, text="Export CSV", command=self.export_csv, width=button_width).pack(side=tk.LEFT) tk.Button(top_frame, text="Toggle Aktiv", command=self.toggle_active, width=button_width).pack(side=tk.LEFT) + tk.Checkbutton(top_frame, text="Filter aktive", variable=self.filter_active, command=self.populate_table).pack(side=tk.LEFT) tk.Button(top_frame, text="Quit", command=self.on_close, width=button_width).pack(side=tk.RIGHT) tk.Button(top_frame, text="Settings", command=self.show_settings, width=button_width).pack(side=tk.RIGHT) @@ -265,6 +267,9 @@ class Application: def populate_table(self): self.delete_all_table_items() for index, item in enumerate(self.address_list): + # skip inactive records if filter is true + if self.filter_active.get() and item[0] != "x": + continue self.table.insert('', 'end', iid=index, values=item) self.update_status_bar()