From 749406afecb6c1bc7fcd8a57e84906490e5a7285 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 5 Sep 2023 06:19:52 +0100 Subject: [PATCH] refactor focus in events for rename popup --- src/nvda_voicemeeter/window.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 2a3e34a..2a44e3c 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -239,18 +239,15 @@ class NVDAVMWindow(psg.Window): elif event == "Index": val = values["Index"] self.nvda.speak(f"Index {val}") - elif event.startswith("Index") and event.endswith("||FOCUS IN"): - val = values["Index"] - self.nvda.speak(f"Index {val}") - elif event.startswith("Edit") and event.endswith("||FOCUS IN"): - self.nvda.speak("Edit") + elif event.endswith("||FOCUS IN"): + if event.startswith("Index"): + val = values["Index"] + self.nvda.speak(f"Index {val}") + else: + self.nvda.speak(event.split("||")[0]) elif event == "Ok": data = values break - elif event.startswith("Ok") and event.endswith("||FOCUS IN"): - self.nvda.speak("Ok") - elif event.startswith("Cancel") and event.endswith("||FOCUS IN"): - self.nvda.speak("Cancel") window.close() return data