From f808d0e4f9f7c00bfae90e102130638ea27d578e Mon Sep 17 00:00:00 2001 From: Walker Arce Date: Thu, 14 Apr 2022 15:14:48 -0500 Subject: [PATCH] Fixes #9 Bump patch number --- output_view_ui.py | 21 +++++++++++++++++++++ ui_params.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/output_view_ui.py b/output_view_ui.py index cd6a7b6..af345b3 100644 --- a/output_view_ui.py +++ b/output_view_ui.py @@ -911,6 +911,10 @@ def add_session_event(self, events): def undo_last_delete(self): if self.deleted_event: + if type(self.deleted_event[1]) is list: + self.update_dur_event(self.deleted_event[0], (self.deleted_event[1][1] - self.deleted_event[1][0])) + else: + self.update_freq_event(self.deleted_event[0], 1) self.add_session_event([self.deleted_event]) self.deleted_event = None @@ -922,6 +926,10 @@ def delete_last_event(self): self.sh_treeview_parents.pop(len(self.event_history) - 1) self.deleted_event = self.event_history[-1] self.event_history.pop(len(self.event_history) - 1) + if type(self.deleted_event[1]) is list: + self.update_dur_event(self.deleted_event[0], -(self.deleted_event[1][1] - self.deleted_event[1][0])) + else: + self.update_freq_event(self.deleted_event[0], -1) def delete_dur_binding(self): if self.current_selection1: @@ -932,6 +940,19 @@ def delete_dur_binding(self): def add_dur_popup(self): NewKeyPopup(self, self.frame, True) + def update_freq_event(self, key_char, change): + for i in range(0, len(self.bindings)): + if self.bindings[i][1] == key_char: + self.bindings_freq[i] += change + self.freq_treeview.set(str(i), column="1", value=self.bindings_freq[i]) + + def update_dur_event(self, key_char, change): + for i in range(0, len(self.dur_bindings)): + if self.dur_bindings[i][1] == key_char: + self.sticky_dur[i] += change + self.sticky_start[i] = 0 + self.dur_treeview.set(str(i), column="2", value=self.sticky_dur[i]) + def check_key(self, key_char, start_time, current_frame, current_window): return_bindings = [] for i in range(0, len(self.bindings)): diff --git a/ui_params.py b/ui_params.py index 76e885f..cae316a 100644 --- a/ui_params.py +++ b/ui_params.py @@ -1,4 +1,4 @@ -cometrics_version = "1.0.9" +cometrics_version = "1.0.10" ui_title = f"cometrics v{cometrics_version}" cometrics_data_root = fr'C:\cometrics'