Statuszeile und filtern von aktiven Adressen #9
@@ -33,6 +33,7 @@ class Application:
|
|||||||
self.current_record: int | None = None
|
self.current_record: int | None = None
|
||||||
self.sort_order = False
|
self.sort_order = False
|
||||||
self.last_sort_field = "#3"
|
self.last_sort_field = "#3"
|
||||||
|
self.filter_active = tk.BooleanVar(value=False)
|
||||||
|
|
||||||
# init paths to json and csv file
|
# init paths to json and csv file
|
||||||
self.json_file_name = "brovski-adress-etiketten-verwaltung.json"
|
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="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="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.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="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)
|
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):
|
def populate_table(self):
|
||||||
self.delete_all_table_items()
|
self.delete_all_table_items()
|
||||||
for index, item in enumerate(self.address_list):
|
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.table.insert('', 'end', iid=index, values=item)
|
||||||
self.update_status_bar()
|
self.update_status_bar()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user