Mantis Issue Tracking for Scribus
· Hosting provided by Anduin.net / Øverby Consulting ·

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010560ScribusScripterpublic12-Jan-31 19:2014-Aug-21 01:35
Reportergpittman 
Assigned Toplinnell 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.4.1.svn 
Target VersionFixed in Version1.5.0svn 
Summary0010560: two new Scripter commands: copyObject() and pasteObject()
DescriptionThese two new commands represent a simple splitting of the functions already contained in duplicateObject(), so that one can first copy an object to the clipboard, then later in a script paste.
What this allows for is switching pages between copying and pasting, and first copying then pasting to multiple pages.
Additional InformationThe uploaded file contains the necessary modified files for the scripter plugin, and also the appropriate documentation page to go into doc/en/

I have also made a script using these commands, and created a wiki page:

http://wiki.scribus.net/canvas/CopyObject%28%29_and_pasteObject%28%29 [^]

to illustrate its usage. I plan to develop the script to be more flexible, such as being able specify specific pages to paste to.

Incidentally, the original duplicateObject() command does NOT work for a selected group.
TagsNo tags attached.
Attached Filestar file icon cmdobj.tar [^] (112,640 bytes) 12-Jan-31 19:20
? file icon paste2all.py [^] (2,302 bytes) 12-Jan-31 19:24
? file icon paste2pagelist.py [^] (2,212 bytes) 12-Mar-23 01:36
? file icon patchfile [^] (4,968 bytes) 14-Jun-15 04:07 [Show Content]

- Relationships

-  Notes
(0027636)
gpittman (developer)
12-Jan-31 19:25
edited on: 12-Jan-31 21:40

I've uploaded the script here also, since I find that copying and pasting scripts from the wiki isn't always so easy.

(0027850)
gpittman (developer)
12-Mar-23 01:37

I have now added another script, paste2pagelist.py, which allows you to paste to a list of pages entered in a valueDialog. There is error checking to make sure all page numbers are in the correct range.
(0031982)
cbradney (administrator)
14-Jun-03 22:18

Greg.. can you perhaps create diffs against current SVN for 1.5 and I will commit these?
(0032058)
gpittman (developer)
14-Jun-09 18:02

I've started looking at this.
One issue of course is that these were created for 1.4.1, and even so, 1.4.4 has a lot of mods since 2012.

Nonetheless, I can still go back and make the necessary mods to 1.5.0svn, then submit the patch. My plan will be to only submit here the changes for cmdobject.h, cmdobject.cpp, and scriptplugin.cpp. I can commit the doc changes myself once the code is committed.
(0032169)
gpittman (developer)
14-Jun-15 04:06
edited on: 14-Jun-15 04:12

Ok, I've gone through the old files, and inserted necessary parts to the 1.5.0 code.
Am uploading a patchfile.

I've checked this out with my scripts paste2all.py and paste2list.py and seems to work fine. These are on the wiki page linked to above in this bug report.

(0032170)
gpittman (developer)
14-Jun-15 04:25
edited on: 14-Jun-15 04:27

Something I just discovered is that the scripts DO work with a selected group!
Perhaps something in 1.5.0 corrected this former problem.

I'll update the wiki page once this patch is committed.

(0032194)
ale (manager)
14-Jun-16 08:14

just one note: i see this as a potential "dangerous" command.

people will copy in a loop and paste afterwards... wondering why they're only getting the last element.

personally, from a programming point of view, i would prefer not to have this in, but (if needed) improve the duplication and placement of the items.

the workflow in a program should in my eyes be: duplicate and keep a reference to the new item. when you're ready move the referenced item to the new page / place.
copying an item to the scrapbook and getting it back from there seems to be very inflexible to me, when i can reference items with variables...

... of course, i might ignore a use case that does not fit the duplicate and move model :-) if there is one, then the copy paste is also ok!
(0032196)
gpittman (developer)
14-Jun-16 13:49
edited on: 14-Jun-16 13:59

Just because a command exists doesn't mean it must be used. I think the scripts I wrote demonstrate the utility of these commands.

Trials have shown using the scripts that I wrote show that the script is undoable - you just repeatedly Undo to remove copies from last to first.

I don't understand the danger -- you copy to the clipboard, then paste one or multiple times. Why someone would serially copy objects then later try to paste them serially makes no sense to me.

There are more dangerous commands than these.

copyObject() is the same as pressing Ctrl-C
pasteObject() the same as Ctrl-V

(0032212)
ale (manager)
14-Jun-17 11:22

as far as i know, there is nothing like ctrl-c and ctrl-v as such in programming.
... there must be good reasons for it...
(even if languages like actionscript might implement it... :-)


for sure, i see the reasons why you like to have those commands.

but i still prefer not to have those in the scripter API: the main reason being that using duplicate and references to the created objects, allows python to catch some of the possible errors.

while copy/paste is wonderful for simple cases, it might fail in unexpected and hard to debug ways in more complicated scripts:

def do_something:
  copy
  ...
  paste

copy
do_something
paste

this is imo a very common -- even if not 100% clean -- pattern for scripts that are duplicating content.
and it will fail :-(
and it will be hard to spot if you script is a few dozens of lines long...
(0032213)
ale (manager)
14-Jun-17 11:38
edited on: 14-Jun-17 13:19

p.s.: it's clear, not because the scripter gets copy / paste that it will be a bad scripter... but i would not add "dangerous" commands, when alternatives already exist, that are almost as simple and safer...

i would rather well document how to do copy paste with the existing duplicate command...

(0032222)
gpittman (developer)
14-Jun-17 19:12

1. copy-paste with duplicate isn't possible. It's why I submitted this feature request.

2. I am still trying to understand why you are attacking this feature. Please show us a script that causes the havoc you envision.

copy
do something
paste
 
is not a functioning script. You seem to be trying to file a bug report on this not-yet-included feature, but without any concrete example of how you see it failing. Can you write such a script for us to examine?
(0032223)
ale (manager)
14-Jun-17 20:37

greg, i'm sorry, that your are feeling that i'm attacking this feature.

i have looked a bit deeper into the issue and indeed scribus seems to be missing a command: moving an object to a specific page.

ciao
a.l.e
(0032501)
JLuc (updater)
14-Jul-06 19:01

Ale : they are such commands that go very much like copy 'n' paste in various languages : its push and pull. Push some object on a stack, and pull it back when needed. For some languages as forth, its the main data management process.
(0032639)
Kunda (manager)
14-Jul-10 00:24

Reminder sent to: gpittman

Is this merged in to trunk and resolved?
(0032646)
gpittman (developer)
14-Jul-10 03:31

Commands have been added to 1.5.0svn
(0032853)
Kunda (manager)
14-Jul-21 02:25

Closing

- Issue History
Date Modified Username Field Change
12-Jan-31 19:20 gpittman New Issue
12-Jan-31 19:20 gpittman File Added: cmdobj.tar
12-Jan-31 19:24 gpittman File Added: paste2all.py
12-Jan-31 19:25 gpittman Note Added: 0027636
12-Jan-31 21:40 gpittman Note Edited: 0027636 View Revisions
12-Mar-23 01:36 gpittman File Added: paste2pagelist.py
12-Mar-23 01:37 gpittman Note Added: 0027850
12-May-30 01:40 plinnell Assigned To => plinnell
12-May-30 01:40 plinnell Status new => assigned
14-Jun-03 22:18 cbradney Note Added: 0031982
14-Jun-09 18:02 gpittman Note Added: 0032058
14-Jun-15 04:06 gpittman Note Added: 0032169
14-Jun-15 04:07 gpittman File Added: patchfile
14-Jun-15 04:12 gpittman Note Edited: 0032169 View Revisions
14-Jun-15 04:12 gpittman Note Edited: 0032169 View Revisions
14-Jun-15 04:25 gpittman Note Added: 0032170
14-Jun-15 04:27 gpittman Note Edited: 0032170 View Revisions
14-Jun-16 08:14 ale Note Added: 0032194
14-Jun-16 13:49 gpittman Note Added: 0032196
14-Jun-16 13:59 gpittman Note Edited: 0032196 View Revisions
14-Jun-17 11:22 ale Note Added: 0032212
14-Jun-17 11:38 ale Note Added: 0032213
14-Jun-17 13:19 ale Note Edited: 0032213 View Revisions
14-Jun-17 19:12 gpittman Note Added: 0032222
14-Jun-17 20:37 ale Note Added: 0032223
14-Jul-06 19:01 JLuc Note Added: 0032501
14-Jul-10 00:24 Kunda Note Added: 0032639
14-Jul-10 03:31 gpittman Note Added: 0032646
14-Jul-10 03:31 gpittman Status assigned => resolved
14-Jul-10 03:31 gpittman Fixed in Version => 1.5.0
14-Jul-10 03:31 gpittman Resolution open => fixed
14-Jul-21 02:25 Kunda Note Added: 0032853
14-Jul-21 02:25 Kunda Status resolved => closed
14-Aug-21 01:35 jghali Fixed in Version 1.5.0 => 1.5.0svn



Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker