Discussion:
[scribus] Interface issues and frame script
Colin Madwolf
2018-11-10 15:25:46 UTC
Permalink
Hi Colin,
It's actually quite simple, even if you've never done it before.
You need a plain-text editor. Copy the lines of the script -- the first line should be '#!/usr/bin/env python', then paste to a new document in the editor. Save that file as retainscaling.py (or whatever you choose).
In Scribus, select the image frame you wish to perform this on, go to the main menu item Scripter, choose Execute Script... and find your file. The next thing you should see is the File Dialog from the script asking you to choose your new image file. Once you click Ok, the image should be loaded and scaled and the script is done.
After you've done this once, you can go to Scripter > Recent Scripts, and you should see the script as the top choice.
You can send the script file retainscaling.py to as many others who want to put it on their computer for their own use.
Greg
Hi Greg

Well too some fiddling, Text edit saved the file as .py.rtf and it failed (even after changing the name and extension) I then looked at it in another editor and there was a load of characters like “/ etc in place of the spaces. So I opened the .py file and copied teh code again and pasted it in and voila it worked.

Though I have to say it still needs some work - as when you run it again it forgets the path of the files on my computer

So all in all I think it is easier to use the interface and get used to it - the tips in the last email helped a lot.

kind regards
Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20181110/e38375bc/attachment.html>
___
Scribus Mailing List: ***@lists.scribus.net
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
htt
Gregory Pittman
2018-11-10 16:18:24 UTC
Permalink
Post by Colin Madwolf
Well too some fiddling, Text edit saved the file as .py.rtf and it failed (even after changing the name and extension) I then looked at it in another editor and there was a load of characters like “/ etc in place of the spaces. So I opened the .py file and copied teh code again and pasted it in and voila it worked.
You should always pay attention to what your editor is doing -- apparently it wasn't a plain text editor. .rtf is not a plain text format.
Post by Colin Madwolf
Though I have to say it still needs some work - as when you run it again it forgets the path of the files on my computer
This is a "feature" of Scribus. Happens to me too. The only solution I know is to hard-code a directory into the search. Even setting paths in Preferences doesn't help.


Greg

___
Scribus Mailing List: ***@lists.scribus.net
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
http://wik
Gregory Pittman
2018-11-10 16:38:33 UTC
Permalink
Post by Gregory Pittman
Post by Colin Madwolf
Well too some fiddling, Text edit saved the file as .py.rtf and it failed (even after changing the name and extension) I then looked at it in another editor and there was a load of characters like “/ etc in place of the spaces. So I opened the .py file and copied teh code again and pasted it in and voila it worked.
You should always pay attention to what your editor is doing -- apparently it wasn't a plain text editor. .rtf is not a plain text format.
Post by Colin Madwolf
Though I have to say it still needs some work - as when you run it again it forgets the path of the files on my computer
This is a "feature" of Scribus. Happens to me too. The only solution I know is to hard-code a directory into the search. Even setting paths in Preferences doesn't help.
It was a bit trickier than I thought. There doesn't seem to be anything you can put in the fileDialog() command that helps this.
This does work:

Change
import scribus

to

import scribus, os

Before the line
scribus.setRedraw(False)

put

os.chdir('/home/gregp/Pictures') # edit this to your desired directory

I suppose you could run an extra fileDialog() command before os.chdir() to select a directory, but I don't see this saves anything over having find the directory with the fileDialog that's already there.

Greg

___
Scribus Mailing List: ***@lists.scribus.net
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:

Loading...