IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Couple of tweaks here and there
Biggest change was to the contents dictionary - making it a dictionary of dictionaries (one dictionary per page). That frees the user from having to worry about constructing the page objects and pretty well just concentrate on the content entries as needed.

As to why I stayed with an anti-modular approach, I did have it somewhat broken down and flattened it out. The purpose of the program is really not so much to show to do it from Python as it is to show the structure of PDF. Mostly just so I could muck with the pdf file itself to play with the specs. A text editor for the pdf would be nicer, but pdf is only superficially text.

Then again, maybe there's an emac's extension. :-)
New Oh, and a couple of Python questions
There is some assumptions about the iteration through the dictionaries that I don't know if it holds. The only one that it's important to maintain the sequence is the order of the page(s) in the pages dictionary. I'm assuming that the hash will spit out the keys in numeric order. Is there a way to force the dictionary for loop to have it sorted by key?

Also, the date/time stamp uses a constant of -05'00' as the offset from UTC - meaning -5 hours which is CST. Couldn't find a Python function to calculate offset from UTC. Know of one offhand?
New Atempts at replies
> There is some assumptions about the iteration
> through the dictionaries that I don't know if
> it holds. The only one that it's important to
> maintain the sequence is the order of the page(s)
> in the pages dictionary. I'm assuming that the
> hash will spit out the keys in numeric order.

This is the major reason I switched some of the dictionaries to lists of 2-tuples--order is automatic. If I took another pass, I'd probably make a tiny class. But I admit I'm assuming that you'll never skip section numbers.

> Is there a way to force the dictionary for loop
> to have it sorted by key?

Sure.

>>> a = {0: 'a', 1: 'b', 2: 'c', 3: 'd'}
>>> keys = a.keys()
>>> keys.sort()
>>> for key in keys:
... \tprint a[key]
... \t
a
b
c
d

> Also, the date/time stamp uses a constant of -05'00'
> as the offset from UTC - meaning -5 hours which is CST.
> Couldn't find a Python function to calculate offset
> from UTC. Know of one offhand?

If you simply want the current UTC time, use datetime.datetime.utcnow() instead of .now() -- you really should use datetime instead of the time module, as it allows a wider range of dates (the time module = time since the (system-dependent) epoch).
I was one of the original authors of VB, and *I* wouldn't use VB for a text
processing program. :-)
Michael Geary, on comp.lang.python
     Generating PDF - (ChrisR) - (7)
         Very nice. - (FuManChu) - (4)
             Here 'tis. - (FuManChu) - (3)
                 Couple of tweaks here and there - (ChrisR) - (2)
                     Oh, and a couple of Python questions - (ChrisR) - (1)
                         Atempts at replies - (FuManChu)
         Don't know if this was mentioned in the other thread, but - (altmann) - (1)
             Definitely the way to go for Pythonistas - (ChrisR)

I ripped my pants!
154 ms