Skip to content

Commit

Permalink
Merge pull request #62 from Munroe-Meyer-Institute-VR-Laboratory/v1.4…
Browse files Browse the repository at this point in the history
….0_dev

V1.4.0 dev
  • Loading branch information
wsarce authored Jul 14, 2023
2 parents 899b581 + 16c21af commit 6023b2e
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 18 deletions.
2 changes: 1 addition & 1 deletion PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Privacy Policy for cometrics
## Date: June 2023
## Date: July 2023

The developer of cometrics is mindful of the security and protection of user data and patient data. This Privacy Policy document explains the types of information that are collected and recorded by cometrics and in which situations the developers will have access to generated data.

Expand Down
40 changes: 32 additions & 8 deletions output_view_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def check_event(self, key_char, start_time):
if self.e4_view.e4:
current_window = EmpaticaE4.get_unix_timestamp()
# Get the appropriate key event
key_events = self.key_view.check_key(key_char, start_time, current_frame, current_window, current_audio_frame)
key_events = self.key_view.check_key(key_char, start_time, current_frame, current_window,
current_audio_frame)
# Add to session history
if key_events:
self.key_view.add_session_event(key_events)
Expand All @@ -247,6 +248,11 @@ def check_duration_keys(self, final_time):
if self.key_view.dur_sticky[i]:
self.check_event(self.key_view.dur_bindings[i][0], final_time)

def edit_last_event(self):
self.delete_last_event()
self.key_view.editing = True
self.video_view.editing = True

def delete_last_event(self):
self.key_view.delete_last_event()
self.video_view.delete_last_event()
Expand Down Expand Up @@ -616,6 +622,8 @@ def __load_protocol_from_file(self, selected_file=None):
self.prot_file = selected_file
with open(self.prot_file, 'r') as f:
self.protocol_steps = json.load(f)['Steps']
if len(self.protocol_steps[0]) == 4:
self.__heal_legacy_protocol()
self.repopulate_treeview()
self.changed_protocol = True
self.prot_save_button['state'] = 'active'
Expand Down Expand Up @@ -784,8 +792,9 @@ def __init__(self, parent, height, width, field_font, header_font, button_size,
self.calibrated = True
self.right_ble_thresh = ble_thresh[0]
self.left_ble_thresh = ble_thresh[1]
print(f"INFO: Vibrotactors already calibrated - Right: {self.right_ble_thresh} Left: {self.left_ble_thresh} "
f"Calibrated: {self.calibrated}")
print(
f"INFO: Vibrotactors already calibrated - Right: {self.right_ble_thresh} Left: {self.left_ble_thresh} "
f"Calibrated: {self.calibrated}")
else:
self.calibrated = False
self.right_ble_thresh = None
Expand Down Expand Up @@ -1268,7 +1277,8 @@ def update_ble_12(self, value):


class ViewVideo:
def __init__(self, caller, root, height, width, field_font, header_font, button_size, fps, kdf, video_button, field_offset=60,
def __init__(self, caller, root, height, width, field_font, header_font, button_size, fps, kdf, video_button,
field_offset=60,
video_import_cb=None, slider_change_cb=None):
self.recording_fps = fps
self.tab_button = video_button
Expand All @@ -1280,6 +1290,7 @@ def __init__(self, caller, root, height, width, field_font, header_font, button_
self.reviewing = False
self.video_loaded = False
self.video_file = None
self.editing = False

self.video_label = Label(self.root, bg='white')
self.video_height, self.video_width = int((width - 10) * (1080 / 1920)), width - 10
Expand Down Expand Up @@ -1443,6 +1454,9 @@ def add_event_direct(self, event):
def add_event(self, events):
if self.video_loaded:
for event in events:
if self.editing:
if type(event[1]) is list and type(self.deleted_event[1]) is list:
event = event[:1] + self.deleted_event[1:]
if type(event[1]) is list:
start_time = int(event[1][1]) - int(event[1][0])
else:
Expand All @@ -1456,6 +1470,8 @@ def add_event(self, events):
tags=(
treeview_tags[
len(self.event_history) % 2])))
self.editing = False
self.deleted_event = None
self.event_treeview.see(self.event_treeview_parents[-1])

def add_event_history(self, event_history):
Expand Down Expand Up @@ -2092,7 +2108,8 @@ def __init__(self, parent, keystroke_file, height, width,
fs_offset=fs_offset)

self.key_explanation = Label(self.frame, font=field_font, text="Delete Last Event: Backspace"
"\nUndo Last Delete: Right Ctrl", justify=LEFT)
"\nUndo Last Delete: Right Ctrl"
"\nEdit Last Event: Left Shift", justify=LEFT)
self.key_explanation.place(x=((width * 0.75) + 30) - ((width * 0.25) * 0.5),
y=height - (th_offset / 2), anchor=NW)

Expand All @@ -2103,6 +2120,7 @@ def init_background_vars(self, keystroke_file):
self.keystroke_json = None
self.new_keystroke = False
self.deleted_event = None
self.editing = False
self.bindings = []
self.event_history = []
self.dur_bindings = []
Expand All @@ -2129,6 +2147,9 @@ def clear_sh_treeview(self):

def add_session_event(self, events):
for event in events:
if self.editing:
if type(event[1]) == type(self.deleted_event[1]):
event = event[:1] + self.deleted_event[1:]
if type(event[1]) is list:
start_time = int(event[1][1]) - int(event[1][0])
else:
Expand All @@ -2138,6 +2159,8 @@ def add_session_event(self, events):
text=str(self.event_history[-1][0]),
values=(start_time,),
tags=(treeview_tags[len(self.event_history) % 2])))
self.editing = False
self.deleted_event = None
self.sh_treeview.see(self.sh_treeview_parents[-1])

def undo_last_delete(self):
Expand Down Expand Up @@ -2212,9 +2235,10 @@ def check_key(self, key_char, start_time, current_frame, current_window, current
self.dur_sticky[i] = True
self.sticky_start[i] = (start_time, current_frame, current_window, current_audio_frame)
if return_bindings:
# Clear deleted event buffer when a new event is added
if self.deleted_event:
self.deleted_event = None
# Clear deleted event buffer when a new event is added but not when editing
if not self.editing:
if self.deleted_event:
self.deleted_event = None
return return_bindings

def add_key_popup(self):
Expand Down
Binary file modified reference/Cometrics User Guide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion reference/PRIVACY_POLICY.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>Privacy Policy for cometrics</h1>
<h2>Date: Aug 2022</h2>
<h2>Date: July 2023</h2>
<p>The developer of cometrics is mindful of the security and protection of user data and patient data. This Privacy Policy document explains the types of information that are collected and recorded by cometrics and in which situations the developers will have access to generated data.</p>
<p>By using cometrics, you hereby consent to this Privacy Policy and agree to its terms and conditions.</p>
<h2>Information cometrics collects</h2>
Expand Down
5 changes: 4 additions & 1 deletion session_manager_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def __init__(self, config, project_setup):
"Delete Last Event": keyboard.Key.backspace,
"Undo Last Delete": keyboard.Key.ctrl_r,
"Next Frame": keyboard.Key.right,
"Previous Frame": keyboard.Key.left
"Previous Frame": keyboard.Key.left,
"Edit Last Event": keyboard.Key.shift
}
self.tag_history = []
self.listener = keyboard.Listener(
Expand Down Expand Up @@ -300,6 +301,8 @@ def handle_global_press(self, key_char):
self.ovu.video_view.increment_frame()
elif key == "Previous Frame":
self.ovu.video_view.decrement_frame()
elif key == "Edit Last Event":
self.ovu.edit_last_event()

def handle_key_press(self, key):
try:
Expand Down
14 changes: 7 additions & 7 deletions tkinter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,20 @@ def __init__(self, root, config):
self.fps_entry.insert(0, int(self.config.get_fps()))
self.fps_entry.place(x=60, y=10)
self.e4_var = tkinter.BooleanVar(popup_root, value=self.config.get_e4())
e4_checkbutton = tkinter.Checkbutton(popup_root, text="E4 Enabled", bg='white', variable=self.e4_var,
e4_checkbutton = tkinter.Checkbutton(popup_root, text="Show E4 Tab", bg='white', variable=self.e4_var,
font=('Purisa', 12))
e4_checkbutton.place(x=10, y=50)
self.woodway_var = tkinter.BooleanVar(popup_root, value=self.config.get_woodway())
woodway_checkbutton = tkinter.Checkbutton(popup_root, text="Woodway Enabled", bg='white',
woodway_checkbutton = tkinter.Checkbutton(popup_root, text="Show Woodway Tab", bg='white',
variable=self.woodway_var, font=('Purisa', 12))
woodway_checkbutton.place(x=10, y=80)
self.ble_var = tkinter.BooleanVar(popup_root, value=self.config.get_ble())
ble_checkbutton = tkinter.Checkbutton(popup_root, text="BLE Enabled", bg='white',
ble_checkbutton = tkinter.Checkbutton(popup_root, text="Show BLE Tab", bg='white',
variable=self.ble_var, font=('Purisa', 12))
ble_checkbutton.place(x=10, y=110)

self.click_var = tkinter.BooleanVar(popup_root, value=self.config.get_clickmode())
clk_checkbutton = tkinter.Checkbutton(popup_root, text="Single Click Enabled", bg='white',
clk_checkbutton = tkinter.Checkbutton(popup_root, text="Enable Single Click", bg='white',
variable=self.click_var, font=('Purisa', 12))
clk_checkbutton.place(x=10, y=140)

Expand All @@ -361,17 +361,17 @@ def __init__(self, root, config):
self.b_entry.place(x=60, y=220)

self.review_var = tkinter.BooleanVar(popup_root, value=self.config.get_review())
review_checkbutton = tkinter.Checkbutton(popup_root, text="Review Mode Enabled", bg='white',
review_checkbutton = tkinter.Checkbutton(popup_root, text="Enable Review Mode", bg='white',
variable=self.review_var, font=('Purisa', 12))
review_checkbutton.place(x=10, y=250)

self.auto_export_var = tkinter.BooleanVar(popup_root, value=self.config.get_auto_export())
auto_export_checkbutton = tkinter.Checkbutton(popup_root, text="Auto Export Enabled", bg='white',
auto_export_checkbutton = tkinter.Checkbutton(popup_root, text="Enable Auto Export", bg='white',
variable=self.auto_export_var, font=('Purisa', 12))
auto_export_checkbutton.place(x=10, y=280)

self.protocol_var = tkinter.BooleanVar(popup_root, value=self.config.get_protocol_beep())
prot_checkbutton = tkinter.Checkbutton(popup_root, text="Protocol Beep Enabled", bg='white',
prot_checkbutton = tkinter.Checkbutton(popup_root, text="Enable Protocol Beep", bg='white',
variable=self.protocol_var, font=('Purisa', 12))
prot_checkbutton.place(x=10, y=310)

Expand Down
Binary file not shown.
Binary file added user_guide/Cometrics User Guide_v11.pdf
Binary file not shown.

0 comments on commit 6023b2e

Please sign in to comment.