Author Topic: My stamp album page design script  (Read 4184 times)

apastuszak

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
My stamp album page design script
« on: July 06, 2012, 08:51:58 pm »
Ok, I made a small script to help me create pages for my stamp collecting album.  My previous posts about XML import relate to this mini project of mine.

Well, I have it to the point where I think it might be useful to others, so I decided to post it to a stamp collecting forum.  If anyone is interested in checking it out, here it the post with instructions on how to use it:

http://www.stampcommunity.org/topic.asp?TOPIC_ID=25697

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1488
  • Karma: 20
    • the graphics lab
Re: My stamp album page design script
« Reply #1 on: July 07, 2012, 03:58:50 pm »
well done!

it's very nice to see this solution being posted to a philatelic forum!

just some comments to  your script:

- initialize your values to 0 or an empty value not to a random value... this will help understanding what happens ... (in a comment you can add the meaning of the variables, if necessary)
- while you're generally using good names for your variables, height 1 to 4 could need a new name :-)
- you can use PIL (python image library) to calculate the size of the images... it may simplify your xml...
- in my eyes, "stampHeight = float(subelement[4].text)" is more readable then a version in two lines...
- use styles instead of direct formatting (you can check at the beginning of the script if the style already exists and create if not)
- put a license at the beginning of your script, when you publish it (in most countries, copyright is automatic, so we need a license to use, change and distribute your script)
- at the beginning of the script, read the current unit, set your preferred unit and at then of the script restore the current unit (the value will be very different when inch rather than mm is selected...)
- you can calculate an approximative grid where you place your elements, instead of putting them on top of each other... this will make your users a bit happier (and create a new page when the current page has got enough elements...; the number of rows and columns can be a parameter at the beginning of your script -> and, then, calculate the height and width of each cell)
- in the script or in your post in the stamp-forum, you can mention that anybody wanting to use and tweak the script can open the F1 help in scribus and browse the development section where he or she will find the meaning of the functions you use

that's it. :-)

all in all: you did a good job!

if you want to work on any of the topics i'm mentioning and you don't know how to do it, just ask!

have a nice weekend
a.l.e

apastuszak

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
Re: My stamp album page design script
« Reply #2 on: July 10, 2012, 07:23:02 pm »
Yes, I want to work on all those things!

Wouldn't setting all the variables to 0 mark them all as integers.  How do I define some as floats or strings?

I would rather not use PIL, since I have no idea what size the image files are going to be.  They're usually much larger than the actual stamp, and all the stamps from one year may come from different sources and be different sizes.

I need to learn more about siyles.  Can you create a style in the scripting, or do you need to define one in the document, and then you can call it?

Someone else had rolled a similar solution using MS Publisher and MS Access as the data source.

I have to say that Scribus is SO MUCH FASTER than Publisher+Access, and the cost of entry is $0.00.  I hate the idea of creating a solution for someone and then telling them it will work as long as they spend $599 on a copy of Office Professional.

Thanks for all the tips.  With any luck, I can code something that will create multiple pages and just require you tweak things with the align and distribute palette and you're done.


My knowledge of python is a tad limited.  I use it at work to script things to help automate my work flow.  I used to use Perl, but am trying something new.  Prior to Perl, I used vbScript, which is kinda like poking yourself in the eye every day for a week, and then coming back for more.  :-)

 

palmate