def __setup_file_types_frames(self): self.ok_files_frame = TkinterWrapper.WindowFrame(self.frame) self.bad_files_frame = TkinterWrapper.WindowFrame(self.frame) self.unknown_files_frame = TkinterWrapper.WindowFrame(self.frame) for frame in [[self.ok_files_frame, "left"], [self.bad_files_frame, "left"], [self.unknown_files_frame, "left"]]: frame[0].pack_frame(frame[1], 0, 0)
def __setup_entry_frame(self): entry_frame = TkinterWrapper.WindowFrame(self.left_frame.get_frame()) entry_frame.pack_frame("top", 0, 0) self.file_type_entry = TkinterWrapper.WindowEntry( entry_frame.get_frame()) self.file_type_entry.configure_size(20) self.file_type_entry.pack_entry("left", 0, 2) self.insert_button(entry_frame.get_frame(), "Add", self.add_file_type, "left")
def make_labels(self): self.file_fraction = TkinterWrapper.WindowLabel( self.top_frame.get_frame(), "") self.file_fraction.configure_colors("grey40", "grey95", "times 11") self.current_file = TkinterWrapper.WindowLabel( self.bottom_frame.get_frame(), "Current File:") self.current_file.configure_colors("grey40", "grey95", "times 10") self.file_entry = TkinterWrapper.WindowEntry( self.bottom_frame.get_frame()) self.file_entry.configure_size(115)
def __setup_frames(self): self.information_frame = TkinterWrapper.WindowFrame( self.window.get_window()) self.directory_frame = TkinterWrapper.WindowFrame( self.window.get_window()) self.button_frame = TkinterWrapper.WindowFrame( self.window.get_window()) self.information_frame.pack_frame("top", 0, 0) self.directory_frame.pack_frame("top", 0, 0) self.button_frame.pack_frame("top", 0, 0)
def setup_textbox_frame(self, file_frame): frame = TkinterWrapper.WindowFrame(file_frame) frame.pack_frame("top", 0, 0) listbox = TkinterWrapper.WindowListbox(frame.get_frame()) listbox.pack_listbox("left", 0, 0) listbox.configure_size(40, 30) scrollbar = TkinterWrapper.WindowScrollbar(frame.get_frame(), "y") scrollbar.attach_to_widget(listbox.get_listbox()) listbox.attach_scrollbar("y", scrollbar.get_scrollbar()) scrollbar.pack_scrollbar("left", 0, 0) self.listboxes.append(listbox)
def __setup_right_frame(self): self.file_type_listbox = TkinterWrapper.WindowListbox( self.right_frame.get_frame()) self.file_type_listbox.configure_size(20, 10) self.file_type_listbox.pack_listbox("left", 0, 0) y_scrollbar = TkinterWrapper.WindowScrollbar( self.right_frame.get_frame(), "y") y_scrollbar.attach_to_widget(self.file_type_listbox.get_listbox()) self.file_type_listbox.attach_scrollbar("y", y_scrollbar.get_scrollbar()) y_scrollbar.pack_scrollbar("left", 0, 0)
def setup_textbox_x_scrollbar_frame( self, file_frame, ): frame = TkinterWrapper.WindowFrame(file_frame) frame.pack_frame("top", 0, 0) scrollbar = TkinterWrapper.WindowScrollbar(frame.get_frame(), "x") scrollbar.attach_to_widget(self.listboxes[len(self.listboxes) - 1].get_listbox()) self.listboxes[len(self.listboxes) - 1].attach_scrollbar( "x", scrollbar.get_scrollbar()) scrollbar.pack_scrollbar("top", 0, 0)
def update_process_information_frame_for_task(self): top_text = TkinterWrapper.WindowLabel( self.process_information_frame.get_frame(), "Scanning....") top_text.configure_colors("grey20", "grey95", "times 14") top_text.pack_label("top", 0, 0) top_text = TkinterWrapper.WindowLabel( self.process_information_frame.get_frame(), "Scanning: {0}".format(saved_information.get_directory_to_scan())) top_text.configure_colors("dodgerblue2", "grey95", "times 10") top_text.pack_label("top", 0, 0) self.progress_bar = Progressbar( self.process_information_frame.get_frame(), 400, 30)
def __setup_frames(self): self.top_frame = TkinterWrapper.WindowFrame(self.window.get_window()) self.bottom_frame = TkinterWrapper.WindowFrame( self.window.get_window()) self.left_frame = TkinterWrapper.WindowFrame( self.top_frame.get_frame()) self.right_frame = TkinterWrapper.WindowFrame( self.top_frame.get_frame()) for item in [[self.top_frame, "top"], [self.left_frame, "left"], [self.right_frame, "right"], [self.bottom_frame, "bottom"]]: item[0].pack_frame(item[1], 1, 0) self.left_frame.configure_border("ridge", 2)
def __setup_frames(self): self.process_information_frame = TkinterWrapper.WindowFrame( self.app_window.get_window()) self.found_files_frame = TkinterWrapper.WindowFrame( self.app_window.get_window()) self.current_file_frame = TkinterWrapper.WindowFrame( self.app_window.get_window()) for item in [[self.process_information_frame, "top"], [self.current_file_frame, "top"], [self.found_files_frame, "top"]]: item[0].pack_frame(item[1], 0, 0) self.file_information_frame = FileInfo( self.found_files_frame.get_frame()) self.current_file_information_frame = CurrentFileInfo( self.current_file_frame)
def __setup_menu(self): self.menu = TkinterWrapper.WindowMenu(self.app_window.get_window()) self.file_cascade = TkinterWrapper.WindowMenuCascade( self.app_window.get_window(), False) self.file_cascade.add_item_to_cascade("Quit", self.app_window.destroy_window) self.edit_cascade = TkinterWrapper.WindowMenuCascade( self.app_window.get_window(), False) self.edit_cascade.add_item_to_cascade( "Known-Good Filetypes", partial(self.add_known_file_type, "KnownGood")) self.edit_cascade.add_item_to_cascade( "Known-Bad Filetypes", partial(self.add_known_file_type, "KnownBad")) self.menu.add_cascade_to_menu("File", self.file_cascade.get_cascade()) self.menu.add_cascade_to_menu("Edit", self.edit_cascade.get_cascade())
def __setup_information_frame(self): description_label = TkinterWrapper.WindowLabel( self.information_frame.get_frame(), "") description_label.configure_text( "Please chose a file to search from the list below:") description_label.configure_colors("grey20", "grey95", "times 11") description_label.pack_label("top", 0, 5)
def __setup_listbox_frame(self): self.listbox_frame = TkinterWrapper.WindowFrame(self.frame) self.listbox_frame.pack_frame("top", 0, 0) super(DirectoryListbox, self).__init__(self.listbox_frame.get_frame()) super(DirectoryListbox, self).pack_listbox("left", 0, 0) super(DirectoryListbox, self).configure_size(80, 10) self.__setup_scrollbar()
def __init__(self): self.app_window = TkinterWrapper.Window("File Scanner") self.update_scan_flags(False, False, False) self.__setup_window() self.__setup_menu() self.__setup_frames() self.update_frames() self.app_window.start_mainloop()
def update_process_information_frame_for_idle(self, top_text, button_text, button_action): label = TkinterWrapper.WindowLabel( self.process_information_frame.get_frame(), "{0}".format(top_text)) label.configure_colors("dodgerblue2", "grey95", "times 11") label.pack_label("top", 0, 0) self.add_button_to_process_information_frame(button_text, button_action)
def __setup_scrollbar(self): y_scrollbar = TkinterWrapper.WindowScrollbar( self.listbox_frame.get_frame(), "y") y_scrollbar.attach_to_widget( super(DirectoryListbox, self).get_listbox()) super(DirectoryListbox, self).attach_scrollbar("y", y_scrollbar.get_scrollbar()) y_scrollbar.pack_scrollbar("left", 0, 0)
def __init__(self, parent_window): self.window = TkinterWrapper.DialogBox(parent_window, "Choose Folder") self.directory_to_search = "" self.__setup_window() self.__setup_frames() self.__setup_information_frame() self.__setup_directory_frame() self.__setup_button_frame() self.window.start_mainloop()
def __setup_directory_entry_frame(self): directory_entry_frame = TkinterWrapper.WindowFrame( self.directory_frame.get_frame()) directory_entry_frame.pack_frame("top", 0, 0) current_directory_label = TkinterWrapper.WindowLabel( directory_entry_frame.get_frame(), "Current Directory:\n") current_directory_label.pack_label("left", 0, 0) current_directory_label.configure_colors("dodgerblue2", "grey95", "times 10") self.current_directory_entry = TkinterWrapper.WindowEntry( directory_entry_frame.get_frame()) self.current_directory_entry.configure_size(65) self.current_directory_entry.pack_entry("top", 0, 0) x_scrollbar = TkinterWrapper.WindowScrollbar( directory_entry_frame.get_frame(), "x") x_scrollbar.attach_to_widget( self.current_directory_entry.get_entry_widget()) self.current_directory_entry.attach_scrollbar( x_scrollbar.get_scrollbar()) x_scrollbar.pack_scrollbar("bottom", 0, 0)
def __init__(self, parrent_window, edit_type): self.edit_type = edit_type self.set_file_type_list() self.window = TkinterWrapper.DialogBox( parrent_window, "Edit {0} File Types".format(edit_type)) self.__setup_window() self.__setup_frames() self.__setup_left_frame() self.__setup_right_frame() self.__setup_bottom_frame() self.update_listbox_text()
def __setup_left_frame(self): self.insert_explanitory_label(self.left_frame.get_frame(), "Enter File Extension to Add:") self.__setup_entry_frame() self.insert_explanitory_label(self.left_frame.get_frame(), "Select a File Extension to Delete") self.insert_button(self.left_frame.get_frame(), "Delete", self.delete_file_type, "top") self.error_frame = TkinterWrapper.WindowFrame( self.left_frame.get_frame()) self.error_frame.pack_frame("top", 0, 0)
def __setup_error_frame(self): self.error_frame = TkinterWrapper.WindowFrame(self.frame) self.error_frame.pack_frame("top", 0, 0)
def insert_file_explaning_note(self, frame, text): information_label = TkinterWrapper.WindowLabel( frame.get_frame(), "{0} files will be\nshown here after a scan".format(text)) information_label.configure_colors("grey50", "grey95", "times 10") information_label.pack_label("top", 0, 2)
def __setup_button_frame(self): self.search_button = TkinterWrapper.WindowButton( self.button_frame.get_frame(), "Scan", self.set_directory_and_destory_window) self.search_button.pack_button("top", 0, 0)
def __setup_directory_listbox_frame(self): directory_listbox_frame = TkinterWrapper.WindowFrame( self.directory_frame.get_frame()) directory_listbox_frame.pack_frame("top", 0, 0) self.dir_listbox = DirectoryListbox( directory_listbox_frame.get_frame(), self.current_directory_entry)
def update_file_frame_for_task(self, frame, text): label = TkinterWrapper.WindowLabel(frame, "{0} Files:".format(text)) label.configure_colors("grey60", "grey95", "times 12") label.pack_label("top", 0, 0) self.setup_textbox_frame(frame) self.setup_textbox_x_scrollbar_frame(frame)
def __setup_dummy_frame(self): dummy_frame = TkinterWrapper.WindowFrame(self.frame.get_frame()) dummy_frame.pack_frame("top", 0, 0)
def setup_frames(self): self.top_frame = TkinterWrapper.WindowFrame(self.frame.get_frame()) self.bottom_frame = TkinterWrapper.WindowFrame(self.frame.get_frame()) for frame, position in [[self.top_frame, "top"], [self.bottom_frame, "top"]]: frame.pack_frame(position, 0, 0)
def insert_button(self, frame, button_text, button_action, side): button = TkinterWrapper.WindowButton(frame, button_text, button_action) button.pack_button(side, 2, 2)
def insert_explanitory_label(self, frame, text): label = TkinterWrapper.WindowLabel(frame, text) label.configure_colors("dodgerblue2", "grey95", "times 11") label.pack_label("top", 0, 10)
def add_button_to_process_information_frame(self, button_text, button_action): button = TkinterWrapper.WindowButton( self.process_information_frame.get_frame(), "{0}".format(button_text), button_action) button.pack_button("top", 0, 1)