python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

How to complete pygobject code

Open byte-voyager opened this issue 5 years ago • 0 comments

I used fakegir and put the generated files in the virtualenv directory. I found that I couldn't jump to gi.repository during the completion and it didn't work properly. But I put the file generated by fakegir into my project directory, renamed the folder to gii, and it works fine.

project
---gii
--- test.py

gii

gii
├── __init__.py
├── __pycache__
│   └── __init__.cpython-36.pyc
└── repository
    ├── AppIndicator3.py
    ├── Atk.py
    ├── Atspi.py
    ├── cairo.py
    ├── Dazzle.py
    ├── DBusGLib.py
    ├── Dbusmenu.py
    ├── DBus.py
    ├── fontconfig.py
    ├── freetype2.py
    ├── GdkPixbuf.py
    ├── Gdk.py
    ├── GdkX11.py
    ├── Gio.py
    ├── GIRepository.py
    ├── GLib.py
    ├── GL.py
    ├── GModule.py
    ├── GObject.py
    ├── Gtk.py
    ├── HarfBuzz.py
    ├── __init__.py
    ├── libxml2.py
    ├── PangoCairo.py
    ├── PangoFT2.py
    ├── Pango.py
    ├── PangoXft.py
    ├── win32.py
    ├── xfixes.py
    ├── xft.py
    ├── xlib.py
    └── xrandr.py

test.py

from gii.repository import Gdk

root_window = Gdk.get_default_root_window()
childs = root_window.get_children()
print(childs)

is there any default operation for pygobject completion internally, which caused me to import the gi package instead of importing from the virtual environment?

byte-voyager avatar Dec 16 '19 05:12 byte-voyager