33import json
44import math
55import os
6+ import time
67from functools import partial
78from pathlib import Path
89
@@ -450,10 +451,15 @@ def data_loading_hide(self):
450451 ]
451452
452453 def data_load_variables (self ):
454+ self .state .loading = True
453455 asynchronous .create_task (self ._data_load_variables ())
454456
455457 async def _data_load_variables (self ):
456458 """Called at 'Load Variables' button click"""
459+ t0 = time .perf_counter ()
460+ # Give some room
461+ await asyncio .sleep (0.1 )
462+
457463 vars_to_show = self .selected_variables
458464
459465 # Flatten the list of lists
@@ -477,17 +483,25 @@ async def _data_load_variables(self):
477483 # Trigger source update + compute avg
478484 with self .state :
479485 self .state .variables_loaded = True
486+
480487 await self .server .network_completion
481488
482489 # Update views in layout
483490 with self .state :
484491 self .view_manager .build_auto_layout (vars_to_show )
492+
485493 await self .server .network_completion
486494
487495 # Reset camera after yield
488496 await asyncio .sleep (0.1 )
489497 self .view_manager .reset_camera ()
490498
499+ # Done with the loading
500+ t1 = time .perf_counter ()
501+ with self .state :
502+ self .state .loading = False
503+ self .state .loading_time = t1 - t0
504+
491505 @change ("layout_grouped" )
492506 def _on_layout_change (self , ** _ ):
493507 vars_to_show = self .selected_variables
0 commit comments