(self, master, Title, func_command, directory_mode = False)
| 449 | class open_file_dialog: |
| 450 | |
| 451 | def __init__(self, master, Title, func_command, directory_mode = False): |
| 452 | #/!\ Although the comments and variable names say 'file_list', or 'items' it inculdes folders also |
| 453 | |
| 454 | #Cell width of each cell |
| 455 | self.cell_width = 190 |
| 456 | |
| 457 | #Variable to hold the max no character name in file list (used for padding in GUIs) |
| 458 | self.max_len = 0 |
| 459 | |
| 460 | #List to store all file names that are currently being displayed and theit details |
| 461 | self.file_list = [] |
| 462 | #An index that points to current file that the mouse is pointing |
| 463 | self.current_file_index = 0 |
| 464 | |
| 465 | #Variables for drawing and storing cursor position |
| 466 | self.mouse_x = 0 |
| 467 | self.mouse_y = 0 |
| 468 | self.max_width = 0 |
| 469 | |
| 470 | #Variable to store which cell cursor is currently pointeing |
| 471 | self.x_cell_pos = 0 |
| 472 | self.y_cell_pos = 0 |
| 473 | |
| 474 | #A dictionary to store indices and highlight rectangle references of selected files |
| 475 | self.selected_file_indices = {} |
| 476 | |
| 477 | #Variable to store start cell position of drag select |
| 478 | self.start_x = 0 |
| 479 | self.start_y = 0 |
| 480 | |
| 481 | #Variable to tell weather directory mode or not |
| 482 | self.directory_mode = False |
| 483 | |
| 484 | #Variable to tell weather hidden files are enabled |
| 485 | self.hidden_files = False |
| 486 | |
| 487 | #Variable to hold the file name with max characters |
| 488 | self.max_len_name = '' |
| 489 | |
| 490 | #Variable for holding the font |
| 491 | self.default_font = font.nametofont("TkDefaultFont") |
| 492 | |
| 493 | self.directory_mode = directory_mode |
| 494 | #Change to script's directory |
| 495 | abspath = os.path.abspath(__file__) |
| 496 | dname = os.path.dirname(abspath) |
| 497 | os.chdir(dname) |
| 498 | |
| 499 | #Load all icons |
| 500 | self.folder_icon_small = PhotoImage(file='Icons/folder_small.png') |
| 501 | self.mountpoint_icon_small = PhotoImage(file='Icons/mountpoint_small.png') |
| 502 | self.folder_icon = PhotoImage(file='Icons/folder_big.png') |
| 503 | self.textfile_icon = PhotoImage(file='Icons/textfile_big.png') |
| 504 | self.up_icon = PhotoImage(file='Icons/up_small.png') |
| 505 | self.dnd_glow_icon = PhotoImage(file='Icons_glow/gotopath_large_glow.png') |
| 506 | |
| 507 | #Create a new dialog box window and set minimum size |
| 508 | self.open_file_dialog_window = Toplevel(master) |
nothing calls this directly
no test coverage detected