https://bugs.kde.org/show_bug.cgi?id=398740

            Bug ID: 398740
           Summary: Updating fileLayer path from script result in invalid
                    path
           Product: krita
           Version: 4.1.1
          Platform: Debian testing
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Scripting
          Assignee: krita-bugs-n...@kde.org
          Reporter: k...@tokiop.com
  Target Milestone: ---

Created attachment 115026
  --> https://bugs.kde.org/attachment.cgi?id=115026&action=edit
file layers setProperties test files

Hi,


1. Original potential bug using 4.0.4
-------------------------------------

fileLayer.setProperties() seem to prepend the old filename without extension
before the new path.

  # display nodes current path :
  print("node path : ",node.path())
  # node path :
/home/user/file-layers-setProperties/file-layers/file-layer-1.png

  # update file layer path :
  node.setProperties(node.path().replace("file-layer-1", "file-layer-2"),
"None")
  print("node path : ",node.path())
  # node path : 
file-layer-1/../file-layers-setProperties/file-layers/file-layer-2.png

  # Expected : file-layers/file-layer-2.png
  #       or :
/home/user/file-layers-setProperties/file-layers/file-layer-2.png


2. Evolution using krita 4.1.1 (error message)
----------------------------------------------

Was using a trick based on previous observations to update the path using 4.0.4
(see attached script/file), but Krita 4.1.1 now displays an additional error :

  Krita has encountered an internal error:
  SAFE ASSERT (krita): "QFile::exists(path())" in file
/home/appimage/workspace/Krita_Stable_Appimage_Build/krita/libs/ui/kis_file_layer.cpp,
line 80
  Please report a bug to developers!

  Press Ignore to try to continue.
  Press Abort to see developers information (all unsaved data will be lost)

In the attached zip, a test file, test script and dummy filelayers. Using
4.0.4, no error message is displayed. On both versions, the layer is updated
after save/reload.

To reproduce on my setup :

1. Open filelayer-setProperties-411.kra
2. Tools > Scripting > Scripter : run test.py
3. should print explanation about the trick and update the path
4. create-delete an empty layer if krita didn't detect the edit
5. save file : Krita displays an error message, click "Ignore"
6. close and re-open the file : the layer should be updated (red)

- tested not using the trick under 4.1.1 but the setProperties behaviour is the
same as in 4.0.4
- tested placing the fileLayer source files next to the .kra vs in a subfolder,
but doesn't seem to help


Am I misusing the method / arguments ?
Anyone able to reproduce ?

Bonus question : is there an function to force-reload a fileLayer source file
from python ? For now it seem required to save/close/reopen to display the new
one.


Thanks for any clues, have a nice day !

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to