Fix names for resource preset and brush
In beginner lesson 13: Resources https://scripting.krita.org/lessons/resources
Under the heading: Working with resources
An error is shown when the code example runs:
KeyError: 'Basic_tip_gaussian'
In file: <string>
In function: <module> at line: 8. Line with error:
The comment on line 6, says that line 7 was used to find the brush.
# I found this by looking at the following output...
# print( Krita.instance().resources('paintoppresets') )
Uncommenting line 7, and running the script, shows:
{}
(followed by the KeyError: 'Basic_tip_gaussian'
message above)
As described/fixed in the MR: Fix resource names !2
The correct brush preset resource name is: preset
Changing paintoppresets
to preset
, shows a list of brush presets:
{'a) Eraser Circle': <PyKrita.krita.Resource object at 0x000001D735C0C550>, 'a) Eraser Small': <PyKrita.krita.Resource object at 0x000001D735C0C5E0>, ...
But none of them are called: Basic_tip_gaussian
One brush is called b) Basic-1
With this MR's changes, the Basic-1
brush preset is selected and modified when the script runs.
The list of brush presets is a little hard to read with the resource objects listed.
Line 7 was changed to only show the brush preset names on their own lines.
print( '\n'.join(list(Krita.instance().resources('preset').keys())) )
a) Eraser Circle
a) Eraser Small
a) Eraser Soft
b) Airbrush Soft
b) Basic-1
b) Basic-2 Opacity
b) Basic-3 Flow
...