Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs
#46
I have created matrix branch that contains Kodistubs generated from Kodi master branch (future 19 "Matrix") using the updated generator script. The stub files are fully Python 3 compatible including function/method signatures with type annotations.
Note that this is a very early version that has had only minimal post-editing to fix obvious syntax errors in the code so docstrings formatting may be weird at many places. The new Kodistubs can be installed using pip:
pip install git+https://github.com/romanvm/Kodistubs.git@matrix

Now you can finaly develop your addons in Python 3 virtual environment.
Reply
#47
I have finally released Kodistubs v.19.0 based on the current Kodi "Matrix" beta: https://pypi.org/project/Kodistubs/ Now you can install "Matrix" version directly from PyPI.
Reply
#48
You can use Kodistubs with Intellij IDEA.

In order for it to work you need to add the location of the libraries, given when it is installed, eg:

...kodistubs in <installation_dir>\lib\site-packages

To Project Settings -> Modules.

After setting up your project:
  • type <CTRL><ALT><SHIFT>S
  • select: Project Settings -> Modules
  • Click on the + next to Add Content Root
  • Select the directory given when kodistubs was installed (e.g: <installation_dir>\lib\site-packages)
Reply
#49
(2022-04-17, 05:06)BillBrowne Wrote: You can use Kodistubs with Intellij IDEA.

In order for it to work you need to add the location of the libraries, given when it is installed, eg:

...kodistubs in <installation_dir>\lib\site-packages

To Project Settings -> Modules.

After setting up your project:
  • type <CTRL><ALT><SHIFT>S
  • select: Project Settings -> Modules
  • Click on the + next to Add Content Root
  • Select the directory given when kodistubs was installed (e.g: <installation_dir>\lib\site-packages)

Or just pip install Kodistubs into your project's virtual environment.
Reply
#50
Hi,

I tried that - maybe I was doing the wrong thing - but it didn't work.  The environment was created but it did not pick up the kodistubs stuff.

I tried it a few times, following the instructions on the Intellij website but I could not get it to work until I stumbled across the setting I showed.

But it's very feasible that I don't know what I'm doing!

Maybe this will help someone in the future anyway.
Reply
#51
Following Kodi 20.0 release Kodistubs v 20.0.0 have been released to PyPI.
Reply
#52
Hi,
I'm using KodiStubs version 20.0.1

If I use a construction such as:

label = self.getFocus().getLabel()

getLabel is unresolved for class 'Control'

But when run it does return the correct label (the currently focused control is a button in this case)

I'm assuming this is because not all controls have a label.  Not sure if there is a way around this. Cheers for any help.
Reply
#53
You are correct. And as such your code is not correct and prone to errors. You should check if your Control instance returned by getFocus() actually has getLabel method. As for type checker warnings in your IDE, there's nothing you can do, except for putting some pragmas to silence them.
Reply
#54
Thanks for your advice.  I will endeavour to clean my code up to fix this.  Cheers!
Reply
#55
Following Kodi v.21 release updated Kodistubs were published to PyPI: https://pypi.org/project/Kodistubs/
Reply

Logout Mark Read Team Forum Stats Members Help
Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs2