Bug 422949 - master: python resources() function is broken
Summary: master: python resources() function is broken
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: git master (please specify the git hash!)
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-14 05:13 UTC by Nabil Maghfur usman
Modified: 2021-02-02 12:10 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nabil Maghfur usman 2020-06-14 05:13:07 UTC
SUMMARY
The python API for resources returns an empty list when it should return a list of all resources of the corresponding type specified. Most certainly related to the ongoing resources rewrite.

STEPS TO REPRODUCE
1. Run krita build where "RESOURCES REWRITE GOING ON" is displayed in the view title bar, probably any unstable git master build
2. Open Tool->Scripter and type ```print(Application.resources("preset"))```
3. Click Run

OBSERVED RESULT
```{}``` is printed in the output panel

EXPECTED RESULT
A python list of all presets currently loaded in krita is printed in the output panel

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Debian GNU/Linux Sid
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
This breakage breaks python scripts that rely on the resources() function, namely the Ten Brushes script.

Specifying other types like "pattern" or "gradient" also return empty list.
Comment 1 Scott Petrovic 2020-07-30 14:00:50 UTC
"preset" is not a valid resource type which is why it is returning empty. It is a bit tricky to figure out what is available. I am working on a scripting site and have a page that show the current state of using resourcesin Krita 5.0. the site isn't live yet, but you can see the code here...

https://invent.kde.org/scottpetrovic/krita-scripting-pro-website/-/blob/master/src/lessons/LessonResources.jsx#L8

You can see what is working. There are still some resource types though that are not done yet...but the resources are being done built yet either. We can close this once 5.0 is ready to test more and all the resource types are implemented.
Comment 2 Tiar 2020-12-11 19:46:52 UTC
Related to bug 430041
Comment 3 Halla Rempt 2021-02-02 12:10:17 UTC
Resolved in 2cc1cf55831b9d6eb971774633f66ed53a891de5