Bug 445308

Summary: Document Name is outdated
Product: [Applications] krita Reporter: keyth_qcfx2 <keyth2363214>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: 5.0.0-beta2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description keyth_qcfx2 2021-11-11 04:24:29 UTC
SUMMARY
File Name is outdated when asking Python the documents name.

STEPS TO REPRODUCE
1. Create a new file
2. Save new file as “test_AAA.kra”
3. now save file again as “test_BBB.kra”
4. Close file
5. Open file “test_BBB.kra”
6. Go to: Tools > Scripts > Scripter
7. Run the following code:
"""
import krita
name = Krita.instance().activeDocument().name()
print(str(name))
"""

OBSERVED RESULT
Result file name will always be the first saved name “test_AAA” being outdate regardless of the version of the file.

EXPECTED RESULT
should output "test_BBB" as the file name "test_BBB.kra" indicates.

SOFTWARE/OS VERSIONS
Windows: 10
Qt Version: 5.12
Comment 1 Halla Rempt 2021-11-11 09:27:59 UTC
The image name is not the same thing as the filename, so this is expected. This dates back to when Krita could store multiple images in a single file, but because of compatibility issues, it's pretty hard to refactor this out. Use filename() instead.