Skip to content

Commit

Permalink
- added a progressbar to show when the search is being made
Browse files Browse the repository at this point in the history
- changed the listbox colors
  • Loading branch information
Felps3000 committed Oct 9, 2023
1 parent 8235852 commit ebf1067
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
.idea/

build.bat
workflows/
45 changes: 35 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
from tkinter import *
from tkinter import ttk
from torrent_search import *
from PIL import ImageTk, Image
from concurrent import futures

handlers = []


# daqui https://github.com/NatanaelAntonioli/CaptainFrogTorrentFinder/pull/4
def thread_clicked(): # Avoid Tkinter freeze
def thread_clicked(): # Avoid Tkinter freeze
thread_pool_executor = futures.ThreadPoolExecutor(max_workers=1)
thread_pool_executor.submit(clicked)


def clicked():
progressbar.tkraise()
progressbar.place(x=16, y=155, width=652, height=10)
progressbar.start(15)
inp = inputtxt.get()
global handlers
handlers = listar_torrents(inp)
listbox.delete(0, END)
for i in range(len(handlers)):
listbox.insert(END, str(handlers[i][2]) + " | " + str(handlers[i][0]))
listbox.focus_set()
progressbar.stop()
progressbar.place_forget()

# scrollbar pra listbox daqui https://github.com/NatanaelAntonioli/CaptainFrogTorrentFinder/pull/8
if listbox.size() > 20:
scrollbar.place(x=749, y=191, height=320)

# scrollbar pra listbox daqui https://github.com/NatanaelAntonioli/CaptainFrogTorrentFinder/pull/8
if (listbox.size()>20):
scrollbar.place(x=749, y=191, height=320)

def listbox_clicked(event):
cs = listbox.curselection()
Expand All @@ -39,14 +48,26 @@ def listbox_clicked(event):
window.configure(bg='#264653')
bgcolor = "#264653"

# TODO: fazer barra de progresso da busca
style = ttk.Style()
# Set the theme to "clam"
style.theme_use("clam")
# Configure the Horizontal.TProgressbar style in "clam" theme
style.configure("Horizontal.TProgressbar",
background="#2a9d8f",
troughcolor="#e9c46a",
bordercolor="#e9c46a",
lightcolor="#2a9d8f",
darkcolor="#2a9d8f")
# Configure the Vertical.TProgressbar style in "clam" theme

progressbar = ttk.Progressbar(window, length=200, orient="horizontal", mode="indeterminate")

# Define o termo de busca
titulo_buscar = Label(window, text="insert search term",
bg=bgcolor,
fg="white",
font=('Bebas Neue', 20))
titulo_buscar.place(x=12, y=128, in_=window)
titulo_buscar.place(x=12, y=123, in_=window)

# Define o campo onde recebemos o input
inputtxt = Entry(window,
Expand All @@ -70,6 +91,8 @@ def listbox_clicked(event):
bd=0,
width=10,
font=('Bebas Neue', 13),
activebackground="#E9C46A",
activeforeground="#2A9D8F",
command=thread_clicked)
btn.place(x=647 + x_offset_adjust, y=30 + global_offset, in_=window)

Expand All @@ -82,7 +105,11 @@ def listbox_clicked(event):
borderwidth=0,
highlightthickness=0,
bd=0,
highlightcolor="#E9C46A",
highlightcolor="#2A9D8F",
highlightbackground ="#E9C46A",
selectforeground= "#2A9D8F",
selectbackground = "#E9C46A",
activestyle = "none"
)
listbox.place(x=16, y=61 + global_offset, in_=window)
listbox.bind('<Double-1>', listbox_clicked)
Expand All @@ -97,10 +124,8 @@ def listbox_clicked(event):
frame = Frame(window, width=20, height=10)
frame.pack()
frame.place(x=10 + x_offset_adjust, y=45)

img = ImageTk.PhotoImage(Image.open("sapo.png"))
image = Label(frame, image=img, bg=bgcolor
)
image = Label(frame, image=img, bg=bgcolor)
image.pack()

# Define o título
Expand Down

0 comments on commit ebf1067

Please sign in to comment.