[Scribus] Update on Calendar Script
Craig Ringer
craig
Thu Nov 25 06:04:32 CET 2004
On Thu, 2004-11-25 at 02:06, Henry Hartley wrote:
> I've just installed Fedora Core 3 and am revisiting my calendar
> script. Although it didn't work in my old configuration, it's
> working now with international (i.e. Unicode) characters. I'm not
> sure what changes, specifically, fixed this but the changes and
> comments made by Elmar Jobs and others here certainly helped.
That's interesting. I should note, by the way, some discussion about
calendier.py in bugs that you may find useful:
http://bugs.scribus.net/view.php?id=1287
In addition, there have been some changes in the scripter recently that
may affect scripts, though generally only if they were doing something
that wouldn't work anyway:
http://bugs.scribus.net/view.php?id=1283
You may also find the draft scripter FAQ and 'boilerplate' script
useful:
http://bugs.scribus.net/view.php?id=1317
In particular, using '#!/usr/bin/env python' is strongly recommended
over '#!/usr/bin/python', as that way the python interpreter may be
anywhere on the user's path. It's also well worth wrapping 'import
scribus' in a try/catch block to explain to users why the script doesn't
work when you run it on the command line, and how to run it correctly.
> * There are a few new font, size and color settings. For instance,
> you don't have to use the same font for everything and you can set
> the color, thickness and shading of the lines.
One of the Scripter changes means that Scribus will now raise an
exception if you attempt to set the font to a font that's not available
on the local system. It used to just ignore your request without telling
you. This means that if you want to continue running and ignore the
failure, you need to do something like:
try:
setFont(fontname, framename)
except scribus.ScribusException,err:
print "Failed to set font on %s to %s: %s" % (fontname, framename, err)
If you use 'from scribus import' not 'import scribus', you don't need
the 'scribus' prefix. I don't much like from import myself, but many do
use it.
Hmm. This code won't work for 1.2 users, as scribus.ScribusException
isn't defined in 1.2 . To retain 1.2 compatiblity you might need to do
something near the start of your script like:
if not hasattr(scribus, "ScribusException"):
class ScribusException(Exception): pass
scribus.ScribusException = ScribusException
(untested). This defines an exception your code can match on, though the
Scribus module will never actually throw it.
> As a side note, http://www.scribus.org.uk doesn't seem to be
> responding. Problems?
Yeah, I think the server has melted :-( . Paul Johnson is looking into
it - he posted here a day or two ago about it.
--
Craig Ringer
More information about the scribus
mailing list