Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lab11/socitrack
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Mar 5, 2024
2 parents a5b8f10 + f9b9a3a commit 70beafa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions software/management/dashboard/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

Expand Down Expand Up @@ -221,15 +221,22 @@ 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):
nonlocal window_size
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):
Expand Down

0 comments on commit 70beafa

Please sign in to comment.