[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/16: marionette: Add a callback arguments to wait-for-screen-text.
From: |
guix-commits |
Subject: |
11/16: marionette: Add a callback arguments to wait-for-screen-text. |
Date: |
Fri, 7 Oct 2022 10:13:40 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository guix.
commit 133901a396cf81aa1dcb35586e77a5a78475c4c7
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Sep 23 00:23:47 2022 -0400
marionette: Add a callback arguments to wait-for-screen-text.
* 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 @@ if it is not needed."
(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 @@ screen dump, which is relative to the current working
directory."
(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)
- branch master updated (31708431c5 -> 6e3dab4737), guix-commits, 2022/10/07
- 03/16: gnu: tigervnc-server: Adjust PAM config., guix-commits, 2022/10/07
- 04/16: gnu: tigervnc-server: Disable tests via #:tests?., guix-commits, 2022/10/07
- 05/16: gnu: tigervnc-server: Patch and wrap vncserver script., guix-commits, 2022/10/07
- 02/16: gnu: tigervnc-server: Move source production into origin snippet., guix-commits, 2022/10/07
- 08/16: marionette: Make marionette-screen-text private., guix-commits, 2022/10/07
- 06/16: gnu: gdm: Patch an extra reference to the Xsession script., guix-commits, 2022/10/07
- 15/16: services: Add xvnc-service-type., guix-commits, 2022/10/07
- 14/16: services: xorg: Add auto-suspend? field to <gdm-configuration>., guix-commits, 2022/10/07
- 09/16: marionette: Preserve screen dumps on failures., guix-commits, 2022/10/07
- 11/16: marionette: Add a callback arguments to wait-for-screen-text.,
guix-commits <=
- 01/16: gnu: tigervnc-server: Use new style inputs, gexps., guix-commits, 2022/10/07
- 07/16: services: gdm: Add a configuration field to enable XDMCP., guix-commits, 2022/10/07
- 10/16: marionette: Define keystrokes for typing colons and exclamation marks., guix-commits, 2022/10/07
- 12/16: gnu: dconf: Set sysconfdir to /etc., guix-commits, 2022/10/07
- 16/16: Update NEWS., guix-commits, 2022/10/07
- 13/16: services: Add dconf-service-type., guix-commits, 2022/10/07