Skip to content

Commit

Permalink
V0.23.3 Added Cancel Button to Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
domhnallmorr committed Jun 19, 2022
1 parent d69591e commit 7a8ee86
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 11 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Tk-Path-Finder (WIP) ![python](https://img.shields.io/badge/python-3.6+-blue)

## Description
A lightweight file explorer based on tabs within tabs written in python (Tkinter). Written primarily to assist working with text files and MS office files spread across many folders/servers.

## Features
- Quick Access Sidebar, links can be grouped into individual folders.
- Tabs within tabs layout.
- Search functionality.
- Basic file comparison functionality.
- Rename files.
- Create multiple folders at once (hit cntrl-d in the craete folder window to duplicate line).
- "Open with" functionality.
- Plugin system (very much WIP at this time).

## Limitations
- Only tested on windows 10.
- No delete functionality.
- Search is very slow on sub-directories with many files.
- Paste cannot be cancelled.
- Does not work with MS teams folders.

## Preview
![alt text](https://i.imgur.com/HNW0v4o.png)
Binary file modified src/__pycache__/paste_windows.cpython-39.pyc
Binary file not shown.
32 changes: 21 additions & 11 deletions src/paste_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from tkinter import messagebox
from tkinter import simpledialog
import time
import traceback

import autoscrollbar


def paste_folder(mainapp, branch_tab, source, destination):
launch_window(mainapp, branch_tab, source, destination)

Expand All @@ -35,10 +35,10 @@ def __init__(self, mainapp, master, branch_tab, source, destination):
self.source = source
self.destination = destination

processes = []
processes.append(Process(target=start_paste_folder, args=[source, destination]))
self.processes = []
self.processes.append(Process(target=start_paste_folder, args=[source, destination]))

for p in processes:
for p in self.processes:
p.start()

#for p in processes:
Expand All @@ -53,6 +53,9 @@ def __init__(self, mainapp, master, branch_tab, source, destination):

self.pb1 = Progressbar(self.top, orient=HORIZONTAL, length=100, mode='determinate')
self.pb1.grid(row=4, column=0, pady=5, sticky='NSEW')

self.cancel_btn = ttk.Button(self.top, text="Cancel", style='danger.TButton', command=self.cancel_copy)
self.cancel_btn.grid(row=5, column=0, sticky="NW")
#self.check_progress()

def get_size(self, folder):
Expand All @@ -71,18 +74,25 @@ def check_progress(self):

while True:
attempts += 1
time.sleep(1)
time.sleep(2)
current_size = self.get_size(self.destination)
progress = round(current_size/self.total_size, 2)

# if attempts > 30:
# break

if progress == 1.0:
break
else:
self.l.config(text=f'Progress: {str(int(progress*100))}%')
self.pb1['value'] = progress*100
self.mainapp.root.update()
try:
self.l.config(text=f'Progress: {str(int(progress*100))}%')
self.pb1['value'] = progress*100
self.mainapp.root.update()
except:
pass

self.top.destroy()

def cancel_copy(self):
for p in self.processes:
p.terminate()
p.join()

self.top.destroy()

0 comments on commit 7a8ee86

Please sign in to comment.