insert inline image

Previous topic - Next topic

zacl

Hi,
I want to insert inline image in text frame with python. I searched in APi and source but I think there is not yet a function for that.
I'm right?

Nermander

In the UI I think the only way is to paste it, are there not Python options to cut/copy and paste?

zacl

Sorry, I forgot to say it for a CLI use, so I can't manually put the cursor at the position in a text frame where I want to include the image. 

For copy paste, there is:

Definition of "pasteObjects" says it call "slotEditPaste" that will call what is necessary to create an inline frame, I think, but the cursor need to be in a text frame.
https://github.com/scribusproject/scribus/blob/70d55132b168ef43e034dfa757de27d4f5631e3a/scribus/plugins/scriptplugin/cmdobj.cpp#L1030
https://github.com/scribusproject/scribus/blob/38d9c97e4bcae46059c16521c2e9c7767b519ec9/scribus/scribus.cpp#L4541

Inserttext is a good exemple cause it insert text at a position but it manipulate directly "string" inside the text box so I can't take inspiration from this function.
https://impagina.org/scribus-scripter-api/text-frame/#inserttext
https://github.com/scribusproject/scribus/blob/6c16393a631679b73728606d2acb81fefaeb3843/scribus/plugins/scripter/api_textitem.cpp#L181

What I'm searching is I think an equivalent of setEditMode() mentioned here with position parameter for text frame : https://bugs.scribus.net/view.php?id=16294