diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..876f23c Binary files /dev/null and b/.DS_Store differ diff --git a/Main.py b/Main.py index a1f9146..5a35fc9 100644 --- a/Main.py +++ b/Main.py @@ -9,6 +9,8 @@ from os import listdir from tkcalendar import DateEntry from PIL import Image, ImageTk +import platform +import ast # safeguard for the treeview automated string conversion problem PREFIX = '<@!PREFIX>' @@ -148,6 +150,32 @@ def __init__(self, parent, controller): self.treeview.bind('', lambda event: self.deselect()) self.treeview.bind('', lambda event: self.show_statistics()) + # *Ordered* list of columns (so we can display them in a fixed order) + self.columns = [ + 'name', + 'pep', + 'type', + 'msg', + 'call', + 'photos', + 'gifs', + 'videos', + 'files' + ] + self.column_titles = columns + + # filter columns + self.filter_columns = { + 'name': '', + 'pep': set(), + 'msg': -1, + 'call': -1, + 'photos': -1, + 'gifs': -1, + 'videos': -1, + 'files': -1 + } + # show frame title ttk.Label( self.main, text=f'{self.module.TITLE_NUMBER_OF_MSGS}: ', foreground='#ffffff', background='#232323', @@ -173,6 +201,19 @@ def __init__(self, parent, controller): command=self.search ).pack(side='top', pady=10) + # show filter button + ttk.Button( + self.nav, text=self.module.TITLE_FILTER, padding=5, command=lambda: FilterPopup(self.controller, self.columns, self.column_titles, self.filter_columns, lambda : self.filter_treeview()) + ).pack(side='top', pady=10) + + # clear selection button + ttk.Button( + self.nav, + text="Clear Filters", + padding=5, + command=self.deselect + ).pack(side='top', pady=10) + # show exit button ttk.Button( self.nav, image=self.controller.ICON_EXIT, text=self.module.TITLE_EXIT, compound='left', padding=5, @@ -197,6 +238,15 @@ def __init__(self, parent, controller): self.nav.pack(side='left', fill='y') self.main.pack(side='right', fill='both', expand=True) + + def set_current_conversation(self, event): + selected = self.treeview.selection() + if selected: + conversation_data = self.treeview.item(selected[0], 'values') + # Assuming the conversation identifier is in the 11th column + self.controller.current_conversation = conversation_data[10].replace('<@!PREFIX>', '') + self.show_statistics() + # invoked on