Scribusoid

Author Topic: Clear clipboard  (Read 485 times)

digirew

  • Jr. Member
  • **
  • Posts: 81
  • Karma: 0
  • Scribus User
Clear clipboard
« on: October 26, 2020, 10: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

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2473
  • Karma: 36
    • the graphics lab
Re: Clear clipboard
« Reply #1 on: October 27, 2020, 10: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.

digirew

  • Jr. Member
  • **
  • Posts: 81
  • Karma: 0
  • Scribus User
Re: Clear clipboard
« Reply #2 on: October 28, 2020, 03: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.



a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2473
  • Karma: 36
    • the graphics lab
Re: Clear clipboard
« Reply #3 on: October 28, 2020, 04: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 : - )