View Issue Details

IDProjectCategoryView StatusLast Update
0016245ScribusScripterpublic2020-11-07 14:52
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.6.svn 
Target VersionFixed in Version1.5.6.svn 
Summary0016245: in the scripter copyObject can copy one single item at a time
Descriptionthe docstring says that it can also copy a "selection Group" but does not specify what a selection group is.

anyway, i don't see a valid reason why the UI can copy multiple items and the scripter only one...
TagsNo tags attached.
PatchNo

Activities

jghali

2020-09-16 21:08

administrator   ~0048080

Last edited: 2020-09-16 21:08

View 2 revisions

I was mentioning the same issue to Craig yesterday about duplicateObject(). I don't see why copyObject() and duplicateObject() would copy a single object even if selection has multiple objects selected. To fix this, should we just keep copyObject() and duplicateObject() as is for backward compatibility and add new methods like copyObjects() / duplicateObjects() or copySelection() / duplicateSelection(), or just fix copyObject() and duplicateObject() to make them work on current selection ?

utnik

2020-09-16 22:00

updater   ~0048081

i don't think that two different commands are better than one! i'm not a coder, but as a simple user i would prefer to have 'copyObject()' and 'duplicateObject()' fixed.

ale

2020-09-17 05:59

manager   ~0048082

i don't think there is a need for two commands.

since it's "hard" to tell which is the first item in a selection, i don't think there is anyone relying on this behavior to copy only one item instead of all the ones in the selection.
and i don't see a use case for having both functions in the API.

copyObject() is a new command and there should be any big risk of breaking old scripts.

we could think of renaming to xxxObjects() and deprecate the old names, but i generally have an issue with the usage of Frame, Item, and Object in the scripter API (on top of the fact that commands have or not an s at the end) and i think that in the foreseeable future, we should go through all affected commands and find a common naming.
(and, IMO, the term Object should disappear from the API since it's not used in the scribus UI)

all in all: for now, i suggest to leave the name as is. and "silently" change the behavior of the function (it should be mentioned in the release notes, though... but there are so many changes in the scripter API...)

jghali

2020-11-01 23:47

administrator   ~0048281

Last edited: 2020-11-01 23:48

View 2 revisions

Ok so in the end copyObject(), pasteObject() and duplicateObject have all been deprecated and will be removed in 1.7.x. So welcome copyObjects(), pasteObjects() and duplicateObjects()!

The new copyObjects() and duplicateObjects() can now receive as argument either a string, when trying to copy a single object, or a list of strings when trying to copy multiple objects. If no argument is provided, the new functions will use the current selection. Examples:
- copyObjects("Text1") -> copy "Text1" item to clipboard
- copyObjects( ["Text1", "Text2"] ) -> copy "Text1" and "Text2" items to clipboard
- copyObjects() -> copy current selection to clipboard

Another difference: pasteObjects() and duplicateObjects() will return the names of newly created objects as a list instead of a comma separated string as pasteObject() and duplicateObject() previously did.

ale

2020-11-02 07:08

manager   ~0048283

jean, can would you mind patching your patch?

in the middle term, i really think that all Object command should be replaced by "Item" ones.

since the new commands are only one night old, would you mind renaming them to copyItems(), pasteItems() and duplicateItems() ?

the scribus UI does not have the concept of Object and i think that the scripter should rather mimic the names of the UI and not of the c++ code.

ale

2020-11-02 07:09

manager   ~0048284

i would also stick with the singular... copyItem, pasteItem, duplicateItem but keep the interface as you have defined it.

Issue History

Date Modified Username Field Change
2020-09-16 19:53 ale New Issue
2020-09-16 21:08 jghali Note Added: 0048080
2020-09-16 21:08 jghali Note Edited: 0048080 View Revisions
2020-09-16 22:00 utnik Note Added: 0048081
2020-09-17 05:59 ale Note Added: 0048082
2020-11-01 23:47 jghali Note Added: 0048281
2020-11-01 23:48 jghali Note Edited: 0048281 View Revisions
2020-11-01 23:48 jghali Assigned To => jghali
2020-11-01 23:48 jghali Status new => resolved
2020-11-01 23:48 jghali Resolution open => fixed
2020-11-01 23:48 jghali Fixed in Version => 1.5.6.svn
2020-11-02 07:08 ale Note Added: 0048283
2020-11-02 07:09 ale Note Added: 0048284
2020-11-07 14:52 cbradney Status resolved => closed