From 82ff70d7e7344e2eb94ced26f29502537eb1a5b7 Mon Sep 17 00:00:00 2001 From: Homeschool <44999124+mjhomeschool@users.noreply.github.com> Date: Tue, 16 Sep 2025 15:07:15 -0600 Subject: [PATCH 1/2] Minor UX improvements 1. Starts with the Monitor, reidentify, and Preview buttons disabled. 2. Selecting a config or an eye image enables the Monitor and Preview buttons. 3. Reidentify remains disabled until seeds are recorded. 4. Clicking Monitor or Reidentify while preview is showing automatically stops the preview. (Brief visual interruption in view between stopping preview and starting the new view.) 5. While monitoring or reidentifying, the other two buttons are disabled. 6. Clicking Stop Monitoring or Stop Reidentifying returns to preview. (Brief visual interruption in view between stopping and returning to preview.) --- src/player_blink_gui.py | 75 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/src/player_blink_gui.py b/src/player_blink_gui.py index 05096df..fe070b7 100644 --- a/src/player_blink_gui.py +++ b/src/player_blink_gui.py @@ -159,12 +159,15 @@ def create_widgets(self): self.monitor_blink_button = ttk.Button(self, text="Monitor Blinks", \ command=self.monitor_blinks) self.monitor_blink_button.grid(column=5,row=0) + self.monitor_blink_button.config(state=tk.DISABLED) self.reidentify_button = ttk.Button(self, text="Reidentify", command=self.reidentify) self.reidentify_button.grid(column=5,row=1) + self.reidentify_button.config(state=tk.DISABLED) self.preview_button = ttk.Button(self, text="Preview", command=self.preview) self.preview_button.grid(column=5,row=2) + self.preview_button.config(state=tk.DISABLED) self.stop_tracking_button = ttk.Button(self, text="Stop Tracking", \ command=self.stop_tracking) @@ -337,6 +340,9 @@ def new_eye(self): self.player_eye_tk = self.cv_image_to_tk(self.player_eye) self.eye_display['image'] = self.player_eye_tk + self.monitor_blink_button.config(state=tk.NORMAL) + self.enable_preview() + def save_config(self): """Save current settings to the selected config file""" with open(join("configs",self.config_combobox.get()),"w",encoding="utf-8") as file: @@ -399,6 +405,9 @@ def config_combobox_onchange(self, _=None): self.timeline_buffer.insert(0, self.config_json["timeline_buffer"]) self.reident_noisy_check_var.set(self.config_json["reident_1_pk_npc"]) + self.monitor_blink_button.config(state=tk.NORMAL) + self.enable_preview() + def stop_tracking(self): """Set tracking to False""" self.tracking = False @@ -416,8 +425,22 @@ def monitor_blinks(self): self.monitoring_thread.daemon = True self.monitoring_thread.start() else: - self.monitor_blink_button['text'] = "Monitor Blinks" - self.monitoring = False + self.stop_monitor_blinks() + + def stop_monitor_blinks(self): + self.monitor_blink_button['text'] = "Monitor Blinks" + self.monitoring = False + + self.enable_preview() + self.enable_reidentify() + + self.preview() + + def enable_monitor_blinks(self): + self.monitor_blink_button.config(state=tk.NORMAL) + + def disable_monitor_blinks(self): + self.monitor_blink_button.config(state=tk.DISABLED) def reidentify(self): """Start monitoring 7/20 blinks to deduce current advance based on entered state""" @@ -428,8 +451,25 @@ def reidentify(self): self.reidentifying_thread.daemon = True self.reidentifying_thread.start() else: - self.reidentify_button['text'] = "Reidentify" - self.reidentifying = False + self.stop_reidentify() + + def stop_reidentify(self): + self.reidentify_button['text'] = "Reidentify" + self.reidentifying = False + + self.enable_preview() + self.enable_monitor_blinks() + + self.preview() + + def enable_reidentify(self): + seeds = self.s0_1_2_3.get(1.0,tk.END) + + if len(seeds) > 1: + self.reidentify_button.config(state=tk.NORMAL) + + def disable_reidentify(self): + self.reidentify_button.config(state=tk.DISABLED) def tidsid(self): """Start monitoring 64 munchlax blinks to deduce current state for tid/sid rng""" @@ -447,6 +487,10 @@ def tidsid(self): # as this function handles both monitoring and setting up timelines # the amount of branches is fair def monitoring_work(self): + self.stop_preview() + self.disable_preview() + self.disable_reidentify() + """Thread work to be for the monitoring function""" self.tracking = False blinks, \ @@ -468,6 +512,9 @@ def monitoring_work(self): self.monitoring = False self.preview() + self.enable_preview() + self.enable_reidentify() + waituntil = time.perf_counter() diff = round(waituntil-offset_time) self.rng.get_next_rand_sequence(diff @@ -560,6 +607,8 @@ def monitoring_work(self): self.timelining = False def tidsiding_work(self): + self.stop_preview() + """Thread work to be done for the tidsid function""" self.tracking = False munchlax_intervals \ @@ -612,9 +661,14 @@ def reidentifying_work(self): try: state = [int(x,16) for x in self.s0_1_2_3.get(1.0,tk.END).split("\n")[:4]] except ValueError as bad_input: + self.stop_reidentify() raise Exception("Cannot pull seeds from S[0-3] for reidentification, " \ "make sure they are in hex and split by line.") from bad_input + self.stop_preview() + self.disable_preview() + self.disable_monitor_blinks() + print(f"{state[0]:08X}{state[1]:08X} {state[2]:08X}{state[3]:08X}") print(f"{state[0]:08X} {state[1]:08X} {state[2]:08X} {state[3]:08X}") self.s0_1_2_3.delete(1.0, tk.END) @@ -693,6 +747,9 @@ def reidentifying_work(self): self.reidentifying = False self.preview() + self.enable_preview() + self.enable_monitor_blinks() + waituntil = time.perf_counter() diff = round(waituntil-offset_time) self.rng.get_next_rand_sequence(diff @@ -785,9 +842,19 @@ def preview(self): self.previewing_thread.daemon = True self.previewing_thread.start() else: + self.stop_preview() + + def stop_preview(self): + if self.previewing: self.preview_button['text'] = "Preview" self.previewing = False + def enable_preview(self): + self.preview_button.config(state=tk.NORMAL) + + def disable_preview(self): + self.preview_button.config(state=tk.DISABLED) + # pylint: disable=too-many-locals # previewing live updates at any setting change # many local variables are required to do this From 4c5367516a4df5e400923abede6d602c85cc6fc1 Mon Sep 17 00:00:00 2001 From: Homeschool <44999124+mjhomeschool@users.noreply.github.com> Date: Wed, 17 Sep 2025 11:59:47 -0600 Subject: [PATCH 2/2] BUG: Reidentify doesn't enable after seed ident. The previous change disabled Reidentify until after seed is identified. The check to enable the Reidentify button was running before the seed field was populated, meaning that the button would only be enabled after the second completion of Monitor Blinks. This fix adjusts the timing so it happens after the first completion of Monitor Blinks. --- src/player_blink_gui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/player_blink_gui.py b/src/player_blink_gui.py index fe070b7..a4113e6 100644 --- a/src/player_blink_gui.py +++ b/src/player_blink_gui.py @@ -529,6 +529,7 @@ def monitoring_work(self): self.s0_1_2_3.insert(1.0,f"{state[0]:08X}\n{state[1]:08X}\n{state[2]:08X}\n{state[3]:08X}") self.s01_23.insert(1.0,f"{state[0]:08X}{state[1]:08X}\n{state[2]:08X}{state[3]:08X}") + self.enable_reidentify() self.advances = (1 if self.menu_check_var.get() else 0) self.tracking = True