View Issue Details

IDProjectCategoryView StatusLast Update
0016897ScribusScripterpublic2023-05-29 18:56
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.7.0.svn 
Fixed in Version1.6.0.svn 
Summary0016897: Documentation of selectObject() lacks precision
DescriptionselectObject() correctly selects the first item in the page, but for the following items, i still get the content of the first item selected.

if put a deselectAll() inbetween, i get the content i expect.

can be reproduce with multiple frames on a page and:

for item in scribus.getPageItems():
    if item[1] == 4:
        # TODO: why do i need to deselect before deselecting?
        scribus.deselectAll()
        scribus.selectObject(item[0])
        print(scribus.getFrameText())

TagsNo tags attached.
PatchNo

Activities

jghali

2023-01-14 19:31

administrator   ~0049922

Expected behavior. Nothing in the documentation says selectObject() deselects previously selected objects...

ale

2023-01-14 19:52

manager   ~0049923

ah, it selects the new item on top of the existing selection?

that's a fine behavior. but it's does not seem obvious to me and should probably be mentioned in the documentation

when reading in scribus/plugins/scriptplugin/cmdmani.h

"Selects the object with the given "name"."

and then the very common

"If "name" is not given the currently selected item is used. "

i really would expect that the only (or best one i've found) function that selects the item does indeed lead to that item to be the active one for all the other functions.


i would modify the documentation to say:

"Adds the the object with the given "name" to the current selection."

and i would probably add:

"If you plan to use the object as the currently selected item, you should probably first call deselectAll()"

jghali

2023-01-14 20:12

administrator   ~0049925

>> and then the very common
>> "If "name" is not given the currently selected item is used. "

Not in this case, if object is already selected selectObject() will not do anything useful.

ale

2023-01-14 20:33

manager   ~0049926

the sentence

"If "name" is not given the currently selected item is used. "

is used for lot of commands all over the documentation.

of course not for this command.

since selectObject() seems to be the preferred way to get a specific item to be the currently selected one, it might be worth to spend a few words on how use it correctly for this very common use case.

ale

2023-01-16 10:23

manager   ~0049938

summarizing it all.

if would be helpful if the docstring for selectObject would modified as follows:

Adds the the object with the given "name" to the current selection.\n\
\n\
If you plan to use the object as the currently selected item, you should first call deselectAll().

jghali

2023-01-17 00:04

administrator   ~0049940

I tried to go a bit further and bring precision to the concept of currently selected item. The fact that the currently selected item is always the first item in the selection has now been added to scripter docs.

ale

2023-01-19 06:56

manager   ~0049950

thanks for the even more detailed description.

Issue History

Date Modified Username Field Change
2023-01-14 18:25 ale New Issue
2023-01-14 19:31 jghali Note Added: 0049922
2023-01-14 19:52 ale Note Added: 0049923
2023-01-14 20:12 jghali Note Added: 0049925
2023-01-14 20:33 ale Note Added: 0049926
2023-01-16 10:23 ale Note Added: 0049938
2023-01-16 23:57 jghali Summary selectObject() does not work if an item is selected => Documentation of selectObject() lacks precision
2023-01-17 00:04 jghali Assigned To => jghali
2023-01-17 00:04 jghali Status new => resolved
2023-01-17 00:04 jghali Resolution open => fixed
2023-01-17 00:04 jghali Fixed in Version => 1.6.0.svn
2023-01-17 00:04 jghali Note Added: 0049940
2023-01-19 06:56 ale Note Added: 0049950
2023-05-29 18:56 cbradney Status resolved => closed