Skip to content

Commit 8cafbf3

Browse files
committed
Use window active state for speech interrupt
Pass the window's active state to UniversalSpeech.say so speech interruption depends on whether the SuraPlayer window is active. Replaces previous calls that omitted the interrupt argument or hardcoded interrupt=True with interrupt=self.isActiveWindow(). Also fixes spacing in the repeat counter formatting in the repeat message (SuraPlayerWindow in ui/sura_player_ui/sura_player_ui.py).
1 parent c65c317 commit 8cafbf3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ui/sura_player_ui/sura_player_ui.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def next_surah(self):
355355
current_index = self.surah_combo.currentIndex()
356356
if current_index < self.surah_combo.count() - 1:
357357
self.surah_combo.setCurrentIndex(current_index + 1)
358-
UniversalSpeech.say(self.surah_combo.currentText())
358+
UniversalSpeech.say(self.surah_combo.currentText(), interrupt=self.isActiveWindow())
359359
logger.info(f"Moved to surah {self.surah_combo.currentText()}.")
360360
self.play_current_surah()
361361

@@ -364,7 +364,7 @@ def previous_surah(self):
364364
current_index = self.surah_combo.currentIndex()
365365
if current_index > 0:
366366
self.surah_combo.setCurrentIndex(current_index - 1)
367-
UniversalSpeech.say(self.surah_combo.currentText())
367+
UniversalSpeech.say(self.surah_combo.currentText(), interrupt=self.isActiveWindow())
368368
logger.info(f"Moved to surah {self.surah_combo.currentText()}.")
369369
self.play_current_surah()
370370

@@ -568,7 +568,7 @@ def _handle_surah_repeats(self) -> bool:
568568
self.current_surah_repeat_count += 1
569569
logger.debug(f"Repeating Surah: repeat {self.current_surah_repeat_count}/{repeat_count}")
570570
self._repeat_current_surah()
571-
UniversalSpeech.say(f"تكرار سورة {self.surah_combo.currentText()}، {self.current_surah_repeat_count +1} من {repeat_count} مرات.", interrupt=True)
571+
UniversalSpeech.say(f"تكرار سورة {self.surah_combo.currentText()}، {self.current_surah_repeat_count + 1} من {repeat_count} مرات.", interrupt=self.isActiveWindow())
572572
return True
573573
else:
574574
logger.debug("Surah repeat count reached limit, resetting counter.")
@@ -606,7 +606,7 @@ def _replay_current_surah(self):
606606
"""
607607
self.replay()
608608
self.play_current_surah()
609-
UniversalSpeech.say(f"تكرار سورة {self.surah_combo.currentText()}.", interrupt=True)
609+
UniversalSpeech.say(f"تكرار سورة {self.surah_combo.currentText()}.", interrupt=self.isActiveWindow())
610610

611611

612612
def _play_next_surah(self):

0 commit comments

Comments
 (0)