diff --git a/software/management/dashboard/processing.py b/software/management/dashboard/processing.py index 8b0ff746..6eeadb8e 100755 --- a/software/management/dashboard/processing.py +++ b/software/management/dashboard/processing.py @@ -172,7 +172,7 @@ def draw_indications(events, event_offset): window_sizes = [10,15,30,60,300,600,900,1800,3600] init_sel = 2 - window_size_slider = Slider(axis_size, 'WindowSize', 0, 7, valinit=init_sel, valstep=1) + window_size_slider = Slider(axis_size, 'WindowSize', 0, 8, valinit=init_sel, valstep=1) window_size = window_sizes[init_sel]/86400.0 window_size_slider.valtext.set_text(seconds_to_human_readable(window_sizes[init_sel])) @@ -221,8 +221,11 @@ def update_shades_and_window(pos): def update_window_position(val): pos = window_position_slider.val + # limiting the movable position + if pos+window_size>tmax: + window_position_slider.set_val(tmax-window_size) + return window_position_slider.valtext.set_text(mdates.num2date(pos).strftime('%y-%m-%d %H:%M:%S')) - update_shades_and_window(pos) def update_window_size(val): @@ -230,6 +233,10 @@ def update_window_size(val): window_size = window_sizes[val]/86400.0 window_size_slider.valtext.set_text(seconds_to_human_readable(window_sizes[val])) pos = window_position_slider.val + # dial the slider back if the range is reached + if pos+window_size>tmax: + pos = tmax-window_size + window_position_slider.set_val(pos) update_shades_and_window(pos) def submit(event_offset):