View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016897 | Scribus | Scripter | public | 2023-01-14 18:25 | 2023-05-29 18:56 |
Reporter | ale | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.7.0.svn | ||||
Fixed in Version | 1.6.0.svn | ||||
Summary | 0016897: Documentation of selectObject() lacks precision | ||||
Description | selectObject() 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()) | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
|
Expected behavior. Nothing in the documentation says selectObject() deselects previously selected objects... |
|
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()" |
|
>> 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. |
|
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. |
|
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(). |
|
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. |
|
thanks for the even more detailed description. |
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 |