Bug 445048 - Wrong name shown for seexpr scripts in certain circumstances (reload and cancelled rename if you renamed it earlier)
Summary: Wrong name shown for seexpr scripts in certain circumstances (reload and canc...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: Resource Management (show other bugs)
Version: git master (please specify the git hash!)
Platform: Mint (Ubuntu based) Linux
: NOR minor
Target Milestone: ---
Assignee: amyspark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-06 00:14 UTC by Tiar
Modified: 2021-11-25 13:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2021-11-06 00:14:14 UTC
SUMMARY
In  certain situations (either when you reload the script or cancel the rename) you can encounter a situation when the seexpr script shows a wrong name.
The name shown is constructed from the filename, because seexpr scripts don't have names embedded into the resource. So when the script resource is reloaded, the name assigned is taken, as usual, from the file. In this case since there is no reliable name source except for the filename, it takes it from the filename. And the filename might be actually different from the name that exists in the database.

Good solution for that would be putting the name from the database again into the resource during reloading, but I'm not sure how to do that, because I don't think KisResourceLocator has access to the database without actual SQL queries.

In any case it's a minor bug (only shows up in certain, uncommon situations and it's mostly easthetical, doesn't affect it working, even sorted is still by the actual name and the popup showing the thumbnail and tags shows the correct name).

STEPS TO REPRODUCE
1. Create a seexpr script called "BeforeRename".
2. Rename it to "AfterRename".
3a. Start renaming it to "AfterSecondRename" but press Cancel.
3b. Change something in the script and press "Reload" button.

OBSERVED RESULT
The script name over the script editor is "BeforeRename" instead of "AfterRename".

EXPECTED RESULT
The script name over the script editor should be "AfterRename".

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0-prealpha (git 279599d483)
 Languages: en_US, en, en_US, en, en_US, en, pl_PL, pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.11.1
  Version (loaded): 5.11.1
Comment 1 amyspark 2021-11-25 13:49:23 UTC
Git commit bb411a37e8e5cc8cb25245ac13b074ef874ce9c5 by L. E. Segovia.
Committed on 25/11/2021 at 13:47.
Pushed by lsegovia into branch 'krita/5.0'.

Fix SeExpr scripts' inconsistent state on reload or rename

On reload, SeExpr presets override the name set to them by the resource system.

Implement the changes made by Halla in
88e48c58ed576b946dbc49ce0fa00e2dcb24afbd for SeExpr presets.

M  +10   -4    libs/flake/resources/KisSeExprScript.cpp
M  +2    -0    libs/flake/resources/KisSeExprScript.h

https://invent.kde.org/graphics/krita/commit/bb411a37e8e5cc8cb25245ac13b074ef874ce9c5
Comment 2 amyspark 2021-11-25 13:49:47 UTC
Git commit be7013420e4277a7e393148b797b37bf66488c84 by L. E. Segovia.
Committed on 25/11/2021 at 13:47.
Pushed by lsegovia into branch 'krita/5.0'.

Correctly fix name refresh of paintop and SeExpr presets

778e8432d5e32d32af7c29a54175ca3470d5100e attempts to fix this by forcing
an update of the name widget. This is incorrect, as the underlying preset
instance still has (and will until replaced) the old name. This is easy to
verify by qWarning() both instances' name() after
the resourceSelected call.

The fix here is to:
- apply the changes to the freshly renamed resource,
- and *then* (not before) issuing the resourceSelected call.
CCMAIL: kimageshop@kde.org

M  +7    -5    libs/ui/widgets/kis_paintop_presets_editor.cpp
M  +4    -4    plugins/generators/seexpr/kis_wdg_seexpr.cpp

https://invent.kde.org/graphics/krita/commit/be7013420e4277a7e393148b797b37bf66488c84
Comment 3 amyspark 2021-11-25 13:53:28 UTC
Git commit 7bf5d2ab1450b9d96d31c0bcf6fb23d54a6e89d5 by L. E. Segovia.
Committed on 25/11/2021 at 13:50.
Pushed by lsegovia into branch 'master'.

Correctly fix name refresh of paintop and SeExpr presets

778e8432d5e32d32af7c29a54175ca3470d5100e attempts to fix this by forcing
an update of the name widget. This is incorrect, as the underlying preset
instance still has (and will until replaced) the old name. This is easy to
verify by qWarning() both instances' name() after
the resourceSelected call.

The fix here is to:
- apply the changes to the freshly renamed resource,
- and *then* (not before) issuing the resourceSelected call.
CCMAIL: kimageshop@kde.org
(cherry picked from commit be7013420e4277a7e393148b797b37bf66488c84)

M  +7    -5    libs/ui/widgets/kis_paintop_presets_editor.cpp
M  +4    -4    plugins/generators/seexpr/kis_wdg_seexpr.cpp

https://invent.kde.org/graphics/krita/commit/7bf5d2ab1450b9d96d31c0bcf6fb23d54a6e89d5
Comment 4 amyspark 2021-11-25 13:53:36 UTC
Git commit d4cad4db30227d2551b4d63261d1af73a3d043a6 by L. E. Segovia.
Committed on 25/11/2021 at 13:50.
Pushed by lsegovia into branch 'master'.

Fix SeExpr scripts' inconsistent state on reload or rename

On reload, SeExpr presets override the name set to them by the resource system.

Implement the changes made by Halla in
88e48c58ed576b946dbc49ce0fa00e2dcb24afbd for SeExpr presets.
(cherry picked from commit bb411a37e8e5cc8cb25245ac13b074ef874ce9c5)

M  +10   -4    libs/flake/resources/KisSeExprScript.cpp
M  +2    -0    libs/flake/resources/KisSeExprScript.h

https://invent.kde.org/graphics/krita/commit/d4cad4db30227d2551b4d63261d1af73a3d043a6