Scribus Forums

Scribus => Scripts and Plugins => Topic started by: digirew on October 26, 2020, 09:17:50 PM

Title: Clear clipboard
Post by: digirew on October 26, 2020, 09:17:50 PM
Hello,

Im running a python script to perform various actions via Scripter.


Is there a way to clear the Scribus clipboard ?  (closing the doc or quitting scribus does not clear the clipboard).


Thanks,


Digirew
Title: Re: Clear clipboard
Post by: a.l.e on October 27, 2020, 09:50:03 AM
personally, i have the feeling that, if you're asking the question, you should not use the clipboard in your script.

why?
because, if it's a problem for you to expose the modified clipboard to your user, the user will probably be angry because her content of the clipboard is not there anymore.
both if you replaced it or cleared it.

as far as i recall, using the clipboard in a script is mostly a hack around missing features in the scripter. so if you are using it for production, you might want to add the relevant features to the scripter API.

so my reply is: use the clipboard as a workaround, but in the long term make sure that the scripter can correctly support your needs.
Title: Re: Clear clipboard
Post by: digirew on October 28, 2020, 02:42:53 PM
Hi a.l.e,

I am using the scripter api.

After a user is done creating the scribus document, they run the script which uses the copyObject & pasteObject api....it appears the copyObject api puts it into the clipboard.

These functions already replace what the user had in the clipboard with something our script does.

I don't think there are any scripter api functions that perform these actions but does not place them into the clipboard.


I suppose it would be best user experience to get what's in the clipboard before our script performs its necessary actions (copyObject & pasteObject), and then put whatever the user had previously back into the clipboard.


Title: Re: Clear clipboard
Post by: a.l.e on October 28, 2020, 03:14:06 PM
as i hinted in my previous post, i would prefer to steer this discussion in a way that it leads to  a solution that does not includes the usage of the clipboard.

i don't think that a script should ever clear the clipboard. and most script should not copy or paste things.

the first thing i was thinking of, is the scrapbook...

one day later, i would rather support a new command based on the multiple duplication.

probably by extending the existing "duplicate()".

or keep the "duplicate()" as is, and adding a setItemPage() ...
the biggest issue is that scribus has no clear ownership between pages and items (as far i can tell, it has been cleaned up a bit, but i think it's not 100% possible to tell on which page an item is placed)

i can work on the command and welcome all types of support : - )