This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Pylint in scripter or way of accessing Krita.py from vscode

Tags: None
(comma "," separated)
jnadeau
Registered Member
Posts
3
Karma
0
OS
Hi,

I am trying my hand at developing a plugin/extension for krita. I saw that we can use a scripter plugin from krita which seems pretty cool but lacks niceties like pylint or autocompletion.

My solution is then to use vscode but I can't seem to find where the Krita.py file is. I was also wondering if krita.py could be added to pip eventually ?

FYI: Using a Flatpak version of krita on debian stretch.

I found a partial solution i.e: loading the module with the python module imp
Code: Select all
import imp
imp.load_source('path/to/file/krita.py')


Have a good day,

jnadeau
User avatar
scottpetrovic
Registered Member
Posts
520
Karma
4
OS
Krita does not come with a "Krita.py" file like what a lot of text editors use for auto-completion.

I made something a little while ago that generates this for the Krita API stuff.
https://github.com/scottpetrovic/krita- ... o-complete

In that project, there is a build folder that you can see the output. You should be able to grab the python file and use that in whatever IDE you are using that supports Python.

This doesn't include any of the PyQt stuff, so you will have to get that from somewhere else. Krita uses PyQt, so can use all of that stuff as well in the scripts
jnadeau
Registered Member
Posts
3
Karma
0
OS
scottpetrovic wrote:Krita does not come with a "Krita.py" file like what a lot of text editors use for auto-completion.

I made something a little while ago that generates this for the Krita API stuff.
https://github.com/scottpetrovic/krita- ... o-complete

In that project, there is a build folder that you can see the output. You should be able to grab the python file and use that in whatever IDE you are using that supports Python.

This doesn't include any of the PyQt stuff, so you will have to get that from somewhere else. Krita uses PyQt, so can use all of that stuff as well in the scripts



So I tried using the output bare. It had some issues since the python code was considered invalid by pylint and I couldn't import it in because of that. I corrected the issues in the python file and I can know use it. I will report the issues that the generated code had on github.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Evergrowing, Google [Bot], rblackwell