attempt at removing tqdm dependency

This commit is contained in:
CactiChameleon9
2020-12-10 08:32:59 +00:00
parent bd417edb89
commit 4eb152b8aa
8 changed files with 12 additions and 33 deletions

View File

@ -1,6 +1,5 @@
import socket
import os
import tqdm
from tkinter import *
from pynput import keyboard
@ -46,7 +45,7 @@ s.send(f"{filename}{SEPARATOR}{filesize}".encode())
def sendfile():
# start sending the file
progress = tqdm.tqdm(range(filesize), f"Sending {filename}", unit="B", unit_scale=True, unit_divisor=1024)
progress = "_"
with open(filename, "rb") as f:
for _ in progress:
# read the bytes from the file
@ -57,8 +56,6 @@ def sendfile():
# we use sendall to assure transimission in
# busy networks
s.sendall(bytes_read)
# update the progress bar
progress.update(len(bytes_read))
# close the socket
#s.close()

View File

@ -1,6 +1,5 @@
import socket
import os
import tqdm
from tkinter import *
from pynput import keyboard
@ -45,7 +44,7 @@ s.send(f"{filename}{SEPARATOR}{filesize}".encode())
def sendfile():
# start sending the file
progress = tqdm.tqdm(range(filesize), f"Sending {filename}", unit="B", unit_scale=True, unit_divisor=1024)
progress = "_"
with open(filename, "rb") as f:
for _ in progress:
# read the bytes from the file
@ -56,8 +55,6 @@ def sendfile():
# we use sendall to assure transimission in
# busy networks
s.sendall(bytes_read)
# update the progress bar
progress.update(len(bytes_read))
# close the socket
#s.close()

View File

@ -1,6 +1,5 @@
import socket
import os
import tqdm
from pynput import keyboard
from pynput.mouse import Button, Controller
from pynput import mouse
@ -33,7 +32,7 @@ s.send(f"{filename}{SEPARATOR}{filesize}".encode())
def sendfile():
# start sending the file
progress = tqdm.tqdm(range(filesize), f"Sending {filename}", unit="B", unit_scale=True, unit_divisor=1024)
progress = "_"
with open(filename, "rb") as f:
for _ in progress:
# read the bytes from the file
@ -44,8 +43,6 @@ def sendfile():
# we use sendall to assure transimission in
# busy networks
s.sendall(bytes_read)
# update the progress bar
progress.update(len(bytes_read))
# close the socket
#s.close()

View File

@ -1,12 +1,11 @@
import socket
import os
import tqdm
from pynput import keyboard
SEPARATOR = "<SEPARATOR>"
BUFFER_SIZE = 4096 # send 4096 bytes each time step
BUFFER_SIZE = 128 # send 4096 bytes each time step
# the ip address or hostname of the server, the receiver
@ -30,7 +29,7 @@ s.send(f"{filename}{SEPARATOR}{filesize}".encode())
def sendfile():
# start sending the file
progress = tqdm.tqdm(range(filesize), f"Sending {filename}", unit="B", unit_scale=True, unit_divisor=1024)
progress = "_"
with open(filename, "rb") as f:
for _ in progress:
# read the bytes from the file
@ -41,8 +40,6 @@ def sendfile():
# we use sendall to assure transimission in
# busy networks
s.sendall(bytes_read)
# update the progress bar
progress.update(len(bytes_read))
# close the socket
#s.close()