Skip to content

Commit

Permalink
V0.52.0
Browse files Browse the repository at this point in the history
  • Loading branch information
domhnallmorr committed Oct 21, 2023
1 parent 3cc29a2 commit dc609bf
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pip install PyPDF2


## Preview
![alt text](https://imgur.com/hPORcAR.png)
![Main](images/main_image.PNG)

![alt text](https://imgur.com/trjQ4QE.png)

Expand Down
Binary file added images/main_image.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def open_in_cmd_explorer(self, mode, branch_id):
elif mode == "explorer":
subprocess.Popen(f'explorer "{current_directory}"')

def copy_cut_file_folder(self, files, branch_id, mode):
def copy_cut_file_folder(self, files, branch_id, mode, total_size_selected=None):
current_directory = self.model.branch_tabs[branch_id].current_directory
files = [os.path.join(current_directory, f) for f in files]

Expand All @@ -361,7 +361,8 @@ def copy_cut_file_folder(self, files, branch_id, mode):

elif mode == "copy":
self.file_to_cut = None
self.file_to_copy = copy.deepcopy(files)
self.file_to_copy = copy.deepcopy(files)
self.view.update_clipboard_labels(len(files), total_size_selected)

def paste_file_folder(self, branch_id):
current_directory = self.model.branch_tabs[branch_id].current_directory
Expand Down
35 changes: 27 additions & 8 deletions src/custom_widgets/branch_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ def __init__(self, view, branch_id, root_tab):
self.branch_id = branch_id
self.root_tab = root_tab

self.total_size_selected = "(0 KB)"

# ----------------- GRID -----------------
self.tree_colspan = 16
self.grid_columnconfigure(14, weight=1)
self.grid_rowconfigure(1, weight=1)

# ----------------- SETUP WIDGETS -----------------
self.setup_buttons()
self.setup_adress_bar()
Expand Down Expand Up @@ -66,7 +68,7 @@ def setup_treeview(self):
height = 20

self.treeview = treeview_functions.create_treeview(self, column_names, column_widths, height)
self.treeview.grid(row=1, column=0, columnspan=16, sticky='NSEW', padx=0, pady=(self.view.default_pady, 0))
self.treeview.grid(row=1, column=0, columnspan=16, sticky='NSEW', padx=0, pady=(0, 0))
self.treeview.bind("<Double-1>", self.double_click_treeview)
self.treeview.bind("<Button-1>", self.left_click_treeview)
self.treeview.bind("<Button-3>", self.right_click_treeview)
Expand All @@ -76,16 +78,24 @@ def setup_treeview(self):

# ------------------ ADD SCROLLBAR ------------------
vsb = autoscrollbar.AutoScrollbar(self, orient="vertical", command=self.treeview.yview)
vsb.grid(row=1, column=16, sticky='NSEW')
vsb.grid(row=1, column=16, sticky='NSEW', pady=(0, 0))
self.treeview.configure(yscrollcommand=vsb.set)
self.treeview.bind('<Control-a>', lambda *args: self.treeview.selection_add(self.treeview.get_children()))

# # tags
self.update_tags()

def setup_labels(self):
self.items_label = Label(self, text="Items")
self.items_label.grid(row=2, column=0, columnspan=16, sticky='NSEW', padx=0, pady=(1, 0), ipady=0)
self.bottom_frame = Frame(self)
self.bottom_frame.grid(row=2, column=0, columnspan=16, sticky='NSEW', padx=0, pady=(1, 0), ipady=0)

self.items_label = Label(self.bottom_frame, text="Items")
self.items_label.grid(row=2, column=0, columnspan=8, sticky='NSEW', padx=0, pady=(1, 0), ipady=0)

self.clipboard_label = Label(self.bottom_frame, text=self.view.clipboard_label_text)
self.clipboard_label.grid(row=2, column=8, columnspan=8, sticky='E', padx=0, pady=(1, 0), ipady=0)

self.bottom_frame.grid_columnconfigure(8, weight=1)

def update_tags(self):
highlight_color = standard.STANDARD_THEMES[self.view.style_name]["colors"]["active"]
Expand Down Expand Up @@ -191,8 +201,17 @@ def update_items_label(self, event=None):
break

if folder_selected is False:
total_size = "{:,}".format(total_size) # add commas to total size number
text = text + f"({total_size} KB)"
if total_size > 1_000_000:
self.total_size_selected = f"({round(total_size/1_000_000, 2)} GB)"
elif total_size > 1_000:
self.total_size_selected = f"({round(total_size/1_000, 2)} MB)"
else:
self.total_size_selected = f"({total_size} KB)"

text=text + self.total_size_selected
else:
self.total_size_selected = None


self.items_label.config(text=text)

Expand Down Expand Up @@ -292,7 +311,7 @@ def right_click_treeview(self, event):
selection.append(self.treeview.item(file_iid, 'text'))

popup_menu.add_command(label="Cut", command=lambda files=selection, branch_id=self.branch_id, mode="cut": self.view.controller.copy_cut_file_folder(files, branch_id, mode), image=self.view.cut_icon2, compound="left")
popup_menu.add_command(label="Copy", command=lambda files=selection, branch_id=self.branch_id, mode="copy": self.view.controller.copy_cut_file_folder(files, branch_id, mode), image=self.view.copy_icon2, compound="left")
popup_menu.add_command(label="Copy", command=lambda files=selection, branch_id=self.branch_id, mode="copy", total_size_selected=self.total_size_selected: self.view.controller.copy_cut_file_folder(files, branch_id, mode, total_size_selected), image=self.view.copy_icon2, compound="left")

if self.view.controller.file_to_copy != None or self.view.controller.file_to_cut != None:
popup_menu.add_command(label="Paste", command=lambda branch_id=self.branch_id: self.view.controller.paste_file_folder(branch_id), image=self.view.paste_icon2, compound="left")
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, parent, *args, **kwargs):
self.controller = controller.Controller(root, parent, self)

# ----------------- VERSION -----------------------
self.version = "0.51.2"
self.version = "0.52.0"

# ----------------- WEEK NUMBER -----------------------
year, week_num, day_of_week = datetime.date.today().isocalendar()
Expand Down
7 changes: 2 additions & 5 deletions src/view/about_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ def about(mainapp):
l2 = tk.Label(win, text=f"Icons From https://icons8.com")
l2.grid(row=1, column=2, columnspan=1)

l3 = tk.Label(win, text = '''
Tk Path Finder makes no promise of warranty, satisfaction, performance,
or anything else. Understand that your use of this tool is completely
at your own risk.''')
l3.grid(row=2, column=0, columnspan=5, ipadx=3, padx=10)
l3 = tk.Label(win, text="Tk Path Finder makes no promise of warranty, satisfaction, performance, or anything else. Understand that your use of this tool is completely at your own risk.", wraplength=300, justify="center")
l3.grid(row=2, column=0, columnspan=5, padx=20, sticky="NSEW")

b = ttk.Button(win, text="OK", command=win.destroy, style="success.TButton")
b.grid(row=3, column=2, pady=10)
29 changes: 23 additions & 6 deletions src/view/search_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, master, data, view):
self.search_where_combo.grid(row=2, column=1, padx=5, pady=5, sticky='W')

ttk.Label(self.options_frame, text='Output:').grid(row=3, column=0, padx=5, pady=5, sticky="E")
self.output_combo = ttk.Combobox(self.options_frame, width=30, values=['Full Path', 'Filename Only'], state='readonly')
self.output_combo = ttk.Combobox(self.options_frame, width=30, values=["Full Path", "Name Only"], state="readonly")
self.output_combo.set('Full Path')
self.output_combo.grid(row=3, column=1, padx=5, pady=5, sticky='W')

Expand Down Expand Up @@ -127,12 +127,20 @@ def on_search(self, event=None):
else:
for d in dirs:
if self.search_bar.get().lower() in d.lower():
self.search_text.insert(END, d)
if self.python_raw_string.get() == 1:
self.search_text.insert(END, 'r"')

if self.output_combo.get() == "Name Only":
self.search_text.insert(END, d)
else:
self.search_text.insert(END, os.path.join(root, d))

if self.python_raw_string.get() == 1:
self.search_text.insert(END, '",')
self.search_text.insert(END, '\n')

else: # Parent directory only
if self.search_for_combo.get() == "Files":
# for file in self.branch_tab.explorer.file_data:
for file in self.data["file_data"]:
if self.search_bar.get().lower() in file[0].lower():
process_file = True
Expand All @@ -143,10 +151,19 @@ def on_search(self, event=None):

if process_file:
self.add_file_to_text(self.directory, file[0])
else:
else: # search for folders
for d in self.data["directory_data"]:
if self.search_bar.get().lower() in d[0].lower():
self.search_text.insert(END, os.path.join(self.directory, d[0]) )
if self.python_raw_string.get() == 1:
self.search_text.insert(END, 'r"')

if self.output_combo.get() == "Name Only":
self.search_text.insert(END, d[0])
else:
self.search_text.insert(END, os.path.join(self.directory, d[0]))

if self.python_raw_string.get() == 1:
self.search_text.insert(END, '",')
self.search_text.insert(END, '\n')


Expand All @@ -170,7 +187,7 @@ def add_file_to_text(self, directory, filename):
if self.python_raw_string.get() == 1:
self.search_text.insert(END, 'r"')

if self.output_combo.get() == "Filename Only":
if self.output_combo.get() == "Name Only":
self.search_text.insert(END, filename)
else:
self.search_text.insert(END, os.path.join(directory, filename))
Expand Down
12 changes: 11 additions & 1 deletion src/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def setup_variables(self):
self.themes[theme_type].append(theme)

self.tool_top_delay = 600
self.clipboard_label_text = "Clipboard: 0 Selected"

def setup_main_frames(self):
self.rootpane = ttk.PanedWindow(self.parent, orient=tk.HORIZONTAL)
Expand Down Expand Up @@ -216,4 +217,13 @@ def get_root_tabs_order(self):
reordered_dict = {k: self.root_tabs[k] for k in root_tabs_order}
self.root_tabs = reordered_dict
self.controller.update_root_tabs_order(root_tabs_order)


def update_clipboard_labels(self, number_of_items, total_size_selected):

for branch_id in self.branch_tabs.keys():
if total_size_selected is None:
self.clipboard_label_text = f"Clipboard: {number_of_items} Selected"
else:
self.clipboard_label_text = f"Clipboard: {number_of_items} Selected {total_size_selected}"

self.branch_tabs[branch_id].clipboard_label.config(text=self.clipboard_label_text)

0 comments on commit dc609bf

Please sign in to comment.