Scribus > Scripts and Plugins

Take Cursor out of text block and Select text frame

(1/2) > >>

digirew:
Trying to figure out an issue, and not sure if its a bug in the scripter api or not.

If you have a text frame on screen and you are entering text, you have the cursor in the text frame as you type.

Is there an API call that will take the cursor out of the text frame and select the text frame?

see image : "cursor_in_text_block.png", I want to be able to select the text frame as in pic  "text_block_selection.png".


Im on a mac running 1.5.6.snv r.23014.


a.l.e:
the command seems to be missing.

digirew:
a.l.e,

Here is a very basic example of the issue that im having.


I have 1 text frame on my Scribus doc and its called "Text1".


I also have the below sample script.

-----------
import scribus

scribus.selectObject("Text1")
textframe = scribus.getSelectedObject()

scribus.copyObject(textframe)
scribus.pasteObject(textframe)

-----------


If you follow this order:

1.  When I enter some text into my textframe, click out of the text frame and select the text frame again so its selected, I run the script to simply copy/paste the object.

works great and it pastes the text frame onto the page. (as shown in screen shot textframe_selected.png).


2. If you do the same thing, enter some text into the text frame, and keep the cursor in the text block as if you are entering more text, and then run the same script.


If you look at the attached screen shot, this is the result I get (see cursor_in_textframe.png).

its putting in the textframe inside the existing text frame etc.



Is this a bug, or am I doing something incorrectly with the script?  I would like to copy/paste the entire text frame as if I had it selected in the first example. (We cant rely on the script to work depending on where the end user has something clicked).


running MacOS and scribus 1.5.6 r. 24102 now.

a.l.e:
i could not replicate your use case.

but i've now created a patch for setNormalMode() and uploaded it to the bug tracker:

https://bugs.scribus.net/view.php?id=16294

let's hope it gets into scribus soon...




and now a question from my side: does anybody see a reason for having also setEditMode().
it's in the patch, but i'm not sure there is any use for it...

digirew:
Hi a.l.e,

This is awesome!, looking forward to seeing it in an upcoming svn release.


Re: setEditMode()


Im assuming setEditMode would be similar to my initial image "cursor_in_text_block.png" ?

it would definitely be useful to be able to select specific text frames and then place text into them.


(However, the way selectObject works right now with text frames, would it not be very similar to setEditMode ?)



Digirew

Navigation

[0] Message Index

[#] Next page

Go to full version