Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of PNGs screenshots: added target and misc #867

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

isidroas
Copy link

@isidroas isidroas commented Apr 7, 2024

  • Makefile: external programs detection
  • compile_pngs.sh: export display
  • screenshots.sh: use xdotool --sync
  • from $c to $counter
Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master or python-dual-support branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment
  • I've included docstrings and/or documentation and/or examples for my code (if this is a new feature)
Description:

(P. S. If this pull requests fixes an existing issue, please specify which one.)

@github-actions github-actions bot added the docs Issues related to documentation label Apr 7, 2024
@isidroas
Copy link
Author

isidroas commented Apr 9, 2024

Related to #358

to avoid c++ confusion with the compiler
Copy link
Collaborator

@ulidtko ulidtko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Please ping me when you achieve stable results

@isidroas
Copy link
Author

isidroas commented Apr 9, 2024

This is ready for my side!

Copy link
Collaborator

@ulidtko ulidtko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough refactor, but does not fix the main issue with these screenshots.

@isidroas please see my comments in #385, you'll also want to check pending commits in the fix-screenshot-race branch

Edit: I mean #358

Comment on lines -12 to +20
DISPLAY=:$DISPLAYNUM # this still doesn't work

# export DISPLAY=:$DISPLAYNUM
# Uncomment this if you want hide the spawned urxvt windows and only want to
# see the results in the pngs.
# It will display many warning messages in xdotool. In particular, the messages are:
# XGetInputFocus returned the focused window of 1. This is likely a bug in the X server.
# but it works.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but no, this specific change will break building docs on CI.

We do need to explicitly point urxvt & xdotool to X11-connect to DISPLAY=:5. This is why we're running a "virtual X-server" on address :5 hosted by Xvfb in the first place.

On a desktop linux, with your change applied, the script will inherit DISPLAY=:0 most likely — so urxvt will start connecting to your graphical session, you'll see the terminal — and the Xvfb instance will be completely unused. Xdotool will also be able to grab screenshots. So what's the problem?

The problem is, in CI containers there's no X server and no DISPLAY=:0. There we need Xvfb. And to not create extra discrepancies in testing, it's best to also use Xvfb locally.

You can comment out the DISPLAY=:$DISPLAYNUM line in your local copy — but don't commit that. It will break CI.

until RXVTWINDOWID=$(xdotool search --classname "$CLASSNAME"); do
sleep 0.1
done
RXVTWINDOWID=$(xdotool search --sync --classname "$CLASSNAME")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good 👍

@isidroas
Copy link
Author

@isidroas please see my comments in #385, you'll also want to check pending commits in the `fix-screenshot-race` branch

Alright, I will read them. A first question arises to me. What do you mean by race? Is it related to race conditions ?

this specific change will break building docs on CI.

That change should not have effect since the DISPLAY variable was not being exported. I was trying to do the most minimal changes to easy reviewing.

And to not create extra discrepancies in testing, it's best to also use Xvfb locally.

It makes sense 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues related to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants