Sounds like the enter key code isn't being stopped if it triggers end turn. In theory, if the turn is triggered by a python key event it will be like a tree a code with 100 branches and hundreds of branches off those, but when it's all done it will be back to where it all started - the python kbd event. If the kbd event is not stopped it may in theory, continue to close the popups. (popups would be part of the "tree" in the middle of the kbd)
It's not a python key event, it's xml defined and handled by the dll. the keyboard (kbd) python event doesn't handle enter, and the branching you're talking about is not in the hundreds but closer to a dozen branches.
The problem seems to be that the screen handleInput call from exe to python is called after the dll handles the enter keypress, and also after the dll tells python that you gained a tech during this end turn. python then goes ahead and creates the tech splash screen, and then the exe tells the tech splash screen through the screen handle input event that enter was pressed.
There may be two ways of fixing this:
1. We could add a short timer in the techsplash screen code that makes it ignore, or even consume all, keypress events in its handle input routine during the first couple of miliseconds after the screen is created.
2. Or possibly the handleInput for the enter keypress is first sent to the main interface screen (before the techsplash screen is created), which does not consume it, so the exe might try to send the input to the techsplash screen when it is created in case the key press was meant for the new screen and not the old one. If that is the case we could make the main interface consume enter press in the handle input routine.
By consume I mean that if the screen returns True or 1 in its handle input routine to the exe it means that the exe will consider the keypress handled, if it returns false or none or 0 it will tell the exe that this keypress meant nothing to me and might be handled elsewhere.
The dll does not consume any keypress events, not even those it handle, I don't think it's capable of consuming them even.
search for CONTROL_ENDTURN in our cpp files to find where the dll handles keypress.
These controls are defined in CIV4ControlInfos.xml