ebook-downloader/gui.py
2023-03-28 22:21:43 -04:00

18 lines
656 B
Python

from nicegui import *
from bookrequest import *
import configparser
config = configparser.ConfigParser()
try:
config.read('config.ini')
except Exception as e:
print(e)
print('Config file not found. Please ensure conf.ini is in the same \
location as bookrequest.py')
def pass_command() -> None:
if title.value != '':
result = searchBook(title.value, unattended=True)
ui.notify('Searching and Downloading Book!')
downloadBook(result)
with ui.card().classes('absolute-center'):
title = ui.input('Title').on('keydown.enter', pass_command)
ui.run(host=config['data']['host'],port=int(config['data']['port']))