diff --git a/app.py b/app.py index e60f9d1..c6b4c86 100644 --- a/app.py +++ b/app.py @@ -31,7 +31,6 @@ pio.templates["plotly_light"].layout['yaxis']['zerolinecolor'] = 'lightgray' ELM = { 'name': 'tempplot', 'filedir': './data', - # 'filename': './data/20260420213656.txt', 'filename': None, 'label_file_fmt': 'File: {filename}', 'label_data_len_fmt': 'Data points: {num:,} (rendered) / {numa:,} (total)', @@ -56,6 +55,8 @@ def main_cli(): '--host', type=str, default='', help='default 127.0.0.1') parser.add_argument( '--port', type=str, default='8085', help='default 8080') + parser.add_argument( + '--dir', type=str, default='./data', help='default ./data') parser.add_argument( '-v', '--verbose', action='store_true', help='Verbose output') parser.add_argument( @@ -86,7 +87,7 @@ def np2pgo(x, y, label=None): return res async def pick_file() -> None: - result = await local_file_picker.local_file_picker('./data', multiple=False) + result = await local_file_picker.local_file_picker(ELM['filedir'], multiple=False) # ui.notify(f'You chose {result}') if result: filename = result[-1] @@ -251,12 +252,12 @@ def index(): ui.label('Heater') ELM['number_heat_min'] = \ ui.number( - label='min', value=None, format='%.2f', min=0, step=1.0, suffix='%') \ + label='min', value=0, format='%.2f', min=0, step=1.0, suffix='%') \ .props('clearable').classes('w-32').on( 'update:model-value', lambda e: update_fig(), throttle=1.0) ELM['number_heat_max'] = \ ui.number( - label='max', value=None, format='%.2f', min=0, step=1.0, suffix='%') \ + label='max', value=100, format='%.2f', min=0, step=1.0, suffix='%') \ .props('clearable').classes('w-32').on( 'update:model-value', lambda e: update_fig(), throttle=1.0) @@ -284,6 +285,7 @@ def index(): ELM['switch_timer'].bind_value_to(ELM['timer'], 'active') def main_gui(args): + ELM['filedir'] = args.dir ui.run( host=args.host, port=int(args.port), title=ELM['name'], dark=False,