pygame-ce
pygame-ce copied to clipboard
Simplify c-side of events sub-module. (Part 1)
This PR moves some of functionality from c to python.
First of all, I'd like to say that I love where this is going :) I have a few modifications that I (personally) would prefer:
- is there a reason why
_NAMES_MAPPINGhas raw integers instead ofpygame.Xevent constants? I tried doing that, and it worked perfectly fine. Incursors.py, the dictionary also has pygame constants - I think your stub situation can be improved: IMO there should not be
_event.pyi, rather, there should be onlyevent.pyicontaining both from_event.cand fromevent.py(there is a stub file forcursors.py, even tho it's made in python!). The stubs are fake code, we don't need to tell the user that event is actually split between C and py, what matters is what is accessible in it. Again I tried that myself, addedinit,quitand modified a signature and thestubcheck.pywith mypy passes for me, that's why I'm suggesting it.
Tell me what you think about this
@damusss Thanks for the comment - I'll update _NAMES_MAPPING shortly. As for _event.pyi, I'm using it as a roadmap of what's left to do, but I'm not going to completely remove pygame._event, just change some of the functionality, so probably this file will be included.
@damusss Thanks for the comment - I'll update
_NAMES_MAPPINGshortly. As for_event.pyi, I'm using it as a roadmap of what's left to do, but I'm not going to completely removepygame._event, just change some of the functionality, so probably this file will be included.
Alright, I'll check the stub situation when you are closer to finish then. Nice work so far :>
(Why the commits duplicated after I resolved merge conflict?)
No actually why are part of the commits not yours?? what even happened? It looks like you are adding the deprecator decorator
I merged commits from upstream using git pull origin main --rebase and likely this --rebase is the cause of inclusion of these commits... I'll try to discard this merge and re-attempt doing it.
Done, even though they still appear in the conversation, I removed them from the commits tab (I guess that conversation side just logs every change and not exactly those that truly will be merged?).
I think I'll split this PR in two parts:
- Migrating stuff related to
Eventclass. ~~(nearly done, c-api documentation still needed to be updated)~~ - Migrating the monstrosity of events filtering. (not touched yet)