mirror of
https://github.com/kristoferssolo/LU-bookstore.git
synced 2025-10-21 18:00:34 +00:00
fix(gui): add empty search
This commit is contained in:
parent
113b123e50
commit
88304a2450
@ -40,8 +40,23 @@ class App(ctk.CTk):
|
|||||||
|
|
||||||
def search(event=None) -> None:
|
def search(event=None) -> None:
|
||||||
value = search_entry.get()
|
value = search_entry.get()
|
||||||
data = self.inventory.find_by_isbn(value)
|
if value == "":
|
||||||
self.update([data])
|
self.update()
|
||||||
|
else:
|
||||||
|
data = []
|
||||||
|
isbn = self.inventory.find_by_isbn(value)
|
||||||
|
if isbn:
|
||||||
|
data.append(isbn)
|
||||||
|
|
||||||
|
title = self.inventory.find_by_title(value)
|
||||||
|
if title:
|
||||||
|
data += title
|
||||||
|
|
||||||
|
author = self.inventory.find_by_author(value)
|
||||||
|
if author:
|
||||||
|
data += author
|
||||||
|
|
||||||
|
self.update(data)
|
||||||
|
|
||||||
search_entry.bind("<Return>", command=search)
|
search_entry.bind("<Return>", command=search)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user