[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#58014] [PATCH 11/15] marionette: Add a callback arguments to wait-f
From: |
Maxim Cournoyer |
Subject: |
[bug#58014] [PATCH 11/15] marionette: Add a callback arguments to wait-for-screen-text. |
Date: |
Fri, 23 Sep 2022 01:00:38 -0400 |
* gnu/build/marionette.scm (wait-for-screen-text): New 'pre-action' and
'post-action' arguments. Update doc. Call the procedures before and after
the OCR occurs, respectively.
---
gnu/build/marionette.scm | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 6f373f87b6..f4b219e842 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -331,11 +331,15 @@ (define image (string-append (tmpnam) ".ppm"))
(define* (wait-for-screen-text marionette predicate
#:key
(ocr "ocrad")
- (timeout 30))
+ (timeout 30)
+ pre-action
+ post-action)
"Wait for TIMEOUT seconds or until the screen text on MARIONETTE matches
PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded.
The error contains the recognized text along the preserved file name of the
-screen dump, which is relative to the current working directory."
+screen dump, which is relative to the current working directory. If
+PRE-ACTION is provided, it should be a thunk to call before each OCR attempt.
+Likewise for POST-ACTION, except it runs at the end of a successful OCR."
(define start
(car (gettimeofday)))
@@ -353,7 +357,9 @@ (define end
(error "'wait-for-screen-text' timeout"
'ocr-text: last-text
'screendump: screendump-backup))
- (let* ((text screendump (marionette-screen-text marionette #:ocr ocr))
+ (let* ((_ (and (procedure? pre-action) (pre-action)))
+ (text screendump (marionette-screen-text marionette #:ocr ocr))
+ (_ (and (procedure? post-action) (post-action)))
(result (predicate text)))
(cond (result
(delete-file screendump)
--
2.37.3
- [bug#58014] [PATCH 00/15] Add xvnc-service-type., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 01/15] gnu: tigervnc-server: Use new style inputs, gexps., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 03/15] gnu: tigervnc-server: Adjust PAM config., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 02/15] gnu: tigervnc-server: Move source production into origin snippet., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 04/15] gnu: tigervnc-server: Disable tests via #:tests?., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 05/15] gnu: tigervnc-server: Patch and wrap vncserver script., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 11/15] marionette: Add a callback arguments to wait-for-screen-text.,
Maxim Cournoyer <=
- [bug#58014] [PATCH 10/15] marionette: Define keystrokes for typing colons and exclamation marks., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 06/15] gnu: gdm: Patch an extra reference to the Xsession script., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 07/15] services: gdm: Add a configuration field to enable XDMCP., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 08/15] marionette: Make marionette-screen-text private., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 12/15] gnu: dconf: Set sysconfdir to /etc., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 09/15] marionette: Preserve screen dumps on failures., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 13/15] services: Add dconf-service-type., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 15/15] services: Add xvnc-service-type., Maxim Cournoyer, 2022/09/23
- [bug#58014] [PATCH 14/15] services: xorg: Add auto-suspend? field to <gdm-configuration>., Maxim Cournoyer, 2022/09/23