From 2d1f504b67df9919b4661d1a923027368029170c Mon Sep 17 00:00:00 2001 From: kassarole Date: Tue, 28 Mar 2023 22:21:43 -0400 Subject: [PATCH] Updated ini to allow configuring host ip/port --- config.ini | 4 +++- gui.py | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config.ini b/config.ini index fa2560f..2d33504 100644 --- a/config.ini +++ b/config.ini @@ -1,2 +1,4 @@ [data] -folder_location = z:\books\ \ No newline at end of file +folder_location = z:\books\ +host = 127.0.0.1 +port = 8080 \ No newline at end of file diff --git a/gui.py b/gui.py index 52ad9a9..13f50ab 100644 --- a/gui.py +++ b/gui.py @@ -1,5 +1,13 @@ 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) @@ -7,4 +15,4 @@ def pass_command() -> None: downloadBook(result) with ui.card().classes('absolute-center'): title = ui.input('Title').on('keydown.enter', pass_command) -ui.run() \ No newline at end of file +ui.run(host=config['data']['host'],port=int(config['data']['port'])) \ No newline at end of file