[orca] Debug: Add "Last spoke" timestamp
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [orca] Debug: Add "Last spoke" timestamp
- Date: Sat, 12 Jun 2021 16:02:36 +0000 (UTC)
commit ef8cfa6806d1b85b10737712b64d6518710bcaa7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Jun 12 17:59:51 2021 +0200
    Debug: Add "Last spoke" timestamp
    
    This is just a hack to facilitate quickly finding instances in debug.out
    files where Orca failed to say anything for a long time, e.g. due to an
    event flood or AT-SPI2 failing to send over any events.
 src/orca/speech.py | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/orca/speech.py b/src/orca/speech.py
index 2491491f0..d052a8e08 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -45,6 +45,9 @@ log = _logger.newLog("speech")
 #
 _speechserver = None
 
+# The last time something was spoken.
+_timestamp = 0
+
 def getSpeechServerFactories():
     """Imports all known SpeechServer factory modules.  Returns a list
     of modules that implement the getSpeechServers method, which
@@ -198,6 +201,12 @@ def speak(content, acss=None, interrupt=True):
         debug.println(debug.LEVEL_WARNING, error % content, True)
         return
 
+    global _timestamp
+    if _timestamp:
+        msg = "SPEECH: Last spoke %.4f seconds ago" % (time.time() - _timestamp)
+        debug.println(debug.LEVEL_INFO, msg, True)
+    _timestamp = time.time()
+
     if isinstance(content, str):
         _speak(content, acss, interrupt)
     if not isinstance(content, list):
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]