I'm using PySide with PyCharm. When I want to jump to the source of a PySide class of method in editor, it always tell me:
Cannot find declaration to go to
I checked the dir python27/Lib/site-packages/PySide
, there are many .pyc
and .pyd
files, but few *.py
. I also download the source package from PySide site, but there are many .cpp
and .xml
files there.
How can I find the .py
sources of PySide and let PyCharm to find them? Or I have to read the docs, which is not that convenient.
You may be misunderstanding something. .pyd
files (that file extension is specific to windows, but the principle also applies to .so
files on Linux and whatever file extension other systems use) are extensions written in C or C++ compiled to native code and put into a dynamically-linked library.
While you could look at the source if the project in question is open-source (in the case of PySide, it is), it's not Python (do you know C? C++? Quite a few good Python programmers don't) and littered with boilerplate code that contributes nothing but making the cross-language functionality happen. To make matters worse, in the case of PySide the C++ source code is generated automatically (from a tool called Shiboken, which presumably processes the xml files you've seen). You could also look at the source of the Qt functions that are wrapped, but again, this unlikely to buy you much.
So the bottom line is: You'll have to stick with the documentation (or read the original Qt documentation; I found it simple enough to translate to Python when I was using PyQt a while ago). Unless it's absolutely terrible (and the original Qt documentation isn't), it will also answer your question:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.