View Issue Details

IDProjectCategoryView StatusLast Update
0001283ScribusScripterpublic2004-12-20 23:31
Reportersubik Assigned Tosubik  
PrioritynormalSeveritymajorReproducibilityN/A
Status closedResolutionfixed 
Platformi686OSGentooOS Version-
Product Version1.2.1cvs 
Fixed in Version1.2.1cvs 
Summary0001283: Scripter code cleanup
DescriptionThis is a tracker for Scripter code cleanup - esp. for Craig R. and mine coordination.

Plans:


1) [DONE PV] move docstring into their right place (Py macro in the right header file)

2) [DONE PV] append the prototype/definition into docstring (e.g. openDoc(params...)) - note: maybe I missed something but the base is done ;)

3) [DONE CR] Remove exception setting code from argument passing failure clause in functions. Once the usage info is in, the exceptions are redundant and can hide more important exceptions from the Python interpreter like Unicode decoding errors or memory errors.

4) [INDEPENDENT] let scripter "stabilize" - I mean test it... trying to break it etc ;) Anyone else figure we haven't done so well with this yet :S . My fault entirely - sorry! -- CR

5) [DONE PV,CR] fix all official scripts in distribution (email sent to the authors). Note: There can still be some warning too but it's propably missed somewhere...

6) [DONE CR,PV] applying docstring enforces us to browse all code to see if there is something strange to fix it...

6.5) [IN PROGRESS] Solve (all) FIX and TODO statements

7) [DONE CR] Change functions that return Py_None when they have an error so
that they throw an informative exception instead - exceptions.

8) [DONE CR] Examine the handling of character encodings in the scripter, and ensure it's all sane. Focus specifically on the distinction between an 8-bit string in a given language encoding (of type 'str'), an 8-bit string in unicode encoding (of type 'str'), and an actual Unicode string (of type 'unicode'). The handling of PageItem names in particular needs to be looked at.

8.5) [DONE CR] Encoding in the scripter console - e.g. messagebarText(unicode) from script works/doesn't work in console. Don't know why :-/

9) [DONE] Examine the arguments taken by functions, and consider supporting keyword arguments for some functions. In particular, consider accepting the target object as a keyword. CR - did a few key ones such as dialog functions. The rest are probably not worth it for 1.2.1. It'd be _nice_ to keywordify them all, even if they have no optionl arguments, because that lets you use the **kwargs calling convention, but that's just sugar.

10) [DONE CR] Update docstrings to relect exceptions that a function may throw.

11) [DONE CR] Turn all we can into METH_NOARGS CR - I don't think I missed any, so marking DONE. See bugs 0001264, 0001276.
Additional Information1.2.1 and 1.3 are back in sync, and all the docstrings, translatatability changes, and unicode fixups are done. It's ready for any further work.
TagsNo tags attached.
Patch

Relationships

related to 0001287 closedplinnell calendier.py doesn't work 
related to 0001317 closedsubik Script plugin FAQ and boilerplate script wrapper code 
child of 0003813 acknowledged Metabug: Scripter 

Activities

subik

2004-11-07 19:58

manager   ~0002807

1) [dependent] move docstring into their right place (Py macro in the right header file)

2) [dependent] append the prototype/definition into docstring (e.g. openDoc(params...))

3) [dependent] turn all we can into METH_NOARGS

4) [independent] let scripter "stabilize" - I mean test it... trying to break it etc ;)

5) [independent] fix all official scripts in distribution (email sent to the authors) [Done partialy 11/07/2004]

6) [side effect] applying docstring enforces us to browse all code to see if there is something strange to fix it...

7) [dependent] Change functions that return Py_None when they have an error so
that they throw an informative exception instead - exceptions.

ringerc

2004-11-10 15:34

reporter   ~0002861

Last edited: 2004-11-21 09:14

I'm starting on 7 now. It's the one that'll have the most significant impact, so I think it's the one that needs to be done most.

This change WILL break scripts that rely on calls failing silently. This is probably good, in that these scripts are really not correct, but will force scripts to be updated to work (even if it's just wrapping the call in a try/except).

ringerc

2004-11-10 15:38

reporter   ~0002862

There's also an eighth task that needs doing - remove the PyErr_SetString calls from the PyArg_ParseTuple calls so that the real Python error gets passed through. This will solve problems like the user being told they've used the wrong arguments when there was actually an encoding conversion error (something I just ran into with calendrier.py).

This should only really be done once the usage info (call prototypes) is in all the docstrings.

subik

2004-11-10 16:10

manager   ~0002863

PyErr_SetString removing goes hand in hand with 7...
ad scripts breaking - the official scripts can be fixed very quickly (as I expect there is no bad params usage)

ringerc

2004-11-10 16:19

reporter   ~0002865

OK, works for me.

In my opinion we should also never be throwing Exception, instead throwing ScribusException, a more specific subclass, or one of the built-in exceptions like ValueError. Changing all the PyExc_Exception uses might want to be number eight in this case.

ringerc

2004-11-10 17:15

reporter   ~0002866

Hmm, going through the exception handling stuff, there seem to be several different schemes in use.

There's:

ERRPARM + QString("err")
QString("err")
"Err"
QObject::tr("err")

Which do you think we should be using? The first question, I guess, is if errors should be translatable. I really don't know the answer to that.

I personally favour QString("err") or QObject::tr("err") depending on whether or not errors should be translatable.

ringerc

2004-11-10 17:23

reporter   ~0002867

Also, in the case of objects not being found - eg a layer not being found or a pageitem not being found - what exception do you think we should throw? ScribusException, some subclass like ObjectNotFoundException, PyExc_ValueError, or something else?

ringerc

2004-11-10 19:36

reporter   ~0002870

Last edited: 2004-11-12 11:09

Here's version 0.0001 of the error handling changes, untested_error_handling.diff (Since obsoleted and removed).

These changes will have more impact than I thought - there are a _lot_ of places in the scripter where errors, nonsensical arguments, boundary errors, etc cause the code to return silently instead of raising an error. Many of these will not be fatal, and the script will continue - it just won't do quite what it was supposed to. On the other hand, there shouldn't be too many scripts out there that hit such errors, because any script that does so wouldn't have been working right before this patch anyway.

While it's important to be stricter about proper error handling etc, the chances are very strong that this will affect existing code.

I also found a lot of reference counting bugs when preparing this patch, and they'll be fixed as part of the patch.

edited on: 04-11-12 12:09

ringerc

2004-11-12 11:07

reporter   ~0002884

Error handling patch updated - fixed some gross errors. It should now run OK, and has had some testing but nothing extensive yet. I'm able to run my mail merge script and the 'odyssey' pagination script, plus a bunch of the Scribus sample scripts and sjc's font sampler without problems.

sjc: looks like I didn't break your font sampler after all ;-)

Testing and comments would be appreciated.

ringerc

2004-11-12 12:36

reporter   ~0002886

I think we need to add another TODO: "Audit handling of Unicode text and document how to use Unicode text in the scripter".

Bug 0001287 shows one example of an issue that can come up from lack of understanding of unicode text. The initial bug is a problem with my patch, but discussion moved on to unicode text problems.

cbradney

2004-11-12 16:53

administrator   ~0002887

Once you guys have beaten this into submission, please send me something to add to the Scripter docs for help manual.

ringerc

2004-11-12 17:08

reporter   ~0002888

Last edited: 2004-11-12 17:11

Way ahead of 'ya :-)

http://www.postnewspapers.com.au/~craig/scribus/scripter_faq_draft_1.txt

It sort of grew out of the unicode issues. That's just a first draft - barely even that - but outlines the main things I was thinking needed covering. I must add mention of using help() there though, and some pointers for new Python users.

Petr: if you wouldn't mind reviewing that, I'll neaten it up and sort it out a bit better so it can go in the docs. In particular, things that need confirmation:
    GUI toolkit. I think this one's pretty clear, but we haven't discussed it yet. I talked this over with sjc earlier. I'm happy to provide more info as needed.
    Unicode frame names. As Scribus uses QStrings, there's no reason we shouldn't support them - but currently the scripter doesn't. It's a relatively easy change, and probably not a bad idea in the interests of making the entire scripter API fully Unicode eventually. Python is going pure Unicode slowly, after all, and most of Qt is already unicode.
    Anything else?

-- edit: If your browser/editor shows the french 'December' text all mangled, make sure it's treating the text file as unicode, or use iconv to convert it to latin-1 : 'iconf -f UTF-8 -t LATIN-1 input.txt > output.txt' . *sigh*. I hate encodings - one day, we'll all be using unicode. One of around four flavours of unicode, unfortunately :-(

edited on: 04-11-12 18:11

subik

2004-11-14 17:26

manager   ~0002889

I vote for QString("err"). We can translate it later - maybe it's better to have it in english for support in the mailing list.

ringerc

2004-11-21 07:49

reporter   ~0002918

Petr - have you had a chance to have a look at the attached error handling patch yet?

ringerc

2004-11-21 08:52

reporter   ~0002919

An explanation is needed for one part of this patch. I've altered GetUniqueItem so that it sets an exception before returning NULL if:
   (a) An item name is supplied, but the item doesn't exist
   (b) No item name is supplied and there is no selection
This lets callers just 'return NULL' to fail with a nice, consistent exception informing the caller that the call failed because it had nothing to operate _on_.

A few calls used GetUniqueItem to discover if an item with that name already existed. I've added a new call, ItemExists, and converted them over to use that instead.

subik

2004-11-21 13:16

manager   ~0002922

craig, if I remember there is python objectExists() and c++ GetUniqueItem(). Maybe I'm wrong i have no S. source here...

ringerc

2004-11-21 13:45

reporter   ~0002923

You're quite right. I should probably have explained better. The point is that the GetUniqueItem function really does a fairly specialised job, and does more than just check to see if a name exists. What I've done is make GetUniqueItem do its job slightly better, and make another function for people to use when all they need to do is find out if an item exists.

GetUniqueItem checks to see if a name has been passed. If a name has been passed, it returns a pointer to the matching PageItem if it exists, or NULL (which is treated as an error condition by the calling code) if it does not. If "" was passed as a name, it returns the selected object if there was one, otherwise NULL again.

If all you want is to find out if a given object exists, this is overkill. There were several bits of rather tangled code in use that called GetUniqueItem when all they actually needed was to find out if the item existed. They explicitly avoided the selection check behaviour by making sure the parameter being passed wasn't "" first. This is a lot of work to go to, and it's much clearer to provide a new, simplified function just to find out if an item exists.

The other reason for changing this is that once I provided a function to check if an item existed, there was only one other set of users for GetUniqueItem. All of them required a valid object to operate on - if they didn't have one, they'd fail silently. The usual code looked like this:

// Let 'QString Name' be the object name, possibly "", passed from Python
item = GetUniqueItem(Name)
if (item != NULL)
{
    // perform the core functions of this Python call
}
Py_INCREF(Py_None)
return Py_None;

As I was going trough converting everything so that it no longer failed silently on an error, this needed correcting. Rather than duplicate the same exception code everywhere, the best approach seemed to be to make GetUniqueItem set an exception if it couldn't find any object to return. That way, callers can use it like this:


// Let 'QString Name' be the object name, possibly "", passed from Python
item = GetUniqueItem(Name)
if (item == NULL)
    return NULL; // An exception has already been set by GetUniqueItem
// perform the core functions of this Python call
Py_INCREF(Py_None)
return Py_None;

Now the function informs the user when something goes wrong, and does so without bloating the scripter with lots of duplicated exception setting code and duplicate strings. There were no cases that called GetUniqueItem() and couldn't use the new, simplified ItemExists() instead that did not treat a NULL return from GetUniqueItem as an error, so this change seemed like an obvious move.

ringerc

2004-11-21 14:13

reporter   ~0002924

Attached patch for 1.3cvs as well. Uggh, I hate merging big patches :S

This patch (both for 1.2 and 1.3) alters the way the Scripter handles errors and invalid input.

There is currently a lot of code like this in the scripter:

if (!error_condition)
{
   // perform requested action
}
Py_INCREF(Py_None);
return Py_None;

or

if (error_condition)
{
    Py_INCREF(Py_None);
    return Py_None;
}
// perform requested action
Py_INCREF(Py_None);
return Py_None;

or even

if (error_condition)
    return Py_BuildValue(i, 0);
// calculate my_real_result
return my_real_result

A caller has no indication if the requested action was actually performed, or was skipped because of some (unknown and unreported) problem. In some cases, a dummy / invalid "real" return value like "" or 0 is returned. This makes debugging difficult and can cause errors to lurk undetected in code. It's also very 'un-Pythonic' and tends to frustate Python programmers no end.

If the code throws an exception, the calling code can always choose to ignore it, warn about it, or terminate the script. Currently, the calling code doesn't get that choice - it will continue on unawares, possibly to fail later at some apparently unrelated point or to terminate normally but fail to do what it's meant to do.

To solve these issues, I'm going through and converting lots of this code to work like this instead:

if (error_condition)
{
    PyErr_SetString(ScribusException, "helpful error message");
    return NULL;
}
// perform requested action

That way, the caller gets explicit notification that the script failed. Calls will never return dummy values like "", 0, or None when they actually mean "I did nothing" or "it didn't work" or "I don't know" or "that doesn't make sense".

This takes a lot of the guesswork out of writing scripts for Scribus.

ringerc

2004-11-21 14:21

reporter   ~0002925

While still not extensively tested, these changes have now been tested with the sample scripts, several of my scripts, and of course the font sampler, with no issues found.

Some scripts now raise errors when they used to fail silently under the wrong conditions (eg moins_10_pourcent_group.py with no object selected), but nothing fails now under circumstances where it used to do the right thing.

It could use more testing, but should not cause major breakage.

ringerc

2004-11-21 16:10

reporter   ~0002929

Minor updates to the patches, mostly making all error messages consistently use QString("") instead of bare "" or QObject::tr("").

ringerc

2004-11-25 07:04

reporter   ~0002943

Just for the record - Petr has applied the patches "error_handling_4.diff" and "error_handling_4_Version13.diff" to CVS. The change was applied on:

Wed, 24 Nov 2004 01:30:18 +0800 (WST) (1.2.1)
Wed, 24 Nov 2004 01:45:06 +0800 (WST) (1.3)

Thanks Petr. I do have one suggestion - it might be a good idea to mention the bug number related to the patches you're committing when you check in a change, so that its easy to find them later based on the cvs history.

subik

2004-11-25 18:14

manager   ~0002945

basic docstring updated. Pydoc output attached. As you can see there is a lot to do... oh, how I hate to write docs :)))

ringerc

2004-11-25 19:13

reporter   ~0002946

Petr

The change you just made to the scripter to separate out constant aliasing seems to be a good idea to me. Do you mind if I submit a slightly simpler implementation?

The reason I used PyRun_String and a dynamically created Python function for function aliases is because that permits the wrapping of the function with warnings, and eventually argument checks or changes.

This doesn't work for constants. Rather than building and running a trivial Python statement, it may be easier to just use Python/C API calls to do the job. The attached patch does this, and also uses 'const char*' arguments to cut down on warnings. It's really a one-line function, but sanity checks and workarounds for braindead const issues bloat it a bit.

subik

2004-11-26 19:05

manager   ~0002947

docstrings updated in cmddoc.h, cmdpage.h

Here is the most up to date Scripter API documentation.:
http://www.yarpen.cz/scripter-docs/

It's updated after each CVS commit.

subik

2004-11-26 19:16

manager   ~0002948

yep. one more idea falls on me right now. what about splitting static PyMethodDef scribus_methods[] into smaller chunks/modules? e.g. have one for cmddoc.h/cpp etc. Then (in the future) have scribus.doc module. It should be better for generated docs... With backward compatibility of course...

ringerc

2004-11-26 19:45

reporter   ~0002949

Last edited: 2004-11-26 19:46

I think that splitting up the PyMethodDef struct does sound sensible, assuming it can be done in a sane way.

I'm not so sure about splitting the interface into individual modules, though. I'm not sure it'd gain much, really, and it could be quite fiddly. I think it'd make more sense to start moving to a more object-oriented interface instead, at least where practical. Unfortunately, that would be a lot of work.

I'm very interested in using SWIG to help automate some of this, but I'm concerned that the internal Scribus APIs might not be stable or clean enough to make it practical.

Overall, though, I think it makes more sense to focus on functionality once these cleanups are done - at least in the near term. To get things like style creation working, look at ways to use gettext from the scripter, fix the debug python crash, look into nicer ways to do guis (eg C++ loaded Qt designer files), make the scripter work right with 1.3, etc. Of couse, that's just my opinion.

Speaking of 1.3, I have a patch to correct the Create* functions so they place objects on the right page - I'll clean it up and attach it here later.

cbradney

2004-11-27 10:33

administrator   ~0002950

Last edited: 2004-11-27 10:33

I still wonder if all this documentation should be going into the binary. Wouldnt it be better to have a short description, plus a single string defined of "Please see the %1 section of Scribus help" and then qstring .arg() that %1 with a "Document" (or appropriate section name).

ringerc

2004-11-27 11:10

reporter   ~0002951

Craig: To be honest, I don't think it's a big deal. The size of the documentation, relative to the scripter code, probably won't be all that big. More to the point, we're loading a _Python_ _interpreter_ and a bunch of its modules. In comparison, the docstrings are not worth noting in terms of footprint. Some Python modules have very large amounts of documentation in them, and it doesn't seem to make any appreciable difference to the memory footprint.

The docstrings are fairly short, and provide important information to the programmer for their immediate use. Remember that in Python, unlike C++, the programmer is often hashing out their code in an interactive session, and it's extremely helpful to be able to just say 'help(someFunction)' to get a reminder about the correct usage of the function. For example, I'll soon be adding information about what exceptions a function may throw to the docstrings.

It's also worth noting that it's much easier to say "You MUST write a docstring for any functions you add to the scripting interface" than "You MUST submit a documentation patch as well as a function." The docs and code are all in one place, and it's easy to see if a function is missing documentation.

Given the relatively small size of the documentation, and its benefits, I think it's well worth keeping.

Personally, I'd find it more interesting to offer users a 'plug-in manager' so they could simply disable the loading of plug-ins they don't use. That means that any users who really care about that small chunk of memory and never use the Python interface can simply turn it off.

subik

2004-11-30 14:15

manager   ~0002955

the plug-in manager is what I'm thinking for 2 months for...
yes, and I abs. agree with docstrings - the binary is only little larger, it's pythonic, it allows to have documentation up to date.

ringerc

2004-11-30 14:40

reporter   ~0002956

The attached patches remove the custom exceptions the scripter sets when a PyArg_ParseTuple fails. This means that when issues other than wrong arguments - such as unicode decode errors - ocurr during argument tuple parsing, the user will now be given an accurate error message.

Users can get function usage information from the docstrings instead.

Testing status of this patch is 'umm, it compiles'. The patch is really trivial though.

Versions for both 1.2.1cvs and 1.3cvs are provided here.

ringerc

2004-11-30 14:56

reporter   ~0002957

Last edited: 2004-11-30 15:13

Petr, re your comment:

"8.5) Encoding in the scripter console - e.g. messagebarText(unicode) from script works/doesn't work in console. Don't know why :-/"

The issue is to do with the difference between 8-bit encoded strings and Unicode strings in Python. A string is by default assumed to be in the system default encoding. Unless told otherwise, Python's default encoding is 'ascii'. There is no defined meaning to the high bit in ASCII - ASCII is a seven bit encoding. So trying to convert an eight-bit ASCII string to Unicode will fail.

Strictly, in the ASCII encoding you just can't use literals not in the ASCII space. Python might let you if you use the unicode string constructor:

u'mystring'

but it's not safe or guaranteed to be consistent. The right answer is to either take unicode input and tell the script interface to expect Unicode input, or just use those ugly \xab escapes.

This should only be an issue on the script console - I'm pretty sure I solved it for normal scripts (see the FAQ on a bug linked from this one).

I'll look into convincing Python to treat console input as unicode shortly. In the mean time, using the unicode string constructor seems to work, as the input from the script console is actually unicode, though Python doesn't really know that.

So use u"l'année" instead of "l'année" and you should be fine anyway.

http://python.shopinator.com/doc/faq/programming.html#what-does-unicodeerror-ascii-decoding-encoding-error-ordinal-not-in-range-128-mean

subik

2004-12-01 07:14

manager   ~0002961

Craig, I know how Python handles strings - maybe beacuse I'm from country where we use a strange encoding :)))
but what I found on monday (testing some texts) - it's console fault. I would like to have all in unicode in Scripter (as it's said above) so e.g. messagebarText(unicode('mystrangestring'), 'iso-8859-2')) is standard now. It works fine calling it via extarnal script file but won't work directly from console. Btw it could be font issue in QTextEdit or whatever propably - I cannot write "special" characters here. It shows glyph_not_found boxes. I'll take a look at it some day ;)

subik

2004-12-01 16:22

manager   ~0002964

Patches commited

ringerc

2004-12-03 11:26

reporter   ~0002973

Last edited: 2004-12-03 11:32

New pair of patches attached - header_tidy_121.diff and header_tidy_13.diff.

This patch tidies up the headers a bit, so that <Python.h> is included from cmdvar.h and all the other files include cmdvar.h . It also removes the redefinition of the PyDoc macros, as they're pulled in from <Python.h> . Because cmdvar.h is pulled in by each header file, it is no longer #included by each C++ file.

While this makes all the headers depend on cmdvar.h and through it, Python.h, it eliminates the duplication of PyDoc macro definitions and makes it easier to use Python API constructs in the headers where appropriate.

I've also removed the last changes of the ERRPARM macro and fixed a few places where I missed PyArg_ParseTuple custom exceptions.

Please let me know if you disagree with this patch - I'm hardly in a position to say "this is how it should be done!", it's just IMO neater this way.

subik

2004-12-03 15:55

manager   ~0002975

patches are in CVS

ringerc

2004-12-03 16:49

reporter   ~0002976

Discussed the strings-in-binary issue some more with cbradney on IRC. It sounds like a bigger concern is to make it possible to translate the strings - something I'm looking into now - rather than binary size concerns.

When it comes to size, a quick test suggested that stripped 1.5MB binary is approximately 5% docstrings (75k) so string size is unlikely to be a concern.

For translatability, hopefully Qt's QObject::tr can be persuaded to do the job, but this isn't certain as the data structure they go into doesn't look like it's made to be built at runtime.

ringerc

2004-12-08 11:48

reporter   ~0003025

Last edited: 2004-12-08 14:20

Attached patches are stage one of the translation support / docstrings tweaks / error checking.

scripter-wide changes:
  Adds top level translatable docstring to module. Full unicode support.
  Adds tr() function to scriptplugin.cpp to support translation of docstrings.
  Modifies PyMethodDef in scriptplugin.cpp to use tr()
  Adds two new exceptions.
  Makes GetUniqueItem throw NoValidObjectError instead of ScribusError when it
    can't get a sensible object to work on. No compatiblity impact, as
    NoValidObjectError is a ScribusError subclass.
  Adds WrongFrameTypeError for use when something tries to perform an
    inappropriate operation on a frame, eg loading an image for a text frame.

Changes to cmdtext.cpp:
  Makes exception text translatable
  Changes some exceptions to more sensible types. No compatibility impact
    expected.
  Makes docstrings translatable.
  Tidies docstrings, makes docstrings include linebreaks like normal
    Python ones and ones found in other C extension modules.
  Documents exceptions that may be thrown by functions, when these are not
    the standard ones most scripter functions may throw.

2004-12-08 13:58

 

scripter_translate_121a.diff (63,329 bytes)   
Index: cmdtext.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp,v
retrieving revision 1.25
diff -u -r1.25 cmdtext.cpp
--- cmdtext.cpp	6 Dec 2004 20:01:36 -0000	1.25
+++ cmdtext.cpp	8 Dec 2004 13:49:24 -0000
@@ -11,6 +11,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font size of non-text frame.","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
@@ -19,8 +24,6 @@
 	}
 	else
 		return PyFloat_FromDouble(static_cast<long>(it->ISize / 10.0));
-	//FIXME: How can we reach this point? Should we raise an exception instead of returning zero?
-	return PyFloat_FromDouble(0.0);
 }
 
 PyObject *scribus_getfont(PyObject *self, PyObject* args)
@@ -33,6 +36,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font of non-text frame.","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
@@ -41,8 +49,6 @@
 	}
 	else
 		return PyString_FromString(it->IFont);
-	//FIXME: How do we reach this point? Should we be raising an exception instead of returning ""?
-	return PyString_FromString("");
 }
 
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args)
@@ -53,7 +59,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Ptext.count())) : NULL;
+	if (i == NULL)
+		return NULL;
+	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text size of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyInt_FromLong(static_cast<long>(i->Ptext.count()));
 }
 
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args)
@@ -64,7 +77,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Cols)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column count of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyInt_FromLong(static_cast<long>(i->Cols));
 }
 
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args)
@@ -75,7 +95,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->LineSp)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get line space of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyFloat_FromDouble(static_cast<double>(i->LineSp));
 }
 
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args)
@@ -86,7 +113,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->ColGap)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column gap of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyFloat_FromDouble(static_cast<double>(i->ColGap));
 }
 
 PyObject *scribus_getframetext(PyObject *self, PyObject* args)
@@ -100,6 +134,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error"));
+		return NULL;
+	}
 	for (uint a = 0; a < it->Ptext.count(); a++)
 	{
 		if (it->HasSel)
@@ -112,7 +151,6 @@
 			text += it->Ptext.at(a)->ch;
 		}
 	}
-	//qDebug(text);		disabled by cr 2004-11-11
 	return PyString_FromString(text);
 }
 
@@ -127,6 +165,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error"));
+		return NULL;
+	}
 	PageItem *is = NULL;
 	// Scan backwards to find the first frame in a linked series
 	while (it->BackBox != 0)
@@ -136,7 +179,9 @@
 		{
 			// While GetUniqueItem has already set an exception, we'll
 			// overwrite that with a more suitable one for this particular case.
-			PyErr_SetString(PyExc_RuntimeError, QString("(System Error) Broken linked frame series when scanning back"));
+			// Not making this translatable, since it shouldnt' be seen and it's more important for
+			// us to be able to understand the error if it's reported.
+			PyErr_SetString(ScribusException, QString("(System Error) Broken linked frame series when scanning back"));
 			return NULL;
 		}
 		it = is;
@@ -162,6 +207,8 @@
 		{
 			// While GetUniqueItem has already set an exception, we'll
 			// overwrite that with a more suitable one for this particular case.
+			// Not making this translatable, since it shouldnt' be seen and it's more important for
+			// us to be able to understand the error if it's reported.
 			PyErr_SetString(ScribusException, QString("(System Error) Broken linked frame series when scanning forward"));
 			return NULL;
 		}
@@ -194,6 +241,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set text of non-text frame.","python error"));
+		return NULL;
+	}
 	QString Daten = QString::fromUtf8(Text);
 	PyMem_Free(Text);
 	if (it->NextBox != 0)
@@ -248,11 +300,16 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot insert text into non-text frame.","python error"));
+		return NULL;
+	}
 	QString Daten = QString::fromUtf8(Text);
 	PyMem_Free(Text);
 	if ((pos < 0) && (pos > static_cast<int>(it->Ptext.count())))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Insert index out of bounds"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Insert index out of bounds","python error"));
 		return NULL;
 	}
 	for (uint a = 0; a < Daten.length(); ++a)
@@ -295,15 +352,15 @@
 		return NULL;
 	if ((alignment > 4) || (alignment < 0))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Alignment out of range. Use one of the scribus.ALIGN* constants."));
-                return NULL;
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of range. Use one of the scribus.ALIGN* constants.","python error"));
+		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
-	if (i->PType != 4)
+	if (i->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Can't set text alignment on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text alignment on a non-text frame","python error"));
 		return NULL;
 	}
 	int Apm = Carrier->doc->AppMode;
@@ -328,16 +385,16 @@
 		return NULL;
 	if ((size > 512) || (size < 1))
 	{
-		PyErr_SetString(ScribusException, QString("Font size out of bounds - must be 1 <= size <= 512"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Font size out of bounds - must be 1 <= size <= 512","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
 
-	if (i->PType != 4)
+	if (i->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Can't set font size on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font size on a non-text frame","python error"));
 		return NULL;
 	}
 	int Apm = Carrier->doc->AppMode;
@@ -363,9 +420,9 @@
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
-	if (i->PType != 4)
+	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
 	{
-		PyErr_SetString(ScribusException, QString("Can't set font on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font on a non-text frame","python error"));
 		return NULL;
 	}
 	if (Carrier->Prefs.AvailFonts.find(QString(Font)))
@@ -381,7 +438,7 @@
 	}
 	else
 	{
-		PyErr_SetString(ScribusException, QString("Font not found"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -398,12 +455,17 @@
 		return NULL;
 	if (w < 0.1)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line space out of bounds, must be >= 0.1"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line space out of bounds, must be >= 0.1","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't line spacing on a non-text frame","python error"));
+		return NULL;
+	}
 	i->LineSp = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -419,12 +481,17 @@
 		return NULL;
 	if (w < 0.0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Column gap out of bounds, must be positive"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Column gap out of bounds, must be positive","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't column gap on a non-text frame","python error"));
+		return NULL;
+	}
 	i->ColGap = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -440,12 +507,17 @@
 		return NULL;
 	if (w < 1)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Column count out of bounds, must be > 1"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Column count out of bounds, must be > 1","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't number of columns on a non-text frame","python error"));
+		return NULL;
+	}
 	i->Cols = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -464,7 +536,12 @@
 		return NULL;
 	if ((start < 0) || ((start + ende) > static_cast<int>(it->Ptext.count()-1)))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Selection index out of bounds"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Selection index out of bounds","python error"));
+		return NULL;
+	}
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't select text in a non-text frame","python error"));
 		return NULL;
 	}
 	/* FIXME: not sure if we should make this check or not
@@ -499,6 +576,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't delete text from a non-text frame","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 		Carrier->DeleteSel(it);
 	else
@@ -521,7 +603,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text fill on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 		{
@@ -535,11 +622,6 @@
 		}
 		it->TxtFill = QString(Color);
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text color"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -555,7 +637,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text stroke on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 		{
@@ -569,11 +656,6 @@
 		}
 		it->TxtStroke = QString(Color);
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text color"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -594,7 +676,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text shade on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
@@ -608,11 +695,6 @@
 		}
 	it->ShTxtFill = w;
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text shade"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -632,24 +714,29 @@
 	PageItem *toitem = GetUniqueItem(QString(name2));
 	if (toitem == NULL)
 		return NULL;
+	if ((fromitem->PType != FRAME_TEXT) || (toitem->PType != FRAME_TEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can only link text frames","python error"));
+		return NULL;
+	}
 	if (toitem->Ptext.count())
 	{
-		PyErr_SetString(ScribusException, QString("Target frame must be empty"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame must be empty","python error"));
 		return NULL;
 	}
 	if (toitem->NextBox != 0)
 	{
-		PyErr_SetString(ScribusException, QString("Target frame links to another frame"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame links to another frame","python error"));
 		return NULL;
 	}
 	if (toitem->BackBox != 0)
 	{
-		PyErr_SetString(ScribusException, QString("Target frame is linked to by another frame"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame is linked to by another frame","python error"));
 		return NULL;
 	}
 	if (toitem == fromitem)
 	{
-		PyErr_SetString(ScribusException, QString("Source and target are the same object"));
+		PyErr_SetString(ScribusException, QObject::tr("Source and target are the same object","python error"));
 		return NULL;
 	}
 	// references to the others boxes
@@ -673,15 +760,20 @@
 	PageItem *item = GetUniqueItem(name);
 	if (item == NULL)
 		return NULL;
+	if (item->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't unlink a non-text frame","python error"));
+		return NULL;
+	}
 	// only linked
 	if (item->BackBox == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Object is not a linked text frame, can't unlink."));
+		PyErr_SetString(ScribusException, QObject::tr("Object is not a linked text frame, can't unlink.","python error"));
 		return NULL;
 	}
 	if (item->NextBox == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Object the last frame in a series, can't unlink."));
+		PyErr_SetString(ScribusException, QObject::tr("Object the last frame in a series, can't unlink. Unlink the previous frame instead.","python error"));
 		return NULL;
 	}
 	PageItem* nextbox = item->NextBox;
@@ -720,9 +812,9 @@
 	PageItem *item = GetUniqueItem(QString(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType != 4)
+	if (item->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot convert a non-text frame to outlines"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't convert a non-text frame to outlines","python error"));
 		return NULL;
 	}
 	Carrier->doc->ActPage = item->OwnPage;
Index: cmdtext.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.h,v
retrieving revision 1.9
diff -u -r1.9 cmdtext.h
--- cmdtext.h	3 Dec 2004 15:02:55 -0000	1.9
+++ cmdtext.h	8 Dec 2004 13:49:25 -0000
@@ -8,201 +8,264 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfontsize__doc__,
-    "getFontSize([\"name\"]) -> float\n\n\
-Returns the fontsize for the textframe \"name\". If this\
-textframe has some text selected the value assigned to\
-the first character of the selection is returned.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFontSize([\"name\"]) -> float\n\
+\n\
+Returns the font size in points for the text frame \"name\". If this text\n\
+frame has some text selected the value assigned to the first character of\n\
+the selection is returned.\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get font size */
 PyObject *scribus_getfontsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfont__doc__,
-    "getFont([\"name\"]) -> string\n\n\
-Returns the font for the textframe \"name\". If this\
-textframe has some text selected the value assigned to the\
-first character of the selection is returned. If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getFont([\"name\"]) -> string\n\
+\n\
+Returns the font name for the text frame \"name\". If this text frame\n\
+has some text selected the value assigned to the first character\n\
+of the selection is returned. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Get font */
 PyObject *scribus_getfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gettextsize__doc__,
-    "getTextLength([\"name\"]) -> integer\n\n\
-Returns the length of the text in the textframe \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getTextLength([\"name\"]) -> integer\n\
+\n\
+Returns the length of the text in the text frame \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get text size */
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getframetext__doc__,
-    "getText([\"name\"]) -> string\n\n\
-Returns the text of the textframe \"name\". If this textframe\
-has some text selected, this text is returned. If \"name\" is\
-not given the currently selected item is used.");
+QT_TR_NOOP("getText([\"name\"]) -> string\n\
+\n\
+Returns the text of the text frame \"name\". If this text frame has some text\n\
+selected, the selected text is returned. All text in the frame, not just\n\
+currently visible text, is returned. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Get frame text */
 PyObject *scribus_getframetext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gettext__doc__,
-    "getAllText([\"name\"]) -> string\n\n\
-Returns the text of the textframe \"name\" and of all\
-textframes which are linked with this frame. If this textframe\
-has some text selected, this text is returned. If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getAllText([\"name\"]) -> string\n\
+\n\
+Returns the text of the text frame \"name\" and of all text frames which are\n\
+linked with this frame. If this textframe has some text selected, the selected\n\
+text is returned. If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Get all text */
 PyObject *scribus_gettext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinespace__doc__,
-    "getLineSpacing([\"name\"]) -> float\n\n\
-Gets the linespacing of the text frame \"name\" expressed\
-in points. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("getLineSpacing([\"name\"]) -> float\n\
+\n\
+Returns the line spacing (\"leading\") of the text frame \"name\" expressed in\n\
+points. If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get line space */
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolumngap__doc__,
-    "getColumnGap([\"name\"]) -> float\n\n\
-Gets the column gap of the text frame \"name\" expressed\
-in points. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("getColumnGap([\"name\"]) -> float\n\
+\n\
+Returns the column gap size of the text frame \"name\" expressed in points. If\n\
+\"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get column gap */
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolumns__doc__,
-    "getColumns([\"name\"]) -> integer\n\n\
-Gets the number of columns of the text frame \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getColumns([\"name\"]) -> integer\n\
+\n\
+Gets the number of columns of the text frame \"name\". If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Get columns */
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setboxtext__doc__,
-    "setText(\"text\", [\"name\"])\n\n\
-Sets the text of the text frame \"name\" to the text of the\
-string \"text\". Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2').\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setText(\"text\", [\"name\"])\n\
+\n\
+Sets the text of the text frame \"name\" to the text of the string \"text\".\n\
+Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2'). See the FAQ\n\
+for more details. If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Set text */
 PyObject *scribus_setboxtext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_inserttext__doc__,
-    "insertText(\"text\", pos, [\"name\"])\n\n\
-Inserts the text \"text\" at the position \"pos\" into the textframe.\
-Text must be UTF encoded (see setText() as reference)\
-The first character has an index of 0. \"name\" If \"name\" is not\
-given the currently selected Item is used.");
+QT_TR_NOOP("insertText(\"text\", pos, [\"name\"])\n\
+\n\
+Inserts the text \"text\" at the position \"pos\" into the text frame. Text\n\
+must be UTF encoded (see setText() as reference) The first character has an\n\
+index of 0. \"name\" If \"name\" is not given the currently selected Item is\n\
+used.\n\
+\n\
+May throw IndexError for an insertion out of bounds.\n\
+"));
 /*! Insert text */
 PyObject *scribus_inserttext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfont__doc__,
-    "setFont(\"font\", [\"name\"])\n\n\
-Sets the font of the text frame \"name\" to \"font\", if there\
-is some text selected only the selected text is changed.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setFont(\"font\", [\"name\"])\n\
+\n\
+Sets the font of the text frame \"name\" to \"font\". If there is some text\n\
+selected only the selected text is changed.  If \"name\" is not given the\n\
+currently selected item is used.\n\
+\n\
+May throw ValueError if the font cannot be found.\n\
+"));
 /*! Set font */
 PyObject *scribus_setfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfontsize__doc__,
-    "setFontSize(size, [\"name\"])\n\n\
-Sets the fontsize of the text frame \"name\" to the pointsize\
-\"size\", if there is some text selected only the selected Text\
-is changed. \"size\" must be in the Range 1 to 512. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("setFontSize(size, [\"name\"])\n\
+\n\
+Sets the font size of the text frame \"name\" to \"size\". \"size\" is treated\n\
+as a value in points. If there is some text selected only the selected text is\n\
+changed. \"size\" must be in the range 1 to 512. If \"name\" is not given the\n\
+currently selected item is used.\n\
+\n\
+May throw ValueError for a font size that's out of bounds.\n\
+"));
 /*! Set font size */
 PyObject *scribus_setfontsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinespace__doc__,
-    "setLineSpacing(size, [\"name\"])\n\n\
-Sets the linespacing of the text frame \"name\" to the pointsize\
-\"size\". If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setLineSpacing(size, [\"name\"])\n\
+\n\
+Sets the line spacing (\"leading\") of the text frame \"name\" to \"size\".\n\
+\"size\" is a value in points. If \"name\" is not given the currently selected\n\
+item is used.\n\
+\n\
+May throw ValueError if the line spacing is out of bounds.\n\
+"));
 /*! Set line space */
 PyObject *scribus_setlinespace(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolumngap__doc__,
-    "setColumnGap(size, [\"name\"])\n\n\
-Sets the column gap of the text frame \"name\" to the value \"size\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setColumnGap(size, [\"name\"])\n\
+\n\
+Sets the column gap of the text frame \"name\" to the value \"size\". If\n\
+\"name\" is not given the currently selected item is used.\n\
+\n\
+May throw ValueError if the column gap is out of bounds (must be positive).\n\
+"));
 /*! Set column gap */
 PyObject *scribus_setcolumngap(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolumns__doc__,
-    "setColumns(nr, [\"name\"])\n\n\
-Sets the number of columns of the text frame \"name\"\
-to the value \"nr\". If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setColumns(nr, [\"name\"])\n\
+\n\
+Sets the number of columns of the text frame \"name\" to the integer \"nr\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May throw ValueError if number of columns is not at least one.\n\
+"));
 /*! Set columns */
 PyObject *scribus_setcolumns(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setalign__doc__,
-    "setTextAlignment(align, [\"name\"])\n\n\
-Sets the text alignment of the text frame \"name\" to the specified\
-alignment. If \"name\" is not given the currently selected item is\
-used. \"align\" can have the defined constants - see ALIGN_<type>.");
+QT_TR_NOOP("setTextAlignment(align, [\"name\"])\n\
+\n\
+Sets the text alignment of the text frame \"name\" to the specified alignment.\n\
+If \"name\" is not given the currently selected item is used. \"align\" should\n\
+be one of the ALIGN_ constants defined in this module - see dir(scribus).\n\
+\n\
+May throw ValueError for an invalid alignment constant.\n\
+"));
 /*! Set alignt */
 PyObject *scribus_setalign(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selecttext__doc__,
-    "selectText(start, count, [\"name\"])\n\n\
-Selects \"count\" characters text of the text frame \"name\"\
-starting from the character \"start\". Character counting starts\
-at 0. If \"count\" is zero, any text selection will be cleared.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("selectText(start, count, [\"name\"])\n\
+\n\
+Selects \"count\" characters of text in the text frame \"name\" starting from the\n\
+character \"start\". Character counting starts at 0. If \"count\" is zero, any\n\
+text selection will be cleared.  If \"name\" is not given the currently\n\
+selected item is used.\n\
+\n\
+May throw IndexError if the selection is outside the bounds of the text.\n\
+"));
 /*! Select text */
 PyObject *scribus_selecttext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deletetext__doc__,
-    "deleteText([\"name\"])\n\n\
-Deletes the text of the text frame \"name\". If there is some\
-text selected, this text will be deleted. If \"name\" is not\
-given the currently selected Item is used.");
+QT_TR_NOOP("deleteText([\"name\"])\n\
+\n\
+Deletes any text in the text frame \"name\". If there is some text selected,\n\
+only the selected text will be deleted. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Delete text */
 PyObject *scribus_deletetext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextfill__doc__,
-    "setTextColor(\"color\", [\"name\"])\n\n\
-Sets the text color of the object \"name\" to the color\
-\"color\", if there is some text selected only the selected\
-text is changed. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setTextColor(\"color\", [\"name\"])\n\
+\n\
+Sets the text color of the text frame \"name\" to the color \"color\". If there\n\
+is some text selected only the selected text is changed. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Set text fill */
 PyObject *scribus_settextfill(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextstroke__doc__,
-    "setTextStroke(\"color\", [\"name\"])\n\n\
-Set \"color\" of the text stroke. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setTextStroke(\"color\", [\"name\"])\n\
+\n\
+Set \"color\" of the text stroke. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Set text stroke */
 PyObject *scribus_settextstroke(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextshade__doc__,
-    "setTextShade(shade, [\"name\"])\n\n\
-Sets the shading of the text color of the object \"name\" to \"shade\",\
-if there is some text selected only the selected text is changed. \"shade\"\
-must be an integer value in the range from 0 (lightest) to 100 (full\
-color intensity). If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("setTextShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the text color of the object \"name\" to \"shade\". If\n\
+there is some text selected only the selected text is changed. \"shade\" must\n\
+be an integer value in the range from 0 (lightest) to 100 (full color\n\
+intensity). If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Set text shde */
 PyObject *scribus_settextshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_linktextframes__doc__,
-    "linkTextFrames(\"name1\", \"name2\")\n\n\
-Create the linked text frames. Parameters are the object names.");
+QT_TR_NOOP("linkTextFrames(\"fromname\", \"toname\")\n\
+\n\
+Link two text frames. The frame named \"fromname\" is linked to the\n\
+frame named \"toname\". The target frame must be an empty text frame\n\
+and must not link to or be linked from any other frames already.\n\
+\n\
+May throw ScribusException if linking rules are violated.\n\
+"));
 /**
  Link text frames via Scripter.
  02/22/04 (petr vanek)
@@ -212,8 +275,14 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_unlinktextframes__doc__,
-    "linkTextFrames(\"name\")\n\n\
-Remove the specified (named) object from the text frame flow/linkage.");
+QT_TR_NOOP("unlinkTextFrames(\"name\")\n\
+\n\
+Remove the specified (named) object from the text frame flow/linkage. If the\n\
+frame was in the middle of a chain, the previous and next frames will be\n\
+connected, eg 'a->b->c' becomes 'a->c' when you unlinkTextFrames(b)'\n\
+\n\
+May throw ScribusException if linking rules are violated.\n\
+"));
 /**
  (Un)Link text frames via Scripter.
  02/22/04 (petr vanek)
@@ -223,9 +292,10 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_tracetext__doc__,
-    "traceText([\"name\"])\n\n\
-Convert the text frame \"name\" to outlines. If \"name\" is not\
-given the currently selected item is used.");
+QT_TR_NOOP("traceText([\"name\"])\n\
+\n\
+Convert the text frame \"name\" to outlines. If \"name\" is not given the\n\
+currently selected item is used."));
 /**
  Trace text frames via Scripter.
  2004-09-07 (Craig Ringer)
Index: cmdutil.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp,v
retrieving revision 1.9
diff -u -r1.9 cmdutil.cpp
--- cmdutil.cpp	3 Dec 2004 15:02:55 -0000	1.9
+++ cmdutil.cpp	8 Dec 2004 13:49:25 -0000
@@ -143,7 +143,7 @@
 			return Carrier->doc->ActPage->SelItem.at(0);
 		else
 		{
-			PyErr_SetString(ScribusException, QString("Can't use empty string for object name when there is no selection"));
+			PyErr_SetString(NoValidObjectError, QString("Can't use empty string for object name when there is no selection"));
 			return NULL;
 		}
 	for (uint i = 0; i<Carrier->view->Pages.count(); i++)
@@ -154,7 +154,7 @@
 				return Carrier->view->Pages.at(i)->Items.at(j);
 		} // for items
 	} // for pages
-	PyErr_SetString(ScribusException, QString("Object not found"));
+	PyErr_SetString(NoValidObjectError, QString("Object not found"));
 	return NULL;
 }
 
Index: cmdvar.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdvar.h,v
retrieving revision 1.9
diff -u -r1.9 cmdvar.h
--- cmdvar.h	3 Dec 2004 15:02:55 -0000	1.9
+++ cmdvar.h	8 Dec 2004 13:49:25 -0000
@@ -4,6 +4,14 @@
 #include <Python.h>
 #include "scribus.h"
 
+/* These will go away in 1.3, but help readability in 1.2.1 code a LOT */
+#define FRAME_IMAGE 2
+#define FRAME_TEXT 4
+#define FRAME_LINE 5
+#define FRAME_VECTOR 6
+#define FRAME_POLYLINE 7
+#define FRAME_PATHTEXT 8
+
 /* Static global Variables */
 extern ScribusApp* Carrier;
 
@@ -12,6 +20,10 @@
 extern PyObject* ScribusException;
 /*! Exception raised when no document opened - see checkHaveDocument() in cmdutil.cpp */
 extern PyObject* NoDocOpenError;
+/*! Exception raised when an operation is performed on a frame type that doesn't support it.*/
+extern PyObject* WrongFrameTypeError;
+/*! Exception raised by GetUniqueItem when it can't find a valid frame or a suitable selection to use. */
+extern PyObject* NoValidObjectError;
 
 #endif
 
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.48
diff -u -r1.48 scriptplugin.cpp
--- scriptplugin.cpp	6 Dec 2004 20:01:36 -0000	1.48
+++ scriptplugin.cpp	8 Dec 2004 13:49:25 -0000
@@ -52,9 +52,13 @@
 #include <qtextstream.h>
 #include <cstdlib>
 
+#include <iostream>
+
 // Exceptions; visible from cmdvar.h, set up in initscribus()
 PyObject* ScribusException;
 PyObject* NoDocOpenError;
+PyObject* WrongFrameTypeError;
+PyObject* NoValidObjectError;
 
 QString Name()
 {
@@ -525,156 +529,169 @@
 	return PyString_FromString(InValue);
 }
 
+/*!
+ * Translate a docstring. Small helper function for use with the
+ * PyMethodDef struct.
+ */
+char* tr(const char* docstringConstant)
+{
+    // Alas, there's a lot of wasteful string copying going on
+    // here.
+    QString translated = QObject::tr(docstringConstant, "scripter docstring");
+    const char* trch = translated.latin1();
+    return strndup(trch, strlen(trch));
+}
+
 /* Now we're using the more pyhtonic convention for names:
 	class - ClassName
 	procedure/function/method - procedureName
 etc. */
-static PyMethodDef scribus_methods[] = {
+PyMethodDef scribus_methods[] = {
 	// 2004/10/03 pv - aliases with common Python syntax - ClassName methodName
 	// 2004-11-06 cr - move aliasing to dynamically generated wrapper functions, sort methoddef
-	{"changeColor", scribus_setcolor, METH_VARARGS, scribus_setcolor__doc__},
-	{"closeDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, scribus_closedoc__doc__},
-	{"createBezierLine", scribus_bezierline, METH_VARARGS, scribus_bezierline__doc__},
-	{"createEllipse", scribus_newellipse, METH_VARARGS, scribus_newellipse__doc__},
-	{"createImage", scribus_newimage, METH_VARARGS, scribus_newimage__doc__},
-	{"createLayer", scribus_createlayer, METH_VARARGS, scribus_createlayer__doc__},
-	{"createLine", scribus_newline, METH_VARARGS, scribus_newline__doc__},
-	{"createPathText", scribus_pathtext, METH_VARARGS, scribus_pathtext__doc__},
-	{"createPolygon", scribus_polygon, METH_VARARGS, scribus_polygon__doc__},
-	{"createPolyLine", scribus_polyline, METH_VARARGS, scribus_polyline__doc__},
-	{"createRect", scribus_newrect, METH_VARARGS, scribus_newrect__doc__},
-	{"createText", scribus_newtext, METH_VARARGS, scribus_newtext__doc__},
-	{"currentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, scribus_actualpage__doc__},
-	{"defineColor", scribus_newcolor, METH_VARARGS, scribus_newcolor__doc__},
-	{"deleteColor", scribus_delcolor, METH_VARARGS, scribus_delcolor__doc__},
-	{"deleteLayer", scribus_removelayer, METH_VARARGS, scribus_removelayer__doc__},
-	{"deleteObject", scribus_deleteobj, METH_VARARGS, scribus_deleteobj__doc__},
-	{"deletePage", scribus_deletepage, METH_VARARGS, scribus_deletepage__doc__},
-	{"deleteText", scribus_deletetext, METH_VARARGS, scribus_deletetext__doc__},
-	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, scribus_deselect__doc__},
-	{"docChanged", scribus_docchanged, METH_VARARGS, scribus_docchanged__doc__},
-	{"fileDialog", scribus_filedia, METH_VARARGS, scribus_filedia__doc__},
-	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, scribus_getactlayer__doc__},
-	{"getAllObjects", scribus_getallobj, METH_VARARGS, scribus_getallobj__doc__},
-	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, scribus_getstylenames__doc__},
-	{"getAllText", scribus_gettext, METH_VARARGS, scribus_gettext__doc__},
-	{"getColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, scribus_colornames__doc__},
-	{"getColor", scribus_getcolor, METH_VARARGS, scribus_getcolor__doc__},
-	{"getColumnGap", scribus_getcolumngap, METH_VARARGS, scribus_getcolumngap__doc__},
-	{"getColumns", scribus_getcolumns, METH_VARARGS, scribus_getcolumns__doc__},
-	{"getCornerRadius", scribus_getcornerrad, METH_VARARGS, scribus_getcornerrad__doc__},
-	{"getFillColor", scribus_getfillcolor, METH_VARARGS, scribus_getfillcolor__doc__},
-	{"getFillShade", scribus_getfillshade, METH_VARARGS, scribus_getfillshade__doc__},
-	{"getFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, scribus_fontnames__doc__},
-	{"getFont", scribus_getfont, METH_VARARGS, scribus_getfont__doc__},
-	{"getFontSize", scribus_getfontsize, METH_VARARGS, scribus_getfontsize__doc__},
-	{"getGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, scribus_getlanguage__doc__},
-	{"getHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, scribus_getHguides__doc__},
-	{"getImageFile", scribus_getimgname, METH_VARARGS, scribus_getimgname__doc__},
-	{"getImageScale", scribus_getimgscale, METH_VARARGS, scribus_getimgscale__doc__},
-	{"getLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, scribus_getlayers__doc__},
-	{"getLineCap", scribus_getlineend, METH_VARARGS, scribus_getlineend__doc__},
-	{"getLineColor", scribus_getlinecolor, METH_VARARGS, scribus_getlinecolor__doc__},
-	{"getLineJoin", scribus_getlinejoin, METH_VARARGS, scribus_getlinejoin__doc__},
-	{"getLineShade", scribus_getlineshade, METH_VARARGS, scribus_getlineshade__doc__},
-	{"getLineSpacing", scribus_getlinespace, METH_VARARGS, scribus_getlinespace__doc__},
-	{"getLineStyle", scribus_getlinestyle, METH_VARARGS, scribus_getlinestyle__doc__},
-	{"getLineWidth", scribus_getlinewidth, METH_VARARGS, scribus_getlinewidth__doc__},
-	{"getPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, scribus_getpageitems__doc__},
-	{"getPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, scribus_getpagemargins__doc__},
-	{"getPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, scribus_pagedimension__doc__}, // just an alias to PageDimension()
-	{"getPosition", scribus_getposi, METH_VARARGS, scribus_getposi__doc__},
-	{"getRotation", scribus_getrotation, METH_VARARGS, scribus_getrotation__doc__},
-	{"getSelectedObject", scribus_getselobjnam, METH_VARARGS, scribus_getselobjnam__doc__},
-	{"getSize", scribus_getsize, METH_VARARGS, scribus_getsize__doc__},
-	{"getTextColor", scribus_getlinecolor, METH_VARARGS, scribus_getlinecolor__doc__},
-	{"getTextLength", scribus_gettextsize, METH_VARARGS, scribus_gettextsize__doc__},
-	{"getText", scribus_getframetext, METH_VARARGS, scribus_getframetext__doc__},
-	{"getTextShade", scribus_getlineshade, METH_VARARGS, scribus_getlineshade__doc__},
-	{"getUnit", (PyCFunction)scribus_getunit, METH_NOARGS, scribus_getunit__doc__},
-	{"getVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, scribus_getVguides__doc__},
-	{"getXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, scribus_xfontnames__doc__},
-	{"gotoPage", scribus_gotopage, METH_VARARGS, scribus_gotopage__doc__},
-	{"groupObjects", scribus_groupobj, METH_VARARGS, scribus_groupobj__doc__},
-	{"haveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, scribus_havedoc__doc__},
-	{"insertText", scribus_inserttext, METH_VARARGS, scribus_inserttext__doc__},
-	{"isLayerPrintable", scribus_glayerprint, METH_VARARGS, scribus_glayerprint__doc__},
-	{"isLayerVisible", scribus_glayervisib, METH_VARARGS, scribus_glayervisib__doc__},
-	{"isLocked", scribus_islocked, METH_VARARGS, scribus_islocked__doc__},
-	{"linkTextFrames", scribus_linktextframes, METH_VARARGS, scribus_linktextframes__doc__},
-	{"loadImage", scribus_loadimage, METH_VARARGS, scribus_loadimage__doc__},
-	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, scribus_loadstylesfromfile__doc__},
-	{"lockObject", scribus_lockobject, METH_VARARGS, scribus_lockobject__doc__},
-	{"messagebarText", scribus_messagebartext, METH_VARARGS, scribus_messagebartext__doc__},
-	{"messageBox", scribus_messdia, METH_VARARGS, scribus_messdia__doc__},
-	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, scribus_moveobjabs__doc__},
-	{"moveObject", scribus_moveobjrel, METH_VARARGS, scribus_moveobjrel__doc__},
-	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, scribus_newdocdia__doc__},
-	{"newDoc", scribus_newdoc, METH_VARARGS, scribus_newdoc__doc__},
-	{"newPage", scribus_newpage, METH_VARARGS, scribus_newpage__doc__},
-	{"objectExists",scribus_objectexists, METH_VARARGS, scribus_objectexists__doc__},
-	{"openDoc", scribus_opendoc, METH_VARARGS, scribus_opendoc__doc__},
-	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, scribus_pagecount__doc__},
-	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, scribus_pagedimension__doc__},
-	{"progressReset", scribus_progressreset, METH_VARARGS, scribus_progressreset__doc__},
-	{"progressSet", scribus_progresssetprogress, METH_VARARGS, scribus_progresssetprogress__doc__},
-	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, scribus_progresssettotalsteps__doc__},
-	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, scribus_redraw__doc__},
-	{"renderFont", scribus_renderfont, METH_VARARGS, scribus_renderfont__doc__},
-	{"replaceColor", scribus_replcolor, METH_VARARGS, scribus_replcolor__doc__},
-	{"rotateObjectAbs", scribus_rotobjabs, METH_VARARGS, scribus_rotobjabs__doc__},
-	{"rotateObject", scribus_rotobjrel, METH_VARARGS, scribus_rotobjrel__doc__},
-	{"saveDocAs", scribus_savedocas, METH_VARARGS, scribus_savedocas__doc__},
-	{"saveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, scribus_savedoc__doc__},
-	{"savePageAsEPS", scribus_savepageeps, METH_VARARGS, scribus_savepageeps__doc__},
-	{"scaleGroup", scribus_scalegroup, METH_VARARGS, scribus_scalegroup__doc__},
-	{"scaleImage", scribus_scaleimage, METH_VARARGS, scribus_scaleimage__doc__},
-	{"selectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, scribus_selcount__doc__},
-	{"selectObject", scribus_selectobj, METH_VARARGS, scribus_selectobj__doc__},
-	{"selectText", scribus_selecttext, METH_VARARGS, scribus_selecttext__doc__},
-	{"sentToLayer", scribus_senttolayer, METH_VARARGS, scribus_senttolayer__doc__},
-	{"setActiveLayer", scribus_setactlayer, METH_VARARGS, scribus_setactlayer__doc__},
-	{"setColumnGap", scribus_setcolumngap, METH_VARARGS, scribus_setcolumngap__doc__},
-	{"setColumns", scribus_setcolumns, METH_VARARGS, scribus_setcolumns__doc__},
-	{"setCornerRadius", scribus_setcornerrad, METH_VARARGS, scribus_setcornerrad__doc__},
-	{"setCursor", scribus_setcursor, METH_VARARGS, scribus_setcursor__doc__},
-	{"setDocType", scribus_setdoctype, METH_VARARGS, scribus_setdoctype__doc__},
-	{"setFillColor", scribus_setfillcolor, METH_VARARGS, scribus_setfillcolor__doc__},
-	{"setFillShade", scribus_setfillshade, METH_VARARGS, scribus_setfillshade__doc__},
-	{"setFont", scribus_setfont, METH_VARARGS, scribus_setfont__doc__},
-	{"setFontSize", scribus_setfontsize, METH_VARARGS, scribus_setfontsize__doc__},
-	{"setGradientFill", scribus_setgradfill, METH_VARARGS, scribus_setgradfill__doc__},
-	{"setHGuides", scribus_setHguides, METH_VARARGS, scribus_setHguides__doc__},
-	{"setInfo", scribus_setinfo, METH_VARARGS, scribus_setinfo__doc__},
-	{"setLayerPrintable", scribus_layerprint, METH_VARARGS, scribus_layerprint__doc__},
-	{"setLayerVisible", scribus_layervisible, METH_VARARGS, scribus_layervisible__doc__},
-	{"setLineCap", scribus_setlineend, METH_VARARGS, scribus_setlineend__doc__},
-	{"setLineColor", scribus_setlinecolor, METH_VARARGS, scribus_setlinecolor__doc__},
-	{"setLineJoin", scribus_setlinejoin, METH_VARARGS, scribus_setlinejoin__doc__},
-	{"setLineShade", scribus_setlineshade, METH_VARARGS, scribus_setlineshade__doc__},
-	{"setLineSpacing", scribus_setlinespace, METH_VARARGS, scribus_setlinespace__doc__},
-	{"setLineStyle", scribus_setlinestyle, METH_VARARGS, scribus_setlinestyle__doc__},
-	{"setLineWidth", scribus_setlinewidth, METH_VARARGS, scribus_setlinewidth__doc__},
-	{"setMargins", scribus_setmargins, METH_VARARGS, scribus_setmargins__doc__},
-	{"setMultiLine", scribus_setmultiline, METH_VARARGS, scribus_setmultiline__doc__},
+	{"changeColor", scribus_setcolor, METH_VARARGS, tr(scribus_setcolor__doc__)},
+	{"closeDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, tr(scribus_closedoc__doc__)},
+	{"createBezierLine", scribus_bezierline, METH_VARARGS, tr(scribus_bezierline__doc__)},
+	{"createEllipse", scribus_newellipse, METH_VARARGS, tr(scribus_newellipse__doc__)},
+	{"createImage", scribus_newimage, METH_VARARGS, tr(scribus_newimage__doc__)},
+	{"createLayer", scribus_createlayer, METH_VARARGS, tr(scribus_createlayer__doc__)},
+	{"createLine", scribus_newline, METH_VARARGS, tr(scribus_newline__doc__)},
+	{"createPathText", scribus_pathtext, METH_VARARGS, tr(scribus_pathtext__doc__)},
+	{"createPolygon", scribus_polygon, METH_VARARGS, tr(scribus_polygon__doc__)},
+	{"createPolyLine", scribus_polyline, METH_VARARGS, tr(scribus_polyline__doc__)},
+	{"createRect", scribus_newrect, METH_VARARGS, tr(scribus_newrect__doc__)},
+	{"createText", scribus_newtext, METH_VARARGS, tr(scribus_newtext__doc__)},
+	{"currentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, tr(scribus_actualpage__doc__)},
+	{"defineColor", scribus_newcolor, METH_VARARGS, tr(scribus_newcolor__doc__)},
+	{"deleteColor", scribus_delcolor, METH_VARARGS, tr(scribus_delcolor__doc__)},
+	{"deleteLayer", scribus_removelayer, METH_VARARGS, tr(scribus_removelayer__doc__)},
+	{"deleteObject", scribus_deleteobj, METH_VARARGS, tr(scribus_deleteobj__doc__)},
+	{"deletePage", scribus_deletepage, METH_VARARGS, tr(scribus_deletepage__doc__)},
+	{"deleteText", scribus_deletetext, METH_VARARGS, tr(scribus_deletetext__doc__)},
+	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, tr(scribus_deselect__doc__)},
+	{"docChanged", scribus_docchanged, METH_VARARGS, tr(scribus_docchanged__doc__)},
+	{"fileDialog", scribus_filedia, METH_VARARGS, tr(scribus_filedia__doc__)},
+	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
+	{"getAllObjects", scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
+	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
+	{"getAllText", scribus_gettext, METH_VARARGS, tr(scribus_gettext__doc__)},
+	{"getColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, tr(scribus_colornames__doc__)},
+	{"getColor", scribus_getcolor, METH_VARARGS, tr(scribus_getcolor__doc__)},
+	{"getColumnGap", scribus_getcolumngap, METH_VARARGS, tr(scribus_getcolumngap__doc__)},
+	{"getColumns", scribus_getcolumns, METH_VARARGS, tr(scribus_getcolumns__doc__)},
+	{"getCornerRadius", scribus_getcornerrad, METH_VARARGS, tr(scribus_getcornerrad__doc__)},
+	{"getFillColor", scribus_getfillcolor, METH_VARARGS, tr(scribus_getfillcolor__doc__)},
+	{"getFillShade", scribus_getfillshade, METH_VARARGS, tr(scribus_getfillshade__doc__)},
+	{"getFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, tr(scribus_fontnames__doc__)},
+	{"getFont", scribus_getfont, METH_VARARGS, tr(scribus_getfont__doc__)},
+	{"getFontSize", scribus_getfontsize, METH_VARARGS, tr(scribus_getfontsize__doc__)},
+	{"getGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, tr(scribus_getlanguage__doc__)},
+	{"getHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, tr(scribus_getHguides__doc__)},
+	{"getImageFile", scribus_getimgname, METH_VARARGS, tr(scribus_getimgname__doc__)},
+	{"getImageScale", scribus_getimgscale, METH_VARARGS, tr(scribus_getimgscale__doc__)},
+	{"getLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__doc__)},
+	{"getLineCap", scribus_getlineend, METH_VARARGS, tr(scribus_getlineend__doc__)},
+	{"getLineColor", scribus_getlinecolor, METH_VARARGS, tr(scribus_getlinecolor__doc__)},
+	{"getLineJoin", scribus_getlinejoin, METH_VARARGS, tr(scribus_getlinejoin__doc__)},
+	{"getLineShade", scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
+	{"getLineSpacing", scribus_getlinespace, METH_VARARGS, tr(scribus_getlinespace__doc__)},
+	{"getLineStyle", scribus_getlinestyle, METH_VARARGS, tr(scribus_getlinestyle__doc__)},
+	{"getLineWidth", scribus_getlinewidth, METH_VARARGS, tr(scribus_getlinewidth__doc__)},
+	{"getPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, tr(scribus_getpageitems__doc__)},
+	{"getPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, tr(scribus_getpagemargins__doc__)},
+	{"getPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)}, // just an alias to PageDimension()
+	{"getPosition", scribus_getposi, METH_VARARGS, tr(scribus_getposi__doc__)},
+	{"getRotation", scribus_getrotation, METH_VARARGS, tr(scribus_getrotation__doc__)},
+	{"getSelectedObject", scribus_getselobjnam, METH_VARARGS, tr(scribus_getselobjnam__doc__)},
+	{"getSize", scribus_getsize, METH_VARARGS, tr(scribus_getsize__doc__)},
+	{"getTextColor", scribus_getlinecolor, METH_VARARGS, tr(scribus_getlinecolor__doc__)},
+	{"getTextLength", scribus_gettextsize, METH_VARARGS, tr(scribus_gettextsize__doc__)},
+	{"getText", scribus_getframetext, METH_VARARGS, tr(scribus_getframetext__doc__)},
+	{"getTextShade", scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
+	{"getUnit", (PyCFunction)scribus_getunit, METH_NOARGS, tr(scribus_getunit__doc__)},
+	{"getVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, tr(scribus_getVguides__doc__)},
+	{"getXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, tr(scribus_xfontnames__doc__)},
+	{"gotoPage", scribus_gotopage, METH_VARARGS, tr(scribus_gotopage__doc__)},
+	{"groupObjects", scribus_groupobj, METH_VARARGS, tr(scribus_groupobj__doc__)},
+	{"haveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, tr(scribus_havedoc__doc__)},
+	{"insertText", scribus_inserttext, METH_VARARGS, tr(scribus_inserttext__doc__)},
+	{"isLayerPrintable", scribus_glayerprint, METH_VARARGS, tr(scribus_glayerprint__doc__)},
+	{"isLayerVisible", scribus_glayervisib, METH_VARARGS, tr(scribus_glayervisib__doc__)},
+	{"isLocked", scribus_islocked, METH_VARARGS, tr(scribus_islocked__doc__)},
+	{"linkTextFrames", scribus_linktextframes, METH_VARARGS, tr(scribus_linktextframes__doc__)},
+	{"loadImage", scribus_loadimage, METH_VARARGS, tr(scribus_loadimage__doc__)},
+	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},
+	{"lockObject", scribus_lockobject, METH_VARARGS, tr(scribus_lockobject__doc__)},
+	{"messagebarText", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
+	{"messageBox", scribus_messdia, METH_VARARGS, tr(scribus_messdia__doc__)},
+	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, tr(scribus_moveobjabs__doc__)},
+	{"moveObject", scribus_moveobjrel, METH_VARARGS, tr(scribus_moveobjrel__doc__)},
+	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, tr(scribus_newdocdia__doc__)},
+	{"newDoc", scribus_newdoc, METH_VARARGS, tr(scribus_newdoc__doc__)},
+	{"newPage", scribus_newpage, METH_VARARGS, tr(scribus_newpage__doc__)},
+	{"objectExists",scribus_objectexists, METH_VARARGS, tr(scribus_objectexists__doc__)},
+	{"openDoc", scribus_opendoc, METH_VARARGS, tr(scribus_opendoc__doc__)},
+	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, tr(scribus_pagecount__doc__)},
+	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)},
+	{"progressReset", scribus_progressreset, METH_VARARGS, tr(scribus_progressreset__doc__)},
+	{"progressSet", scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
+	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
+	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
+	{"renderFont", scribus_renderfont, METH_VARARGS, tr(scribus_renderfont__doc__)},
+	{"replaceColor", scribus_replcolor, METH_VARARGS, tr(scribus_replcolor__doc__)},
+	{"rotateObjectAbs", scribus_rotobjabs, METH_VARARGS, tr(scribus_rotobjabs__doc__)},
+	{"rotateObject", scribus_rotobjrel, METH_VARARGS, tr(scribus_rotobjrel__doc__)},
+	{"saveDocAs", scribus_savedocas, METH_VARARGS, tr(scribus_savedocas__doc__)},
+	{"saveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, tr(scribus_savedoc__doc__)},
+	{"savePageAsEPS", scribus_savepageeps, METH_VARARGS, tr(scribus_savepageeps__doc__)},
+	{"scaleGroup", scribus_scalegroup, METH_VARARGS, tr(scribus_scalegroup__doc__)},
+	{"scaleImage", scribus_scaleimage, METH_VARARGS, tr(scribus_scaleimage__doc__)},
+	{"selectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, tr(scribus_selcount__doc__)},
+	{"selectObject", scribus_selectobj, METH_VARARGS, tr(scribus_selectobj__doc__)},
+	{"selectText", scribus_selecttext, METH_VARARGS, tr(scribus_selecttext__doc__)},
+	{"sentToLayer", scribus_senttolayer, METH_VARARGS, tr(scribus_senttolayer__doc__)},
+	{"setActiveLayer", scribus_setactlayer, METH_VARARGS, tr(scribus_setactlayer__doc__)},
+	{"setColumnGap", scribus_setcolumngap, METH_VARARGS, tr(scribus_setcolumngap__doc__)},
+	{"setColumns", scribus_setcolumns, METH_VARARGS, tr(scribus_setcolumns__doc__)},
+	{"setCornerRadius", scribus_setcornerrad, METH_VARARGS, tr(scribus_setcornerrad__doc__)},
+	{"setCursor", scribus_setcursor, METH_VARARGS, tr(scribus_setcursor__doc__)},
+	{"setDocType", scribus_setdoctype, METH_VARARGS, tr(scribus_setdoctype__doc__)},
+	{"setFillColor", scribus_setfillcolor, METH_VARARGS, tr(scribus_setfillcolor__doc__)},
+	{"setFillShade", scribus_setfillshade, METH_VARARGS, tr(scribus_setfillshade__doc__)},
+	{"setFont", scribus_setfont, METH_VARARGS, tr(scribus_setfont__doc__)},
+	{"setFontSize", scribus_setfontsize, METH_VARARGS, tr(scribus_setfontsize__doc__)},
+	{"setGradientFill", scribus_setgradfill, METH_VARARGS, tr(scribus_setgradfill__doc__)},
+	{"setHGuides", scribus_setHguides, METH_VARARGS, tr(scribus_setHguides__doc__)},
+	{"setInfo", scribus_setinfo, METH_VARARGS, tr(scribus_setinfo__doc__)},
+	{"setLayerPrintable", scribus_layerprint, METH_VARARGS, tr(scribus_layerprint__doc__)},
+	{"setLayerVisible", scribus_layervisible, METH_VARARGS, tr(scribus_layervisible__doc__)},
+	{"setLineCap", scribus_setlineend, METH_VARARGS, tr(scribus_setlineend__doc__)},
+	{"setLineColor", scribus_setlinecolor, METH_VARARGS, tr(scribus_setlinecolor__doc__)},
+	{"setLineJoin", scribus_setlinejoin, METH_VARARGS, tr(scribus_setlinejoin__doc__)},
+	{"setLineShade", scribus_setlineshade, METH_VARARGS, tr(scribus_setlineshade__doc__)},
+	{"setLineSpacing", scribus_setlinespace, METH_VARARGS, tr(scribus_setlinespace__doc__)},
+	{"setLineStyle", scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
+	{"setLineWidth", scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
+	{"setMargins", scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
+	{"setMultiLine", scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
 	// duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"},
-	{"setRedraw", scribus_setredraw, METH_VARARGS, scribus_setredraw__doc__},
+	{"setRedraw", scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)},
 	// missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
-	{"setStyle", scribus_setstyle, METH_VARARGS, scribus_setstyle__doc__},
-	{"setTextAlignment", scribus_setalign, METH_VARARGS, scribus_setalign__doc__},
-	{"setTextColor", scribus_settextfill, METH_VARARGS, scribus_settextfill__doc__},
-	{"setText", scribus_setboxtext, METH_VARARGS, scribus_setboxtext__doc__},
-	{"setTextShade", scribus_settextshade, METH_VARARGS, scribus_settextshade__doc__},
-	{"setTextStroke", scribus_settextstroke, METH_VARARGS, scribus_settextstroke__doc__},
-	{"setUnit", scribus_setunit, METH_VARARGS, scribus_setunit__doc__},
-	{"setVGuides", scribus_setVguides, METH_VARARGS, scribus_setVguides__doc__},
-	{"sizeObject", scribus_sizeobjabs, METH_VARARGS, scribus_sizeobjabs__doc__},
-	{"statusMessage", scribus_messagebartext, METH_VARARGS, scribus_messagebartext__doc__},
-	{"textFlowsAroundFrame", scribus_textflow, METH_VARARGS, scribus_textflow__doc__},
-	{"traceText", scribus_tracetext, METH_VARARGS, scribus_tracetext__doc__},
-	{"unGroupObject", scribus_ungroupobj, METH_VARARGS, scribus_ungroupobj__doc__},
-	{"unlinkTextFrames", scribus_unlinktextframes, METH_VARARGS, scribus_unlinktextframes__doc__},
-	{"valueDialog", scribus_valdialog, METH_VARARGS, scribus_valdialog__doc__},
+	{"setStyle", scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)},
+	{"setTextAlignment", scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)},
+	{"setTextColor", scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)},
+	{"setText", scribus_setboxtext, METH_VARARGS, tr(scribus_setboxtext__doc__)},
+	{"setTextShade", scribus_settextshade, METH_VARARGS, tr(scribus_settextshade__doc__)},
+	{"setTextStroke", scribus_settextstroke, METH_VARARGS, tr(scribus_settextstroke__doc__)},
+	{"setUnit", scribus_setunit, METH_VARARGS, tr(scribus_setunit__doc__)},
+	{"setVGuides", scribus_setVguides, METH_VARARGS, tr(scribus_setVguides__doc__)},
+	{"sizeObject", scribus_sizeobjabs, METH_VARARGS, tr(scribus_sizeobjabs__doc__)},
+	{"statusMessage", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
+	{"textFlowsAroundFrame", scribus_textflow, METH_VARARGS, tr(scribus_textflow__doc__)},
+	{"traceText", scribus_tracetext, METH_VARARGS, tr(scribus_tracetext__doc__)},
+	{"unGroupObject", scribus_ungroupobj, METH_VARARGS, tr(scribus_ungroupobj__doc__)},
+	{"unlinkTextFrames", scribus_unlinktextframes, METH_VARARGS, tr(scribus_unlinktextframes__doc__)},
+	{"valueDialog", scribus_valdialog, METH_VARARGS, tr(scribus_valdialog__doc__)},
 	// end of aliases
 	{"retval", scribus_retval, METH_VARARGS, "TODO: docstring"},
 	{"getval", scribus_getval, METH_VARARGS, "TODO: docstring"},
@@ -703,6 +720,14 @@
 	NoDocOpenError = PyErr_NewException((char*)"scribus.NoDocOpenError", ScribusException, NULL);
 	Py_INCREF(NoDocOpenError);
 	PyModule_AddObject(m, (char*)"NoDocOpenError", NoDocOpenError);
+	// wrong type of frame for operation
+	WrongFrameTypeError = PyErr_NewException((char*)"scribus.WrongFrameTypeError", ScribusException, NULL);
+	Py_INCREF(WrongFrameTypeError);
+	PyModule_AddObject(m, (char*)"WrongFrameTypeError", WrongFrameTypeError);
+	// Couldn't find named object, or no named object and no selection
+	NoValidObjectError = PyErr_NewException((char*)"scribus.NoValidObjectError", ScribusException, NULL);
+	Py_INCREF(NoValidObjectError);
+	PyModule_AddObject(m, (char*)"NoValidObjectError", NoValidObjectError);
 	// Done with exception setup
 
 	// CONSTANTS
@@ -1030,5 +1055,51 @@
 	constantAlias(d, "PAPER_LETTER", "Paper_Letter");
 	constantAlias(d, "PAPER_TABLOID", "Paper_Tabloid");
 	// end of deprecated cosntants
+
+	// Create the module-level docstring. This can be a proper unicode string, unlike
+	// the others, because we can just create a Unicode object and insert it in our
+	// module dictionary.
+	QString docstring = QObject::tr("Scribus Python interface module\n\
+		\n\
+		This module is the Python interface for Scribus. It provides functions\n\
+		to control scribus and to manipulate objects on the canvas. Each\n\
+		function is documented individually below.\n\
+		\n\
+		A few things are common across most of the interface.\n\
+		\n\
+		Most functions operate on frames. Frames are identified by their name,\n\
+		a string - they are not real Python objects. Many functions take an\n\
+		optional (non-keyword) parameter, a frame name.\n\
+		Many exceptions are also common across most functions. These are\n\
+		not currently documented in the docstring for each function.\n\
+		\n\
+		    - Many functions will raise a NoDocOpenError if you try to use them\n\
+		      without a document to operate on.\n\
+		\n\
+		    - If you do not pass a frame name to a function that requires one,\n\
+		      the function will use the currently selected frame, if any, or\n\
+		      raise a NoValidObjectError if it can't find anything to operate\n\
+		      on.\n\
+		\n\
+		    - Many functions will raise WrongFrameTypeError if you try to use them\n\
+		      on a frame type that they do not make sense with. For example, setting\n\
+		      the text colour on a graphics frame doesn't make sense, and will result\n\
+		      in this exception being raised.\n\
+		\n\
+		    - Errors resulting from calls to the underlying Python API will be\n\
+		      passed through unaltered. As such, the list of exceptions thrown by\n\
+		      any function as provided here and in its docstring is incomplete.\n\
+		\n\
+		Details of what exceptions each function may throw are provided on the\n\
+		function's documentation.\n\
+		");
+
+	// Py_UNICODE is a typedef for unsigned short
+	PyObject* uniDocStr = Py_BuildValue("u", (Py_UNICODE*)(docstring.ucs2()));
+	if (uniDocStr == NULL)
+		qDebug("Failed to create module-level docstring object!");
+	else
+		PyDict_SetItemString(d, "__doc__", uniDocStr);
+	Py_DECREF(uniDocStr);
 }
 
scripter_translate_121a.diff (63,329 bytes)   

2004-12-08 13:58

 

scripter_translate_13a.diff (65,318 bytes)   
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.11.2.10
diff -u -r1.11.2.10 cmdobj.cpp
--- cmdobj.cpp	3 Dec 2004 15:05:48 -0000	1.11.2.10
+++ cmdobj.cpp	8 Dec 2004 13:49:09 -0000
@@ -543,3 +543,18 @@
 	}
 	return styleList;
 }
+
+/*! 2004-12-08 CR
+ * Return the internal frame type number for a frame.
+ */
+PyObject* scribus_getframetype(PyObject* self, PyObject* args, PyObject* kw)
+{
+    char* frameName = "";
+    char* kwds[] = {"frame=", NULL};
+    if (!PyArg_ParseTupleAndKeywords(args, kw, "|s", kwds, &frameName))
+        return NULL;
+    PageItem *it = GetUniqueItem(QString(frameName));
+    if (it == NULL)
+        return NULL;
+    return PyInt_FromLong( (long)(it->PType) );
+}
Index: cmdobj.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.h,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 cmdobj.h
--- cmdobj.h	3 Dec 2004 15:05:48 -0000	1.6.2.4
+++ cmdobj.h	8 Dec 2004 13:49:09 -0000
@@ -185,5 +185,8 @@
 */
 PyObject *scribus_getstylenames(PyObject *self);
 
+/* Internal function not intended for general use; no docstring */
+PyObject* scribus_getframetype(PyObject* self, PyObject* args, PyObject* kw);
+
 #endif
 
Index: cmdtext.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp,v
retrieving revision 1.19.2.9
diff -u -r1.19.2.9 cmdtext.cpp
--- cmdtext.cpp	6 Dec 2004 20:03:42 -0000	1.19.2.9
+++ cmdtext.cpp	8 Dec 2004 13:49:09 -0000
@@ -11,6 +11,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font size of non-text frame.","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
@@ -19,8 +24,6 @@
 	}
 	else
 		return PyFloat_FromDouble(static_cast<long>(it->ISize / 10.0));
-	//FIXME: How can we reach this point? Should we raise an exception instead of returning zero?
-	return PyFloat_FromDouble(0.0);
 }
 
 PyObject *scribus_getfont(PyObject *self, PyObject* args)
@@ -33,6 +36,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font of non-text frame.","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
@@ -41,8 +49,6 @@
 	}
 	else
 		return PyString_FromString(it->IFont);
-	//FIXME: How do we reach this point? Should we be raising an exception instead of returning ""?
-	return PyString_FromString("");
 }
 
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args)
@@ -53,7 +59,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Ptext.count())) : NULL;
+	if (i == NULL)
+		return NULL;
+	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text size of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyInt_FromLong(static_cast<long>(i->Ptext.count()));
 }
 
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args)
@@ -64,7 +77,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Cols)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column count of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyInt_FromLong(static_cast<long>(i->Cols));
 }
 
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args)
@@ -75,7 +95,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->LineSp)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get line space of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyFloat_FromDouble(static_cast<double>(i->LineSp));
 }
 
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args)
@@ -86,7 +113,14 @@
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->ColGap)) : NULL;
+	if (i == NULL)
+		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column gap of non-text frame.","python error"));
+		return NULL;
+	}
+	return PyFloat_FromDouble(static_cast<double>(i->ColGap));
 }
 
 PyObject *scribus_getframetext(PyObject *self, PyObject* args)
@@ -100,6 +134,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error"));
+		return NULL;
+	}
 	for (uint a = 0; a < it->Ptext.count(); a++)
 	{
 		if (it->HasSel)
@@ -112,7 +151,6 @@
 			text += it->Ptext.at(a)->ch;
 		}
 	}
-	//qDebug(text);		disabled by cr 2004-11-11
 	return PyString_FromString(text);
 }
 
@@ -127,6 +165,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error"));
+		return NULL;
+	}
 	PageItem *is = NULL;
 	// Scan backwards to find the first frame in a linked series
 	while (it->BackBox != 0)
@@ -136,7 +179,9 @@
 		{
 			// While GetUniqueItem has already set an exception, we'll
 			// overwrite that with a more suitable one for this particular case.
-			PyErr_SetString(PyExc_RuntimeError, QString("(System Error) Broken linked frame series when scanning back"));
+			// Not making this translatable, since it shouldnt' be seen and it's more important for
+			// us to be able to understand the error if it's reported.
+			PyErr_SetString(ScribusException, QString("(System Error) Broken linked frame series when scanning back"));
 			return NULL;
 		}
 		it = is;
@@ -162,6 +207,8 @@
 		{
 			// While GetUniqueItem has already set an exception, we'll
 			// overwrite that with a more suitable one for this particular case.
+			// Not making this translatable, since it shouldnt' be seen and it's more important for
+			// us to be able to understand the error if it's reported.
 			PyErr_SetString(ScribusException, QString("(System Error) Broken linked frame series when scanning forward"));
 			return NULL;
 		}
@@ -194,6 +241,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set text of non-text frame.","python error"));
+		return NULL;
+	}
 	QString Daten = QString::fromUtf8(Text);
 	PyMem_Free(Text);
 	if (it->NextBox != 0)
@@ -248,11 +300,16 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot insert text into non-text frame.","python error"));
+		return NULL;
+	}
 	QString Daten = QString::fromUtf8(Text);
 	PyMem_Free(Text);
 	if ((pos < 0) && (pos > static_cast<int>(it->Ptext.count())))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Insert index out of bounds"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Insert index out of bounds","python error"));
 		return NULL;
 	}
 	for (uint a = 0; a < Daten.length(); ++a)
@@ -295,15 +352,15 @@
 		return NULL;
 	if ((alignment > 4) || (alignment < 0))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Alignment out of range. Use one of the scribus.ALIGN* constants."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of range. Use one of the scribus.ALIGN* constants.","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
-	if (i->PType == 4)
+	if (i->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Can't set text alignment on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text alignment on a non-text frame","python error"));
 		return NULL;
 	}
 	int Apm = Carrier->doc->AppMode;
@@ -328,16 +385,16 @@
 		return NULL;
 	if ((size > 512) || (size < 1))
 	{
-		PyErr_SetString(ScribusException, QString("Font size out of bounds - must be 1 <= size <= 512"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Font size out of bounds - must be 1 <= size <= 512","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
 	
-	if (i->PType == 4)
+	if (i->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Can't set text alignment on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font size on a non-text frame","python error"));
 		return NULL;
 	}
 	int Apm = Carrier->doc->AppMode;
@@ -363,9 +420,9 @@
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
-	if (i->PType != 4)
+	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
 	{
-		PyErr_SetString(ScribusException, QString("Can't set font on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font on a non-text frame","python error"));
 		return NULL;
 	}
 	if (Carrier->Prefs.AvailFonts.find(QString(Font)))
@@ -381,7 +438,7 @@
 	}
 	else
 	{
-		PyErr_SetString(ScribusException, QString("Font not found"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -398,12 +455,17 @@
 		return NULL;
 	if (w < 0.1)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line space out of bounds, must be >= 0.1"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line space out of bounds, must be >= 0.1","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't line spacing on a non-text frame","python error"));
+		return NULL;
+	}
 	i->LineSp = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -419,12 +481,17 @@
 		return NULL;
 	if (w < 0.0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Column gap out of bounds, must be positive"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Column gap out of bounds, must be positive","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't column gap on a non-text frame","python error"));
+		return NULL;
+	}
 	i->ColGap = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -440,12 +507,17 @@
 		return NULL;
 	if (w < 1)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Column count out of bounds, must be > 1"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Column count out of bounds, must be > 1","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
 	if (i == NULL)
 		return NULL;
+	if (i->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't number of columns on a non-text frame","python error"));
+		return NULL;
+	}
 	i->Cols = w;
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -464,7 +536,12 @@
 		return NULL;
 	if ((start < 0) || ((start + ende) > static_cast<int>(it->Ptext.count()-1)))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Selection index out of bounds"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Selection index out of bounds","python error"));
+		return NULL;
+	}
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't select text in a non-text frame","python error"));
 		return NULL;
 	}
 	/* FIXME: not sure if we should make this check or not
@@ -499,6 +576,11 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't delete text from a non-text frame","python error"));
+		return NULL;
+	}
 	if (it->HasSel)
 		Carrier->DeleteSel(it);
 	else
@@ -521,7 +603,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text fill on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 		{
@@ -535,11 +622,6 @@
 		}
 		it->TxtFill = QString(Color);
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text color"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -555,7 +637,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text stroke on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 		{
@@ -569,11 +656,6 @@
 		}
 		it->TxtStroke = QString(Color);
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text color"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -594,7 +676,12 @@
 	PageItem *it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->PType == 4) || (it->PType == 8))
+	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text shade on a non-text frame","python error"));
+		return NULL;
+	}
+	else
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
@@ -608,11 +695,6 @@
 		}
 	it->ShTxtFill = w;
 	}
-	else
-	{
-		PyErr_SetString(ScribusException, QString("Wrong frame type, can't set text shade"));
-		return NULL;
-	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -632,24 +714,29 @@
 	PageItem *toitem = GetUniqueItem(QString(name2));
 	if (toitem == NULL)
 		return NULL;
+	if ((fromitem->PType != FRAME_TEXT) || (toitem->PType != FRAME_TEXT))
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can only link text frames","python error"));
+		return NULL;
+	}
 	if (toitem->Ptext.count())
 	{
-		PyErr_SetString(ScribusException, QString("Target frame must be empty"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame must be empty","python error"));
 		return NULL;
 	}
 	if (toitem->NextBox != 0)
 	{
-		PyErr_SetString(ScribusException, QString("Target frame links to another frame"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame links to another frame","python error"));
 		return NULL;
 	}
 	if (toitem->BackBox != 0)
 	{
-		PyErr_SetString(ScribusException, QString("Target frame is linked to by another frame"));
+		PyErr_SetString(ScribusException, QObject::tr("Target frame is linked to by another frame","python error"));
 		return NULL;
 	}
 	if (toitem == fromitem)
 	{
-		PyErr_SetString(ScribusException, QString("Source and target are the same object"));
+		PyErr_SetString(ScribusException, QObject::tr("Source and target are the same object","python error"));
 		return NULL;
 	}
 	// references to the others boxes
@@ -672,15 +759,20 @@
 	PageItem *item = GetUniqueItem(name);
 	if (item == NULL)
 		return NULL;
+	if (item->PType != FRAME_TEXT)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't unlink a non-text frame","python error"));
+		return NULL;
+	}
 	// only linked
 	if (item->BackBox == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Object is not a linked text frame, can't unlink."));
+		PyErr_SetString(ScribusException, QObject::tr("Object is not a linked text frame, can't unlink.","python error"));
 		return NULL;
 	}
 	if (item->NextBox == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Object the last frame in a series, can't unlink."));
+		PyErr_SetString(ScribusException, QObject::tr("Object the last frame in a series, can't unlink. Unlink the previous frame instead.","python error"));
 		return NULL;
 	}
 	PageItem* nextbox = item->NextBox;
@@ -719,9 +811,9 @@
 	PageItem *item = GetUniqueItem(QString(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType == 4)
+	if (item->PType != FRAME_TEXT)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot convert a non-text frame to outlines"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't convert a non-text frame to outlines","python error"));
 		return NULL;
 	}
 	Carrier->view->Deselect(true);
Index: cmdtext.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.h,v
retrieving revision 1.6.2.3
diff -u -r1.6.2.3 cmdtext.h
--- cmdtext.h	3 Dec 2004 15:05:48 -0000	1.6.2.3
+++ cmdtext.h	8 Dec 2004 13:49:10 -0000
@@ -8,201 +8,264 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfontsize__doc__,
-    "getFontSize([\"name\"]) -> float\n\n\
-Returns the fontsize for the textframe \"name\". If this\
-textframe has some text selected the value assigned to\
-the first character of the selection is returned.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFontSize([\"name\"]) -> float\n\
+\n\
+Returns the font size in points for the text frame \"name\". If this text\n\
+frame has some text selected the value assigned to the first character of\n\
+the selection is returned.\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get font size */
 PyObject *scribus_getfontsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfont__doc__,
-    "getFont([\"name\"]) -> string\n\n\
-Returns the font for the textframe \"name\". If this\
-textframe has some text selected the value assigned to the\
-first character of the selection is returned. If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getFont([\"name\"]) -> string\n\
+\n\
+Returns the font name for the text frame \"name\". If this text frame\n\
+has some text selected the value assigned to the first character\n\
+of the selection is returned. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Get font */
 PyObject *scribus_getfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gettextsize__doc__,
-    "getTextLength([\"name\"]) -> integer\n\n\
-Returns the length of the text in the textframe \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getTextLength([\"name\"]) -> integer\n\
+\n\
+Returns the length of the text in the text frame \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get text size */
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getframetext__doc__,
-    "getText([\"name\"]) -> string\n\n\
-Returns the text of the textframe \"name\". If this textframe\
-has some text selected, this text is returned. If \"name\" is\
-not given the currently selected item is used.");
+QT_TR_NOOP("getText([\"name\"]) -> string\n\
+\n\
+Returns the text of the text frame \"name\". If this text frame has some text\n\
+selected, the selected text is returned. All text in the frame, not just\n\
+currently visible text, is returned. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Get frame text */
 PyObject *scribus_getframetext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gettext__doc__,
-    "getAllText([\"name\"]) -> string\n\n\
-Returns the text of the textframe \"name\" and of all\
-textframes which are linked with this frame. If this textframe\
-has some text selected, this text is returned. If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getAllText([\"name\"]) -> string\n\
+\n\
+Returns the text of the text frame \"name\" and of all text frames which are\n\
+linked with this frame. If this textframe has some text selected, the selected\n\
+text is returned. If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Get all text */
 PyObject *scribus_gettext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinespace__doc__,
-    "getLineSpacing([\"name\"]) -> float\n\n\
-Gets the linespacing of the text frame \"name\" expressed\
-in points. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("getLineSpacing([\"name\"]) -> float\n\
+\n\
+Returns the line spacing (\"leading\") of the text frame \"name\" expressed in\n\
+points. If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get line space */
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolumngap__doc__,
-    "getColumnGap([\"name\"]) -> float\n\n\
-Gets the column gap of the text frame \"name\" expressed\
-in points. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("getColumnGap([\"name\"]) -> float\n\
+\n\
+Returns the column gap size of the text frame \"name\" expressed in points. If\n\
+\"name\" is not given the currently selected item is used.\n\
+"));
 /*! Get column gap */
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolumns__doc__,
-    "getColumns([\"name\"]) -> integer\n\n\
-Gets the number of columns of the text frame \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getColumns([\"name\"]) -> integer\n\
+\n\
+Gets the number of columns of the text frame \"name\". If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Get columns */
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setboxtext__doc__,
-    "setText(\"text\", [\"name\"])\n\n\
-Sets the text of the text frame \"name\" to the text of the\
-string \"text\". Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2').\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setText(\"text\", [\"name\"])\n\
+\n\
+Sets the text of the text frame \"name\" to the text of the string \"text\".\n\
+Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2'). See the FAQ\n\
+for more details. If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Set text */
 PyObject *scribus_setboxtext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_inserttext__doc__,
-    "insertText(\"text\", pos, [\"name\"])\n\n\
-Inserts the text \"text\" at the position \"pos\" into the textframe.\
-Text must be UTF encoded (see setText() as reference)\
-The first character has an index of 0. \"name\" If \"name\" is not\
-given the currently selected Item is used.");
+QT_TR_NOOP("insertText(\"text\", pos, [\"name\"])\n\
+\n\
+Inserts the text \"text\" at the position \"pos\" into the text frame. Text\n\
+must be UTF encoded (see setText() as reference) The first character has an\n\
+index of 0. \"name\" If \"name\" is not given the currently selected Item is\n\
+used.\n\
+\n\
+May throw IndexError for an insertion out of bounds.\n\
+"));
 /*! Insert text */
 PyObject *scribus_inserttext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfont__doc__,
-    "setFont(\"font\", [\"name\"])\n\n\
-Sets the font of the text frame \"name\" to \"font\", if there\
-is some text selected only the selected text is changed.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setFont(\"font\", [\"name\"])\n\
+\n\
+Sets the font of the text frame \"name\" to \"font\". If there is some text\n\
+selected only the selected text is changed.  If \"name\" is not given the\n\
+currently selected item is used.\n\
+\n\
+May throw ValueError if the font cannot be found.\n\
+"));
 /*! Set font */
 PyObject *scribus_setfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfontsize__doc__,
-    "setFontSize(size, [\"name\"])\n\n\
-Sets the fontsize of the text frame \"name\" to the pointsize\
-\"size\", if there is some text selected only the selected Text\
-is changed. \"size\" must be in the Range 1 to 512. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("setFontSize(size, [\"name\"])\n\
+\n\
+Sets the font size of the text frame \"name\" to \"size\". \"size\" is treated\n\
+as a value in points. If there is some text selected only the selected text is\n\
+changed. \"size\" must be in the range 1 to 512. If \"name\" is not given the\n\
+currently selected item is used.\n\
+\n\
+May throw ValueError for a font size that's out of bounds.\n\
+"));
 /*! Set font size */
 PyObject *scribus_setfontsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinespace__doc__,
-    "setLineSpacing(size, [\"name\"])\n\n\
-Sets the linespacing of the text frame \"name\" to the pointsize\
-\"size\". If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setLineSpacing(size, [\"name\"])\n\
+\n\
+Sets the line spacing (\"leading\") of the text frame \"name\" to \"size\".\n\
+\"size\" is a value in points. If \"name\" is not given the currently selected\n\
+item is used.\n\
+\n\
+May throw ValueError if the line spacing is out of bounds.\n\
+"));
 /*! Set line space */
 PyObject *scribus_setlinespace(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolumngap__doc__,
-    "setColumnGap(size, [\"name\"])\n\n\
-Sets the column gap of the text frame \"name\" to the value \"size\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setColumnGap(size, [\"name\"])\n\
+\n\
+Sets the column gap of the text frame \"name\" to the value \"size\". If\n\
+\"name\" is not given the currently selected item is used.\n\
+\n\
+May throw ValueError if the column gap is out of bounds (must be positive).\n\
+"));
 /*! Set column gap */
 PyObject *scribus_setcolumngap(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolumns__doc__,
-    "setColumns(nr, [\"name\"])\n\n\
-Sets the number of columns of the text frame \"name\"\
-to the value \"nr\". If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setColumns(nr, [\"name\"])\n\
+\n\
+Sets the number of columns of the text frame \"name\" to the integer \"nr\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May throw ValueError if number of columns is not at least one.\n\
+"));
 /*! Set columns */
 PyObject *scribus_setcolumns(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setalign__doc__,
-    "setTextAlignment(align, [\"name\"])\n\n\
-Sets the text alignment of the text frame \"name\" to the specified\
-alignment. If \"name\" is not given the currently selected item is\
-used. \"align\" can have the defined constants - see ALIGN_<type>.");
+QT_TR_NOOP("setTextAlignment(align, [\"name\"])\n\
+\n\
+Sets the text alignment of the text frame \"name\" to the specified alignment.\n\
+If \"name\" is not given the currently selected item is used. \"align\" should\n\
+be one of the ALIGN_ constants defined in this module - see dir(scribus).\n\
+\n\
+May throw ValueError for an invalid alignment constant.\n\
+"));
 /*! Set alignt */
 PyObject *scribus_setalign(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selecttext__doc__,
-    "selectText(start, count, [\"name\"])\n\n\
-Selects \"count\" characters text of the text frame \"name\"\
-starting from the character \"start\". Character counting starts\
-at 0. If \"count\" is zero, any text selection will be cleared.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("selectText(start, count, [\"name\"])\n\
+\n\
+Selects \"count\" characters of text in the text frame \"name\" starting from the\n\
+character \"start\". Character counting starts at 0. If \"count\" is zero, any\n\
+text selection will be cleared.  If \"name\" is not given the currently\n\
+selected item is used.\n\
+\n\
+May throw IndexError if the selection is outside the bounds of the text.\n\
+"));
 /*! Select text */
 PyObject *scribus_selecttext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deletetext__doc__,
-    "deleteText([\"name\"])\n\n\
-Deletes the text of the text frame \"name\". If there is some\
-text selected, this text will be deleted. If \"name\" is not\
-given the currently selected Item is used.");
+QT_TR_NOOP("deleteText([\"name\"])\n\
+\n\
+Deletes any text in the text frame \"name\". If there is some text selected,\n\
+only the selected text will be deleted. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Delete text */
 PyObject *scribus_deletetext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextfill__doc__,
-    "setTextColor(\"color\", [\"name\"])\n\n\
-Sets the text color of the object \"name\" to the color\
-\"color\", if there is some text selected only the selected\
-text is changed. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setTextColor(\"color\", [\"name\"])\n\
+\n\
+Sets the text color of the text frame \"name\" to the color \"color\". If there\n\
+is some text selected only the selected text is changed. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Set text fill */
 PyObject *scribus_settextfill(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextstroke__doc__,
-    "setTextStroke(\"color\", [\"name\"])\n\n\
-Set \"color\" of the text stroke. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setTextStroke(\"color\", [\"name\"])\n\
+\n\
+Set \"color\" of the text stroke. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Set text stroke */
 PyObject *scribus_settextstroke(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_settextshade__doc__,
-    "setTextShade(shade, [\"name\"])\n\n\
-Sets the shading of the text color of the object \"name\" to \"shade\",\
-if there is some text selected only the selected text is changed. \"shade\"\
-must be an integer value in the range from 0 (lightest) to 100 (full\
-color intensity). If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("setTextShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the text color of the object \"name\" to \"shade\". If\n\
+there is some text selected only the selected text is changed. \"shade\" must\n\
+be an integer value in the range from 0 (lightest) to 100 (full color\n\
+intensity). If \"name\" is not given the currently selected item is\n\
+used.\n\
+"));
 /*! Set text shde */
 PyObject *scribus_settextshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_linktextframes__doc__,
-    "linkTextFrames(\"name1\", \"name2\")\n\n\
-Create the linked text frames. Parameters are the object names.");
+QT_TR_NOOP("linkTextFrames(\"fromname\", \"toname\")\n\
+\n\
+Link two text frames. The frame named \"fromname\" is linked to the\n\
+frame named \"toname\". The target frame must be an empty text frame\n\
+and must not link to or be linked from any other frames already.\n\
+\n\
+May throw ScribusException if linking rules are violated.\n\
+"));
 /**
  Link text frames via Scripter.
  02/22/04 (petr vanek)
@@ -212,8 +275,14 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_unlinktextframes__doc__,
-    "linkTextFrames(\"name\")\n\n\
-Remove the specified (named) object from the text frame flow/linkage.");
+QT_TR_NOOP("unlinkTextFrames(\"name\")\n\
+\n\
+Remove the specified (named) object from the text frame flow/linkage. If the\n\
+frame was in the middle of a chain, the previous and next frames will be\n\
+connected, eg 'a->b->c' becomes 'a->c' when you unlinkTextFrames(b)'\n\
+\n\
+May throw ScribusException if linking rules are violated.\n\
+"));
 /**
  (Un)Link text frames via Scripter.
  02/22/04 (petr vanek)
@@ -223,9 +292,10 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_tracetext__doc__,
-    "traceText([\"name\"])\n\n\
-Convert the text frame \"name\" to outlines. If \"name\" is not\
-given the currently selected item is used.");
+QT_TR_NOOP("traceText([\"name\"])\n\
+\n\
+Convert the text frame \"name\" to outlines. If \"name\" is not given the\n\
+currently selected item is used."));
 /**
  Trace text frames via Scripter.
  2004-09-07 (Craig Ringer)
Index: cmdutil.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp,v
retrieving revision 1.6.2.6
diff -u -r1.6.2.6 cmdutil.cpp
--- cmdutil.cpp	3 Dec 2004 15:05:48 -0000	1.6.2.6
+++ cmdutil.cpp	8 Dec 2004 13:49:10 -0000
@@ -137,7 +137,7 @@
 			return Carrier->view->SelItem.at(0);
 		else
 		{
-			PyErr_SetString(ScribusException, QString("Can't use empty string for object name when there is no selection"));
+			PyErr_SetString(NoValidObjectError, QString("Can't use empty string for object name when there is no selection"));
 			return NULL;
 		}
 	for (uint j = 0; j<Carrier->doc->Items.count(); j++)
@@ -145,7 +145,7 @@
 		if (name==Carrier->doc->Items.at(j)->AnName)
 			return Carrier->doc->Items.at(j);
 	} // for items
-	PyErr_SetString(ScribusException, QString("Object not found"));
+	PyErr_SetString(NoValidObjectError, QString("Object not found"));
 	return NULL;
 }
 
Index: cmdvar.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdvar.h,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 cmdvar.h
--- cmdvar.h	3 Dec 2004 15:05:48 -0000	1.6.2.4
+++ cmdvar.h	8 Dec 2004 13:49:10 -0000
@@ -4,6 +4,14 @@
 #include <Python.h>
 #include "scribus.h"
 
+/* These will go away in 1.3, but help readability in 1.2.1 code a LOT */
+#define FRAME_IMAGE 2
+#define FRAME_TEXT 4
+#define FRAME_LINE 5
+#define FRAME_VECTOR 6
+#define FRAME_POLYLINE 7
+#define FRAME_PATHTEXT 8
+
 /* Static global Variables */
 extern ScribusApp* Carrier;
 
@@ -12,9 +20,10 @@
 extern PyObject* ScribusException;
 /*! Exception raised when no document opened - see checkHaveDocument() in cmdutil.cpp */
 extern PyObject* NoDocOpenError;
-
-/* Gross solution to compat with 1.2.1 scripts - track the 'current page' internally */
-extern int currentPage;
+/*! Exception raised when an operation is performed on a frame type that doesn't support it.*/
+extern PyObject* WrongFrameTypeError;
+/*! Exception raised by GetUniqueItem when it can't find a valid frame or a suitable selection to use. */
+extern PyObject* NoValidObjectError;
 
 #endif
 
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.33.2.22
diff -u -r1.33.2.22 scriptplugin.cpp
--- scriptplugin.cpp	6 Dec 2004 20:03:42 -0000	1.33.2.22
+++ scriptplugin.cpp	8 Dec 2004 13:49:10 -0000
@@ -52,9 +52,13 @@
 #include <qtextstream.h>
 #include <cstdlib>
 
+#include <iostream>
+
 // Exceptions; visible from cmdvar.h, set up in initscribus()
 PyObject* ScribusException;
 PyObject* NoDocOpenError;
+PyObject* WrongFrameTypeError;
+PyObject* NoValidObjectError;
 
 QString Name()
 {
@@ -525,159 +529,173 @@
 	return PyString_FromString(InValue);
 }
 
+/*!
+ * Translate a docstring. Small helper function for use with the
+ * PyMethodDef struct.
+ */
+char* tr(const char* docstringConstant)
+{
+    // Alas, there's a lot of wasteful string copying going on
+    // here.
+    QString translated = QObject::tr(docstringConstant, "scripter docstring");
+    const char* trch = translated.latin1();
+    return strndup(trch, strlen(trch));
+}
+
 /* Now we're using the more pyhtonic convention for names:
 	class - ClassName
 	procedure/function/method - procedureName
 etc. */
-static PyMethodDef scribus_methods[] = {
+PyMethodDef scribus_methods[] = {
 	// 2004/10/03 pv - aliases with common Python syntax - ClassName methodName
 	// 2004-11-06 cr - move aliasing to dynamically generated wrapper functions, sort methoddef
-	{"changeColor", scribus_setcolor, METH_VARARGS, scribus_setcolor__doc__},
-	{"closeDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, scribus_closedoc__doc__},
-	{"createBezierLine", scribus_bezierline, METH_VARARGS, scribus_bezierline__doc__},
-	{"createEllipse", scribus_newellipse, METH_VARARGS, scribus_newellipse__doc__},
-	{"createImage", scribus_newimage, METH_VARARGS, scribus_newimage__doc__},
-	{"createLayer", scribus_createlayer, METH_VARARGS, scribus_createlayer__doc__},
-	{"createLine", scribus_newline, METH_VARARGS, scribus_newline__doc__},
-	{"createPathText", scribus_pathtext, METH_VARARGS, scribus_pathtext__doc__},
-	{"createPolygon", scribus_polygon, METH_VARARGS, scribus_polygon__doc__},
-	{"createPolyLine", scribus_polyline, METH_VARARGS, scribus_polyline__doc__},
-	{"createRect", scribus_newrect, METH_VARARGS, scribus_newrect__doc__},
-	{"createText", scribus_newtext, METH_VARARGS, scribus_newtext__doc__},
-	{"currentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, scribus_actualpage__doc__},
-	{"defineColor", scribus_newcolor, METH_VARARGS, scribus_newcolor__doc__},
-	{"deleteColor", scribus_delcolor, METH_VARARGS, scribus_delcolor__doc__},
-	{"deleteLayer", scribus_removelayer, METH_VARARGS, scribus_removelayer__doc__},
-	{"deleteObject", scribus_deleteobj, METH_VARARGS, scribus_deleteobj__doc__},
-	{"deletePage", scribus_deletepage, METH_VARARGS, scribus_deletepage__doc__},
-	{"deleteText", scribus_deletetext, METH_VARARGS, scribus_deletetext__doc__},
-	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, scribus_deselect__doc__},
-	{"docChanged", scribus_docchanged, METH_VARARGS, scribus_docchanged__doc__},
-	{"fileDialog", scribus_filedia, METH_VARARGS, scribus_filedia__doc__},
-	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, scribus_getactlayer__doc__},
-	{"getAllObjects", scribus_getallobj, METH_VARARGS, scribus_getallobj__doc__},
-	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, scribus_getstylenames__doc__},
-	{"getAllText", scribus_gettext, METH_VARARGS, scribus_gettext__doc__},
-	{"getColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, scribus_colornames__doc__},
-	{"getColor", scribus_getcolor, METH_VARARGS, scribus_getcolor__doc__},
-	{"getColumnGap", scribus_getcolumngap, METH_VARARGS, scribus_getcolumngap__doc__},
-	{"getColumns", scribus_getcolumns, METH_VARARGS, scribus_getcolumns__doc__},
-	{"getCornerRadius", scribus_getcornerrad, METH_VARARGS, scribus_getcornerrad__doc__},
-	{"getFillColor", scribus_getfillcolor, METH_VARARGS, scribus_getfillcolor__doc__},
-	{"getFillShade", scribus_getfillshade, METH_VARARGS, scribus_getfillshade__doc__},
-	{"getFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, scribus_fontnames__doc__},
-	{"getFont", scribus_getfont, METH_VARARGS, scribus_getfont__doc__},
-	{"getFontSize", scribus_getfontsize, METH_VARARGS, scribus_getfontsize__doc__},
-	{"getGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, scribus_getlanguage__doc__},
-	{"getHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, scribus_getHguides__doc__},
-	{"getImageFile", scribus_getimgname, METH_VARARGS, scribus_getimgname__doc__},
-	{"getImageScale", scribus_getimgscale, METH_VARARGS, scribus_getimgscale__doc__},
-	{"getLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, scribus_getlayers__doc__},
-	{"getLineCap", scribus_getlineend, METH_VARARGS, scribus_getlineend__doc__},
-	{"getLineColor", scribus_getlinecolor, METH_VARARGS, scribus_getlinecolor__doc__},
-	{"getLineJoin", scribus_getlinejoin, METH_VARARGS, scribus_getlinejoin__doc__},
-	{"getLineShade", scribus_getlineshade, METH_VARARGS, scribus_getlineshade__doc__},
-	{"getLineSpacing", scribus_getlinespace, METH_VARARGS, scribus_getlinespace__doc__},
-	{"getLineStyle", scribus_getlinestyle, METH_VARARGS, scribus_getlinestyle__doc__},
-	{"getLineWidth", scribus_getlinewidth, METH_VARARGS, scribus_getlinewidth__doc__},
-	{"getPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, scribus_getpageitems__doc__},
-	{"getPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, scribus_getpagemargins__doc__},
-	{"getPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, scribus_pagedimension__doc__}, // just an alias to PageDimension()
-	{"getPosition", scribus_getposi, METH_VARARGS, scribus_getposi__doc__},
-	{"getRotation", scribus_getrotation, METH_VARARGS, scribus_getrotation__doc__},
-	{"getSelectedObject", scribus_getselobjnam, METH_VARARGS, scribus_getselobjnam__doc__},
-	{"getSize", scribus_getsize, METH_VARARGS, scribus_getsize__doc__},
-	{"getTextColor", scribus_getlinecolor, METH_VARARGS, scribus_getlinecolor__doc__},
-	{"getTextLength", scribus_gettextsize, METH_VARARGS, scribus_gettextsize__doc__},
-	{"getText", scribus_getframetext, METH_VARARGS, scribus_getframetext__doc__},
-	{"getTextShade", scribus_getlineshade, METH_VARARGS, scribus_getlineshade__doc__},
-	{"getUnit", (PyCFunction)scribus_getunit, METH_NOARGS, scribus_getunit__doc__},
-	{"getVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, scribus_getVguides__doc__},
-	{"getXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, scribus_xfontnames__doc__},
-	{"gotoPage", scribus_gotopage, METH_VARARGS, scribus_gotopage__doc__},
-	{"groupObjects", scribus_groupobj, METH_VARARGS, scribus_groupobj__doc__},
-	{"haveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, scribus_havedoc__doc__},
-	{"insertText", scribus_inserttext, METH_VARARGS, scribus_inserttext__doc__},
-	{"isLayerPrintable", scribus_glayerprint, METH_VARARGS, scribus_glayerprint__doc__},
-	{"isLayerVisible", scribus_glayervisib, METH_VARARGS, scribus_glayervisib__doc__},
-	{"isLocked", scribus_islocked, METH_VARARGS, scribus_islocked__doc__},
-	{"linkTextFrames", scribus_linktextframes, METH_VARARGS, scribus_linktextframes__doc__},
-	{"loadImage", scribus_loadimage, METH_VARARGS, scribus_loadimage__doc__},
-	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, scribus_loadstylesfromfile__doc__},
-	{"lockObject", scribus_lockobject, METH_VARARGS, scribus_lockobject__doc__},
-	{"messagebarText", scribus_messagebartext, METH_VARARGS, scribus_messagebartext__doc__},
-	{"messageBox", scribus_messdia, METH_VARARGS, scribus_messdia__doc__},
-	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, scribus_moveobjabs__doc__},
-	{"moveObject", scribus_moveobjrel, METH_VARARGS, scribus_moveobjrel__doc__},
-	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, scribus_newdocdia__doc__},
-	{"newDoc", scribus_newdoc, METH_VARARGS, scribus_newdoc__doc__},
-	{"newPage", scribus_newpage, METH_VARARGS, scribus_newpage__doc__},
-	{"objectExists",scribus_objectexists, METH_VARARGS, scribus_objectexists__doc__},
-	{"openDoc", scribus_opendoc, METH_VARARGS, scribus_opendoc__doc__},
-	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, scribus_pagecount__doc__},
-	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, scribus_pagedimension__doc__},
-	{"progressReset", scribus_progressreset, METH_VARARGS, scribus_progressreset__doc__},
-	{"progressSet", scribus_progresssetprogress, METH_VARARGS, scribus_progresssetprogress__doc__},
-	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, scribus_progresssettotalsteps__doc__},
-	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, scribus_redraw__doc__},
-	{"renderFont", scribus_renderfont, METH_VARARGS, scribus_renderfont__doc__},
-	{"replaceColor", scribus_replcolor, METH_VARARGS, scribus_replcolor__doc__},
-	{"rotateObjectAbs", scribus_rotobjabs, METH_VARARGS, scribus_rotobjabs__doc__},
-	{"rotateObject", scribus_rotobjrel, METH_VARARGS, scribus_rotobjrel__doc__},
-	{"saveDocAs", scribus_savedocas, METH_VARARGS, scribus_savedocas__doc__},
-	{"saveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, scribus_savedoc__doc__},
-	{"savePageAsEPS", scribus_savepageeps, METH_VARARGS, scribus_savepageeps__doc__},
-	{"scaleGroup", scribus_scalegroup, METH_VARARGS, scribus_scalegroup__doc__},
-	{"scaleImage", scribus_scaleimage, METH_VARARGS, scribus_scaleimage__doc__},
-	{"selectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, scribus_selcount__doc__},
-	{"selectObject", scribus_selectobj, METH_VARARGS, scribus_selectobj__doc__},
-	{"selectText", scribus_selecttext, METH_VARARGS, scribus_selecttext__doc__},
-	{"sentToLayer", scribus_senttolayer, METH_VARARGS, scribus_senttolayer__doc__},
-	{"setActiveLayer", scribus_setactlayer, METH_VARARGS, scribus_setactlayer__doc__},
-	{"setColumnGap", scribus_setcolumngap, METH_VARARGS, scribus_setcolumngap__doc__},
-	{"setColumns", scribus_setcolumns, METH_VARARGS, scribus_setcolumns__doc__},
-	{"setCornerRadius", scribus_setcornerrad, METH_VARARGS, scribus_setcornerrad__doc__},
-	{"setCursor", scribus_setcursor, METH_VARARGS, scribus_setcursor__doc__},
-	{"setDocType", scribus_setdoctype, METH_VARARGS, scribus_setdoctype__doc__},
-	{"setFillColor", scribus_setfillcolor, METH_VARARGS, scribus_setfillcolor__doc__},
-	{"setFillShade", scribus_setfillshade, METH_VARARGS, scribus_setfillshade__doc__},
-	{"setFont", scribus_setfont, METH_VARARGS, scribus_setfont__doc__},
-	{"setFontSize", scribus_setfontsize, METH_VARARGS, scribus_setfontsize__doc__},
-	{"setGradientFill", scribus_setgradfill, METH_VARARGS, scribus_setgradfill__doc__},
-	{"setHGuides", scribus_setHguides, METH_VARARGS, scribus_setHguides__doc__},
-	{"setInfo", scribus_setinfo, METH_VARARGS, scribus_setinfo__doc__},
-	{"setLayerPrintable", scribus_layerprint, METH_VARARGS, scribus_layerprint__doc__},
-	{"setLayerVisible", scribus_layervisible, METH_VARARGS, scribus_layervisible__doc__},
-	{"setLineCap", scribus_setlineend, METH_VARARGS, scribus_setlineend__doc__},
-	{"setLineColor", scribus_setlinecolor, METH_VARARGS, scribus_setlinecolor__doc__},
-	{"setLineJoin", scribus_setlinejoin, METH_VARARGS, scribus_setlinejoin__doc__},
-	{"setLineShade", scribus_setlineshade, METH_VARARGS, scribus_setlineshade__doc__},
-	{"setLineSpacing", scribus_setlinespace, METH_VARARGS, scribus_setlinespace__doc__},
-	{"setLineStyle", scribus_setlinestyle, METH_VARARGS, scribus_setlinestyle__doc__},
-	{"setLineWidth", scribus_setlinewidth, METH_VARARGS, scribus_setlinewidth__doc__},
-	{"setMargins", scribus_setmargins, METH_VARARGS, scribus_setmargins__doc__},
-	{"setMultiLine", scribus_setmultiline, METH_VARARGS, scribus_setmultiline__doc__},
+	{"changeColor", scribus_setcolor, METH_VARARGS, tr(scribus_setcolor__doc__)},
+	{"closeDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, tr(scribus_closedoc__doc__)},
+	{"createBezierLine", scribus_bezierline, METH_VARARGS, tr(scribus_bezierline__doc__)},
+	{"createEllipse", scribus_newellipse, METH_VARARGS, tr(scribus_newellipse__doc__)},
+	{"createImage", scribus_newimage, METH_VARARGS, tr(scribus_newimage__doc__)},
+	{"createLayer", scribus_createlayer, METH_VARARGS, tr(scribus_createlayer__doc__)},
+	{"createLine", scribus_newline, METH_VARARGS, tr(scribus_newline__doc__)},
+	{"createPathText", scribus_pathtext, METH_VARARGS, tr(scribus_pathtext__doc__)},
+	{"createPolygon", scribus_polygon, METH_VARARGS, tr(scribus_polygon__doc__)},
+	{"createPolyLine", scribus_polyline, METH_VARARGS, tr(scribus_polyline__doc__)},
+	{"createRect", scribus_newrect, METH_VARARGS, tr(scribus_newrect__doc__)},
+	{"createText", scribus_newtext, METH_VARARGS, tr(scribus_newtext__doc__)},
+	{"currentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, tr(scribus_actualpage__doc__)},
+	{"defineColor", scribus_newcolor, METH_VARARGS, tr(scribus_newcolor__doc__)},
+	{"deleteColor", scribus_delcolor, METH_VARARGS, tr(scribus_delcolor__doc__)},
+	{"deleteLayer", scribus_removelayer, METH_VARARGS, tr(scribus_removelayer__doc__)},
+	{"deleteObject", scribus_deleteobj, METH_VARARGS, tr(scribus_deleteobj__doc__)},
+	{"deletePage", scribus_deletepage, METH_VARARGS, tr(scribus_deletepage__doc__)},
+	{"deleteText", scribus_deletetext, METH_VARARGS, tr(scribus_deletetext__doc__)},
+	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, tr(scribus_deselect__doc__)},
+	{"docChanged", scribus_docchanged, METH_VARARGS, tr(scribus_docchanged__doc__)},
+	{"fileDialog", scribus_filedia, METH_VARARGS, tr(scribus_filedia__doc__)},
+	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
+	{"getAllObjects", scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
+	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
+	{"getAllText", scribus_gettext, METH_VARARGS, tr(scribus_gettext__doc__)},
+	{"getColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, tr(scribus_colornames__doc__)},
+	{"getColor", scribus_getcolor, METH_VARARGS, tr(scribus_getcolor__doc__)},
+	{"getColumnGap", scribus_getcolumngap, METH_VARARGS, tr(scribus_getcolumngap__doc__)},
+	{"getColumns", scribus_getcolumns, METH_VARARGS, tr(scribus_getcolumns__doc__)},
+	{"getCornerRadius", scribus_getcornerrad, METH_VARARGS, tr(scribus_getcornerrad__doc__)},
+	{"getFillColor", scribus_getfillcolor, METH_VARARGS, tr(scribus_getfillcolor__doc__)},
+	{"getFillShade", scribus_getfillshade, METH_VARARGS, tr(scribus_getfillshade__doc__)},
+	{"getFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, tr(scribus_fontnames__doc__)},
+	{"getFont", scribus_getfont, METH_VARARGS, tr(scribus_getfont__doc__)},
+	{"getFontSize", scribus_getfontsize, METH_VARARGS, tr(scribus_getfontsize__doc__)},
+	{"getGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, tr(scribus_getlanguage__doc__)},
+	{"getHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, tr(scribus_getHguides__doc__)},
+	{"getImageFile", scribus_getimgname, METH_VARARGS, tr(scribus_getimgname__doc__)},
+	{"getImageScale", scribus_getimgscale, METH_VARARGS, tr(scribus_getimgscale__doc__)},
+	{"getLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__doc__)},
+	{"getLineCap", scribus_getlineend, METH_VARARGS, tr(scribus_getlineend__doc__)},
+	{"getLineColor", scribus_getlinecolor, METH_VARARGS, tr(scribus_getlinecolor__doc__)},
+	{"getLineJoin", scribus_getlinejoin, METH_VARARGS, tr(scribus_getlinejoin__doc__)},
+	{"getLineShade", scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
+	{"getLineSpacing", scribus_getlinespace, METH_VARARGS, tr(scribus_getlinespace__doc__)},
+	{"getLineStyle", scribus_getlinestyle, METH_VARARGS, tr(scribus_getlinestyle__doc__)},
+	{"getLineWidth", scribus_getlinewidth, METH_VARARGS, tr(scribus_getlinewidth__doc__)},
+	{"getPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, tr(scribus_getpageitems__doc__)},
+	{"getPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, tr(scribus_getpagemargins__doc__)},
+	{"getPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)}, // just an alias to PageDimension()
+	{"getPosition", scribus_getposi, METH_VARARGS, tr(scribus_getposi__doc__)},
+	{"getRotation", scribus_getrotation, METH_VARARGS, tr(scribus_getrotation__doc__)},
+	{"getSelectedObject", scribus_getselobjnam, METH_VARARGS, tr(scribus_getselobjnam__doc__)},
+	{"getSize", scribus_getsize, METH_VARARGS, tr(scribus_getsize__doc__)},
+	{"getTextColor", scribus_getlinecolor, METH_VARARGS, tr(scribus_getlinecolor__doc__)},
+	{"getTextLength", scribus_gettextsize, METH_VARARGS, tr(scribus_gettextsize__doc__)},
+	{"getText", scribus_getframetext, METH_VARARGS, tr(scribus_getframetext__doc__)},
+	{"getTextShade", scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
+	{"getUnit", (PyCFunction)scribus_getunit, METH_NOARGS, tr(scribus_getunit__doc__)},
+	{"getVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, tr(scribus_getVguides__doc__)},
+	{"getXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, tr(scribus_xfontnames__doc__)},
+	{"gotoPage", scribus_gotopage, METH_VARARGS, tr(scribus_gotopage__doc__)},
+	{"groupObjects", scribus_groupobj, METH_VARARGS, tr(scribus_groupobj__doc__)},
+	{"haveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, tr(scribus_havedoc__doc__)},
+	{"insertText", scribus_inserttext, METH_VARARGS, tr(scribus_inserttext__doc__)},
+	{"isLayerPrintable", scribus_glayerprint, METH_VARARGS, tr(scribus_glayerprint__doc__)},
+	{"isLayerVisible", scribus_glayervisib, METH_VARARGS, tr(scribus_glayervisib__doc__)},
+	{"isLocked", scribus_islocked, METH_VARARGS, tr(scribus_islocked__doc__)},
+	{"linkTextFrames", scribus_linktextframes, METH_VARARGS, tr(scribus_linktextframes__doc__)},
+	{"loadImage", scribus_loadimage, METH_VARARGS, tr(scribus_loadimage__doc__)},
+	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},
+	{"lockObject", scribus_lockobject, METH_VARARGS, tr(scribus_lockobject__doc__)},
+	{"messagebarText", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
+	{"messageBox", scribus_messdia, METH_VARARGS, tr(scribus_messdia__doc__)},
+	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, tr(scribus_moveobjabs__doc__)},
+	{"moveObject", scribus_moveobjrel, METH_VARARGS, tr(scribus_moveobjrel__doc__)},
+	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, tr(scribus_newdocdia__doc__)},
+	{"newDoc", scribus_newdoc, METH_VARARGS, tr(scribus_newdoc__doc__)},
+	{"newPage", scribus_newpage, METH_VARARGS, tr(scribus_newpage__doc__)},
+	{"objectExists",scribus_objectexists, METH_VARARGS, tr(scribus_objectexists__doc__)},
+	{"openDoc", scribus_opendoc, METH_VARARGS, tr(scribus_opendoc__doc__)},
+	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, tr(scribus_pagecount__doc__)},
+	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)},
+	{"progressReset", scribus_progressreset, METH_VARARGS, tr(scribus_progressreset__doc__)},
+	{"progressSet", scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
+	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
+	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
+	{"renderFont", scribus_renderfont, METH_VARARGS, tr(scribus_renderfont__doc__)},
+	{"replaceColor", scribus_replcolor, METH_VARARGS, tr(scribus_replcolor__doc__)},
+	{"rotateObjectAbs", scribus_rotobjabs, METH_VARARGS, tr(scribus_rotobjabs__doc__)},
+	{"rotateObject", scribus_rotobjrel, METH_VARARGS, tr(scribus_rotobjrel__doc__)},
+	{"saveDocAs", scribus_savedocas, METH_VARARGS, tr(scribus_savedocas__doc__)},
+	{"saveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, tr(scribus_savedoc__doc__)},
+	{"savePageAsEPS", scribus_savepageeps, METH_VARARGS, tr(scribus_savepageeps__doc__)},
+	{"scaleGroup", scribus_scalegroup, METH_VARARGS, tr(scribus_scalegroup__doc__)},
+	{"scaleImage", scribus_scaleimage, METH_VARARGS, tr(scribus_scaleimage__doc__)},
+	{"selectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, tr(scribus_selcount__doc__)},
+	{"selectObject", scribus_selectobj, METH_VARARGS, tr(scribus_selectobj__doc__)},
+	{"selectText", scribus_selecttext, METH_VARARGS, tr(scribus_selecttext__doc__)},
+	{"sentToLayer", scribus_senttolayer, METH_VARARGS, tr(scribus_senttolayer__doc__)},
+	{"setActiveLayer", scribus_setactlayer, METH_VARARGS, tr(scribus_setactlayer__doc__)},
+	{"setColumnGap", scribus_setcolumngap, METH_VARARGS, tr(scribus_setcolumngap__doc__)},
+	{"setColumns", scribus_setcolumns, METH_VARARGS, tr(scribus_setcolumns__doc__)},
+	{"setCornerRadius", scribus_setcornerrad, METH_VARARGS, tr(scribus_setcornerrad__doc__)},
+	{"setCursor", scribus_setcursor, METH_VARARGS, tr(scribus_setcursor__doc__)},
+	{"setDocType", scribus_setdoctype, METH_VARARGS, tr(scribus_setdoctype__doc__)},
+	{"setFillColor", scribus_setfillcolor, METH_VARARGS, tr(scribus_setfillcolor__doc__)},
+	{"setFillShade", scribus_setfillshade, METH_VARARGS, tr(scribus_setfillshade__doc__)},
+	{"setFont", scribus_setfont, METH_VARARGS, tr(scribus_setfont__doc__)},
+	{"setFontSize", scribus_setfontsize, METH_VARARGS, tr(scribus_setfontsize__doc__)},
+	{"setGradientFill", scribus_setgradfill, METH_VARARGS, tr(scribus_setgradfill__doc__)},
+	{"setHGuides", scribus_setHguides, METH_VARARGS, tr(scribus_setHguides__doc__)},
+	{"setInfo", scribus_setinfo, METH_VARARGS, tr(scribus_setinfo__doc__)},
+	{"setLayerPrintable", scribus_layerprint, METH_VARARGS, tr(scribus_layerprint__doc__)},
+	{"setLayerVisible", scribus_layervisible, METH_VARARGS, tr(scribus_layervisible__doc__)},
+	{"setLineCap", scribus_setlineend, METH_VARARGS, tr(scribus_setlineend__doc__)},
+	{"setLineColor", scribus_setlinecolor, METH_VARARGS, tr(scribus_setlinecolor__doc__)},
+	{"setLineJoin", scribus_setlinejoin, METH_VARARGS, tr(scribus_setlinejoin__doc__)},
+	{"setLineShade", scribus_setlineshade, METH_VARARGS, tr(scribus_setlineshade__doc__)},
+	{"setLineSpacing", scribus_setlinespace, METH_VARARGS, tr(scribus_setlinespace__doc__)},
+	{"setLineStyle", scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
+	{"setLineWidth", scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
+	{"setMargins", scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
+	{"setMultiLine", scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
 	// duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"},
-	{"setRedraw", scribus_setredraw, METH_VARARGS, scribus_setredraw__doc__},
+	{"setRedraw", scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)},
 	// missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
-	{"setStyle", scribus_setstyle, METH_VARARGS, scribus_setstyle__doc__},
-	{"setTextAlignment", scribus_setalign, METH_VARARGS, scribus_setalign__doc__},
-	{"setTextColor", scribus_settextfill, METH_VARARGS, scribus_settextfill__doc__},
-	{"setText", scribus_setboxtext, METH_VARARGS, scribus_setboxtext__doc__},
-	{"setTextShade", scribus_settextshade, METH_VARARGS, scribus_settextshade__doc__},
-	{"setTextStroke", scribus_settextstroke, METH_VARARGS, scribus_settextstroke__doc__},
-	{"setUnit", scribus_setunit, METH_VARARGS, scribus_setunit__doc__},
-	{"setVGuides", scribus_setVguides, METH_VARARGS, scribus_setVguides__doc__},
-	{"sizeObject", scribus_sizeobjabs, METH_VARARGS, scribus_sizeobjabs__doc__},
-	{"statusMessage", scribus_messagebartext, METH_VARARGS, scribus_messagebartext__doc__},
-	{"textFlowsAroundFrame", scribus_textflow, METH_VARARGS, scribus_textflow__doc__},
-	{"traceText", scribus_tracetext, METH_VARARGS, scribus_tracetext__doc__},
-	{"unGroupObject", scribus_ungroupobj, METH_VARARGS, scribus_ungroupobj__doc__},
-	{"unlinkTextFrames", scribus_unlinktextframes, METH_VARARGS, scribus_unlinktextframes__doc__},
-	{"valueDialog", scribus_valdialog, METH_VARARGS, scribus_valdialog__doc__},
+	{"setStyle", scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)},
+	{"setTextAlignment", scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)},
+	{"setTextColor", scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)},
+	{"setText", scribus_setboxtext, METH_VARARGS, tr(scribus_setboxtext__doc__)},
+	{"setTextShade", scribus_settextshade, METH_VARARGS, tr(scribus_settextshade__doc__)},
+	{"setTextStroke", scribus_settextstroke, METH_VARARGS, tr(scribus_settextstroke__doc__)},
+	{"setUnit", scribus_setunit, METH_VARARGS, tr(scribus_setunit__doc__)},
+	{"setVGuides", scribus_setVguides, METH_VARARGS, tr(scribus_setVguides__doc__)},
+	{"sizeObject", scribus_sizeobjabs, METH_VARARGS, tr(scribus_sizeobjabs__doc__)},
+	{"statusMessage", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
+	{"textFlowsAroundFrame", scribus_textflow, METH_VARARGS, tr(scribus_textflow__doc__)},
+	{"traceText", scribus_tracetext, METH_VARARGS, tr(scribus_tracetext__doc__)},
+	{"unGroupObject", scribus_ungroupobj, METH_VARARGS, tr(scribus_ungroupobj__doc__)},
+	{"unlinkTextFrames", scribus_unlinktextframes, METH_VARARGS, tr(scribus_unlinktextframes__doc__)},
+	{"valueDialog", scribus_valdialog, METH_VARARGS, tr(scribus_valdialog__doc__)},
 	// end of aliases
 	{"retval", scribus_retval, METH_VARARGS, "TODO: docstring"},
 	{"getval", scribus_getval, METH_VARARGS, "TODO: docstring"},
+	{"frametype", (PyCFunction)scribus_getframetype, METH_VARARGS|METH_KEYWORDS, "Return the internal type ID of the frame\n"},
 	{NULL,		NULL}		/* sentinel */
 };
 
@@ -703,6 +721,14 @@
 	NoDocOpenError = PyErr_NewException("scribus.NoDocOpenError", ScribusException, NULL);
 	Py_INCREF(NoDocOpenError);
 	PyModule_AddObject(m, "NoDocOpenError", NoDocOpenError);
+	// wrong type of frame for operation
+	WrongFrameTypeError = PyErr_NewException((char*)"scribus.WrongFrameTypeError", ScribusException, NULL);
+	Py_INCREF(WrongFrameTypeError);
+	PyModule_AddObject(m, (char*)"WrongFrameTypeError", WrongFrameTypeError);
+	// Couldn't find named object, or no named object and no selection
+	NoValidObjectError = PyErr_NewException((char*)"scribus.NoValidObjectError", ScribusException, NULL);
+	Py_INCREF(NoValidObjectError);
+	PyModule_AddObject(m, (char*)"NoValidObjectError", NoValidObjectError);
 	// Done with exception setup
 
 	// CONSTANTS
@@ -780,7 +806,6 @@
 	PyDict_SetItemString(d, "PAPER_LEGAL", Py_BuildValue("(ff)", 612.0, 1008.0));
 	PyDict_SetItemString(d, "PAPER_LETTER", Py_BuildValue("(ff)", 612.0, 792.0));
 	PyDict_SetItemString(d, "PAPER_TABLOID", Py_BuildValue("(ff)", 792.0, 1224.0));
-	// end of legacy
 
 	Carrier = pl;
 	// Function aliases for compatibility
@@ -1030,5 +1055,51 @@
 	constantAlias(d, "PAPER_LETTER", "Paper_Letter");
 	constantAlias(d, "PAPER_TABLOID", "Paper_Tabloid");
 	// end of deprecated cosntants
+
+	// Create the module-level docstring. This can be a proper unicode string, unlike
+	// the others, because we can just create a Unicode object and insert it in our
+	// module dictionary.
+	QString docstring = QObject::tr("Scribus Python interface module\n\
+		\n\
+		This module is the Python interface for Scribus. It provides functions\n\
+		to control scribus and to manipulate objects on the canvas. Each\n\
+		function is documented individually below.\n\
+		\n\
+		A few things are common across most of the interface.\n\
+		\n\
+		Most functions operate on frames. Frames are identified by their name,\n\
+		a string - they are not real Python objects. Many functions take an\n\
+		optional (non-keyword) parameter, a frame name.\n\
+		Many exceptions are also common across most functions. These are\n\
+		not currently documented in the docstring for each function.\n\
+		\n\
+		    - Many functions will raise a NoDocOpenError if you try to use them\n\
+		      without a document to operate on.\n\
+		\n\
+		    - If you do not pass a frame name to a function that requires one,\n\
+		      the function will use the currently selected frame, if any, or\n\
+		      raise a NoValidObjectError if it can't find anything to operate\n\
+		      on.\n\
+		\n\
+		    - Many functions will raise WrongFrameTypeError if you try to use them\n\
+		      on a frame type that they do not make sense with. For example, setting\n\
+		      the text colour on a graphics frame doesn't make sense, and will result\n\
+		      in this exception being raised.\n\
+		\n\
+		    - Errors resulting from calls to the underlying Python API will be\n\
+		      passed through unaltered. As such, the list of exceptions thrown by\n\
+		      any function as provided here and in its docstring is incomplete.\n\
+		\n\
+		Details of what exceptions each function may throw are provided on the\n\
+		function's documentation.\n\
+		");
+
+	// Py_UNICODE is a typedef for unsigned short
+	PyObject* uniDocStr = Py_BuildValue("u", (Py_UNICODE*)(docstring.ucs2()));
+	if (uniDocStr == NULL)
+		qDebug("Failed to create module-level docstring object!");
+	else
+		PyDict_SetItemString(d, "__doc__", uniDocStr);
+	Py_DECREF(uniDocStr);
 }
 
scripter_translate_13a.diff (65,318 bytes)   

subik

2004-12-09 16:48

manager   ~0003076

Last edited: 2004-12-09 16:58

commited... but it breaks pydoc generator:

Traceback (most recent call last):
  File "<string>", line 4, in ?
  File "/home/subzero/devel/tests/scripter-docs/scribusdoc.py", line 4, in ?
    pydoc.writedoc(scribus)
  File "/usr/lib/python2.3/pydoc.py", line 1385, in writedoc
    file.write(page)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 539-1324: ordinal not in range(128)

it's somewhere in the scribus module docstring - pydoc create full of trash when I set sys.setappdefaultencoding("utf8") into script...

ringerc

2004-12-09 17:16

reporter   ~0003077

Last edited: 2004-12-09 17:20

Strange - there shouldn't be any non-ASCII characters in the default docstrings.

I am aware of an issue with unicode chars in the top-level docstring, but will resolve that after these changes are done - they need to go in ASAP to meet the string freeze deadline. It shouldn't turn up unless someone translates the docstring to use chars in a non-latin1 encoding anyway.

Separately, there is something a bit broken in the output encoding handling that I really need to investigate once all this is done.

ringerc

2004-12-09 20:41

reporter   ~0003079

Last edited: 2004-12-09 21:06

Hi Petr

I've just attached a patch to 1.2.1 scripter that completes the job. It has seen some testing, and runs all the shipping scripts fine, but needs a bit more given its status as the monster-patch from hell.

I'm sorry it's so large and that it combines a number of different types of change (as described above) - I've been working in a hurry to meet the string freeze deadline, and had to get a whole bunch of things done basically all at once to do it. After all, if I had to change the exceptions I'd have to change the docstrings, ditto formatting changes, making exceptions more specific, etc.

I'd like to split it up neatly, but there's just no time.

There is no corresponding 1.3 version yet - expect that tomorrow, once I've had some sleep.

What it does:
  - Makes all docstrings translatable. No compat impact.
  - Makes all error messages translatable, with the "python error" context on the strings. No compat impact.
  - Makes some exceptions more specific subclasses of ScribusError. No compat impact.
  - Adds extra error checks to some functions, such as checks that they're operating on the right kind of frame, more checks that fonts / colours / layers / styles exist, etc. **MAY BREAK SCRIPTS THAT EXPECT SCRIBUS TO IGNORE ERRORS.**
  - Changes a few functions to raise an exception on error instead of returning a bool. For compatibility, they still return True instead of None when they succeed, and a comment on the function notes this. Compatibility impact limited to exception dialog instead of silent failure or graceful dialog by script in case of an error.
  - Change all docstrings to be hard-wrapped with newlines. No compatibility impact.
  - Add exception info to docstrings. No compatilbity impact.
  - Expand a few docstrings, clarify a few docstrings, fix some typos. No compatiblity impact.
  - Correct a series of bugs where 'char*' strings were being compared with == . As most were in error checks, it's possible this could break scripts that expect scribus to ignore errors, as per above.
  - Keywordify a few functions (most notably messageBox and fileDialog) and update the docstrings to match. No compatibility impact, and significantly nicer to use dialogs. Also changed messageBox to default to OK button if no buttons specified - no compat impact because code that didn't specify a button would've been illegal before. Added constants for buttons triggered by enter and escape.
  - Use constants instead of "magic" numbers for frame types. No compat impact, improved source readability.
  - Add extra error handling to sample scripts, tidy them up a bit, add explicit encoding headings, __main__ checks, main() functions, convert tabs to spaces, catch more errors gracefully with dialogs instead of silent failures / exception dialogs, add nice explanation if the user tries to run the script from the command line. *phew*.

This was all sort of interdependent, in that most of these changes required docstring updates and the docstrings are the thing with the deadline of 'yesterday'. So again, sorry for the monster patch. Time permitting I'll split it up a bit, but I don't know what the time is like.

I can roll back the extra error checks if really required, but frankly I don't expect them to be a signifiant issue, and I think it's important to have good error checking in 1.2.1 scripter.

ringerc

2004-12-09 21:27

reporter   ~0003080

Last edited: 2004-12-09 21:28

One last note on this latest patch - I finished it while very tired, so it _definitely_ needs checking. I'll go over it tomorrow, but you know what they say about checking one's own work.

Also:

 cmdcolor.cpp                       |   55 ++++++---
 cmdcolor.h                         |   69 ++++++++---
 cmddialog.cpp                      |   25 ++--
 cmddialog.h                        |   98 +++++++++++------
 cmddoc.cpp                         |   21 ++-
 cmddoc.h                           |  144 +++++++++++++++++--------
 cmdgetprop.cpp                     |    4
 cmdgetprop.h                       |  127 +++++++++++++---------
 cmdmani.cpp                        |   18 +--
 cmdmani.h                          |  154 ++++++++++++++++----------
 cmdmisc.cpp                        |   54 ++++-----
 cmdmisc.h                          |  141 +++++++++++++++++-------
 cmdobj.cpp                         |   38 +++---
 cmdobj.h                           |  213 ++++++++++++++++++++++---------------
 cmdpage.cpp                        |   23 ++-
 cmdpage.h                          |  131 ++++++++++++++--------
 cmdsetprop.cpp                     |   21 +--
 cmdsetprop.h                       |  118 +++++++++++++-------
 cmdvar.h                           |    4
 guiapp.h                           |   58 ++++++----
 samples/3columnA4.py               |   47 +++++---
 samples/3columnUSLTR.py            |   46 +++++--
 samples/Calender.py                |  122 ++++++++++++---------
 samples/Sample1.py                 |   32 +++--
 samples/golden-mean.py             |   21 +++
 samples/htmlimport.py              |   99 +++++++++--------
 samples/legende.py                 |   48 ++++++--
 samples/moins_10_pourcent_group.py |   16 ++
 samples/plus_10_pourcent_group.py  |   16 ++
 samples/pochette_cd.py             |  209 +++++++++++++++++++-----------------
 samples/quote.py                   |  115 +++++++++++--------
 samples/trait_de_coupe.py          |   63 ++++++----
 samples/wordcount.py               |   96 ++++++++++------
 scriptplugin.cpp                   |   14 ++
 34 files changed, 1543 insertions(+), 917 deletions(-)

That might help make it clearer what's happened. The masive script spikes are tab/space conversions. The smaller .py changes are general tidying and fixes.

The massive header changes are docstring translation tagging and docstring reformatting, plus a little bit of docstring editing and expansion. Not all that much docstring content was signficantly changed, it was mostly reformatting, small corrections, and additons.

The mostly small .cpp changes are the error checking and new exceptions, bug fixes, exception translation support, and function keywordifcation.

subik

2004-12-10 06:55

manager   ~0003084

crai, thanks for this work! I'm offline for this weekend - you can have rest and have a party ;) becuse I'll commit these patches at Sat. or Mon. I mean I will check the code these days too.

ringerc

2004-12-10 15:27

reporter   ~0003093

Last edited: 2004-12-11 15:37

Updated patch fixes UnicodeDecodeError on help(scribus) if some docstrings contain non-7-bit ascii chars.

BIG FAT WARNING

This changes sysdefaultencoding. While I don't think it should break anything, and sysdefaultencoding is ASCII in Python only for very-crufty historical reasons, it's a global change to a behaviour of the interpreter and requires at least some testing.

That said, the only case I _know_ it'll break are scripts that are already wrong - they use non-7-bit chars without specifying a coding line. That is also a trivial fix, and easy to document in the FAQ.

sysdefaultencoding is changed to latin-1, but I'll be testing and uploading a new change that makes it utf-8 once I've tested that and made sure it all works.

Note after the fact: I was wrong about this. Changing sysdefaultencoding broke the working handling of latin-1 text in scripter functions. This was because latin-1 text really only worked due to (at least) two separate problems that cancelled each other out. The fix for this is simple and will be completed soon.

ringerc

2004-12-10 16:18

reporter   ~0003094

Last edited: 2004-12-10 16:28

Patch updated again. This version makes sysdefaultencoding unicode, and tweaks the script console to support that. Result:

Docstring problems solved. We can now translate docstrings properly, even with CJK text.

As a handy bonus:

Unicode output in the scripter is now FIXED. No more ascii codec errors or ???s. I can now display Chinese if I feel like it (and I've tested it). Unicode input is not yet fixed but I think I know how. If I get it working I'll update this patch, but don't hold anything for that because it can go in later just as easily.

This should have no more impact than the latin-1 version of this patch, so I've removed the old one and replaced it with this one.

Note that this patch must be applied using patch -p0 .

ringerc

2004-12-10 17:06

reporter   ~0003095

New patch attached - translations_and_fixups_UNICODE_INOUT.diff . This one also fixes unicode input in the script console, so no more ????s when you type non-ascii literals into the script console.

... except it doesn't, as there are issues with the u'' string constructor. I'll put it back up once its fixed.

ringerc

2004-12-10 18:20

reporter   ~0003096

Last edited: 2004-12-10 18:54

OK, further testing suggests the unicode input fix should be included. It doesn't break anything after all, nor cost us anything.

My tests have shown that setting sysdefaultencoding DOES break latin1 support, in that it used to somewhat work and can now produce garbage in situations where it used to work. It won't cause it to crash / produce an error were it used to work, and it won't cause any problems with normal ASCII. The upside is that I can supply a series of patches to fix that, to follow after this one, and that they'll not only fix latin1 but will bring in full unicode text support across the board.

Chinese in scripter dialog boxes, here we come.

It turns out that the u'' string constructor was (a) no more broken than before, (b) only broken in the console where it was before, and (C) also apparently broken in the Python interactive console on the command line:

Python 2.3.4 (0000005, Sep 24 2004, 21:28:18)
[GCC 3.3.2 20031022 (Red Hat Linux 3.3.2-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = '定,四川省委副'
[14818 refs]
>>> x
'\xe5\xae\x9a\xef\xbc\x8c\xe5\x9b\x9b\xe5\xb7\x9d\xe7\x9c\x81\xe5\xa7\x94\xe5\x89\xaf'
[14820 refs]
>>> print x
定,四川省委副
[14820 refs]
>>> y = u'定,四川省委副'
[14825 refs]
>>> y
u'\xe5\xae\x9a\xef\xbc\x8c\xe5\x9b\x9b\xe5\xb7\x9d\xe7\x9c\x81\xe5\xa7\x94\xe5\x89\xaf'
[14825 refs]
>>> print y
å®ï¼åå·çå§å¯
[14825 refs]
>>> z = unicode(x,'utf-8')
[14830 refs]
>>> z
u'\u5b9a\uff0c\u56db\u5ddd\u7701\u59d4\u526f'
[14830 refs]
>>> print z
定,四川省委副
[14830 refs]
>>> print x.decode('utf-8')
定,四川省委副
[14830 refs]
>>>

(set your browser to display this page as utf-8 to see the above, if it doesn't do so by default. Edit: Or not. Grr. something encoded the characters to HTML entities, but mantis seems to be escaping the entities so they're not displayed. Arrggh.). That's from the Python interpreter on the command line with a utf-8 locale, but I get the same thing in the patched scripter console. I guess that's a good thing :S. A test script that uses the u'' constructor ran unchanged, so it only appears to be a console issue.

Consquently, I'm putting the full unicode version with unicode input fix back up. I think that despite the MAJOR changes this patch introduces (including all its various revisions), it's the only way to make docstrings and exceptions properly translatable. It's also cool and will let me fix lots of niggling i18n issues.

If you decide to apply this, expect a series of more reasonably sized patches to account for the required changes to functions to support unicode input. No changes will be required to the docstrings for this, so they can come in later.

2004-12-10 18:21

 

translations_and_fixups_UNICODE_INOUT.diff (155,562 bytes)   
This version also fixes unicode INPUT in the script console.

Index: cmdcolor.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp,v
retrieving revision 1.9
diff -u -r1.9 cmdcolor.cpp
--- cmdcolor.cpp	3 Dec 2004 15:02:55 -0000	1.9
+++ cmdcolor.cpp	10 Dec 2004 17:01:52 -0000
@@ -24,13 +24,19 @@
 	int c, m, y, k;
 	if (!PyArg_ParseTuple(args, "s", &Name))
 		return NULL;
-	if (Name == "")
-		return Py_BuildValue("(iiii)", 0, 0, 0, 0);
+	if (strcmp(Name, "") == 0)
+	{
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot get a colour with an empty name.","python error"));
+		return NULL;
+	}
 	edc = Carrier->HaveDoc ? Carrier->doc->PageColors : Carrier->Prefs.DColors;
 	QString col = QString(Name);
 	if (!edc.contains(col))
-		return Py_BuildValue("(iiii)", 0, 0, 0, 0);
-  edc[col].getCMYK(&c, &m, &y, &k);
+	{
+		PyErr_SetString(NotFoundError, QObject::tr("Colour not found","python error"));
+		return NULL;
+	}
+	edc[col].getCMYK(&c, &m, &y, &k);
 	return Py_BuildValue("(iiii)", static_cast<long>(c), static_cast<long>(m), static_cast<long>(y), static_cast<long>(k));
 }
 
@@ -40,9 +46,9 @@
 	int c, m, y, k;
 	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot change a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot change a colour with an empty name.","python error"));
 		return NULL;
 	}
 	QString col = QString(Name);
@@ -50,7 +56,7 @@
 	{
 		if (!Carrier->doc->PageColors.contains(col))
 		{
-			PyErr_SetString(ScribusException, QString("Colour does not exist in document"));
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in document","python error"));
 			return NULL;
 		}
 		Carrier->doc->PageColors[col].setColor(c, m, y, k);
@@ -59,7 +65,7 @@
 	{
 		if (!Carrier->Prefs.DColors.contains(col))
 		{
-			PyErr_SetString(ScribusException, QString("Colour does not exist in preferences"));
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in default colors","python error"));
 			return NULL;
 		}
 		Carrier->Prefs.DColors[col].setColor(c, m, y, k);
@@ -74,9 +80,9 @@
 	int c, m, y, k;
 	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot create a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create a colour with an empty name.","python error"));
 		return NULL;
 	}
 	QString col = QString(Name);
@@ -108,29 +114,35 @@
 	char *Repl = "None";
 	if (!PyArg_ParseTuple(args, "s|s", &Name, &Repl))
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name,"") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot delete a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot delete a colour with an empty name.","python error"));
 		return NULL;
 	}
 	QString col = QString(Name);
 	QString rep = QString(Repl);
 	if (Carrier->HaveDoc)
 	{
-		// FIXME: should we raise an exception when the user tries to delete a colour that
-		// does not exist?
 		if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
 			{
 				Carrier->doc->PageColors.remove(col);
 				ReplaceColor(col, rep);
 			}
+		else
+		{
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in document","python error"));
+			return NULL;
+		}
 	}
 	else
 	{
-		// FIXME: should we raise an exception when the user tries to delete a colour that
-		// does not exist?
 		if (Carrier->Prefs.DColors.contains(col))
 			Carrier->Prefs.DColors.remove(col);
+		else
+		{
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in default colors","python error"));
+			return NULL;
+		}
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -145,17 +157,20 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot replace a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot replace a colour with an empty name.","python error"));
 		return NULL;
 	}
 	QString col = QString(Name);
 	QString rep = QString(Repl);
-	// FIXME: should we raise an error when the user tries to replace a colour and the colour
-	// they're trying to replace does not exist?
 	if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
 		ReplaceColor(col, rep);
+	else
+	{
+		PyErr_SetString(NotFoundError, QObject::tr("Colour not found","python error"));
+		return NULL;
+	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdcolor.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.h,v
retrieving revision 1.8
diff -u -r1.8 cmdcolor.h
--- cmdcolor.h	3 Dec 2004 15:02:55 -0000	1.8
+++ cmdcolor.h	10 Dec 2004 17:01:52 -0000
@@ -8,50 +8,81 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_colornames__doc__,
-    "getColorNames() -> list\n\n\
-Returns a list with the names of all defined colors.");
+QT_TR_NOOP("getColorNames() -> list\n\
+\n\
+Returns a list containing the names of all defined colors in the document.\n\
+If no document is open, returns a list of the default document colors.\n\
+"));
 /** Returns a list with colours available in doc or in prefs. */
 PyObject *scribus_colornames(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolor__doc__,
-    "getColor(\"name\") -> tuple\n\n\
-Returns a tuple (C, M, Y, K) containing the four color components\
-of the color \"name\".");
+QT_TR_NOOP("getColor(\"name\") -> tuple\n\
+\n\
+Returns a tuple (C, M, Y, K) containing the four color components of the\n\
+color \"name\" from the current document. If no document is open, returns\n\
+the value of the named color from the default document colors.\n\
+\n\
+May raise NotFoundError if the named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Returns a CMYK tuple of the specified color. */
 PyObject *scribus_getcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolor__doc__,
-    "changeColor(\"name\", c, m, y, k)\n\n\
-Changes the color \"name\", The color value is defined via four\
-components c = Cyan, m = Magenta, y = Yellow and k = Black.\
-Color compontens should be in the range from 0 to 255.");
+QT_TR_NOOP("changeColor(\"name\", c, m, y, k)\n\
+\n\
+Changes the color \"name\" to the specified CMYK value. The color value is\n\
+defined via four components c = Cyan, m = Magenta, y = Yellow and k = Black.\n\
+Color components should be in the range from 0 to 255.\n\
+\n\
+May raise NotFoundError if the named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Sets named color with C,M,Y,K params. */
 PyObject *scribus_setcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newcolor__doc__,
-    "newColor(\"name\", c, m, y, k)\n\n\
-Defines a new color \"name\". The color Value is defined via four\
-components c = Cyan, m = Magenta, y = Yello and k = Black.\
-color compontens should be in the range from 0 to 255.");
+QT_TR_NOOP("defineColor(\"name\", c, m, y, k)\n\
+\n\
+Defines a new color \"name\". The color Value is defined via four components:\n\
+c = Cyan, m = Magenta, y = Yello and k = Black. Color components should be in\n\
+the range from 0 to 255.\n\
+\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Creates new color with name, C, M, Y, K params. */
 PyObject *scribus_newcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_delcolor__doc__,
-    "deleteColor(\"name\", \"replace\")\n\n\
-Deletes the color \"name\". Every occurence of that color\
-is replaced by the color \"replace\".");
+QT_TR_NOOP("deleteColor(\"name\", \"replace\")\n\
+\n\
+Deletes the color \"name\". Every occurence of that color is replaced by the\n\
+color \"replace\". If not specified, \"replace\" defaults to the color\n\
+\"None\" - transparent.\n\
+\n\
+deleteColor works on the default document colors if there is no document open.\n\
+In that case, \"replace\", if specified, has no effect.\n\
+\n\
+May raise NotFoundError if a named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Deletes named color */
 PyObject *scribus_delcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_replcolor__doc__,
-    "replaceColor(\"name\", \"replace\")\n\n\
-Every occurence of that color \"name\" is replaced by the\
-color \"replace\".");
+QT_TR_NOOP("replaceColor(\"name\", \"replace\")\n\
+\n\
+Every occurence of the color \"name\" is replaced by the color \"replace\".\n\
+\n\
+May raise NotFoundError if a named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Replaces color with the 2nd one. */
 PyObject *scribus_replcolor(PyObject *self, PyObject* args);
 
Index: cmddialog.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp,v
retrieving revision 1.18
diff -u -r1.18 cmddialog.cpp
--- cmddialog.cpp	3 Dec 2004 15:02:55 -0000	1.18
+++ cmddialog.cpp	10 Dec 2004 17:01:52 -0000
@@ -14,32 +14,33 @@
 	return PyInt_FromLong(static_cast<long>(ret));
 }
 
-PyObject *scribus_filedia(PyObject *self, PyObject* args)
+PyObject *scribus_filedia(PyObject *self, PyObject* args, PyObject* kw)
 {
-	char *caption;
-	char *filter;
-	char *defName;
-	QString fName;
-	int pre = 0;
-	int mode = 0;
-	if (!PyArg_ParseTuple(args, "sss|ii", &caption, &filter, &defName, &pre, &mode))
+	char *caption = NULL;
+	char *filter = "";
+	char *defName = "";
+	int haspreview = 0;
+	int issave = 0;
+	char* kwargs[] = {"caption", "filter", "defaultname", "haspreview", "issave", NULL};
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssii", kwargs, &caption, &filter, &defName, &haspreview, &issave))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(pre), static_cast<bool>(mode), 0, 0);
+	QString fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(haspreview), static_cast<bool>(issave), 0, 0);
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyString_FromString(fName.utf8());
 }
 
-PyObject *scribus_messdia(PyObject *self, PyObject* args)
+PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw)
 {
 	char *caption = "";
 	char *message = "";
 	uint result;
 	QMessageBox::Icon ico = QMessageBox::NoIcon;
-	int butt1 = QMessageBox::NoButton;
+	int butt1 = QMessageBox::Ok|QMessageBox::Default;
 	int butt2 = QMessageBox::NoButton;
 	int butt3 = QMessageBox::NoButton;
-	if (!PyArg_ParseTuple(args, "ssii|ii", &caption, &message, &ico, &butt1, &butt2, &butt3))
+	char* kwargs[] = {"caption", "message", "icon", "button1", "button2", "button3", NULL};
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "ss|iiii", kwargs, &caption, &message, &ico, &butt1, &butt2, &butt3))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
 	QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
Index: cmddialog.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.h,v
retrieving revision 1.10
diff -u -r1.10 cmddialog.h
--- cmddialog.h	3 Dec 2004 15:02:55 -0000	1.10
+++ cmddialog.h	10 Dec 2004 17:01:52 -0000
@@ -8,55 +8,91 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newdocdia__doc__,
-    "newDocDialog() -> bool\n\n\
-Shows the \"New Document\" dialog box. Returns true if\
-a new document was created.");
+QT_TR_NOOP("newDocDialog() -> bool\n\
+\n\
+Displays the \"New Document\" dialog box. Creates a new document if the user\n\
+accepts the settings. Does not create a document if the user presses cancel.\n\
+Returns true if a new document was created.\n\
+"));
 /** Raises the Scribus New Document dialog */
 PyObject *scribus_newdocdia(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_filedia__doc__,
-    "fileDialog(\"caption\", \"filter\", \"defaultName\" [,preview, mode]) -> string with filename\n\n\
-Shows a FileSelect box with the caption \"caption\". Files are\
-filtered with the filter string \"filter\", refer to the\
-Qt-Documentation for it's use. A default filename can also\
-supplied, leave this string empty when you don't want to use it.\
-A Value of 1 for preview enables a small preview widget in the\
-FileSelect box. When the mode parameter is set to 1 the dialog\
-acts like a \"Save As\" dialog otherwise it acts like\
-a \"File Open Dialog\". The default for both of the opional\
-Parameters is 0.");
+QT_TR_NOOP("fileDialog(\"caption\", [\"filter\", \"defaultname\" ,haspreview, issave]) -> string with filename\n\
+\n\
+Shows a File Open dialog box with the caption \"caption\". Files are filtered\n\
+with the filter string \"filter\". A default filename or file path can also\n\
+supplied, leave this string empty when you don't want to use it.  A value of\n\
+True for haspreview enables a small preview widget in the FileSelect box.  When\n\
+the issave parameter is set to True the dialog acts like a \"Save As\" dialog\n\
+otherwise it acts like a \"File Open Dialog\". The default for both of the\n\
+opional parameters is False.\n\
+\n\
+The filter, if specified, takes the form 'comment (*.type *.type2 ...)'.\n\
+For example 'Images (*.png *.xpm *.jpg)'.\n\
+\n\
+Refer to the Qt-Documentation for QFileDialog for details on filters.\n\
+\n\
+Example: fileDialog('Open input', 'CSV files (*.csv)')\n\
+Example: fileDialog('Save report', defaultname='report.txt', issave=True)\n\
+"));
 /** Raises file dialog.
  Params - caption, filter, default name and opt. pre, mode. */
-PyObject *scribus_filedia(PyObject *self, PyObject* args);
+PyObject *scribus_filedia(PyObject *self, PyObject* args, PyObject* kw);
 /* diplicity Sends a string into the Message Bar
 PyObject *scribus_mess(PyObject *self, PyObject* args);
 */
 
 /*! docstring */
 PyDoc_STRVAR(scribus_messdia__doc__,
-    "messageBox(\"caption\", \"message\", icon, Button1 [, Button2, Button3]) -> integer (see constants below)\n\n\
-Shows a message box with the title \"caption\", the message \"message\",\
-and an icon \"icon\" and up to 3 Buttons. Button1 is always needed. For\
-the icon and the button parameters there are predefined constants\
-available with the same names as in the Qt Documentation. Returns\
-the number of the selected button. Buttons and returning values:\
-BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO, BUTTON_NONE,\
-BUTTON_OK, BUTTON_RETRY, BUTTON_YES");
+QT_TR_NOOP("messageBox(\"caption\", \"message\",\n\
+    icon=ICON_NONE, button1=BUTTON_OK|BUTTONOPT_DEFAULT,\n\
+    button2=BUTTON_NONE, button3=BUTTON_NONE) -> integer\n\
+\n\
+Displays a message box with the title \"caption\", the message \"message\", and\n\
+an icon \"icon\" and up to 3 buttons. By default no icon is used and a single\n\
+button, OK, is displayed. Only the caption and message arguments are required,\n\
+though setting an icon and appropriate button(s) is strongly\n\
+recommended. The message text may contain simple HTML-like markup.\n\
+\n\
+Returns the number of the button the user pressed. Button numbers start\n\
+at 1.\n\
+\n\
+For the icon and the button parameters there are predefined constants available\n\
+with the same names as in the Qt Documentation. These are the BUTTON_* and\n\
+ICON_* constants defined in the module. There are also two extra constants that\n\
+can be binary-ORed with button constants:\n\
+    BUTTONOPT_DEFAULT   Pressing enter presses this button.\n\
+    BUTTONOPT_ESCAPE    Pressing escape presses this button.\n\
+\n\
+Usage examples:\n\
+result = messageBox('Script failed',\n\
+                    'This script only works when you have a text frame selected.',\n\
+                    ICON_ERROR)\n\
+result = messageBox('Monkeys!', 'Something went ook! <i>Was it a monkey?</i>',\n\
+                    ICON_WARNING, BUTTON_YES|BUTTONOPT_DEFAULT,\n\
+                    BUTTON_NO, BUTTON_IGNORE|BUTTONOPT_ESCAPE)\n\
+\n\
+Defined button and icon constants:\n\
+BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO,\n\
+BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL,\n\
+ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.\n\
+"));
 /** Displays a message box with - caption, message, icon, button
  and two more buttons optional. */
-PyObject *scribus_messdia(PyObject *self, PyObject* args);
+PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_valdialog__doc__,
-    "valueDialog(caption, message [,defaultvalue]) -> string\n\n\
-Shows the common 'Ask for string' dialog and returns its value as string\
-Parameters: window title, text in the window and optional 'default' value.\
-Example: valueDialog('title', 'text in the window', 'optional'");
-/** Raises the common 'Ask for string' dialog and returns its value
-params: window title, text in the window and optional 'default value.
-ValueDialog('title', 'text in the window', 'optional')
-09/24/2004 petr vanek */
+QT_TR_NOOP("valueDialog(caption, message [,defaultvalue]) -> string\n\
+\n\
+Shows the common 'Ask for string' dialog and returns its value as a string\n\
+Parameters: window title, text in the window and optional 'default' value.\n\
+\n\
+Example: valueDialog('title', 'text in the window', 'optional')\n\
+"));
+/* 09/24/2004 petr vanek */
 PyObject *scribus_valdialog(PyObject *self, PyObject* args);
 
 #endif
Index: cmddoc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp,v
retrieving revision 1.16
diff -u -r1.16 cmddoc.cpp
--- cmddoc.cpp	3 Dec 2004 15:02:55 -0000	1.16
+++ cmddoc.cpp	10 Dec 2004 17:01:52 -0000
@@ -68,7 +68,13 @@
 	if (!PyArg_ParseTuple(args, "s", &Name))
 		return NULL;
 	bool ret = Carrier->LadeDoc(QString(Name));
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to open document","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True); // compatibility: return true, not none, on success
+	return Py_True;
 }
 
 PyObject *scribus_savedoc(PyObject *self)
@@ -76,7 +82,8 @@
 	if(!checkHaveDocument())
 		return NULL;
 	Carrier->slotFileSave();
-	return PyInt_FromLong(0L);
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 PyObject *scribus_savedocas(PyObject *self, PyObject* args)
@@ -87,7 +94,13 @@
 	if(!checkHaveDocument())
 		return NULL;
 	bool ret = Carrier->DoFileSave(QString(Name));
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to save document","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True); // compatibility: return true, not none, on success
+	return Py_True;
 }
 
 PyObject *scribus_setinfo(PyObject *self, PyObject* args)
@@ -116,7 +129,7 @@
 		return NULL;
 	if ((e < 0) || (e > 3))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Unit out of range. Use one of the scribus.UNIT_* constants."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Unit out of range. Use one of the scribus.UNIT_* constants.","python error"));
 		return NULL;
 	}
 	Carrier->slotChangeUnit(e);
Index: cmddoc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.h,v
retrieving revision 1.9
diff -u -r1.9 cmddoc.h
--- cmddoc.h	3 Dec 2004 15:02:55 -0000	1.9
+++ cmddoc.h	10 Dec 2004 17:01:52 -0000
@@ -8,105 +8,161 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newdoc__doc__,
-    "newDoc(size, margins, orientation, firstPageNumber, unit, facingPages, firstSideLeft) -> bool\n\n\
-Creates a new document and returns true if successful. The parameters have the following meaning:\n\
-size = A Tuple (width, height) describing the Size of the Document.\
-You can use predefined cosntants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\
-margins = A Tuple (Left, Right, Top, Bottom) describing the Margins of the Document.\n\
-orientation = the Page Orientation - constants PORTRAIT, LANDSCAPE\n\
-firstPageNumer = is the number of the first page in the document used for pagenumbering\n\
-unit: this Value sets the Measurement Unit of the Document\
-UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS\n\
-facingPages = FACINGPAGES, NOFACINGPAGES\n\
-firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\
-The values for Width, Height and the Margins are expressed in the given unit for the document.\n\n\
-example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_PICAS, FACINGPAGES, FIRSTPAGERIGHT)");
+QT_TR_NOOP("newDoc(size, margins, orientation, firstPageNumber,\n\
+                   unit, facingPages, firstSideLeft) -> bool\n\
+\n\
+Creates a new document and returns true if successful. The parameters have the\n\
+following meaning:\n\
+\n\
+    size = A tuple (width, height) describing the size of the document. You can\n\
+    use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\
+\n\
+    margins = A tuple (left, right, top, bottom) describing the document\n\
+    margins\n\
+\n\
+    orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\
+\n\
+    firstPageNumer = is the number of the first page in the document used for\n\
+    pagenumbering. While you'll usually want 1, it's useful to have higher\n\
+    numbers if you're creating a document in several parts.\n\
+\n\
+    unit: this value sets the measurement units used by the document. Use a\n\
+    predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\
+    UNIT_PICAS, UNIT_POINTS.\n\
+\n\
+    facingPages = FACINGPAGES, NOFACINGPAGES\n\
+\n\
+    firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\
+\n\
+The values for width, height and the margins are expressed in the given unit\n\
+for the document. PAPER_* constants are expressed in points. If your document\n\
+is not in points, make sure to account for this.\n\
+\n\
+example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS,\n\
+                FACINGPAGES, FIRSTPAGERIGHT)\n\
+"));
 /** Creates a new document e.g. (Paper_A4, Margins, 1, 1, 1, NoFacingPages, FirstPageLeft)
  first 2 args are lists (tuples) */
 PyObject *scribus_newdoc(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_closedoc__doc__,
-    "closeDoc() -> bool\n\n\
-Closes the current Document. Returns true if successful.");
+QT_TR_NOOP("closeDoc()\n\
+\n\
+Closes the current document without prompting to save.\n\
+\n\
+May throw NoDocOpenError if there is no document to close\n\
+"));
 /** Closes active doc. No params */
 PyObject *scribus_closedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_havedoc__doc__,
-    "haveDoc() -> bool\n\n\
-Returns true if there is a document open.");
+QT_TR_NOOP("haveDoc() -> bool\n\
+\n\
+Returns true if there is a document open.\n\
+"));
 /** Checks if is a document opened. */
 PyObject *scribus_havedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_opendoc__doc__,
-    "openDoc(\"name\") -> bool\n\n\
-Opens the document \"name\". Returns true if successful.");
+QT_TR_NOOP("openDoc(\"name\")\n\
+\n\
+Opens the document \"name\".\n\
+\n\
+May raise ScribusError if the document could not be opened.\n\
+"));
 /** Opens a document with given name. */
 PyObject *scribus_opendoc(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savedoc__doc__,
-    "saveDoc() -> bool\n\n\
-Saves the document with its actual name, returns true if successful.");
+QT_TR_NOOP("saveDoc()\n\
+\n\
+Saves the current document with its current name, returns true if successful.\n\
+If the document has not already been saved, this may bring up an interactive\n\
+save file dialog.\n\
+\n\
+If the save fails, there is currently no way to tell.\n\
+"));
 PyObject *scribus_savedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savedocas__doc__,
-    "saveDocAs(\"name\") -> bool\n\n\
-    Saves the actual Document under the new Name \"name\". Returns true if successful.");
+QT_TR_NOOP("saveDocAs(\"name\")\n\
+\n\
+Saves the current document under the new name \"name\" (which may be a full or\n\
+relative path).\n\
+\n\
+May raise ScribusError if the save fails.\n\
+"));
 /** Saves active document with given name */
 PyObject *scribus_savedocas(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setinfo__doc__,
-    "saveDocAs(\"author\", \"info\", \"description\") -> bool\n\n\
-Sets the document information. \"Author\", \"Info\", \"Description\" are strings.\
-Returns true if successful.");
+QT_TR_NOOP("saveDocAs(\"author\", \"info\", \"description\") -> bool\n\
+\n\
+Sets the document information. \"Author\", \"Info\", \"Description\" are\n\
+strings.\n\
+"));
 /** Sets document infos - author, title and description */
 PyObject *scribus_setinfo(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setmargins__doc__,
-    "setMargins(lr, rr, tr, br)\n\n\
-Sets the print margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\
-Margins are given in the measurement unit of the document - see UNIT_<type> constants.");
+QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\
+\n\
+Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\
+margins are given in the measurement units of the document - see UNIT_<type>\n\
+constants.\n\
+"));
 /** Sets document margins - left, right, top and bottom. */
 PyObject *scribus_setmargins(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setunit__doc__,
-    "setUnit(type)\n\n\
-Changes the Measurement Unit of the Document. Possible Values for Unit are\
-defined as constants UNIT_<type>.");
+QT_TR_NOOP("setUnit(type)\n\
+\n\
+Changes the measurement unit of the document. Possible values for \"unit\" are\n\
+defined as constants UNIT_<type>.\n\
+\n\
+May raise ValueError if an invalid unit is passed.\n\
+"));
 /** Changes unit scale. */
 PyObject *scribus_setunit(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getunit__doc__,
-    "getUnit() -> integer (Scribus typo unit)\n\n\
-Returns the Measurement Unit of the Document.\
-Possible Values for Unit are defined as constants.\
-Constants are:\n\
-UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.");
+QT_TR_NOOP("getUnit() -> integer (Scribus unit constant)\n\
+\n\
+Returns the measurement units of the document. The returned value will be one\n\
+of the UNIT_* constants:\n\
+UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.\n\
+"));
 /** Returns actual unit scale. */
 PyObject *scribus_getunit(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_loadstylesfromfile__doc__,
-    "loadStylesFromFile(\"filename\")\n\n\
-Loads styles specified in the \"filename\" document into actual one.");
+QT_TR_NOOP("loadStylesFromFile(\"filename\")\n\
+\n\
+Loads paragraph styles from the Scribus document at \"filename\" into the\n\
+current document.\n\
+"));
 /** Loads styles from another .sla file (craig r.)*/
 PyObject *scribus_loadstylesfromfile(PyObject *self, PyObject *args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setdoctype__doc__,
-	"setDocType(facingPages, firstPageLeft)\n\n\
-Sets the type of the documents, to get facing pages set the first parameter\
-to FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead.\
-If you want to be the first page a left side set the second parameter\
-to FIRSTPAGELEFT, for a right rage use FIRSTPAGERIGHT.");
+QT_TR_NOOP("setDocType(facingPages, firstPageLeft)\n\
+\n\
+Sets the document type. To get facing pages set the first parameter to\n\
+FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead.  If you want\n\
+to be the first page a left side set the second parameter to FIRSTPAGELEFT, for\n\
+a right page use FIRSTPAGERIGHT.\n\
+"));
 /*! TODO: comment */
 PyObject *scribus_setdoctype(PyObject *self, PyObject* args);
 
Index: cmdgetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp,v
retrieving revision 1.13
diff -u -r1.13 cmdgetprop.cpp
--- cmdgetprop.cpp	3 Dec 2004 15:02:55 -0000	1.13
+++ cmdgetprop.cpp	10 Dec 2004 17:01:52 -0000
@@ -23,7 +23,7 @@
 	it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->HasSel) && ((it->PType == 4) || (it->PType == 8)))
+	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
@@ -58,7 +58,7 @@
 	it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->HasSel) && ((it->PType == 4) || (it->PType == 8)))
+	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
Index: cmdgetprop.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h,v
retrieving revision 1.5
diff -u -r1.5 cmdgetprop.h
--- cmdgetprop.h	3 Dec 2004 15:02:55 -0000	1.5
+++ cmdgetprop.h	10 Dec 2004 17:01:52 -0000
@@ -8,128 +8,159 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfillcolor__doc__,
-    "getFillColor([\"name\"]) -> string\n\n\
-Returns the name of the fill color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFillColor([\"name\"]) -> string\n\
+\n\
+Returns the name of the fill color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns fill color of the object */
 PyObject *scribus_getfillcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinecolor__doc__,
-    "getLineColor([\"name\"]) -> string\n\n\
-Returns the name of the line color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getLineColor([\"name\"]) -> string\n\
+\n\
+Returns the name of the line color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns color of the line */
 PyObject *scribus_getlinecolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinewidth__doc__,
-    "getLineWidth([\"name\"]) -> integer\n\n\
-Returns the line width of the object \"name\". If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getLineWidth([\"name\"]) -> integer\n\
+\n\
+Returns the line width of the object \"name\". If \"name\"\n\
+is not given the currently selected Item is used.\n\
+"));
 /*! Returns width of the line */
 PyObject *scribus_getlinewidth(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlineshade__doc__,
-    "getLineShade([\"name\"]) -> integer\n\n\
-Returns the shading value of the line color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getLineShade([\"name\"]) -> integer\n\
+\n\
+Returns the shading value of the line color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns shading of the line */
 PyObject *scribus_getlineshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinejoin__doc__,
-    "getLineJoin([\"name\"]) -> integer (see contants)\n\n\
-Returns the line join style of the object \"name\". If \"name\"\
-is not given the currently selected item is used.\
-The join types are: JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND");
+QT_TR_NOOP("getLineJoin([\"name\"]) -> integer (see contants)\n\
+\n\
+Returns the line join style of the object \"name\". If \"name\" is not given\n\
+the currently selected item is used.  The join types are:\n\
+JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND\n\
+"));
 /*! Returns join type of the line */
 PyObject *scribus_getlinejoin(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlineend__doc__,
-    "getLineEnd([\"name\"]) -> integer (see constants)\n\n\
-Returns the line cap style of the object \"name\". If \"name\"\
-is not given the currently selected item is used.\
-The cap types are: CAP_FLAT, CAP_ROUND, CAP_SQUARE");
+QT_TR_NOOP("getLineEnd([\"name\"]) -> integer (see constants)\n\
+\n\
+Returns the line cap style of the object \"name\". If \"name\" is not given the\n\
+currently selected item is used. The cap types are:\n\
+CAP_FLAT, CAP_ROUND, CAP_SQUARE\n\
+"));
 /*! Returns cap type of the line */
 PyObject *scribus_getlineend(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinestyle__doc__,
-    "getLineStyle([\"name\"]) -> integer (see constants)\n\n\
-Returns the line style of the object \"name\". If \"name\" is\
-not given the currently selected item is used.\
-Linestyles: LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID");
+QT_TR_NOOP("getLineStyle([\"name\"]) -> integer (see constants)\n\
+\n\
+Returns the line style of the object \"name\". If \"name\" is not given the\n\
+currently selected item is used. Line style constants are:\n\
+LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID\n\
+"));
 /*! Returns style type of the line */
 PyObject *scribus_getlinestyle(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfillshade__doc__,
-    "getFillShade([\"name\"]) -> integer\n\n\
-Returns the shading value of the fill color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFillShade([\"name\"]) -> integer\n\
+\n\
+Returns the shading value of the fill color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns fill shade of the object */
 PyObject *scribus_getfillshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcornerrad__doc__,
-    "getCornerRadius([\"name\"]) -> integer\n\n\
+QT_TR_NOOP("getCornerRadius([\"name\"]) -> integer\n\
+\n\
 Returns the corner radius of the object \"name\". The radius is\
 expressed in points. If \"name\" is not given the currently\
-selected Item is used.");
+selected item is used.\n\
+"));
 /*! Returns corner radius of the object */
 PyObject *scribus_getcornerrad(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getimgscale__doc__,
-    "getImageScale([\"name\"]) -> tuple\n\n\
-Returns a (x, y) tuple containing the scaling values of the image frame \"name\".\
-If \"name\" is not given the currently selected Item is used.");
+QT_TR_NOOP("getImageScale([\"name\"]) -> (x,y)\n\
+\n\
+Returns a (x, y) tuple containing the scaling values of the image frame\n\
+\"name\".  If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns image scale of the object */
 PyObject *scribus_getimgscale(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getimgname__doc__,
-    "getImageName([\"name\"]) -> string\n\n\
-Returns the filename for the image in the image frame.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getImageName([\"name\"]) -> string\n\
+\n\
+Returns the filename for the image in the image frame. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Returns image name of the object */
 PyObject *scribus_getimgname(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getposi__doc__,
-    "getPosition([\"name\"]) -> tuple\n\n\
-Returns a (x, y) tuple with the actual position of the object \"name\".\
+QT_TR_NOOP("getPosition([\"name\"]) -> (x,y)\n\
+\n\
+Returns a (x, y) tuple with the position of the object \"name\".\n\
 If \"name\" is not given the currently selected item is used.\
-The position is expressed in the actual measurement unit of the document\
-- see UNIT_<type> for reference.");
+The position is expressed in the actual measurement unit of the document\n\
+- see UNIT_<type> for reference.\n\
+"));
 /*! Returns position of the object */
 PyObject *scribus_getposi(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getsize__doc__,
-    "getSize([\"name\"]) -> tuple\n\n\
-Returns a (width, height) tuple with the actual size of the object \"name\".\
-If \"name\" is not given the currently selected item is used.\
-The size is expressed in the actual measurement unit of the document\
-- see UNIT_<type> for reference.");
+QT_TR_NOOP("getSize([\"name\"]) -> (width,height)\n\
+\n\
+Returns a (width, height) tuple with the size of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used. The size is\n\
+expressed in the current measurement unit of the document - see UNIT_<type>\n\
+for reference.\n\
+"));
 /*! Returns size of the object */
 PyObject *scribus_getsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getrotation__doc__,
-    "getRotation([\"name\"]) -> integer\n\n\
-Returns the rotation of the object \"name\". The value is expressed\
-in degrees. If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getRotation([\"name\"]) -> integer\n\
+\n\
+Returns the rotation of the object \"name\". The value is expressed in degrees,\n\
+and clockwise is positive. If \"name\" is not given the currently selected item\n\
+is used.\n\
+"));
 /*! Returns rotation of the object */
 PyObject *scribus_getrotation(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getallobj__doc__,
-    "getAllObjects() -> list\n\n\
-Returns a list containing the names of all objects on the actual page.");
+QT_TR_NOOP("getAllObjects() -> list\n\
+\n\
+Returns a list containing the names of all objects on the current page.\n\
+"));
 /*! Returns a list with all objects in page */
 PyObject *scribus_getallobj(PyObject *self, PyObject* args);
 
Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.13
diff -u -r1.13 cmdmani.cpp
--- cmdmani.cpp	3 Dec 2004 15:02:55 -0000	1.13
+++ cmdmani.cpp	10 Dec 2004 17:01:52 -0000
@@ -12,6 +12,11 @@
 	PageItem *item = GetUniqueItem(QString(Name));
 	if (item == NULL)
 		return NULL;
+	if (item->PType != FRAME_IMAGE)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
+		return NULL;
+	}
 	item->OwnPage->LoadPict(QString(Image), item->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -28,16 +33,13 @@
 	PageItem *item = GetUniqueItem(Name);
 	if (item == NULL)
 		return NULL;
-	if (item->PType == 2)
-	{
-		item->LocalScX = x;
-		item->LocalScY = y;
-	}
-	else
+	if (!item->PType == FRAME_IMAGE)
 	{
-		PyErr_SetString(ScribusException, QString("Specified item not an image frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
 		return NULL;
 	}
+	item->LocalScX = x;
+	item->LocalScY = y;
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -200,7 +202,7 @@
 		return NULL;
 	if (sc == 0.0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't scale by 0%"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't scale by 0%","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
Index: cmdmani.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v
retrieving revision 1.7
diff -u -r1.7 cmdmani.h
--- cmdmani.h	3 Dec 2004 15:02:55 -0000	1.7
+++ cmdmani.h	10 Dec 2004 17:01:52 -0000
@@ -8,141 +8,177 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_moveobjrel__doc__,
-    "moveObject(dx, dy [, \"name\"])\n\n\
-Moves the object \"name\" by dx and dy relative to its origin.\
-The distances are expressed in the actual measurement unit of\
-the document (see UNIT constants). If \"name\" is not given\
-the currently selected item is used. If the object \"name\"\
-belongs to a group, the whole group is moved.");
+QT_TR_NOOP("moveObject(dx, dy [, \"name\"])\n\
+\n\
+Moves the object \"name\" by dx and dy relative to its current position. The\n\
+distances are expressed in the current measurement unit of the document (see\n\
+UNIT constants). If \"name\" is not given the currently selected item is used.\n\
+If the object \"name\" belongs to a group, the whole group is moved.\n\
+"));
 /*! Move REL the object */
 PyObject *scribus_moveobjrel(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_moveobjabs__doc__,
-    "moveObjectAbs(x, y [, \"name\"])\n\n\
-Moves the object \"name\" to a new location. The coordinates are\
-expressed in the actual measurement unit of the document (see UNIT constants).\
-If \"name\" is not given the currently selected item is used.\
-If the object \"name\" belongs to a group, the whole group is moved.");
+QT_TR_NOOP("moveObjectAbs(x, y [, \"name\"])\n\
+\n\
+Moves the object \"name\" to a new location. The coordinates are expressed in\n\
+the current measurement unit of the document (see UNIT constants).  If \"name\"\n\
+is not given the currently selected item is used.  If the object \"name\"\n\
+belongs to a group, the whole group is moved.\n\
+"));
 /*! Move ABS the object */
 PyObject *scribus_moveobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_rotobjrel__doc__,
-    "rotateObject(rot [, \"name\"])\n\n\
-Rotates the object \"name\" by \"rot\" degrees relatively. Positve values mean\
-counter clockwise rotation. If \"name\" is not given the currently\
-selected Item is used.");
+QT_TR_NOOP("rotateObject(rot [, \"name\"])\n\
+\n\
+Rotates the object \"name\" by \"rot\" degrees relatively. The object is\n\
+rotated by the vertex that is currently selected as the rotation point - by\n\
+default, the top left vertext at zero rotation. Positive values mean counter\n\
+clockwise rotation when the default rotation point is used. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Rotate REL the object */
 PyObject *scribus_rotobjrel(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_rotobjabs__doc__,
-    "rotateObjectAbs(rot [, \"name\"])\n\n\
-Sets the rotation of the object \"name\" to \"rot\". Positve values\
-mean counter clockwise rotation. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("rotateObjectAbs(rot [, \"name\"])\n\
+\n\
+Sets the rotation of the object \"name\" to \"rot\". Positve values\n\
+mean counter clockwise rotation. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Rotate ABS the object */
 PyObject *scribus_rotobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_sizeobjabs__doc__,
-    "sizeObject(width, height [, \"name\"])\n\n\
-Resizes the object \"name\" to the given width and height. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("sizeObject(width, height [, \"name\"])\n\
+\n\
+Resizes the object \"name\" to the given width and height. If \"name\"\n\
+is not given the currently selected item is used.\n\
+"));
 /*! Resize ABS the object */
 PyObject *scribus_sizeobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getselobjnam__doc__,
-    "getSelectedObject([nr]) -> string\n\n\
-Returns the name of the selected object. \"nr\" if given indicates\
-the number of the selected object, e.g. 0 means the first selected object,\
-1 means the second selected Object and so on.");
+QT_TR_NOOP("getSelectedObject([nr]) -> string\n\
+\n\
+Returns the name of the selected object. \"nr\" if given indicates the number\n\
+of the selected object, e.g. 0 means the first selected object, 1 means the\n\
+second selected Object and so on.\n\
+"));
 /*! Returns name of the selected object */
 PyObject *scribus_getselobjnam(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selcount__doc__,
-    "selectionCount() -> integer\n\n\
-Returns the number of selected objects.");
+QT_TR_NOOP("selectionCount() -> integer\n\
+\n\
+Returns the number of selected objects.\n\
+"));
 /*! Returns count of the selected object */
 PyObject *scribus_selcount(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selectobj__doc__,
-    "selectObject(\"name\")\n\n\
-Selects the object with the given \"name\".");
+QT_TR_NOOP("selectObject(\"name\")\n\
+\n\
+Selects the object with the given \"name\".\n\
+"));
 /*! Count selection */
 PyObject *scribus_selectobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deselect__doc__,
-    "deselectAll()\n\n\
-Deselects all objects in the whole document.");
+QT_TR_NOOP("deselectAll()\n\
+\n\
+Deselects all objects in the whole document.\n\
+"));
 /*! Remove all selection */
 PyObject *scribus_deselect(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_groupobj__doc__,
-    "groupObjects(list)\n\n\
-Groups the objects named in \"list\" together. \"list\" must contain\
-the names of the objects to be grouped. If \"list\" is\
-not given the currently selected items are used.");
+QT_TR_NOOP("groupObjects(list)\n\
+\n\
+Groups the objects named in \"list\" together. \"list\" must contain the names\n\
+of the objects to be grouped. If \"list\" is not given the currently selected\n\
+items are used.\n\
+"));
 /*! Group objects named in list. */
 PyObject *scribus_groupobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_ungroupobj__doc__,
-    "unGroupObjects(\"name\")\n\n\
+QT_TR_NOOP("unGroupObjects(\"name\")\n\n\
 Destructs the group the object \"name\" belongs to.\
-If \"name\" is not given the currently selected item is used.");
+If \"name\" is not given the currently selected item is used."));
 /*! Ungroup objects named in list. */
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_scalegroup__doc__,
-    "scaleGroup(factor [,\"name\"])\n\n\
-Scales the group the object \"name\" belongs to. Values greater\
-than 1 enlarge the group, values smaller than 1 make the group\
-smaller e.g a value of 0.5 scales the group to 50 % of its original\
-size, a value of 1.5 scales the group to 150 % of its original size.\
-The value for \"factor\" must be greater than 0. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("scaleGroup(factor [,\"name\"])\n\
+\n\
+Scales the group the object \"name\" belongs to. Values greater than 1 enlarge\n\
+the group, values smaller than 1 make the group smaller e.g a value of 0.5\n\
+scales the group to 50 % of its original size, a value of 1.5 scales the group\n\
+to 150 % of its original size.  The value for \"factor\" must be greater than\n\
+0. If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise ValueError if an invalid scale factor is passed.\n\
+"));
 /*! Scale group with object name */
 PyObject *scribus_scalegroup(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_loadimage__doc__,
-    "loadImage(\"filename\" [, \"name\"])\n\n\
-Loads the picture \"picture\" into the image frame \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("loadImage(\"filename\" [, \"name\"])\n\
+\n\
+Loads the picture \"picture\" into the image frame \"name\". If \"name\" is\n\
+not given the currently selected item is used.\n\
+\n\
+May raise WrongFrameTypeError if the target frame is not an image frame\n\
+"));
 /*! Loads image file into frame. */
 PyObject *scribus_loadimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_scaleimage__doc__,
-    "scaleImage(x, y [, \"name\"])\n\n\
-Sets the scaling factors of the picture in the image frame \"name\".\
-If \"name\" is not given the currently selected item is used.\
-A Number of 1 means 100 %.");
+QT_TR_NOOP("scaleImage(x, y [, \"name\"])\n\
+\n\
+Sets the scaling factors of the picture in the image frame \"name\".\n\
+If \"name\" is not given the currently selected item is used. A number of 1\n\
+means 100 %.\n\
+\n\
+May raise WrongFrameTypeError if the target frame is not an image frame\n\
+"));
 /*! Scale Image. */
 PyObject *scribus_scaleimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_lockobject__doc__,
-    "lockObject([\"name\"]) -> bool\n\n\
-Locks the object \"name\" if it's unlocked or unlock it if it's locked.\
-If \"name\" is not given the currently selected item is used.\
-Returns true if locked.");
+QT_TR_NOOP("lockObject([\"name\"]) -> bool\n\
+\n\
+Locks the object \"name\" if it's unlocked or unlock it if it's locked.\n\
+If \"name\" is not given the currently selected item is used. Returns true\n\
+if locked.\n\
+"));
 /*! (Un)Lock the object 2004/7/10 pv.*/
 PyObject *scribus_lockobject(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_islocked__doc__,
-    "isLocked([\"name\"]) -> bool\n\n\
-Returns true if is the object \"name\" locked.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("isLocked([\"name\"]) -> bool\n\
+\n\
+Returns true if is the object \"name\" locked.  If \"name\" is not given the\n\
+currently selected item is used.\n\
+"));
 /*! Status of locking 2004/7/10 pv.*/
 PyObject *scribus_islocked(PyObject *self, PyObject* args);
 
Index: cmdmisc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp,v
retrieving revision 1.19
diff -u -r1.19 cmdmisc.cpp
--- cmdmisc.cpp	3 Dec 2004 15:02:55 -0000	1.19
+++ cmdmisc.cpp	10 Dec 2004 17:01:52 -0000
@@ -71,18 +71,18 @@
 		return NULL;
 	if (!Carrier->Prefs.AvailFonts.find(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("Font not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
 	QString ts = QString(Sample);
 	if (ts == "")
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't render an empty sample"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't render an empty sample","python error"));
 		return NULL;
 	}
 	if (QString(FileName) == "")
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't save to a blank filename"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't save to a blank filename","python error"));
 		return NULL;
 	}
 	QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
@@ -111,9 +111,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = -1;
@@ -131,7 +131,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -153,9 +153,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Layer == "")
+	if (strcmp(Layer, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -174,7 +174,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -189,9 +189,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	bool found = false;
@@ -206,7 +206,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -223,7 +223,7 @@
 		return NULL;
 	if (Name == "")
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	bool found = false;
@@ -238,7 +238,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -252,9 +252,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = 0;
@@ -270,7 +270,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	return PyInt_FromLong(static_cast<long>(i));
@@ -283,9 +283,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = 0;
@@ -301,7 +301,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	return PyInt_FromLong(static_cast<long>(i));
@@ -314,14 +314,14 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, ""))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	if (Carrier->doc->Layers.count() == 1)
 	{
-		PyErr_SetString(ScribusException, QString("Can't remove the last layer"));
+		PyErr_SetString(ScribusException, QObject::tr("Can't remove the last layer","python error"));
 		return NULL;
 	}
 	bool found = false;
@@ -355,7 +355,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -369,16 +369,16 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Can't create layer without a name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't create layer without a name","python error"));
 		return NULL;
 	}
 	QString tmp;
 	struct Layer ll;
 	ll.LNr = Carrier->doc->Layers.last().LNr + 1;
 	ll.Level = Carrier->doc->Layers.count();
-    // FIXME: what if the name exists?
+	// FIXME: what if the name exists?
 	ll.Name = QString(Name);
 	ll.Sichtbar = true;
 	ll.Drucken = true;
Index: cmdmisc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.h,v
retrieving revision 1.9
diff -u -r1.9 cmdmisc.h
--- cmdmisc.h	3 Dec 2004 15:02:55 -0000	1.9
+++ cmdmisc.h	10 Dec 2004 17:01:53 -0000
@@ -8,23 +8,31 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setredraw__doc__,
-    "setRedraw(bool)\n\n\
-Disables page redraw when bool = 0, otherwise redrawing is enabled.");
+QT_TR_NOOP("setRedraw(bool)\n\
+\n\
+Disables page redraw when bool = False, otherwise redrawing is enabled.\n\
+This change will persist even after the script exits, so make sure to call\n\
+setRedraw(True) in a finally: clause at the top level of your script.\n\
+"));
 /*! Enable/disable page redrawing. */
 PyObject *scribus_setredraw(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_fontnames__doc__,
-    "getFontNames() -> list\n\n\
-Returns a list with the names of all available fonts.");
+QT_TR_NOOP("getFontNames() -> list\n\
+\n\
+Returns a list with the names of all available fonts.\n\
+"));
 /*! simple list of font names. */
 PyObject *scribus_fontnames(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_xfontnames__doc__,
-    "getXFontNames() -> list of tuples\n\n\
-Returns a larger font info. It's a list of the tuples with: \
-[ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]");
+QT_TR_NOOP("getXFontNames() -> list of tuples\n\
+\n\
+Returns a larger font info. It's a list of the tuples with:\n\
+[ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]\n\
+"));
 /*!
  return a list of the tuples with
  Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file
@@ -33,97 +41,144 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_renderfont__doc__,
-    "rendeFont(\"name\", \"filename\", \"sample\", size) -> bool\n\n\
-Creates an image preview of font \"name\" with given text \"sample\"\
-and size. Image is saved into \"filename\". Returns true when success.");
+QT_TR_NOOP("rendeFont(\"name\", \"filename\", \"sample\", size) -> bool\n\
+\n\
+Creates an image preview of font \"name\" with given text \"sample\" and size.\n\
+Image is saved into \"filename\". Returns true when success.\n\
+\n\
+May raise NotFoundError if the specified font can't be found.\n\
+May raise ValueError if an empty sample or filename is passed.\n\
+"));
 /*! Font example to image. */
 PyObject *scribus_renderfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlayers__doc__,
-    "getLayers() -> list\n\n\
-Returns a list with the names of all defined layers.");
+QT_TR_NOOP("getLayers() -> list\n\
+\n\
+Returns a list with the names of all defined layers.\n\
+"));
 /*! List of the layers */
 PyObject *scribus_getlayers(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setactlayer__doc__,
-    "setActiveLayer(\"name\")\n\n\
-Sets the active layer to the layer named \"name\".");
+QT_TR_NOOP("setActiveLayer(\"name\")\n\
+\n\
+Sets the active layer to the layer named \"name\".\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Move into layer */
 PyObject *scribus_setactlayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getactlayer__doc__,
-    "getActiveLayer() -> string\n\n\
-Returns the name of the current active layer.");
+QT_TR_NOOP("getActiveLayer() -> string\n\
+\n\
+Returns the name of the current active layer.\n\
+"));
 /*! Get layer name */
 PyObject *scribus_getactlayer(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_senttolayer__doc__,
-    "sentToLayer(\"layer\" [, \"name\"])\n\n\
-Sends the object \"name\" to the layer \"layer\". The layer\
-must exist. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("sentToLayer(\"layer\" [, \"name\"])\n\
+\n\
+Sends the object \"name\" to the layer \"layer\". The layer must exist.\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Move object from one layer to other one */
 PyObject *scribus_senttolayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_layervisible__doc__,
-    "setLayerVisible(\"layer\", visible)\n\n\
-Sets the layer \"layer\" to be visible or not. If is the\
-visible set to false the layer is invisible.");
+QT_TR_NOOP("setLayerVisible(\"layer\", visible)\n\
+\n\
+Sets the layer \"layer\" to be visible or not. If is the visible set to false\n\
+the layer is invisible.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer visible */
 PyObject *scribus_layervisible(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_layerprint__doc__,
-    "setLayerPrintable(\"layer\", printable)\n\n\
-Sets the layer \"layer\" to be printable or not. If is the\
-printable set to false the layer won't be printed.");
+QT_TR_NOOP("setLayerPrintable(\"layer\", printable)\n\
+\n\
+Sets the layer \"layer\" to be printable or not. If is the printable set to\n\
+false the layer won't be printed.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer printable */
 PyObject *scribus_layerprint(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_glayervisib__doc__,
-    "isLayerPrintable(\"layer\") -> bool\n\n\
-Returns wether the Layer \"layer\" is visible or not, a value\
-of true means that the layer \"layer\" is visible, a Value of false\
-means that the layer \"layer\" is invisible.");
+QT_TR_NOOP("isLayerPrintable(\"layer\") -> bool\n\
+\n\
+Returns wether the Layer \"layer\" is visible or not, a value of True means\n\
+that the layer \"layer\" is visible, a value of False means that the layer\n\
+\"layer\" is invisible.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer visible */
 PyObject *scribus_glayervisib(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_glayerprint__doc__,
-    "isLayerPrintable(\"layer\") -> bool\n\n\
-Returns wether the layer \"layer\" is printable or not,\
-a value of true means that the layer \"layer\" can be printed,\
-a value of false means that printing the layer \"layer\"\
-is disabled.");
+QT_TR_NOOP("isLayerPrintable(\"layer\") -> bool\n\
+\n\
+Returns wether the layer \"layer\" is printable or not, a value of True means\n\
+that the layer \"layer\" can be printed, a value of False means that printing\n\
+the layer \"layer\" is disabled.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer printable */
 PyObject *scribus_glayerprint(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_removelayer__doc__,
-    "deleteLayer(\"layer\")\n\n\
-Deletes the layer with the name \"layer\". Nothing happens\
-if the layer doesn't exists or if it's the only layer in\
-the document.");
+QT_TR_NOOP("deleteLayer(\"layer\")\n\
+\n\
+Deletes the layer with the name \"layer\". Nothing happens if the layer doesn't\n\
+exists or if it's the only layer in the document.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Remove layer */
 PyObject *scribus_removelayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_createlayer__doc__,
-    "createLayer(layer)\n\n\
-Creates a new layer with the name \"name\".");
+QT_TR_NOOP("createLayer(layer)\n\
+\n\
+Creates a new layer with the name \"name\".\n\
+\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! New layer */
 PyObject *scribus_createlayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlanguage__doc__,
-    "getGuiLanguage() -> string\n\n\
-Returns a string with the -lang value.");
+QT_TR_NOOP("getGuiLanguage() -> string\n\
+\n\
+Returns a string with the -lang value.\n\
+"));
 /*! Language of the GUI */
 PyObject *scribus_getlanguage(PyObject *self);
 
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.17
diff -u -r1.17 cmdobj.cpp
--- cmdobj.cpp	3 Dec 2004 15:02:55 -0000	1.17
+++ cmdobj.cpp	10 Dec 2004 17:01:53 -0000
@@ -11,7 +11,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	int i = Carrier->doc->ActPage->PaintRect(ValueToPoint(x), ValueToPoint(y),
@@ -34,7 +34,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	int i = Carrier->doc->ActPage->PaintEllipse(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h),  Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
@@ -55,7 +55,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	int i = Carrier->doc->ActPage->PaintPict(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h));
@@ -76,7 +76,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	int i = Carrier->doc->ActPage->PaintText(ValueToPoint(x), ValueToPoint(y),
@@ -99,7 +99,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	x =	ValueToPoint(x);
@@ -143,17 +143,17 @@
 	int len = PyList_Size(il);
 	if (len < 4)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least two points (four values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least two points (four values)","python error"));
 		return NULL;
 	}
 	if ((len % 2) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain an even number of values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h;
@@ -217,17 +217,17 @@
 	int len = PyList_Size(il);
 	if (len < 6)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least three points (six values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least three points (six values)","python error"));
 		return NULL;
 	}
 	if ((len % 2) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain an even number of values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h;
@@ -293,17 +293,17 @@
 	int len = PyList_Size(il);
 	if (len < 8)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least four points (eight values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least four points (eight values)","python error"));
 		return NULL;
 	}
 	if ((len % 6) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must have a multiple of six values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must have a multiple of six values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h, kx, ky, kx2, ky2;
@@ -382,7 +382,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	//FIXME: Why use GetItem not GetUniqueItem? Maybe use GetUniqueItem and use the exceptions
@@ -391,7 +391,7 @@
 	int ii = GetItem(QString(PolyB));
 	if ((i == -1) || (ii == -1))
 	{
-		PyErr_SetString(ScribusException, QString("Oook! You're calling an object doesn't exist!"));
+		PyErr_SetString(NotFoundError, QObject::tr("Object not found","python error"));
 		return NULL;
 	}
 	Carrier->doc->ActPage->SelItem.clear();
@@ -479,7 +479,7 @@
 	PageItem *item = GetUniqueItem(QString(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType == 4)
+	if (item->PType == FRAME_TEXT)
 	{
 		/*
 		 * First, find the style number associated with the requested style
@@ -500,7 +500,7 @@
 		}
 		if (!found) {
 			// whoops, the user specified an invalid style, complain loudly.
-			PyErr_SetString(PyExc_Exception, QString("Style not found"));
+			PyErr_SetString(NotFoundError, QObject::tr("Style not found","python error"));
 			return NULL;
 		}
 		// quick hack to always apply on the right frame - pv
@@ -512,7 +512,7 @@
 	}
 	else
 	{
-		PyErr_SetString(ScribusException, QString("Can't set style on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set style on a non-text frame","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
Index: cmdobj.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.h,v
retrieving revision 1.10
diff -u -r1.10 cmdobj.h
--- cmdobj.h	3 Dec 2004 15:02:55 -0000	1.10
+++ cmdobj.h	10 Dec 2004 17:01:53 -0000
@@ -8,12 +8,16 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newrect__doc__,
-    "createRect(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new rectangle on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createRect(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new rectangle on the current page and returns its name. The\n\
+coordinates are given in the current measurement units of the document\n\
+(see UNIT constants). \"name\" should be a unique identifier for the object\n\
+because you need this name to reference that object in future. If \"name\"\n\
+is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a rectangular with params X, Y (base position)
  b, h (width, height) and optional name of the object.
  */
@@ -21,12 +25,16 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newellipse__doc__,
-    "createEllipse(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new ellipse on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createEllipse(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new ellipse on the current page and returns its name.\n\
+The coordinates are given in the current measurement units of the document\n\
+(see UNIT constants). \"name\" should be a unique identifier for the object\n\
+because you need this name for further referencing of that object. If \"name\"\n\
+is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates an ellipse with x, y, b and h - name optionally
  params.
  */
@@ -34,90 +42,121 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newimage__doc__,
-    "createImage(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new picture on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createImage(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new picture frame on the current page and returns its name. The\n\
+coordinates are given in the current measurement units of the document.\n\
+\"name\" should be a unique identifier for the object because you need this\n\
+name for further access to that object. If \"name\" is not given Scribus will\n\
+create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates an image frame - x, y, b, h and opt. name. */
 PyObject *scribus_newimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newtext__doc__,
-    "createText(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new textframe on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createText(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new text frame on the actual page and returns its name.\n\
+The coordinates are given in the actual measurement unit of the document (see\n\
+UNIT constants). \"name\" should be a unique identifier for the object because\n\
+you need this name for further referencing of that object. If \"name\" is not\n\
+given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a text frame - x, y, b, h and opt. name. */
 PyObject *scribus_newtext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newline__doc__,
-    "createLine(x1, y1, x2, y2, [\"name\"]) -> string\n\n\
-Creates a new line from the point(x1, y1) to the point(x2, y2)\
-and returns its name. The coordinates are given in the actual\
-measurement unit of the document (see UNIT constants). \"name\" should be a unique\
-identifier for the object because you need this name for further\
-referencing of that object. If \"name\" is not given Scribus\
-will create one for you.");
+QT_TR_NOOP("createLine(x1, y1, x2, y2, [\"name\"]) -> string\n\
+\n\
+Creates a new line from the point(x1, y1) to the point(x2, y2) and returns\n\
+its name. The coordinates are given in the current measurement unit of the\n\
+document (see UNIT constants). \"name\" should be a unique identifier for the\n\
+object because you need this name for further access to that object. If\n\
+\"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a line object - x, y, b, h and opt. name. */
 PyObject *scribus_newline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_polyline__doc__,
-    "createPolyLine(list, [\"name\"]) -> string\n\n\
-Creates a new polyline and returns its name. The pPoints for the\
-polyline are stored in the list \"list\" in the following order:\
-[x1, y1, x2, y2...xn. yn]. The coordinates are given in the actual\
-measurement unit of the document (see UNIT constants). \"name\" should be a unique\
-identifier for the object because you need this name for further\
-referencing of that object. If \"name\" is not given Scribus will\
-create one for you.");
+QT_TR_NOOP("createPolyLine(list, [\"name\"]) -> string\n\
+\n\
+Creates a new polyline and returns its name. The points for the polyline are\n\
+stored in the list \"list\" in the following order: [x1, y1, x2, y2...xn. yn].\n\
+The coordinates are given in the current measurement units of the document (see\n\
+UNIT constants). \"name\" should be a unique identifier for the object because\n\
+you need this name for further access to that object. If \"name\" is not given\n\
+Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a polygon line - list with points and opt. name as params. */
 PyObject *scribus_polyline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_polygon__doc__,
-    "createPolygon(list, [\"name\"]) -> string\n\n\
-Creates a new polygon and returns its name. The points for the\
-polygon are stored in the list \"list\" in the following order:\
-[x1, y1, x2, y2...xn. yn]. At least three points are required. There\
-is no need to repeat the first point to close the polygon. The polygon\
-is automatically closed by connecting the first and the last point.\
-The coordinates are given in the actual measurement unit of the document (see UNIT constants).\
-\"name\" should be a unique identifier for the object because you need\
-this name for further referencing of that object. If \"name\" is not\
-given Scribus will create one for you.");
+QT_TR_NOOP("createPolygon(list, [\"name\"]) -> string\n\
+\n\
+Creates a new polygon and returns its name. The points for the polygon are\n\
+stored in the list \"list\" in the following order: [x1, y1, x2, y2...xn. yn].\n\
+At least three points are required. There is no need to repeat the first point\n\
+to close the polygon. The polygon is automatically closed by connecting the\n\
+first and the last point.  The coordinates are given in the current measurement\n\
+units of the document (see UNIT constants).  \"name\" should be a unique\n\
+identifier for the object because you need this name for further access to that\n\
+object. If \"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a polygon - list with points and opt. name as params. */
 PyObject *scribus_polygon(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_bezierline__doc__,
-    "createBezierLine(list, [\"name\"]) -> string\n\n\
-Creates a new bezier curve and returns its name. The points for\
-the bezier curve are stored in the list \"list\" in the following\
-order: [x1, y1, kx1, ky1, x2, y2, kx2, ky2...xn. yn, kxn. kyn].\
-Where x and y mean the x and y coordinates of the point and kx and\
-ky meaning the controlpoint for the curve. The coordinates are given\
-in the actual measurement unit of the document (see UNIT constants). \"name\" should be a\
-unique identifier for the object because you need this name for\
-further referencing of that object. If \"name\" is not given Scribus\
-will create one for you.");
+QT_TR_NOOP("createBezierLine(list, [\"name\"]) -> string\n\
+\n\
+Creates a new bezier curve and returns its name. The points for the bezier\n\
+curve are stored in the list \"list\" in the following order:\n\
+[x1, y1, kx1, ky1, x2, y2, kx2, ky2...xn. yn, kxn. kyn]\n\
+In the points list, x and y mean the x and y coordinates of the point and kx\n\
+and ky meaning the control point for the curve.  The coordinates are given in\n\
+the current measurement units of the document (see UNIT constants). \"name\"\n\
+should be a unique identifier for the object because you need this name for\n\
+further access to that object. If \"name\" is not given Scribus will create one\n\
+for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a Bezier line - list with points and opt. name as params. */
 PyObject *scribus_bezierline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pathtext__doc__,
-    "createPathText(x, y, \"textbox\", \"beziercurve\", [\"name\"]) -> string\n\n\
-Creates a new pathText by merging the 2 objects \"textbox\" and\
-\"beziercurve\" and returns its name. The coordinates are given\
-in the actual measurement unit of the document (see UNIT constants). \"name\" should\
-be a unique identifier for the object because you need this name\
-for further referencing of that object. If \"name\" is not given\
-Scribus will create one for you.");
+QT_TR_NOOP("createPathText(x, y, \"textbox\", \"beziercurve\", [\"name\"]) -> string\n\
+\n\
+Creates a new pathText by merging the two objects \"textbox\" and\n\
+\"beziercurve\" and returns its name. The coordinates are given in the current\n\
+measurement unit of the document (see UNIT constants). \"name\" should be a\n\
+unique identifier for the object because you need this name for further access\n\
+to that object. If \"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise NotFoundError if one or both of the named base object don't exist.\n\
+"));
 /** Joins 2 objects - textframe and line - into text on path.
  Uses x, y (base of the new object), name of the text frame,
  name of the line and opt. new name as params. */
@@ -125,19 +164,23 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deleteobj__doc__,
-    "deleteObject([\"name\"])\n\n\
-Deletes the item with the name \"name\". If \"name\" is not\
-given the currently selected item is deleted.");
+QT_TR_NOOP("deleteObject([\"name\"])\n\
+\n\
+Deletes the item with the name \"name\". If \"name\" is not given the currently\n\
+selected item is deleted.\n\
+"));
 /** Deletes an object - if is the name given the named object is
  deleted else the active object erased. */
 PyObject *scribus_deleteobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_textflow__doc__,
-    "textFlowsAroundFrame(\"name\" [, state])\n\n\
-Enables/disables \"Text Flows Around Frame\" feature for object \"name\".\
-Called with parameters string name and voluntary boolean state 1|0. When 1 set flowing\
-to true (0 to false). When is second param empty flowing is reverted.");
+QT_TR_NOOP("textFlowsAroundFrame(\"name\" [, state])\n\
+\n\
+Enables/disables \"Text Flows Around Frame\" feature for object \"name\".\n\
+Called with parameters string name and optional boolean \"state\". If \"state\"\n\
+is not passed, text flow is toggled.\n\
+"));
 /**
 Enables/disables "Text Flows Around Box" feature for object.
 Called with params string objectName and voluntary 1|0.
@@ -149,10 +192,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_objectexists__doc__,
-    "objectExists([\"name\"]) -> bool\n\n\
-User test if an object with specified name really exists in the document.\
-Optional parameter is the object name. When no param given returns\
-if there is something selected.");
+QT_TR_NOOP("objectExists([\"name\"]) -> bool\n\
+\n\
+Test if an object with specified name really exists in the document.\n\
+The optional parameter is the object name. When no object name is given,\n\
+returns True if there is something selected.\n\
+"));
 /**
 User test if an object with specified name really exists in
 the doc. Object name as param.
@@ -164,9 +209,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setstyle__doc__,
-    "setStyle(\"style\" [, \"name\"])\n\n\
-Apply the named \"style\" to the object named \"name\". If is no\
-name given, it's applied on the selected object.");
+QT_TR_NOOP("setStyle(\"style\" [, \"name\"])\n\
+\n\
+Apply the named \"style\" to the object named \"name\". If is no object name\n\
+given, it's applied on the selected object.\n\
+"));
 /**
  Craig Ringer, 2004-09-09
  Apply the named style to the currently selected object.
@@ -177,8 +224,10 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getstylenames__doc__,
-    "getAllStyles() -> list\n\n\
-Enumerate all known paragraph styles.");
+QT_TR_NOOP("getAllStyles() -> list\n\
+\n\
+Return a list of the names of all paragraph styles in the current document.\n\
+"));
 /**
  Craig Ringer, 2004-09-09
  Enumerate all known paragraph styles
Index: cmdpage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v
retrieving revision 1.18
diff -u -r1.18 cmdpage.cpp
--- cmdpage.cpp	3 Dec 2004 15:02:55 -0000	1.18
+++ cmdpage.cpp	10 Dec 2004 17:01:53 -0000
@@ -25,8 +25,13 @@
 	if(!checkHaveDocument())
 		return NULL;
 	bool ret = Carrier->DoSaveAsEps(QString(Name));
-	//FIXME: Should we really be returning a bool here? -- cr
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True);	// return True not None for backward compat
+	return Py_True;
 }
 
 PyObject *scribus_deletepage(PyObject *self, PyObject* args)
@@ -39,7 +44,7 @@
 	e--;
 	if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 		return NULL;
 	}
 	Carrier->DeletePage2(e);
@@ -57,7 +62,7 @@
 	e--;
 	if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 		return NULL;
 	}
 	Carrier->view->GotoPage(e);
@@ -80,7 +85,7 @@
 		e--;
 		if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
 		{
-			PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+			PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 			return NULL;
 		}
 		Carrier->slotNewPageP(e, QString(name));
@@ -158,7 +163,7 @@
 		return NULL;
 	if (!PyList_Check(l))
 	{
-		PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
+		PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values","python error"));
 		return NULL;
 	}
 	int i, n;
@@ -169,7 +174,7 @@
 	{
 		if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
 		{
-			PyErr_SetString(PyExc_TypeError, QString("argument contains non-numeric values: must be list of float values"));
+			PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains non-numeric values: must be list of float values","python error"));
 			return NULL;
 		}
 		Carrier->doc->ActPage->YGuides += ValueToPoint(guide);
@@ -207,7 +212,7 @@
 		return NULL;
 	if (!PyList_Check(l))
 	{
-		PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
+		PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values","python error"));
 		return NULL;
 	}
 	int i, n;
@@ -218,7 +223,7 @@
 	{
 		if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
 		{
-			PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
+			PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains no-numeric values: must be list of float values","python error"));
 			return NULL;
 		}
 		Carrier->doc->ActPage->XGuides += ValueToPoint(guide);
Index: cmdpage.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.h,v
retrieving revision 1.11
diff -u -r1.11 cmdpage.h
--- cmdpage.h	3 Dec 2004 15:02:55 -0000	1.11
+++ cmdpage.h	10 Dec 2004 17:01:53 -0000
@@ -8,99 +8,132 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newpage__doc__,
-    "newPage(where [,\"template\"])\n\n\
-Creates a new page. If \"where\" is -1 the new Page is appended\
-to the document, otherwise the new page is inserted at \"where\".\
-The pagenumbers are counted from 1 upwards. The optional parameter\
-\"template\" specifies the name of the template page for the new page.");
+QT_TR_NOOP("newPage(where [,\"template\"])\n\
+\n\
+Creates a new page. If \"where\" is -1 the new Page is appended to the\n\
+document, otherwise the new page is inserted before \"where\". Page numbers are\n\
+counted from 1 upwards, no matter what the displayed first page number of your\n\
+document is. The optional parameter \"template\" specifies the name of the\n\
+template page for the new page.\n\
+\n\
+May raise IndexError if the page number is out of range\n\
+"));
 /*! new page */
 PyObject *scribus_newpage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_actualpage__doc__,
-    "currentPage() -> integer\n\n\
-Returns the number of the current working page. Pagenumbers are\
-counted from 1 upwards.");
+QT_TR_NOOP("currentPage() -> integer\n\
+\n\
+Returns the number of the current working page. Page numbers are counted from 1\n\
+upwards, no matter what the displayed first page number of your document is.\n\
+"));
 /*! get actual page */
 PyObject *scribus_actualpage(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_redraw__doc__,
-    "redrawAll()\n\n\
-Redraws all Pages.");
+QT_TR_NOOP("redrawAll()\n\
+\n\
+Redraws all pages.\n\
+"));
 /*! redraw all */
 PyObject *scribus_redraw(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savepageeps__doc__,
-    "savePageAsEPS(\"name\") -> bool\n\n\
-Saves the actual page as an EPS with name, returns true if successful.");
+QT_TR_NOOP("savePageAsEPS(\"name\")\n\
+\n\
+Saves the current page as an EPS to the file \"name\".\n\
+\n\
+May raise ScribusError if the save failed.\n\
+"));
 /*! Export page as EPS file */
 PyObject *scribus_savepageeps(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deletepage__doc__,
-    "deletePage(nr)\n\n\
-Deletes the given Page, does nothing if the Document contains\
-only one Page. Pagenumbers are counted from 1 upwards.");
+QT_TR_NOOP("deletePage(nr)\n\
+\n\
+Deletes the given page. Does nothing if the document contains only one page.\n\
+Page numbers are counted from 1 upwards, no matter what the displayed first\n\
+page number is.\n\
+\n\
+May raise IndexError if the page number is out of range\n\
+"));
 /*! Delete page */
 PyObject *scribus_deletepage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gotopage__doc__,
-    "gotoPage(nr)\n\n\
-    Moves to the page \"nr\". If \"nr\" is outside the current\
-rage of pages \"Page number out of range\" exception raised.");
+QT_TR_NOOP("gotoPage(nr)\n\
+\n\
+Moves to the page \"nr\" (that is, makes the current page \"nr\"). Note that\n\
+gotoPage doesn't (curently) change the page the user's view is displaying, it\n\
+just sets the page that script commands will operates on.\n\
+\n\
+May raise IndexError if the page number is out of range.\n\
+"));
 /*! Go to page */
 PyObject *scribus_gotopage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pagecount__doc__,
-    "pageCount() -> integer\n\n\
-Returns the Number of Pages in the Document.");
+QT_TR_NOOP("pageCount() -> integer\n\
+\n\
+Returns the number of pages in the document.\n\
+"));
 /*! Go to page */
 PyObject *scribus_pagecount(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getHguides__doc__,
-    "getHGuides() -> list\n\n\
-Returns the list containing positions of the horizontal guides.\
-Values are in specified typo unit - see UNIT_<type> constants.");
+QT_TR_NOOP("getHGuides() -> list\n\
+\n\
+Returns a list containing positions of the horizontal guides. Values are in the\n\
+document's current units - see UNIT_<type> constants.\n\
+"));
 /*! get H guides */
 PyObject *scribus_getHguides(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setHguides__doc__,
-    "setHGuides(list)\n\n\
-Sets horizontal guides. Input parameter must be a list with typo\
-units values - see UNIT_<type> constants.\n\
-E.g.: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost");
+QT_TR_NOOP("setHGuides(list)\n\
+\n\
+Sets horizontal guides. Input parameter must be a list of guide positions\n\
+measured in the current document units - see UNIT_<type> constants.\n\
+\n\
+Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost\n\
+         setHGuides([90,250]) # replace current guides entirely\n\
+"));
 /*! set H guides */
 PyObject *scribus_setHguides(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getVguides__doc__,
-    "getVGuides()\n\n\
-Returns the list containing positions of the vertical guides.\
-Values are in specified typo unit - see UNIT_<type> constants.");
+QT_TR_NOOP("getVGuides()\n\
+\n\
+See getHGuides.\n\
+"));
 /*! get V guides */
 PyObject *scribus_getVguides(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setVguides__doc__,
-    "setVGuides()\n\n\
-Sets vertical guides. Input parameter must be a list with typo\
-units values - see UNIT_<type> constants.\n\
-E.g.: setVGuides(getVGuides() + [200.0, 210.0] # add new guides without any lost");
+QT_TR_NOOP("setVGuides()\n\
+\n\
+See setHGuides.\n\
+"));
 /*! set V guides */
 PyObject *scribus_setVguides(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pagedimension__doc__,
-    "getPageSize() -> tuple\n\n\
-Returns a tuple with page dimensions in used system e.g. when\
-the document's page is in picas - picas are returned. See UNIT_<type>\
-constants and getPageMargins()");
+QT_TR_NOOP("getPageSize() -> tuple\n\
+\n\
+Returns a tuple with page dimensions measured in the document's current units.\n\
+See UNIT_<type> constants and getPageMargins()\n\
+"));
 /**
 returns a tuple with page domensions in used system
 e.g. when is the doc in picas returns picas ;)
@@ -110,12 +143,13 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getpageitems__doc__,
-    "getPageItems() -> list\n\n\
-Returns a list of tuples with items on the actual page.\
-(name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\
-means that object named 'Text1' is a text frame (type 4)\
-and is the first at the page...\
-TODO: implement constants for types for item type etc.");
+QT_TR_NOOP("getPageItems() -> list\n\
+\n\
+Returns a list of tuples with items on the current page. The tuple is:\n\
+(name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\n\
+means that object named 'Text1' is a text frame (type 4) and is the first at\n\
+the page...\n\
+"));
 /**
 returns a list of tuples with items on the actual page
 TODO: solve utf/iso chars in object names
@@ -125,10 +159,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getpagemargins__doc__,
-    "getPageMargins()\n\n\
-Returns a tuple with page margins in used system e.g. when\
-the document's page is in picas - picas are returned. See UNIT_<type>\
-constants and getPageSize().");
+QT_TR_NOOP("getPageMargins()\n\
+\n\
+Returns the page margins as a (left, right, top, bottom) tuple in the current\n\
+units. See UNIT_<type> constants and getPageSize().\n\
+"));
 /**
 returns a tuple with page margins
 Craig Ringer, Petr Vanek 09/25/2004
Index: cmdsetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp,v
retrieving revision 1.13
diff -u -r1.13 cmdsetprop.cpp
--- cmdsetprop.cpp	3 Dec 2004 15:02:55 -0000	1.13
+++ cmdsetprop.cpp	10 Dec 2004 17:01:53 -0000
@@ -71,7 +71,7 @@
 		return NULL;
 	if ((w < 0.0) || (w > 12.0))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line width out of bounds, must be 0 <= line_width <= 12"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line width out of bounds, must be 0 <= line_width <= 12","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -92,7 +92,7 @@
 		return NULL;
 	if ((w < 0) || (w > 100))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line shade out of bounds, must be 0 <= shade <= 100"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
 	PageItem *it = GetUniqueItem(QString(Name));
@@ -113,7 +113,7 @@
 		return NULL;
 	if ((w < 0) || (w > 100))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Fill shade out of bounds, must be 0 <= shade <= 100"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Fill shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -182,13 +182,14 @@
 		return NULL;
 	if (w < 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Corner radius must be a positive number."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error"));
 		return NULL;
 	}
 	PageItem *b = GetUniqueItem(QString(Name));
 	if (b == NULL)
 		return NULL;
-	if ((b->PType == 2) || (b->PType == 3) || (b->PType == 4))
+	// What the heck is a type 3 frame?
+	if ((b->PType == FRAME_IMAGE) || (b->PType == 3) || (b->PType == FRAME_TEXT))
 	{
 		b->RadRect = w;
 		if (w > 0)
@@ -203,20 +204,20 @@
 PyObject *scribus_setmultiline(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	char *Style = NULL;
+	if (!PyArg_ParseTuple(args, "s|s", &Style, &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *b = GetUniqueItem(QString(Name));
 	if (b == NULL)
 		return NULL;
-	if (!Carrier->doc->MLineStyles.contains(QString(Color)))
+	if (!Carrier->doc->MLineStyles.contains(QString(Style)))
 	{
-		PyErr_SetString(ScribusException, QString("Color not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Line style not found","python error"));
 		return NULL;
 	}
-	b->NamedLStyle = QString(Color);
+	b->NamedLStyle = QString(Style);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdsetprop.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h,v
retrieving revision 1.5
diff -u -r1.5 cmdsetprop.h
--- cmdsetprop.h	3 Dec 2004 15:02:55 -0000	1.5
+++ cmdsetprop.h	10 Dec 2004 17:01:53 -0000
@@ -8,99 +8,131 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setgradfill__doc__,
-    "setGradientFill(type, \"color1\", shade1, \"color2\", shade2, [\"name\"])\n\n\
-Sets the gradient fill of the object \"name\" to type.\
-Color descriptions are the same as for setFillColor()\
-and setFillShade(). See the constants for available types (FILL_<type>).");
+QT_TR_NOOP("setGradientFill(type, \"color1\", shade1, \"color2\", shade2, [\"name\"])\n\
+\n\
+Sets the gradient fill of the object \"name\" to type. Color descriptions are\n\
+the same as for setFillColor() and setFillShade(). See the constants for\n\
+available types (FILL_<type>).\n\
+"));
 /*! Set gradient */
 PyObject *scribus_setgradfill(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfillcolor__doc__,
-    "setFillColor(\"color\", [\"name\"])\n\n\
-Sets the fill color of the object \"name\" to the color \"color\".\
-\"color\" is the name of one of the defined colors. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("setFillColor(\"color\", [\"name\"])\n\
+\n\
+Sets the fill color of the object \"name\" to the color \"color\". \"color\"\n\
+is the name of one of the defined colors. If \"name\" is not given the\n\
+currently selected item is used.\n\
+"));
 /*! Set fill color */
 PyObject *scribus_setfillcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinecolor__doc__,
-    "setLineColor(\"color\", [\"name\"])\n\n\
-Sets the line color of the object \"name\" to the color \"color\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setLineColor(\"color\", [\"name\"])\n\
+\n\
+Sets the line color of the object \"name\" to the color \"color\". If \"name\"\n\
+is not given the currently selected item is used.\n\
+"));
 /*! Set line color */
 PyObject *scribus_setlinecolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinewidth__doc__,
-    "setLineWidth(width, [\"name\"])\n\n\
-Sets line width of the object \"name\" to \"width\". \"width\" must\
-be in the range from 0.0 to 12.0 inclusive. If \"name\" is not given\
-the currently selected item is used.");
+QT_TR_NOOP("setLineWidth(width, [\"name\"])\n\
+\n\
+Sets line width of the object \"name\" to \"width\". \"width\" must be in the\n\
+range from 0.0 to 12.0 inclusive, and is measured in points. If \"name\" is not\n\
+given the currently selected item is used.\n\
+\n\
+May raise ValueError if the line width is out of bounds.\n\
+"));
 /*! Set line width */
 PyObject *scribus_setlinewidth(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlineshade__doc__,
-    "setLineShade(shade, [\"name\"])\n\n\
-Sets the shading of the line color of the object \"name\" to \"shade\".\
-\"shade\" must be an integer value in the range from 0 (lightest) to\
-100 (full color intensity). If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setLineShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the line color of the object \"name\" to \"shade\".\n\
+\"shade\" must be an integer value in the range from 0 (lightest) to 100\n\
+(full color intensity). If \"name\" is not given the currently selected item\n\
+is used.\n\
+\n\
+May raise ValueError if the line shade is out of bounds.\n\
+"));
 /*! Set line shade */
 PyObject *scribus_setlineshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinejoin__doc__,
-    "setLineJoin(join, [\"name\"])\n\n\
-Sets the line join style of the object \"name\" to the style \"join\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for join - JOIN_<type>.");
+QT_TR_NOOP("setLineJoin(join, [\"name\"])\n\
+\n\
+Sets the line join style of the object \"name\" to the style \"join\".\n\
+If \"name\" is not given the currently selected item is used. There are\n\
+predefined constants for join - JOIN_<type>.\n\
+"));
 /*! Set line join */
 PyObject *scribus_setlinejoin(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlineend__doc__,
-    "setLineEnd(endtype, [\"name\"])\n\n\
-Sets the line cap style of the object \"name\" to the style \"cap\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for \"cap\" - CAP_<type>.");
+QT_TR_NOOP("setLineEnd(endtype, [\"name\"])\n\
+\n\
+Sets the line cap style of the object \"name\" to the style \"cap\".\n\
+If \"name\" is not given the currently selected item is used. There are\n\
+predefined constants for \"cap\" - CAP_<type>.\n\
+"));
 /*! Set line end */
 PyObject *scribus_setlineend(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinestyle__doc__,
-    "setLineStyle(style, [\"name\"])\n\n\
-Sets the line style of the object \"name\" to the style \"style\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for \"style\" - LINE_<style>.");
+QT_TR_NOOP("setLineStyle(style, [\"name\"])\n\
+\n\
+Sets the line style of the object \"name\" to the style \"style\". If \"name\"\n\
+is not given the currently selected item is used. There are predefined\n\
+constants for \"style\" - LINE_<style>.\n\
+"));
 /*! Set line end */
 PyObject *scribus_setlinestyle(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfillshade__doc__,
-    "setFillShade(shade, [\"name\"])\n\n\
-Sets the shading of the fill color of the object \"name\" to \"shade\".\
-\"shade\" must be an integer value in the range from 0 (lightest) to 100\
-(full Color intensity). If \"name\" is not given the currently selected\
-Item is used.");
+QT_TR_NOOP("setFillShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the fill color of the object \"name\" to \"shade\".\n\
+\"shade\" must be an integer value in the range from 0 (lightest) to 100\n\
+(full Color intensity). If \"name\" is not given the currently selected\n\
+Item is used.\n\
+\n\
+May raise ValueError if the fill shade is out of bounds.\n\
+"));
 /*! Set fill shade */
 PyObject *scribus_setfillshade(PyObject *self, PyObject* args);
 
 /*! docstringscribus_setmultiline__doc__ */
 PyDoc_STRVAR(scribus_setcornerrad__doc__,
-    "setCornerRadius(radius, [\"name\"])\n\n\
-Sets the corner radius of the object \"name\". The radius is expressed\
-in points. If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setCornerRadius(radius, [\"name\"])\n\
+\n\
+Sets the corner radius of the object \"name\". The radius is expressed\n\
+in points. If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise ValueError if the corner radius is negative.\n\
+"));
 /*! Set corner radius */
 PyObject *scribus_setcornerrad(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setmultiline__doc__,
-    "setMultiLine(\"namedStyle\", [\"name\"])\n\n\
-Sets the line style of the object \"name\" to the named style \"namedStyle\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setMultiLine(\"namedStyle\", [\"name\"])\n\
+\n\
+Sets the line style of the object \"name\" to the named style \"namedStyle\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise NotFoundError if the line style doesn't exist.\n\
+"));
 /*! Set multiline */
 PyObject *scribus_setmultiline(PyObject *self, PyObject* args);
 
Index: cmdvar.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdvar.h,v
retrieving revision 1.10
diff -u -r1.10 cmdvar.h
--- cmdvar.h	9 Dec 2004 16:50:21 -0000	1.10
+++ cmdvar.h	10 Dec 2004 17:01:53 -0000
@@ -24,6 +24,10 @@
 extern PyObject* WrongFrameTypeError;
 /*! Exception raised by GetUniqueItem when it can't find a valid frame or a suitable selection to use. */
 extern PyObject* NoValidObjectError;
+/*! A general exception for when objects such as colors and fonts cannot be found. */
+extern PyObject* NotFoundError;
+/*! Exception raised when the user tries to create an object with the same name as one that already exists */
+extern PyObject* NameExistsError;
 
 #endif
 
Index: conswin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/conswin.cpp,v
retrieving revision 1.6
diff -u -r1.6 conswin.cpp
--- conswin.cpp	28 Nov 2004 17:40:56 -0000	1.6
+++ conswin.cpp	10 Dec 2004 17:01:53 -0000
@@ -29,9 +29,7 @@
 	font without family specification.
 	TODO: get user defined font by (future) KDE integration
 	TODO: is there any component with more user friendly pythonic interface? readline etc?
-	TODO: script console won't handle national (czech) characters.
-	as in somescript.py do. it inserts ??? instead. why? kill all
-	special alphabets :)))*/
+	*/
 	QFont font = QFont("nonexisting:)");
 	font.setStyleHint(QFont::TypeWriter);
 	font.setPointSize(ScApp->Prefs.AppFontSize);
Index: guiapp.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.h,v
retrieving revision 1.5
diff -u -r1.5 guiapp.h
--- guiapp.h	3 Dec 2004 15:02:55 -0000	1.5
+++ guiapp.h	10 Dec 2004 17:01:53 -0000
@@ -8,9 +8,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_messagebartext__doc__,
-    "messagebarText(\"string\")\n\n\
-Writes the \"string\" into the Scribus message bar (status line).\
-The text must be UTF8 encoded.");
+QT_TR_NOOP("messagebarText(\"string\")\n\
+\n\
+Writes the \"string\" into the Scribus message bar (status line). The text\n\
+must be UTF8 encoded or 'unicode' string(recommended).\n\
+"));
 /**
 Changes the status bar string.
 TODO: national chars handling.
@@ -20,10 +22,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progressreset__doc__,
-    "progressReset()\n\n\
-Cleans up the Scribus progress bar previous settings. It is called\
-before the new progress bar use.");
-/**
+QT_TR_NOOP("progressReset()\n\
+\n\
+Cleans up the Scribus progress bar previous settings. It is called before the\n\
+new progress bar use. See progressSet.\n\
+"));
+/*
 Progressbar handling
 TODO: check total vs. set values.
 (Petr Vanek 02/19/04)
@@ -32,26 +36,33 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssettotalsteps__doc__,
-    "progressTotal(max)\n\n\
-Sets the progress bar's maximum steps value to the specified number.");
+QT_TR_NOOP("progressTotal(max)\n\
+\n\
+Sets the progress bar's maximum steps value to the specified number.\n\
+See progressSet.\n\
+"));
 PyObject *scribus_progresssettotalsteps(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssetprogress__doc__,
-    "progressSet(nr)\n\n\
-Progress bar handling. The progress bar uses the concept of steps;\
-you give it the total number of steps and the number of steps completed\
-so far and it will display the percentage of steps that have been\
-completed. You can specify the total number of steps in the constructor\
-or later with progressTotal(). The current number of steps is set with\
-progressSet(). The progress bar can be rewound to the beginning with\
-progressReset(). [taken from Trolltech's Qt docs]");
+QT_TR_NOOP("progressSet(nr)\n\
+\n\
+Set the progress bar position to \"nr\", a value relative to the previously set\n\
+progressTotal. The progress bar uses the concept of steps; you give it the\n\
+total number of steps and the number of steps completed so far and it will\n\
+display the percentage of steps that have been completed. You can specify the\n\
+total number of steps with progressTotal(). The current number of steps is set\n\
+with progressSet(). The progress bar can be rewound to the beginning with\n\
+progressReset(). [based on info taken from Trolltech's Qt docs]\n\
+"));
 PyObject *scribus_progresssetprogress(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcursor__doc__,
-    "setCursor()\n\n\
-[UNSUPPORTED!]");
+QT_TR_NOOP("setCursor()\n\
+\n\
+[UNSUPPORTED!] This might break things, so steer clear for now.\n\
+"));
 /**
 Cursor handling
 (Petr Vanek 02/19/04)
@@ -60,9 +71,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_docchanged__doc__,
-    "docChanged(bool)\n\n\
-Enable/disable save icon in the Scribus icon bar. It's useful to call\
-this procedure when you're changing the document.");
+QT_TR_NOOP("docChanged(bool)\n\
+\n\
+Enable/disable save icon in the Scribus icon bar and the Save menu item. It's\n\
+useful to call this procedure when you're changing the document, because Scribus\n\
+won't automatically notice when you change the document using a script.\n\
+"));
 /**
 Enable/disable save icon
 (Petr Vanek 02/20/04)
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.49
diff -u -r1.49 scriptplugin.cpp
--- scriptplugin.cpp	9 Dec 2004 16:50:21 -0000	1.49
+++ scriptplugin.cpp	10 Dec 2004 17:01:54 -0000
@@ -59,6 +59,8 @@
 PyObject* NoDocOpenError;
 PyObject* WrongFrameTypeError;
 PyObject* NoValidObjectError;
+PyObject* NotFoundError;
+PyObject* NameExistsError;
 
 QString Name()
 {
@@ -79,6 +81,11 @@
 {
 	QString cm;
 	Py_Initialize();
+	if (PyUnicode_SetDefaultEncoding("utf-8"))
+	{
+		qDebug("Failed to set default encoding to utf-8.\n");
+		PyErr_Clear();
+	}
 	Carrier = plug;
 	RetVal = 0;
 	initscribus(Carrier);
@@ -246,6 +253,7 @@
 		qDebug("Failed to get __main__ - aborting script");
 	else
 	{
+		// FIXME: If filename contains chars outside 7bit ascii, might be problems
 		PyObject* globals = PyModule_GetDict(m);
 		// Build the Python code to run the script
 		QString cm = QString("import sys,StringIO,traceback\n");
@@ -264,6 +272,7 @@
 		// We re-raise the exception so the return value of PyRun_String reflects
 		// the fact that an exception has ocurred.
 		cm        += QString("    raise\n");
+		// FIXME: if cmd contains chars outside 7bit ascii, might be problems
 		QCString cmd = cm.latin1();
 		// Now run the script in the interpreter's global scope
 		PyObject* result = PyRun_String(cmd.data(), Py_file_input, globals, globals);
@@ -315,6 +324,7 @@
 		initscribus(Carrier);
 		if (RetVal == 0)
 		{
+			// FIXME: if CurDir contains chars outside 7bit ascii, might be problems
 			cm = "import sys\nsys.path[0] = \""+CurDir+"\"\n";
 			cm += "import cStringIO\n";
 			cm += "from scribus import *\n";
@@ -332,6 +342,7 @@
 		cm += "\tre = bu.getvalue()\n";
 		cm += "retval(re, rv)\n";
 	}
+	// FIXME: if cmd contains chars outside 7bit ascii, might be problems
 	QCString cmd = cm.latin1();
 	comm[0] = (char*)"scribus";
 	PySys_SetArgv(1, comm);
@@ -470,7 +481,7 @@
 	wrapperFunc += QString("    \"\"\"Deprecated alias for function %1 - see help(%2).\"\"\"\n").arg(oldName).arg(oldName);
 	wrapperFunc += QString("    warnings.warn(\"Warning, script function %1 is deprecated, use %2 instead.\\n\",exceptions.DeprecationWarning)\n").arg(newName).arg(oldName);
 	wrapperFunc += QString("    return %1(*args,**kwargs)\n").arg(oldName);
-	QCString wsData = wrapperFunc.latin1();
+	QCString wsData = wrapperFunc.latin1();	//this should probably be utf8 now
 	// And run it in the namespace of the scribus module
 	PyObject* result = PyRun_String(wsData, Py_file_input, scribusdict, scribusdict);
 	// NULL is returned if an exception is set. We don't care about any other return value and
@@ -513,20 +524,21 @@
 
 static PyObject *scribus_retval(PyObject *self, PyObject* args)
 {
-	char *Name;
-	int retV;
+	char *Name = NULL;
+	int retV = 0;
 	if (!PyArg_ParseTuple(args, (char*)"si", &Name, &retV))
 		return NULL;
-	RetString = QString(Name);
+	// Because sysdefaultencoding is not utf-8, Python is returning utf-8 encoded
+	// 8-bit char* strings. Make sure Qt understands that the input is utf-8 not
+	// the default local encoding (usually latin-1) by using QString::fromUtf8()
+	RetString = QString::fromUtf8(Name);
 	RetVal = retV;
 	return PyInt_FromLong(0L);
 }
 
-static PyObject *scribus_getval(PyObject *self, PyObject* args)
+static PyObject *scribus_getval(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, (char*)""))
-		return NULL;
-	return PyString_FromString(InValue);
+	return PyString_FromString(InValue.utf8().data());
 }
 
 /*!
@@ -535,17 +547,31 @@
  */
 char* tr(const char* docstringConstant)
 {
-    // Alas, there's a lot of wasteful string copying going on
-    // here.
-    QString translated = QObject::tr(docstringConstant, "scripter docstring");
-    const char* trch = translated.latin1();
-    return strndup(trch, strlen(trch));
+	// Alas, there's a lot of wasteful string copying going on
+	// here.
+	QString translated = QObject::tr(docstringConstant, "scripter docstring");
+	/*
+	 * Python doesn't support 'unicode' object docstrings in the PyMethodDef,
+	 * and has no way to specify what encoding docstrings are in. The passed C
+	 * strings passed are made into 'str' objects as-is. These are interpreted
+	 * as being in the Python sysdefaultencoding, usually 'ascii', when used.
+	 * We now set systemdefaultencoding to 'utf-8' ...  so we're going to pass
+	 * Python an 8-bit utf-8 encoded string in a char* .  With
+	 * sysdefaultencoding set correctly, Python will interpret it correctly and
+	 * we'll have our unicode docstrings. It's not as ugly a hack as it sounds,
+	 * you just have to remember that C and Python strings can both be
+	 * considered 8-bit strings of binary data that can be later interpreted as
+	 * a text string in a particular text encoding.
+	 */
+	//QCString utfTranslated = translated.utf8();
+	const char* trch = translated.utf8().data();
+	return strndup(trch, strlen(trch));
 }
 
-/* Now we're using the more pyhtonic convention for names:
-	class - ClassName
-	procedure/function/method - procedureName
-etc. */
+/* Now we're using the more pythonic convention for names:
+ * class - ClassName
+ * procedure/function/method - procedureName
+ * etc. */
 PyMethodDef scribus_methods[] = {
 	// 2004/10/03 pv - aliases with common Python syntax - ClassName methodName
 	// 2004-11-06 cr - move aliasing to dynamically generated wrapper functions, sort methoddef
@@ -570,7 +596,7 @@
 	{"deleteText", scribus_deletetext, METH_VARARGS, tr(scribus_deletetext__doc__)},
 	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, tr(scribus_deselect__doc__)},
 	{"docChanged", scribus_docchanged, METH_VARARGS, tr(scribus_docchanged__doc__)},
-	{"fileDialog", scribus_filedia, METH_VARARGS, tr(scribus_filedia__doc__)},
+	{"fileDialog", (PyCFunction)scribus_filedia, METH_VARARGS|METH_KEYWORDS, tr(scribus_filedia__doc__)},
 	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
 	{"getAllObjects", scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
 	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
@@ -623,7 +649,7 @@
 	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},
 	{"lockObject", scribus_lockobject, METH_VARARGS, tr(scribus_lockobject__doc__)},
 	{"messagebarText", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
-	{"messageBox", scribus_messdia, METH_VARARGS, tr(scribus_messdia__doc__)},
+	{"messageBox", (PyCFunction)scribus_messdia, METH_VARARGS|METH_KEYWORDS, tr(scribus_messdia__doc__)},
 	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, tr(scribus_moveobjabs__doc__)},
 	{"moveObject", scribus_moveobjrel, METH_VARARGS, tr(scribus_moveobjrel__doc__)},
 	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, tr(scribus_newdocdia__doc__)},
@@ -694,7 +720,7 @@
 	{"valueDialog", scribus_valdialog, METH_VARARGS, tr(scribus_valdialog__doc__)},
 	// end of aliases
 	{"retval", scribus_retval, METH_VARARGS, "TODO: docstring"},
-	{"getval", scribus_getval, METH_VARARGS, "TODO: docstring"},
+	{"getval", (PyCFunction)scribus_getval, METH_NOARGS, "TODO: docstring"},
 	{NULL,		NULL}		/* sentinel */
 };
 
@@ -728,6 +754,14 @@
 	NoValidObjectError = PyErr_NewException((char*)"scribus.NoValidObjectError", ScribusException, NULL);
 	Py_INCREF(NoValidObjectError);
 	PyModule_AddObject(m, (char*)"NoValidObjectError", NoValidObjectError);
+	// Couldn't find the specified resource - font, color, etc.
+	NotFoundError = PyErr_NewException((char*)"scribus.NotFoundError", ScribusException, NULL);
+	Py_INCREF(NotFoundError);
+	PyModule_AddObject(m, (char*)"NotFoundError", NotFoundError);
+	// Tried to create an object with the same name as one that already exists
+	NameExistsError = PyErr_NewException((char*)"scribus.NameExistsError", ScribusException, NULL);
+	Py_INCREF(NameExistsError);
+	PyModule_AddObject(m, (char*)"NameExistsError", NameExistsError);
 	// Done with exception setup
 
 	// CONSTANTS
Index: scriptplugin.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.h,v
retrieving revision 1.9
diff -u -r1.9 scriptplugin.h
--- scriptplugin.h	10 Nov 2004 21:41:36 -0000	1.9
+++ scriptplugin.h	10 Dec 2004 17:01:54 -0000
@@ -31,7 +31,7 @@
 
 /** Some useful Subroutines */
 static PyObject *scribus_retval(PyObject *self, PyObject* args);
-static PyObject *scribus_getval(PyObject *self, PyObject* args);
+static PyObject *scribus_getval(PyObject *self);
 QString RetString;
 QString InValue;
 int RetVal;
Index: samples/3columnA4.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/3columnA4.py,v
retrieving revision 1.3
diff -u -r1.3 3columnA4.py
--- samples/3columnA4.py	7 Nov 2004 19:39:37 -0000	1.3
+++ samples/3columnA4.py	10 Dec 2004 17:01:54 -0000
@@ -1,20 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Creates 3 column layout on A4 paper and save it under 3columnA4.sla filename"""
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (50, 50, 50, 50)
 size = (612, 792)
-if newDoc(PAPER_A4, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
-	a = createText(50, 50, 230, 512)
-	setTextAlignment(1,a)
-	setText("Column A", a)
-	setFontSize(12, a)
-	b = createText(280, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column B", b)
-	setFontSize(12, b)
-	c = createText(510, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column C", c)
-	setFontSize(12, c)
-	saveDocAs("3columnA4.sla")
-	closeDoc()
+
+def main():
+    if newDoc(PAPER_A4, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
+        a = createText(50, 50, 230, 512)
+        setTextAlignment(1,a)
+        setText("Column A", a)
+        setFontSize(12, a)
+        b = createText(280, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column B", b)
+        setFontSize(12, b)
+        c = createText(510, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column C", c)
+        setFontSize(12, c)
+        saveDocAs("3columnA4.sla")
+        closeDoc()
+
+if __name__ == '__main__':
+    main()
Index: samples/3columnUSLTR.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/3columnUSLTR.py,v
retrieving revision 1.3
diff -u -r1.3 3columnUSLTR.py
--- samples/3columnUSLTR.py	7 Nov 2004 19:39:37 -0000	1.3
+++ samples/3columnUSLTR.py	10 Dec 2004 17:01:54 -0000
@@ -1,21 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Creates 3 column layout on Letter paper and save it under 3columnUS.sla filename"""
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (50, 50, 50, 50)
 size = (612, 792)
-if newDoc(PAPER_LETTER, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
-	a = createText(50, 50, 230, 512)
-	setTextAlignment(1,a)
-	setText("Column A", a)
-	setFontSize(12, a)
-	b = createText(280, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column B", b)
-	setFontSize(12, b)
-	c = createText(510, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column C", c)
-	setFontSize(12, c)
-	saveDocAs("3columnUS.sla")
-	closeDoc()
 
+def main():
+    if newDoc(PAPER_LETTER, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
+        a = createText(50, 50, 230, 512)
+        setTextAlignment(1,a)
+        setText("Column A", a)
+        setFontSize(12, a)
+        b = createText(280, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column B", b)
+        setFontSize(12, b)
+        c = createText(510, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column C", c)
+        setFontSize(12, c)
+        saveDocAs("3columnUS.sla")
+        closeDoc()
+
+if __name__ == '__main__':
+    main()
Index: samples/Calender.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/Calender.py,v
retrieving revision 1.4
diff -u -r1.4 Calender.py
--- samples/Calender.py	7 Nov 2004 19:39:37 -0000	1.4
+++ samples/Calender.py	10 Dec 2004 17:01:54 -0000
@@ -1,57 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ This Script creates a Calendar Sheet for the Current Month """
 
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 import calendar
 import time
-from scribus import *
 
-if haveDoc():
-	setRedraw(0)
-	Month = time.localtime()[1]
-	Year = time.localtime()[0]
-	Objects = []
-	MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
-	DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
-	Xcoor = 10
-	Ycoor = 30
-	DayC = 0
-	Calend = calendar.monthcalendar(Year, Month)
-	ob = createText(10, 10, 245, 20)
-	Title = MonthList[Month-1] + " " + str(Year)
-	setText(Title, ob)
-	Objects.append(ob)
-	for lx in range(45, 245, 35):
-		ob = createLine(lx, 30, lx, 20*len(Calend)+50)
-		Objects.append(ob)
-	for ly in range(50, 20*len(Calend)+50, 20):
-		ob = createLine(10, ly, 255, ly)
-		Objects.append(ob)
-	ob = createRect(10, 30, 245, 20*len(Calend)+20)
-	setFillColor("None", ob)
-	Objects.append(ob)
-	for day in range(7):
-		ob = createText(Xcoor, Ycoor, 35, 20)
-		setTextAlignment(Centered, ob)
-		setFontSize(12, ob)
-		if day == 6:
-			setTextColor("Red", ob)
-		setText(DaysList[day], ob)
-		Objects.append(ob)
-		Xcoor = Xcoor + 35
-	Ycoor = Ycoor + 20
-	for lines in Calend:
-		Xcoor = 10
-		DayC = 0
-		for rows in lines:
-			if rows != 0:
-				ob = createText(Xcoor, Ycoor, 35, 20)
-				setTextAlignment(Centered, ob)
-				if DayC == 6:
-					setTextColor("Red", ob)
-				setText(str(rows), ob)
-				Objects.append(ob)
-			Xcoor = Xcoor + 35
-			DayC = DayC + 1
-		Ycoor = Ycoor + 20
-	groupObjects(Objects)
-	setRedraw(1)
-	redrawAll
+def main():
+    Month = time.localtime()[1]
+    Year = time.localtime()[0]
+    Objects = []
+    MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
+    DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
+    Xcoor = 10
+    Ycoor = 30
+    DayC = 0
+    Calend = calendar.monthcalendar(Year, Month)
+    ob = createText(10, 10, 245, 20)
+    Title = MonthList[Month-1] + " " + str(Year)
+    setText(Title, ob)
+    Objects.append(ob)
+    for lx in range(45, 245, 35):
+        ob = createLine(lx, 30, lx, 20*len(Calend)+50)
+        Objects.append(ob)
+    for ly in range(50, 20*len(Calend)+50, 20):
+        ob = createLine(10, ly, 255, ly)
+        Objects.append(ob)
+    ob = createRect(10, 30, 245, 20*len(Calend)+20)
+    setFillColor("None", ob)
+    Objects.append(ob)
+    for day in range(7):
+        ob = createText(Xcoor, Ycoor, 35, 20)
+        setTextAlignment(Centered, ob)
+        setFontSize(12, ob)
+        if day == 6:
+            setTextColor("Red", ob)
+        setText(DaysList[day], ob)
+        Objects.append(ob)
+        Xcoor = Xcoor + 35
+    Ycoor = Ycoor + 20
+    for lines in Calend:
+        Xcoor = 10
+        DayC = 0
+        for rows in lines:
+            if rows != 0:
+                ob = createText(Xcoor, Ycoor, 35, 20)
+                setTextAlignment(Centered, ob)
+                if DayC == 6:
+                    setTextColor("Red", ob)
+                setText(str(rows), ob)
+                Objects.append(ob)
+            Xcoor = Xcoor + 35
+            DayC = DayC + 1
+        Ycoor = Ycoor + 20
+    groupObjects(Objects)
+
+if __name__ == '__main__':
+    if haveDoc():
+        try:
+            setRedraw(False)
+            main()
+        finally:
+            setRedraw(True)
+            redrawAll()
+    else:
+        messageBox("Calendar Script", "Please run this script with a document open.", ICON_INFORMATION);
Index: samples/Sample1.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/Sample1.py,v
retrieving revision 1.4
diff -u -r1.4 Sample1.py
--- samples/Sample1.py	7 Nov 2004 19:39:37 -0000	1.4
+++ samples/Sample1.py	10 Dec 2004 17:01:54 -0000
@@ -1,12 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ A sample script """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (10, 10, 10, 30)
-if newDoc(PAPER_A4, margins, PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
-	a = createText(50, 50, 200, 80)
-	setText("A Test for Scribus", a)
-	setFontSize(20, a)
-	b = createEllipse(267, 391, 60, 60)
-	setFillColor("Red", b)
-	saveDocAs("Sample1.sla")
-	closeDoc()
+
+def main():
+    if newDoc(PAPER_A4, margins, PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
+        a = createText(50, 50, 200, 80)
+        setText("A Test for Scribus", a)
+        setFontSize(20, a)
+        b = createEllipse(267, 391, 60, 60)
+        setFillColor("Red", b)
+        saveDocAs("Sample1.sla")
+
+if __name__ == '__main__':
+    main()
Index: samples/golden-mean.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/golden-mean.py,v
retrieving revision 1.2
diff -u -r1.2 golden-mean.py
--- samples/golden-mean.py	1 Nov 2004 21:49:05 -0000	1.2
+++ samples/golden-mean.py	10 Dec 2004 17:01:54 -0000
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """Golden Mean for Scribus.
 
 This script creates supplementary marks on the page to
@@ -38,8 +41,15 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 """
 
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 from math import sqrt
-from scribus import *
 
 GMLAYER = "Golden Mean Layer"
 
@@ -58,8 +68,7 @@
          X-D, Y, X, Y-D, X, Y+D, X+D, Y], aName)
 
 
-# main
-if haveDoc():
+def main():
     # remember user settings
     unit = getUnit()
     layer = getActiveLayer()
@@ -89,3 +98,9 @@
     # restore user settings
     setUnit(unit)
     setActiveLayer(layer)
+
+if __name__ == '__main__':
+    if haveDoc():
+        main()
+    else:
+        messageBox("Golden Mean.py", "Please run this script with a document already open", ICON_INFORMATION);
Index: samples/htmlimport.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/htmlimport.py,v
retrieving revision 1.5
diff -u -r1.5 htmlimport.py
--- samples/htmlimport.py	7 Nov 2004 19:39:37 -0000	1.5
+++ samples/htmlimport.py	10 Dec 2004 17:01:54 -0000
@@ -1,4 +1,13 @@
-from scribus import *
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 from sgmllib import SGMLParser
 from htmlentitydefs import entitydefs
 
@@ -14,57 +23,57 @@
 BUTTON_OK = 1
 ICON_WARNING = 2
 NEWLINE = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6',
-		   'br', 'p', 'li', 'div', 'tr']
+           'br', 'p', 'li', 'div', 'tr']
 
 class HTMLParser(SGMLParser):
 
-	def __init__(self, textbox):
-		self.encoding = valueDialog(TITLE, 'Set encoding of the imported file', ENCODING)
-		SGMLParser.__init__(self)
-		self.in_body = 0
-		self.textbox = textbox
-
-	def append(self, text):
-		insertText(unicode(text, self.encoding), getTextLength(self.textbox), self.textbox)
-
-	def start_body(self, attrs):
-		self.in_body = 1
-
-	def end_body(self):
-		self.in_body = 0
-
-	def unknown_starttag(self, name, attrs):
-		if name in NEWLINE:
-			self.append('\n')
-
-	def unknown_endtag(self, name):
-		if name in NEWLINE:
-			self.append('\n')
-
-	def handle_data(self, raw_data):
-		if self.in_body:
-			data = ' '.join(
-				raw_data.replace('\n', ' ').split())
-			if raw_data.startswith(' '):
-				data = ' ' + data
-			if raw_data.endswith(' ') and len(raw_data) > 1:
-				data = data + ' '
-			self.append(data)
+    def __init__(self, textbox):
+        self.encoding = valueDialog(TITLE, 'Set encoding of the imported file', ENCODING)
+        SGMLParser.__init__(self)
+        self.in_body = 0
+        self.textbox = textbox
+
+    def append(self, text):
+        insertText(unicode(text, self.encoding), getTextLength(self.textbox), self.textbox)
+
+    def start_body(self, attrs):
+        self.in_body = 1
+
+    def end_body(self):
+        self.in_body = 0
+
+    def unknown_starttag(self, name, attrs):
+        if name in NEWLINE:
+            self.append('\n')
+
+    def unknown_endtag(self, name):
+        if name in NEWLINE:
+            self.append('\n')
+
+    def handle_data(self, raw_data):
+        if self.in_body:
+            data = ' '.join(
+                raw_data.replace('\n', ' ').split())
+            if raw_data.startswith(' '):
+                data = ' ' + data
+            if raw_data.endswith(' ') and len(raw_data) > 1:
+                data = data + ' '
+            self.append(data)
 
-	def unknown_entityref(self, entity):
-		self.handle_data(entitydefs.get(entity, ''))
+    def unknown_entityref(self, entity):
+        self.handle_data(entitydefs.get(entity, ''))
 
 
 if haveDoc():
-	filename = fileDialog(TITLE, "*.htm*", "", 0, 1)
-	if filename:
-		unit = getUnit()
-		setUnit(UNIT_MILLIMETERS)
-		textbox = createText(20, 20, 70, 250)
-		parser = HTMLParser(textbox)
-		parser.feed(open(filename).read())
-		setUnit(unit)
+    filename = fileDialog(TITLE, "*.htm*", "", 0, 1)
+    if filename:
+        unit = getUnit()
+        setUnit(UNIT_MILLIMETERS)
+        textbox = createText(20, 20, 70, 250)
+        parser = HTMLParser(textbox)
+        parser.feed(open(filename).read())
+        setUnit(unit)
 else:
-	MessageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
 
 
Index: samples/legende.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/legende.py,v
retrieving revision 1.2
diff -u -r1.2 legende.py
--- samples/legende.py	1 Nov 2004 21:49:05 -0000	1.2
+++ samples/legende.py	10 Dec 2004 17:01:54 -0000
@@ -1,17 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ When you have an image selected this script creates small text legende
-below the image. The new textframe contains name of the file. """
+(caption) below the image. The new textframe contains name of the file. """
+
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-from scribus import *
 import os
 
-userUnit = getUnit()
-setUnit(1)
-x,y = getPosition()
-l,h = getSize()
-texte = getImageFile()
-image = os.path.basename(texte)
-a = createText(x,y+h+2,l,8)
-insertText(image,0,a)
-setTextAlignment(2,a)
-setFontSize(7,a)
-setUnit(userUnit)
+def main():
+    userUnit = getUnit()
+    setUnit(1)
+    sel_count = selectionCount()
+
+    if sel_count == 0:
+        messageBox("legende.py",
+                "Please select the object to add a caption to before running this script.",
+                ICON_INFORMATION)
+        sys.exit(1)
+
+    x,y = getPosition()
+    l,h = getSize()
+    texte = getImageFile()
+    image = os.path.basename(texte)
+    a = createText(x,y+h+2,l,8)
+    insertText(image,0,a)
+    setTextAlignment(2,a)
+    setFontSize(7,a)
+    setUnit(userUnit)
+
+if __name__ == '__main__':
+    main()
Index: samples/moins_10_pourcent_group.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/moins_10_pourcent_group.py,v
retrieving revision 1.2
diff -u -r1.2 moins_10_pourcent_group.py
--- samples/moins_10_pourcent_group.py	1 Nov 2004 21:49:05 -0000	1.2
+++ samples/moins_10_pourcent_group.py	10 Dec 2004 17:01:54 -0000
@@ -1,5 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Make selected group smaller by 10% """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-scaleGroup(0.9)
+if haveDoc() and selectionCount():
+    scaleGroup(1/1.1)
+else:
+    messageBox("moins_10_pourcent_group.py", "Please select an object to scale before running this script.", ICON_INFORMATION)
Index: samples/plus_10_pourcent_group.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/plus_10_pourcent_group.py,v
retrieving revision 1.2
diff -u -r1.2 plus_10_pourcent_group.py
--- samples/plus_10_pourcent_group.py	1 Nov 2004 21:49:05 -0000	1.2
+++ samples/plus_10_pourcent_group.py	10 Dec 2004 17:01:54 -0000
@@ -1,5 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Make selected group larger by 10% """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-scaleGroup(1.1)
+if haveDoc() and selectionCount():
+    scaleGroup(1.1)
+else:
+    messageBox("plus_10_pourcent_group.py", "Please select an object to scale before running this script.", ICON_INFORMATION)
Index: samples/pochette_cd.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/pochette_cd.py,v
retrieving revision 1.3
diff -u -r1.3 pochette_cd.py
--- samples/pochette_cd.py	7 Nov 2004 19:39:37 -0000	1.3
+++ samples/pochette_cd.py	10 Dec 2004 17:01:54 -0000
@@ -1,104 +1,117 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ This script creates a CD Pochette - a paper pocket for CD/DVD disc """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
 margins = (0, 0, 0, 0)
 paper = (210, 297)
 
-if newDoc(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT):
-	setUnit(1)
-	newPage(-1)
-	gotoPage(1)
-	createLayer("normal")
-	setActiveLayer("normal")
-	a = createText(98.5, 20, 100, 10)
-	setText("CD pochette - front page", a)
-	setFontSize(11, a)
-	setTextAlignment(1, a)
-	b = createText(28.5, 45, 120, 120)
-	setFillColor("None", b)
-	c = createText(148.5, 45, 120, 120)
-	setFillColor("None", c)
-	createLayer("bords_perdus")
-	setActiveLayer("bords_perdus")
-	img1 = createImage(24.35, 41.25 , 124.20, 127.95,)
-	img2 = createImage(148.55, 41.25 , 124.20, 127.95,)
-	createLayer("coupe")
-	setActiveLayer("coupe")
-	t1 = createLine(28.5, 38, 28.5, 43)
-	setLineWidth(0.1, t1)
-	t2 = createLine(148.5, 38, 148.5, 43)
-	setLineWidth(0.1, t2)
-	t3 = createLine(268.5, 38, 268.5, 43)
-	setLineWidth(0.1, t3)
-	t4 = createLine(28.5, 172, 28.5, 167)
-	setLineWidth(0.1, t4)
-	t5 = createLine(148.5, 172, 148.5, 167)
-	setLineWidth(0.1, t5)
-	t6 = createLine(268.5, 172, 268.5, 167)
-	setLineWidth(0.1, t6)
-	t7 = createLine(21.5, 45, 26.5, 45)
-	setLineWidth(0.1, t7)
-	t8 = createLine(21.5, 165, 26.5, 165)
-	setLineWidth(0.1, t8)
-	t9 = createLine(270.5, 45, 275.5, 45)
-	setLineWidth(0.1, t9)
-	t10 = createLine(270.5, 165, 275.5, 165)
-	setLineWidth(0.1, t10)
-	gotoPage(2)
-	setActiveLayer("normal")
-	a2 = createText(98.5, 20, 100, 10)
-	setText("CD pochette - back page", a2)
-	setFontSize(11, a2)
-	setTextAlignment(1, a2)
-	a2t = createText(204, 44, 78, 9)
-	setText("Mode d'emploi :", a2t)
-	setFontSize(13, a2t)
-	setTextAlignment(1, a2t)
-	a21 = createText(204, 54, 78, 87)
-	setText("Usage. TODO: tranlslate it from french", a21)
-	setFontSize(11, a21)
-	setTextAlignment(0, a21)
-	b2 = createText(28.5, 162.10, 117, 6)
-	setText("Texte sur la tranche", b2)
-	setFontSize(9, b2)
-	setTextAlignment(1, b2)
-	rotateObjectAbs(90, b2)
-	setFillColor("None", b2)
-	c2 = createText(34.5, 45, 137.5, 117)
-	setFillColor("None", c2)
-	d2 = createText(28.5, 162.10, 117, 6)
-	setText("Texte sur la tranche", d2)
-	setFontSize(9, d2)
-	setTextAlignment(1, d2)
-	rotateObjectAbs(90, d2)
-	setFillColor("None", d2)
-	moveObject(143.5, 0, d2)
-	setActiveLayer("bords_perdus")
-	img3 = createImage(24.35, 41.25 , 157.50, 126.50,)
-	setActiveLayer("coupe")
-	t21 = createLine(28.5, 38, 28.5, 43)
-	setLineWidth(0.1, t21)
-	t22 = createLine(34.5, 38, 34.5, 43)
-	setLineWidth(0.1, t22)
-	t23 = createLine(172, 38, 172, 43)
-	setLineWidth(0.1, t23)
-	t24 = createLine(178, 38, 178, 43)
-	setLineWidth(0.1, t24)
-	t25 = createLine(28.5, 164.5, 28.5, 169.5)
-	setLineWidth(0.1, t25)
-	t26 = createLine(34.5, 164, 34.5, 169.5)
-	setLineWidth(0.1, t26)
-	t27 = createLine(172, 164, 172, 169.5)
-	setLineWidth(0.1, t27)
-	t28 = createLine(178, 164, 178, 169.5)
-	setLineWidth(0.1, t28)
-	t29 = createLine(22.5, 45, 27.5, 45)
-	setLineWidth(0.1, t29)
-	t30 = createLine(22.5, 162, 27.5, 162)
-	setLineWidth(0.1, t30)
-	t31 = createLine(179.5, 45, 184.5, 45)
-	setLineWidth(0.1, t31)
-	t32 = createLine(179.5, 162, 184.5, 162)
-	setLineWidth(0.1, t32)
-	saveDocAs("pochette_CD.sla")
+def main():
+    if newDoc(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT):
+        setUnit(1)
+        newPage(-1)
+        gotoPage(1)
+        createLayer("normal")
+        setActiveLayer("normal")
+        a = createText(98.5, 20, 100, 10)
+        setText("CD pochette - front page", a)
+        setFontSize(11, a)
+        setTextAlignment(1, a)
+        b = createText(28.5, 45, 120, 120)
+        setFillColor("None", b)
+        c = createText(148.5, 45, 120, 120)
+        setFillColor("None", c)
+        createLayer("bords_perdus")
+        setActiveLayer("bords_perdus")
+        img1 = createImage(24.35, 41.25 , 124.20, 127.95,)
+        img2 = createImage(148.55, 41.25 , 124.20, 127.95,)
+        createLayer("coupe")
+        setActiveLayer("coupe")
+        t1 = createLine(28.5, 38, 28.5, 43)
+        setLineWidth(0.1, t1)
+        t2 = createLine(148.5, 38, 148.5, 43)
+        setLineWidth(0.1, t2)
+        t3 = createLine(268.5, 38, 268.5, 43)
+        setLineWidth(0.1, t3)
+        t4 = createLine(28.5, 172, 28.5, 167)
+        setLineWidth(0.1, t4)
+        t5 = createLine(148.5, 172, 148.5, 167)
+        setLineWidth(0.1, t5)
+        t6 = createLine(268.5, 172, 268.5, 167)
+        setLineWidth(0.1, t6)
+        t7 = createLine(21.5, 45, 26.5, 45)
+        setLineWidth(0.1, t7)
+        t8 = createLine(21.5, 165, 26.5, 165)
+        setLineWidth(0.1, t8)
+        t9 = createLine(270.5, 45, 275.5, 45)
+        setLineWidth(0.1, t9)
+        t10 = createLine(270.5, 165, 275.5, 165)
+        setLineWidth(0.1, t10)
+        gotoPage(2)
+        setActiveLayer("normal")
+        a2 = createText(98.5, 20, 100, 10)
+        setText("CD pochette - back page", a2)
+        setFontSize(11, a2)
+        setTextAlignment(1, a2)
+        a2t = createText(204, 44, 78, 9)
+        setText("Mode d'emploi :", a2t)
+        setFontSize(13, a2t)
+        setTextAlignment(1, a2t)
+        a21 = createText(204, 54, 78, 87)
+        setText("Usage. TODO: tranlslate it from french", a21)
+        setFontSize(11, a21)
+        setTextAlignment(0, a21)
+        b2 = createText(28.5, 162.10, 117, 6)
+        setText("Texte sur la tranche", b2)
+        setFontSize(9, b2)
+        setTextAlignment(1, b2)
+        rotateObjectAbs(90, b2)
+        setFillColor("None", b2)
+        c2 = createText(34.5, 45, 137.5, 117)
+        setFillColor("None", c2)
+        d2 = createText(28.5, 162.10, 117, 6)
+        setText("Texte sur la tranche", d2)
+        setFontSize(9, d2)
+        setTextAlignment(1, d2)
+        rotateObjectAbs(90, d2)
+        setFillColor("None", d2)
+        moveObject(143.5, 0, d2)
+        setActiveLayer("bords_perdus")
+        img3 = createImage(24.35, 41.25 , 157.50, 126.50,)
+        setActiveLayer("coupe")
+        t21 = createLine(28.5, 38, 28.5, 43)
+        setLineWidth(0.1, t21)
+        t22 = createLine(34.5, 38, 34.5, 43)
+        setLineWidth(0.1, t22)
+        t23 = createLine(172, 38, 172, 43)
+        setLineWidth(0.1, t23)
+        t24 = createLine(178, 38, 178, 43)
+        setLineWidth(0.1, t24)
+        t25 = createLine(28.5, 164.5, 28.5, 169.5)
+        setLineWidth(0.1, t25)
+        t26 = createLine(34.5, 164, 34.5, 169.5)
+        setLineWidth(0.1, t26)
+        t27 = createLine(172, 164, 172, 169.5)
+        setLineWidth(0.1, t27)
+        t28 = createLine(178, 164, 178, 169.5)
+        setLineWidth(0.1, t28)
+        t29 = createLine(22.5, 45, 27.5, 45)
+        setLineWidth(0.1, t29)
+        t30 = createLine(22.5, 162, 27.5, 162)
+        setLineWidth(0.1, t30)
+        t31 = createLine(179.5, 45, 184.5, 45)
+        setLineWidth(0.1, t31)
+        t32 = createLine(179.5, 162, 184.5, 162)
+        setLineWidth(0.1, t32)
+        saveDocAs("pochette_CD.sla")
+
+if __name__ == '__main__':
+    main()
Index: samples/quote.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/quote.py,v
retrieving revision 1.4
diff -u -r1.4 quote.py
--- samples/quote.py	7 Nov 2004 19:48:28 -0000	1.4
+++ samples/quote.py	10 Dec 2004 17:01:54 -0000
@@ -1,56 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+
 """ This script changes quotation marks from " " to french style """
 
-# -*- coding: ISO-8859-1 -*-
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 import re
 
 TITLE = "Text quoting"
-BUTTON_OK = 1
-ICON_INFORMATION = 1
-ICON_WARNING = 2
-QUOTE_START = "�"
-QUOTE_END = "�"
 
+# These need to be declared as unicode strings until some
+# charset issues in the scripter are worked out.
+QUOTE_START = u"�"
+QUOTE_END = u"�"
 
 def quote(textobj):
-	quoted_re = re.compile('"[^"]*"')
-	text = getText(textobj)
-	count = 0
-	i = 0
-	selectText(0, 0, textobj)
-	while i < len(text):
-		match = quoted_re.match(text[i:])
-		if match:
-			end = match.end()
-			selectText(i, 1, textobj)
-			deleteText(textobj)
-			insertText(QUOTE_START, i, textobj)
-			selectText(i + end - 1, 1, textobj)
-			deleteText(textobj)
-			insertText(QUOTE_END, i + end - 1, textobj)
-			count += 1
-			i = i + end
-		else:
-			i = i + 1
-	return count
-
-
-if haveDoc():
-	changed = 0
-	sel_count = selectionCount()
-	setRedraw(0)
-	if sel_count:
-		for i in range(sel_count):
-			changed += quote(getSelectedObject(i))
-	else:
-		for page in range(pageCount()):
-			gotoPage(page)
-			for obj in getAllObjects():
-				changed += quote(obj)
-	setRedraw(1)
-	redrawAll()
-	messageBox(TITLE, "%s quotations changed" % changed,
-			   ICON_INFORMATION, BUTTON_OK)
-
-else:
-	messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    quoted_re = re.compile('"[^"]*"')
+    try:
+        text = getText(textobj)
+    except WrongFrameTypeError:
+        messageBox("quote.py", "Can't quote text in a non-text frame", ICON_INFORMATION);
+        sys.exit(1)
+    if len(text) == 0:
+        return 0    # We can't very well change anything in an empty frame
+    count = 0
+    i = 0
+    selectText(0, 0, textobj)
+    while i < len(text):
+        match = quoted_re.match(text[i:])
+        if match:
+            end = match.end()
+            selectText(i, 1, textobj)
+            deleteText(textobj)
+            insertText(QUOTE_START, i, textobj)
+            selectText(i + end - 1, 1, textobj)
+            deleteText(textobj)
+            insertText(QUOTE_END, i + end - 1, textobj)
+            count += 1
+            i = i + end
+        else:
+            i = i + 1
+    return count
+
+
+def main():
+    changed = 0
+    sel_count = selectionCount()
+    if sel_count:
+        for i in range(sel_count):
+            changed += quote(getSelectedObject(i))
+    else:
+        for page in range(pageCount()):
+            gotoPage(page)
+            for obj in getAllObjects():
+                changed += quote(obj)
+    messageBox(TITLE, "%s quotations changed" % changed,
+               ICON_INFORMATION, BUTTON_OK)
+
+if __name__ == '__main__':
+    if haveDoc():
+        try:
+            setRedraw(False)
+            main()
+        finally:
+            setRedraw(True)
+            redrawAll()
+    else:
+        messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
Index: samples/trait_de_coupe.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/trait_de_coupe.py,v
retrieving revision 1.2
diff -u -r1.2 trait_de_coupe.py
--- samples/trait_de_coupe.py	1 Nov 2004 21:49:05 -0000	1.2
+++ samples/trait_de_coupe.py	10 Dec 2004 17:01:54 -0000
@@ -1,27 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Draws a "crop marks" around selected object """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
+def main():
+    userUnit = getUnit()
+    setUnit(1)
+    x,y = getPosition()
+    l,h = getSize()
+    t1 = createLine(x, y-2, x, y-7)
+    setLineWidth(0.1, t1)
+    t2 = createLine(x+l, y-2, x+l, y-7)
+    setLineWidth(0.1, t2)
+    t3 = createLine(x, y+7+h, x, y+2+h)
+    setLineWidth(0.1, t3)
+    t4 = createLine(x+l, y+7+h, x+l, y+2+h)
+    setLineWidth(0.1, t4)
+    t5 = createLine(x-2, y, x-7, y)
+    setLineWidth(0.1, t5)
+    t6 = createLine(x-2, y+h, x-7, y+h)
+    setLineWidth(0.1, t6)
+    t7 = createLine(x+l+2, y+h, x+l+7, y+h)
+    setLineWidth(0.1, t7)
+    t7 = createLine(x+l+2, y, x+l+7, y)
+    setLineWidth(0.1, t7)
+    deselectAll()
+    setUnit(userUnit)
 
-if haveDoc():
-	userUnit = getUnit()
-	setUnit(1)
-	x,y = getPosition()
-	l,h = getSize()
-	t1 = createLine(x, y-2, x, y-7)
-	setLineWidth(0.1, t1)
-	t2 = createLine(x+l, y-2, x+l, y-7)
-	setLineWidth(0.1, t2)
-	t3 = createLine(x, y+7+h, x, y+2+h)
-	setLineWidth(0.1, t3)
-	t4 = createLine(x+l, y+7+h, x+l, y+2+h)
-	setLineWidth(0.1, t4)
-	t5 = createLine(x-2, y, x-7, y)
-	setLineWidth(0.1, t5)
-	t6 = createLine(x-2, y+h, x-7, y+h)
-	setLineWidth(0.1, t6)
-	t7 = createLine(x+l+2, y+h, x+l+7, y+h)
-	setLineWidth(0.1, t7)
-	t7 = createLine(x+l+2, y, x+l+7, y)
-	setLineWidth(0.1, t7)
-	deselectAll()
-	setUnit(userUnit)
+if __name__ == '__main__':
+    if haveDoc() and selectionCount():
+        main()
+    else:
+        messageBox("trait_de_coupe.py", "Please select an object to put crop marks around<i>before</i> running this script.", ICON_INFORMATION)
Index: samples/wordcount.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/wordcount.py,v
retrieving revision 1.4
diff -u -r1.4 wordcount.py
--- samples/wordcount.py	7 Nov 2004 19:39:37 -0000	1.4
+++ samples/wordcount.py	10 Dec 2004 17:01:54 -0000
@@ -1,45 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: latin-1 -*-
+
 """ Counts the words in the whole document or in a textframe """
 
-# -*- coding: ISO-8859-1 -*-
-from scribus import *
-import re
+import sys
 
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-TITLE = "Word count"
-BUTTON_OK = 1
-ICON_INFORMATION = 1
-ICON_WARNING = 2
+import re
 
+TITLE = "Word count"
 
 def wordsplit(text):
-	word_pattern = "([A-Za-z�����]+)"
-	words = []
-	for x in re.split(word_pattern, text):
-		if re.match(word_pattern, x):
-			words.append(x)
-	return words
-
-
-if haveDoc():
-	words = 0
-	sel_count = selectionCount()
-	if sel_count:
-		source = "selected textframe"
-		if sel_count > 1: source += "s" #plural
-		for i in range(sel_count):
-			text = getText(getSelectedObject(i))
-			words += len(wordsplit(text))
-	else:
-		source = "whole document"
-		for page in range(pageCount()):
-			gotoPage(page)
-			for obj in getAllObjects():
-				text = getText(obj)
-				words += len(wordsplit(text))
-
-	if words == 0: words = "No"
-	messageBox(TITLE, "%s words counted in %s" % (words, source),
-			   ICON_INFORMATION, BUTTON_OK)
-
-else:
-	messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    word_pattern = "([A-Za-z�����]+)"
+    words = []
+    for x in re.split(word_pattern, text):
+        if re.match(word_pattern, x):
+            words.append(x)
+    return words
+
+
+def main():
+    words = 0
+    sel_count = selectionCount()
+    if sel_count:
+        source = "selected textframe"
+        if sel_count > 1: source += "s" #plural
+        for i in range(sel_count):
+            try:
+                text = getText(getSelectedObject(i))
+            except WrongFrameTypeError:
+                if sel_count == 1:
+                    # If there's only one object selected, display a message
+                    messageBox(TITLE, "Can't count words in a non-text frame", ICON_INFORMATION);
+                    sys.exit(1)
+                else:
+                    # otherwise ignore
+                    pass
+            words += len(wordsplit(text))
+    else:
+        source = "whole document"
+        for page in range(1,pageCount() + 1):
+            gotoPage(page)
+            for obj in getAllObjects():
+                try:
+                    text = getText(obj)
+                except WrongFrameTypeError:
+                    pass # ignore the error, it just wasn't a frame we can count
+                words += len(wordsplit(text))
+
+    if words == 0: words = "No"
+    messageBox(TITLE, "%s words counted in %s" % (words, source),
+               ICON_INFORMATION)
+
+
+if __name__ == '__main__':
+    if haveDoc():
+        main()
+    else:
+        messageBox(TITLE, "No document open", ICON_WARNING)

cbradney

2004-12-10 20:21

administrator   ~0003097

translations_and_fixups_UNICODE_INOUT.diff [^] (155,562 bytes) 04-Dec-10 19:21

Applied that file to 1.2.1cvs. Please do not delete it from the bug.

ringerc

2004-12-11 16:40

reporter   ~0003104

Last edited: 2004-12-11 18:41

utf_fixes_cmddialog.diff :

Fix up unicode in cmddialog.cpp. Touches:
    fileDialog(), valueDialog(), messageBox()

Also touches guiapp.cpp and scriptplugin.cpp with trivial fixes:
    make progressReset() METH_NOARGS
    make setCursor reject non-ASCII input.

This patch fixes up unicode string input in the Python dialog functions.

2004-12-11 18:19

 

utf_fixes_cmddialog.diff (5,846 bytes)   
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.51
diff -u -r1.51 scriptplugin.cpp
--- scriptplugin.cpp	10 Dec 2004 21:22:58 -0000	1.51
+++ scriptplugin.cpp	11 Dec 2004 18:18:49 -0000
@@ -657,7 +657,7 @@
 	{"openDoc", scribus_opendoc, METH_VARARGS, tr(scribus_opendoc__doc__)},
 	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, tr(scribus_pagecount__doc__)},
 	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)},
-	{"progressReset", scribus_progressreset, METH_VARARGS, tr(scribus_progressreset__doc__)},
+	{"progressReset", (PyCFunction)scribus_progressreset, METH_NOARGS, tr(scribus_progressreset__doc__)},
 	{"progressSet", scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
 	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
 	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
Index: guiapp.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.cpp,v
retrieving revision 1.10
diff -u -r1.10 guiapp.cpp
--- guiapp.cpp	3 Dec 2004 15:02:55 -0000	1.10
+++ guiapp.cpp	11 Dec 2004 18:18:49 -0000
@@ -14,10 +14,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_progressreset(PyObject *self, PyObject* args)
+PyObject *scribus_progressreset(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-		return NULL;
 	Carrier->FProg->reset();
 	qApp->processEvents();
 	Py_INCREF(Py_None);
@@ -57,9 +55,9 @@
 {
 	char *aCursor;
 	qDebug("WARNING! SetCursor() is not stable!");
-	if (!PyArg_ParseTuple(args, "s", &aCursor))
+	if (!PyArg_ParseTuple(args, "es", "ascii", &aCursor))
 		return NULL;
-	if (aCursor=="wait")
+	if (strcmp(aCursor, "wait") == 0)
 		qApp->setOverrideCursor(Qt::WaitCursor);
 	else
 		qApp->restoreOverrideCursor();
Index: guiapp.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.h,v
retrieving revision 1.6
diff -u -r1.6 guiapp.h
--- guiapp.h	10 Dec 2004 19:28:41 -0000	1.6
+++ guiapp.h	11 Dec 2004 18:18:49 -0000
@@ -32,7 +32,7 @@
 TODO: check total vs. set values.
 (Petr Vanek 02/19/04)
 */
-PyObject *scribus_progressreset(PyObject *self, PyObject* args);
+PyObject *scribus_progressreset(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssettotalsteps__doc__,
Index: cmddialog.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp,v
retrieving revision 1.19
diff -u -r1.19 cmddialog.cpp
--- cmddialog.cpp	10 Dec 2004 19:28:41 -0000	1.19
+++ cmddialog.cpp	11 Dec 2004 18:18:49 -0000
@@ -22,28 +22,33 @@
 	int haspreview = 0;
 	int issave = 0;
 	char* kwargs[] = {"caption", "filter", "defaultname", "haspreview", "issave", NULL};
-	if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssii", kwargs, &caption, &filter, &defName, &haspreview, &issave))
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "es|esesii", kwargs,
+									 "utf-8", &caption, "utf-8", &filter, "utf-8", &defName,
+									 &haspreview, &issave))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	QString fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(haspreview), static_cast<bool>(issave), 0, 0);
+	QString fName = Carrier->CFileDialog(".", QString::fromUtf8(caption), QString::fromUtf8(filter),
+										 QString::fromUtf8(defName), static_cast<bool>(haspreview),
+										 static_cast<bool>(issave), 0, 0);
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+	// FIXME: filename return unicode OK?
 	return PyString_FromString(fName.utf8());
 }
 
 PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw)
 {
-	char *caption = "";
-	char *message = "";
+	char *caption = NULL;
+	char *message = NULL;
 	uint result;
 	QMessageBox::Icon ico = QMessageBox::NoIcon;
 	int butt1 = QMessageBox::Ok|QMessageBox::Default;
 	int butt2 = QMessageBox::NoButton;
 	int butt3 = QMessageBox::NoButton;
 	char* kwargs[] = {"caption", "message", "icon", "button1", "button2", "button3", NULL};
-	if (!PyArg_ParseTupleAndKeywords(args, kw, "ss|iiii", kwargs, &caption, &message, &ico, &butt1, &butt2, &butt3))
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "eses|iiii", kwargs, "utf-8", &caption, "utf-8", &message, &ico, &butt1, &butt2, &butt3))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
+	QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, Carrier);
 	result = mb.exec();
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyInt_FromLong(static_cast<long>(result));
@@ -51,16 +56,16 @@
 
 PyObject *scribus_valdialog(PyObject *self, PyObject* args)
 {
-	char *caption = "";
-	char *message = "";
+	char *caption = NULL;
+	char *message = NULL;
 	char *value = "";
-	if (!PyArg_ParseTuple(args, "ss|s", &caption, &message, &value))
+	if (!PyArg_ParseTuple(args, "eses|es", "utf-8", &caption, "utf-8", &message, "utf-8", &value))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
 	ValueDialog *d = new ValueDialog(Carrier, "d", TRUE, 0);
-	d->dialogLabel->setText(message);
-	d->valueEdit->setText(value);
-	d->setCaption(caption);
+	d->dialogLabel->setText(QString::fromUtf8(message));
+	d->valueEdit->setText(QString::fromUtf8(value));
+	d->setCaption(QString::fromUtf8(caption));
 	d->exec();
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyString_FromString(d->valueEdit->text().utf8());
utf_fixes_cmddialog.diff (5,846 bytes)   

ringerc

2004-12-11 18:28

reporter   ~0003108

Last edited: 2004-12-11 18:39

Patched two more files for unicode fixes. All the utf_fixes patches are independent.

utf_fixes_cmdobj.cpp.diff touches:

getFontSize
getFont
getTextLength
getText
getAllText
getLineSpacing
getColumnGap
getColumns
setText
insertText
setFont
setFontSize
setLineSpacing
setTextAlignment
selectText
deleteText
setTextColor
setTextStroke
setTextShade
linkTextFrames
unlinkTextFrames
traceText

utf_fixes_cmdobj.cpp.diff touches:

createRect
createEllipse
createImage
createText
createLine
createPolyLine
createPolygon
createBezierLine
createPathText
deleteObject
textFlowsAroundFrame
objectExists
setStyle
getStyleNames
getAllStyles

I expect to have more patches done tomorrow - hopefully all of them. I'm testing each quite solidly, and don't anticipate any problems. It also means each one takes a while.

2004-12-11 18:40

 

utf_fixes_cmdtext.cpp.diff (13,907 bytes)   
Index: cmdtext.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp,v
retrieving revision 1.26
diff -u -r1.26 cmdtext.cpp
--- cmdtext.cpp	9 Dec 2004 16:50:21 -0000	1.26
+++ cmdtext.cpp	11 Dec 2004 18:18:09 -0000
@@ -4,11 +4,11 @@
 PyObject *scribus_getfontsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -29,11 +29,11 @@
 PyObject *scribus_getfont(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -45,20 +45,20 @@
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 			if (it->Ptext.at(b)->cselect)
-				return PyString_FromString(it->Ptext.at(b)->cfont);
+				return PyString_FromString(it->Ptext.at(b)->cfont.utf8());
 	}
 	else
-		return PyString_FromString(it->IFont);
+		return PyString_FromString(it->IFont.utf8());
 }
 
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
@@ -72,11 +72,11 @@
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -90,11 +90,11 @@
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -108,11 +108,11 @@
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -126,12 +126,12 @@
 PyObject *scribus_getframetext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	QString text = "";
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -151,18 +151,18 @@
 			text += it->Ptext.at(a)->ch;
 		}
 	}
-	return PyString_FromString(text);
+	return PyString_FromString(text.utf8());
 }
 
 PyObject *scribus_gettext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	QString text = "";
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -227,18 +227,18 @@
 			}
 		} // for
 	} // while
-	return PyString_FromString(text);
+	return PyString_FromString(text.utf8());
 }
 
 PyObject *scribus_setboxtext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	char *Text;
-	if (!PyArg_ParseTuple(args, "es|s", "utf-8", &Text, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Text, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -293,11 +293,11 @@
 	char *Name = "";
 	char *Text;
 	int pos;
-	if (!PyArg_ParseTuple(args, "esi|s", "utf-8", &Text, &pos, &Name))
+	if (!PyArg_ParseTuple(args, "esi|es", "utf-8", &Text, &pos, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -346,7 +346,7 @@
 {
 	char *Name = "";
 	int alignment;
-	if (!PyArg_ParseTuple(args, "i|s", &alignment, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &alignment, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -355,7 +355,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of range. Use one of the scribus.ALIGN* constants.","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -379,7 +379,7 @@
 {
 	char *Name = "";
 	double size;
-	if (!PyArg_ParseTuple(args, "d|s", &size, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &size, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -388,7 +388,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Font size out of bounds - must be 1 <= size <= 512","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 
@@ -413,11 +413,11 @@
 {
 	char *Name = "";
 	char *Font = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Font, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Font, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
@@ -425,14 +425,14 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font on a non-text frame","python error"));
 		return NULL;
 	}
-	if (Carrier->Prefs.AvailFonts.find(QString(Font)))
+	if (Carrier->Prefs.AvailFonts.find(QString::fromUtf8(Font)))
 	{
 		int Apm = Carrier->doc->AppMode;
 		i->OwnPage->SelItem.clear();
 		i->OwnPage->SelItem.append(i);
 		if (i->HasSel)
 			Carrier->doc->AppMode = 7;
-		Carrier->SetNewFont(QString(Font));
+		Carrier->SetNewFont(QString::fromUtf8(Font));
 		Carrier->doc->AppMode = Apm;
 		i->OwnPage->Deselect();
 	}
@@ -449,7 +449,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -458,7 +458,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line space out of bounds, must be >= 0.1","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -475,7 +475,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -484,7 +484,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Column gap out of bounds, must be positive","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -501,7 +501,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -510,7 +510,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Column count out of bounds, must be > 1","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -527,11 +527,11 @@
 {
 	char *Name = "";
 	int start, ende;
-	if (!PyArg_ParseTuple(args, "ii|s", &start, &ende, &Name))
+	if (!PyArg_ParseTuple(args, "ii|es", &start, &ende, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((start < 0) || ((start + ende) > static_cast<int>(it->Ptext.count()-1)))
@@ -569,11 +569,11 @@
 PyObject *scribus_deletetext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -596,11 +596,11 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -615,12 +615,12 @@
 			if (it->HasSel)
 			{
 				if (it->Ptext.at(b)->cselect)
-					it->Ptext.at(b)->ccolor = QString(Color);
+					it->Ptext.at(b)->ccolor = QString::fromUtf8(Color);
 			}
 			else
-				it->Ptext.at(b)->ccolor = QString(Color);
+				it->Ptext.at(b)->ccolor = QString::fromUtf8(Color);
 		}
-		it->TxtFill = QString(Color);
+		it->TxtFill = QString::fromUtf8(Color);
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -630,11 +630,11 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -649,12 +649,12 @@
 			if (it->HasSel)
 			{
 				if (it->Ptext.at(b)->cselect)
-					it->Ptext.at(b)->cstroke = QString(Color);
+					it->Ptext.at(b)->cstroke = QString::fromUtf8(Color);
 			}
 			else
-				it->Ptext.at(b)->cstroke = QString(Color);
+				it->Ptext.at(b)->cstroke = QString::fromUtf8(Color);
 		}
-		it->TxtStroke = QString(Color);
+		it->TxtStroke = QString::fromUtf8(Color);
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -664,7 +664,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -673,7 +673,7 @@
 		Py_INCREF(Py_None);
 		return Py_None;
 	}
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -704,14 +704,14 @@
 	char *name1;
 	char *name2;
 
-	if (!PyArg_ParseTuple(args, "ss", &name1, &name2))
+	if (!PyArg_ParseTuple(args, "eses", "utf-8", &name1, "utf-8", &name2))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *fromitem = GetUniqueItem(QString(name1));
+	PageItem *fromitem = GetUniqueItem(QString::fromUtf8(name1));
 	if (fromitem == NULL)
 		return NULL;
-	PageItem *toitem = GetUniqueItem(QString(name2));
+	PageItem *toitem = GetUniqueItem(QString::fromUtf8(name2));
 	if (toitem == NULL)
 		return NULL;
 	if ((fromitem->PType != FRAME_TEXT) || (toitem->PType != FRAME_TEXT))
@@ -753,11 +753,11 @@
 PyObject *scribus_unlinktextframes(PyObject * self, PyObject* args)
 {
 	char *name;
-	if (!PyArg_ParseTuple(args, "s", &name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_TEXT)
@@ -805,11 +805,11 @@
 PyObject *scribus_tracetext(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_TEXT)
utf_fixes_cmdtext.cpp.diff (13,907 bytes)   

2004-12-11 18:40

 

utf_fixes_cmdobj.cpp.diff (12,758 bytes)   
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.18
diff -u -r1.18 cmdobj.cpp
--- cmdobj.cpp	10 Dec 2004 19:28:41 -0000	1.18
+++ cmdobj.cpp	11 Dec 2004 18:18:26 -0000
@@ -4,12 +4,12 @@
 PyObject *scribus_newrect(PyObject *self, PyObject* args)
 {
 	double x, y, b, h;
-	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	char *Name = NULL;
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -19,8 +19,8 @@
 															Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
 	Carrier->doc->ActPage->SetRectFrame(Carrier->doc->ActPage->Items.at(i));
 	if (Name != "")
-		Carrier->doc->ActPage->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName);
+		Carrier->doc->ActPage->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName.utf8());
 }
 
 
@@ -28,11 +28,11 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -40,8 +40,8 @@
 	int i = Carrier->doc->ActPage->PaintEllipse(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h),  Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
 	Carrier->doc->ActPage->SetOvalFrame(Carrier->doc->ActPage->Items.at(i));
 	if (Name != "")
-		Carrier->doc->ActPage->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName);
+		Carrier->doc->ActPage->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName.utf8());
 }
 
 
@@ -49,11 +49,11 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -61,8 +61,8 @@
 	int i = Carrier->doc->ActPage->PaintPict(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h));
 	Carrier->doc->ActPage->SetRectFrame(Carrier->doc->ActPage->Items.at(i));
 	if (Name != "")
-		Carrier->doc->ActPage->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName);
+		Carrier->doc->ActPage->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName.utf8());
 }
 
 
@@ -70,11 +70,11 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -84,8 +84,8 @@
 															Carrier->doc->Dwidth, Carrier->doc->DpenText);
 	Carrier->doc->ActPage->SetRectFrame(Carrier->doc->ActPage->Items.at(i));
 	if (Name != "")
-		Carrier->doc->ActPage->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName);
+		Carrier->doc->ActPage->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->ActPage->Items.at(i)->AnName.utf8());
 }
 
 
@@ -93,11 +93,11 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -127,8 +127,8 @@
 	Carrier->doc->ActPage->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), i, false, false);
 	Carrier->doc->ActPage->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -136,7 +136,8 @@
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -151,7 +152,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -200,9 +201,9 @@
 	Carrier->doc->ActPage->AdjustItemSize(it);
 	if (Name != "")
 	{
-		it->AnName = QString(Name);
+		it->AnName = QString::fromUtf8(Name);
 	}
-	return PyString_FromString(it->AnName);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -210,7 +211,8 @@
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -225,7 +227,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -278,15 +280,16 @@
 	Carrier->doc->ActPage->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false);
 	Carrier->doc->ActPage->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 PyObject *scribus_bezierline(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -301,7 +304,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must have a multiple of six values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -363,8 +366,8 @@
 	Carrier->doc->ActPage->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false);
 	Carrier->doc->ActPage->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -376,19 +379,19 @@
 	char *Name = "";
 	char *TextB = "";
 	char *PolyB = "";
-	if (!PyArg_ParseTuple(args, "ddss|s", &x, &y, &TextB, &PolyB, &Name))
+	if (!PyArg_ParseTuple(args, "ddeses|es", &x, &y, "utf-8", &TextB, "utf-8", &PolyB, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	//FIXME: Why use GetItem not GetUniqueItem? Maybe use GetUniqueItem and use the exceptions
 	// its sets for us?
-	int i = GetItem(QString(TextB));
-	int ii = GetItem(QString(PolyB));
+	int i = GetItem(QString::fromUtf8(TextB));
+	int ii = GetItem(QString::fromUtf8(PolyB));
 	if ((i == -1) || (ii == -1))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Object not found","python error"));
@@ -398,11 +401,13 @@
 	Carrier->doc->ActPage->SelItem.append(Carrier->doc->ActPage->Items.at(i));
 	Carrier->doc->ActPage->SelItem.append(Carrier->doc->ActPage->Items.at(ii));
 	PageItem *it = Carrier->doc->ActPage->Items.at(i);
+	// FIXME: If this fails, because of eg wrong item types, we don't notice. Worse, change the
+	// name of the item BEFORE we fail to notice. Looks like a core bug.
 	Carrier->doc->ActPage->ToPathText();
 	Carrier->doc->ActPage->MoveItem(ValueToPoint(x) - it->Xpos, ValueToPoint(y) - it->Ypos, it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -411,11 +416,11 @@
 PyObject *scribus_deleteobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->SelItem.clear();
@@ -433,11 +438,11 @@
 	char *name = "";
 	int state = -1;
 
-	if (!PyArg_ParseTuple(args, "s|i", &name, &state))
+	if (!PyArg_ParseTuple(args, "es|i", "utf-8", &name, &state))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(name));
 	if (i == NULL)
 		return NULL;
 	if (state == -1)
@@ -454,11 +459,11 @@
 PyObject *scribus_objectexists(PyObject *self, PyObject* args)
 {
 	char* name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(name)))
+	if (ItemExists(QString::fromUtf8(name)))
 		return PyBool_FromLong(static_cast<long>(true));
 	return PyBool_FromLong(static_cast<long>(false));
 }
@@ -470,16 +475,16 @@
  */
 PyObject *scribus_setstyle(PyObject *self, PyObject* args)
 {
-	char *Style = "";
+	char *style = "";
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Style, &name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &style, "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType == FRAME_TEXT)
+	if ((item->PType == FRAME_TEXT) || (item->PType == FRAME_PATHTEXT))
 	{
 		/*
 		 * First, find the style number associated with the requested style
@@ -492,7 +497,7 @@
 		// We start at zero here because it's OK to match an internal name
 		for (uint i=0; i < Carrier->doc->Vorlagen.count(); ++i)
 		{
-			if (Carrier->doc->Vorlagen[i].Vname == Style) {
+			if (Carrier->doc->Vorlagen[i].Vname == QString::fromUtf8(style)) {
 				found = true;
 				styleid = i;
 				break;
@@ -536,7 +541,7 @@
 	*/
 	for (uint i=0; i < Carrier->doc->Vorlagen.count(); ++i)
 	{
-		if (PyList_Append(styleList, PyString_FromString(Carrier->doc->Vorlagen[i].Vname)))
+		if (PyList_Append(styleList, PyString_FromString(Carrier->doc->Vorlagen[i].Vname.utf8())))
 		{
 			// An exception will have already been set by PyList_Append apparently.
 			return NULL;
utf_fixes_cmdobj.cpp.diff (12,758 bytes)   

cbradney

2004-12-11 18:49

administrator   ~0003109

Committed the last 3.

2004-12-12 11:42

 

utf_fixes_cmdcolor.cpp.diff (3,611 bytes)   
Index: cmdcolor.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp,v
retrieving revision 1.11
diff -u -r1.11 cmdcolor.cpp
--- cmdcolor.cpp	10 Dec 2004 21:22:58 -0000	1.11
+++ cmdcolor.cpp	12 Dec 2004 11:39:15 -0000
@@ -11,7 +11,7 @@
 	l = PyList_New(edc.count());
 	for (it = edc.begin(); it != edc.end(); ++it)
 	{
-		PyList_SetItem(l, cc, PyString_FromString(it.key()));
+		PyList_SetItem(l, cc, PyString_FromString(it.key().utf8()));
 		cc++;
 	}
 	return l;
@@ -22,7 +22,7 @@
 	CListe edc;
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if (strcmp(Name, "") == 0)
 	{
@@ -30,7 +30,7 @@
 		return NULL;
 	}
 	edc = Carrier->HaveDoc ? Carrier->doc->PageColors : Carrier->Prefs.DColors;
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (!edc.contains(col))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Color not found","python error"));
@@ -44,14 +44,14 @@
 {
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
+	if (!PyArg_ParseTuple(args, "esiiii", "utf-8", &Name, &c, &m, &y, &k))
 		return NULL;
 	if (strcmp(Name, "") == 0)
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot change a color with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (Carrier->HaveDoc)
 	{
 		if (!Carrier->doc->PageColors.contains(col))
@@ -78,14 +78,14 @@
 {
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
+	if (!PyArg_ParseTuple(args, "esiiii", "utf-8", &Name, &c, &m, &y, &k))
 		return NULL;
 	if (strcmp(Name, "") == 0)
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create a color with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (Carrier->HaveDoc)
 		{
 			if (!Carrier->doc->PageColors.contains(col))
@@ -112,15 +112,15 @@
 {
 	char *Name = "";
 	char *Repl = "None";
-	if (!PyArg_ParseTuple(args, "s|s", &Name, &Repl))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Name, "utf-8", &Repl))
 		return NULL;
-	if (strcmp(Name,"") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot delete a color with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
-	QString rep = QString(Repl);
+	QString col = QString::fromUtf8(Name);
+	QString rep = QString::fromUtf8(Repl);
 	if (Carrier->HaveDoc)
 	{
 		if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
@@ -150,10 +150,10 @@
 
 PyObject *scribus_replcolor(PyObject *self, PyObject* args)
 {
-	char *Name = "";
+	char *Name = NULL;
 	char *Repl = "None";
 	//FIXME: this should definitely use keyword arguments
-	if (!PyArg_ParseTuple(args, "s|s", &Name, &Repl))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Name, "utf-8", &Repl))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -162,8 +162,8 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot replace a color with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
-	QString rep = QString(Repl);
+	QString col = QString::fromUtf8(Name);
+	QString rep = QString::fromUtf8(Repl);
 	if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
 		ReplaceColor(col, rep);
 	else
utf_fixes_cmdcolor.cpp.diff (3,611 bytes)   

2004-12-12 11:42

 

utf_fixes_cmdgetprop.cpp.diff (7,438 bytes)   
Index: cmdgetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdgetprop.cpp
--- cmdgetprop.cpp	10 Dec 2004 19:28:41 -0000	1.14
+++ cmdgetprop.cpp	12 Dec 2004 11:39:35 -0000
@@ -3,24 +3,24 @@
 
 PyObject *scribus_getfillcolor(PyObject *self, PyObject* args)
 {
-	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	char *Name = NULL;
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyString_FromString(i->Pcolor) : NULL;
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+	return i != NULL ? PyString_FromString(i->Pcolor.utf8()) : NULL;
 }
 
 PyObject *scribus_getlinecolor(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	PageItem *it;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	it = GetUniqueItem(QString(Name));
+	it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
@@ -28,22 +28,21 @@
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
 			if (it->Ptext.at(b)->cselect)
-				return PyString_FromString(it->Ptext.at(b)->ccolor);
+				return PyString_FromString(it->Ptext.at(b)->ccolor.utf8());
 		}
 	}
 	else
-		return PyString_FromString(it->Pcolor2);
-	return PyString_FromString("");
+		return PyString_FromString(it->Pcolor2.utf8());
 }
 
 PyObject *scribus_getlinewidth(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->Pwidth)) : NULL;
 }
 
@@ -51,11 +50,11 @@
 {
 	char *Name = "";
 	PageItem *it;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	it = GetUniqueItem(QString(Name));
+	it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
@@ -74,110 +73,110 @@
 PyObject *scribus_getlinejoin(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineJoin)) : NULL;
 }
 
 PyObject *scribus_getlineend(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineEnd)) : NULL;
 }
 
 PyObject *scribus_getlinestyle(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineArt)) : NULL;
 }
 
 PyObject *scribus_getfillshade(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Shade)) : NULL;
 }
 
 PyObject *scribus_getcornerrad(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->RadRect)) : NULL;
 }
 
 PyObject *scribus_getimgscale(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? Py_BuildValue("(ff)", i->LocalScX, i->LocalScY) : NULL;
 }
 
 PyObject *scribus_getimgname(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyString_FromString(i->Pfile) : NULL;
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+	return i != NULL ? PyString_FromString(i->Pfile.utf8()) : NULL;
 }
 
 PyObject *scribus_getposi(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return (i != NULL) ? Py_BuildValue("(ff)", PointToValue(i->Xpos), PointToValue(i->Ypos)) : NULL;
 }
 
 PyObject *scribus_getsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return (i != NULL) ? Py_BuildValue("(ff)", PointToValue(i->Width), PointToValue(i->Height)) : NULL;
 }
 
 PyObject *scribus_getrotation(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->Rot * -1)) : NULL;
 }
 
@@ -210,12 +209,12 @@
 		{
 			if (Carrier->doc->ActPage->Items.at(lam)->PType == typ)
 			{
-				PyList_SetItem(l, counter2, PyString_FromString(Carrier->doc->ActPage->Items.at(lam)->AnName));
+				PyList_SetItem(l, counter2, PyString_FromString(Carrier->doc->ActPage->Items.at(lam)->AnName.utf8()));
 				counter2++;
 			}
 		}
 		else
-			PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->ActPage->Items.at(lam)->AnName));
+			PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->ActPage->Items.at(lam)->AnName.utf8()));
 	}
 	return l;
 }
utf_fixes_cmdgetprop.cpp.diff (7,438 bytes)   

2004-12-12 11:43

 

utf_fixes_cmdsetprop.cpp.diff (6,329 bytes)   
Index: cmdsetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdsetprop.cpp
--- cmdsetprop.cpp	10 Dec 2004 19:28:41 -0000	1.14
+++ cmdsetprop.cpp	12 Dec 2004 11:39:28 -0000
@@ -7,17 +7,17 @@
 	char *Color1;
 	char *Color2;
 	int typ, shade1, shade2;
-	if (!PyArg_ParseTuple(args, "isisi|s", &typ, &Color1, &shade1, &Color2, &shade2, &Name))
+	if (!PyArg_ParseTuple(args, "iesiesi|es", &typ, "utf-8", &Color1, &shade1, "utf-8", &Color2, &shade2, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
 	QColor tmp;
 	b->fill_gradient.clearStops();
-	QString c1 = QString(Color1);
-	QString c2 = QString(Color2);
+	QString c1 = QString::fromUtf8(Color1);
+	QString c2 = QString::fromUtf8(Color2);
 	b->SetFarbe(&tmp, c1, shade1);
 	b->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, c1, shade1);
 	b->SetFarbe(&tmp, c2, shade2);
@@ -33,14 +33,14 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
-	i->Pcolor = QString(Color);
+	i->Pcolor = QString::fromUtf8(Color);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -49,14 +49,14 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
-	it->Pcolor2 = QString(Color);
+	it->Pcolor2 = QString::fromUtf8(Color);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -65,7 +65,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -74,7 +74,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line width out of bounds, must be 0 <= line_width <= 12","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->Pwidth = w;
@@ -86,7 +86,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -95,7 +95,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	it->Shade2 = w;
@@ -107,7 +107,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -116,7 +116,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Fill shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->Shade = w;
@@ -128,11 +128,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineJoin = Qt::PenJoinStyle(w);
@@ -144,11 +144,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineEnd = Qt::PenCapStyle(w);
@@ -160,11 +160,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineArt = Qt::PenStyle(w);
@@ -176,7 +176,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -185,10 +185,11 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error"));
 		return NULL;
 	}
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
 	// What the heck is a type 3 frame?
+	// FIXME: Doesn't seem to work, at least on rect/polygon frames
 	if ((b->PType == FRAME_IMAGE) || (b->PType == 3) || (b->PType == FRAME_TEXT))
 	{
 		b->RadRect = w;
@@ -205,19 +206,19 @@
 {
 	char *Name = "";
 	char *Style = NULL;
-	if (!PyArg_ParseTuple(args, "s|s", &Style, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Style, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
-	if (!Carrier->doc->MLineStyles.contains(QString(Style)))
+	if (!Carrier->doc->MLineStyles.contains(QString::fromUtf8(Style)))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Line style not found","python error"));
 		return NULL;
 	}
-	b->NamedLStyle = QString(Style);
+	b->NamedLStyle = QString::fromUtf8(Style);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
utf_fixes_cmdsetprop.cpp.diff (6,329 bytes)   

ringerc

2004-12-12 11:45

reporter   ~0003116

Last edited: 2004-12-12 16:01

Here's the next round of utf8 fixes.

utf_fixes_cmdcolor.cpp.diff
utf_fixes_cmdgetprop.cpp.diff
utf_fixes_cmdsetprop.cpp.diff
utf_fixes_cmdmani.cpp.diff
utf_fixes_cmddoc.cpp.diff
utf_fixes_cmdmisc.cpp.diff
utf_fixes_cmdpage.cpp.diff

2004-12-12 13:59

 

utf_fixes_cmdmani.cpp.diff (6,709 bytes)   
Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdmani.cpp
--- cmdmani.cpp	10 Dec 2004 19:28:41 -0000	1.14
+++ cmdmani.cpp	12 Dec 2004 13:58:49 -0000
@@ -5,11 +5,11 @@
 {
 	char *Name = "";
 	char *Image;
-	if (!PyArg_ParseTuple(args, "s|s", &Image, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Image, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_IMAGE)
@@ -17,20 +17,21 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
 		return NULL;
 	}
-	item->OwnPage->LoadPict(QString(Image), item->ItemNr);
+	item->OwnPage->LoadPict(QString::fromUtf8(Image), item->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
 
 PyObject *scribus_scaleimage(PyObject *self, PyObject* args)
 {
+	// FIXME: This function doesn't seem to work...
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(Name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (!item->PType == FRAME_IMAGE)
@@ -48,11 +49,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->OwnPage->GroupSel)
@@ -67,11 +68,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->OwnPage->GroupSel)
@@ -91,11 +92,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->RotateItem(item->Rot - x, item->ItemNr);
@@ -107,11 +108,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->RotateItem(x * -1.0, item->ItemNr);
@@ -123,11 +124,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	item->OwnPage->SizeItem(ValueToPoint(x) - item->Xpos, ValueToPoint(y) - item->Ypos, item->ItemNr);
@@ -155,8 +156,11 @@
 		}
 		for (int i = 0; i < len; i++)
 		{
+			// FIXME: We might need to explicitly get this string as utf8
+			// but as sysdefaultencoding is utf8 it should be a no-op to do
+			// so anyway.
 			Name = PyString_AsString(PyList_GetItem(il, i));
-			PageItem *ic = GetUniqueItem(QString(Name));
+			PageItem *ic = GetUniqueItem(QString::fromUtf8(Name));
 			if (ic == NULL)
 				return NULL;
 			ic->OwnPage->SelectItemNr(ic->ItemNr);
@@ -177,11 +181,11 @@
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	uint p = Carrier->doc->ActPage->PageNr;
@@ -196,7 +200,7 @@
 {
 	char *Name = "";
 	double sc;
-	if (!PyArg_ParseTuple(args, "d|s", &sc, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &sc, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -205,7 +209,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't scale by 0%","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->Deselect();
@@ -228,6 +232,7 @@
 	if ((i < static_cast<int>(Carrier->doc->ActPage->SelItem.count())) && (i > -1))
 		return PyString_FromString(Carrier->doc->ActPage->SelItem.at(i)->AnName);
 	else
+		// FIXME: Should probably return None if no selection?
 		return PyString_FromString("");
 }
 
@@ -241,11 +246,11 @@
 PyObject *scribus_selectobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->SelectItemNr(i->ItemNr);
@@ -266,11 +271,11 @@
 PyObject *scribus_lockobject(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	// FIXME: Rather than toggling the lock, we should probably let the user set the lock state
@@ -284,11 +289,11 @@
 PyObject *scribus_islocked(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->Locked)
utf_fixes_cmdmani.cpp.diff (6,709 bytes)   

2004-12-12 14:37

 

utf_fixes_cmddoc.cpp.diff (2,258 bytes)   
Index: cmddoc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp,v
retrieving revision 1.17
diff -u -r1.17 cmddoc.cpp
--- cmddoc.cpp	10 Dec 2004 19:28:41 -0000	1.17
+++ cmddoc.cpp	12 Dec 2004 14:36:59 -0000
@@ -65,9 +65,9 @@
 PyObject *scribus_opendoc(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
-	bool ret = Carrier->LadeDoc(QString(Name));
+	bool ret = Carrier->LadeDoc(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to open document","python error"));
@@ -89,11 +89,11 @@
 PyObject *scribus_savedocas(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	bool ret = Carrier->DoFileSave(QString(Name));
+	bool ret = Carrier->DoFileSave(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to save document","python error"));
@@ -108,13 +108,15 @@
 	char *Author;
 	char *Title;
 	char *Desc;
+	// z means string, but None becomes a NULL value. QString()
+	// will correctly handle NULL.
 	if (!PyArg_ParseTuple(args, "zzz", &Author, &Title, &Desc))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	Carrier->doc->DocAutor = QString(Author);
-	Carrier->doc->DocTitel = QString(Title);
-	Carrier->doc->DocComments = QString(Desc);
+	Carrier->doc->DocAutor = QString::fromUtf8(Author);
+	Carrier->doc->DocTitel = QString::fromUtf8(Title);
+	Carrier->doc->DocComments = QString::fromUtf8(Desc);
 	Carrier->slotDocCh();
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -147,11 +149,11 @@
 PyObject *scribus_loadstylesfromfile(PyObject *self, PyObject *args)
 {
 	char *fileName;
-	if (!PyArg_ParseTuple(args, "s", &fileName))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &fileName))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	Carrier->doc->loadStylesFromFile(QString(fileName));
+	Carrier->doc->loadStylesFromFile(QString::fromUtf8(fileName));
 	Py_INCREF(Py_None);
 	return Py_None;
 }
utf_fixes_cmddoc.cpp.diff (2,258 bytes)   

2004-12-12 16:00

 

utf_fixes_cmdpage.cpp.diff (1,450 bytes)   
Index: cmdpage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v
retrieving revision 1.20
diff -u -r1.20 cmdpage.cpp
--- cmdpage.cpp	10 Dec 2004 21:22:58 -0000	1.20
+++ cmdpage.cpp	12 Dec 2004 15:57:46 -0000
@@ -20,11 +20,11 @@
 PyObject *scribus_savepageeps(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	bool ret = Carrier->DoSaveAsEps(QString(Name));
+	bool ret = Carrier->DoSaveAsEps(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS","python error"));
@@ -74,12 +74,12 @@
 {
 	int e;
 	char *name = "Normal";
-	if (!PyArg_ParseTuple(args, "i|s", &e, &name))
+	if (!PyArg_ParseTuple(args, "i|es", &e, "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	if (e < 0)
-		Carrier->slotNewPageP(Carrier->view->Pages.count(), QString(name));
+		Carrier->slotNewPageP(Carrier->view->Pages.count(), QString::fromUtf8(name));
 	else
 	{
 		e--;
@@ -88,7 +88,7 @@
 			PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 			return NULL;
 		}
-		Carrier->slotNewPageP(e, QString(name));
+		Carrier->slotNewPageP(e, QString::fromUtf8(name));
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
utf_fixes_cmdpage.cpp.diff (1,450 bytes)   

2004-12-12 16:00

 

utf_fixes_cmdmisc.cpp.diff (9,262 bytes)   
Index: cmdmisc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp,v
retrieving revision 1.20
diff -u -r1.20 cmdmisc.cpp
--- cmdmisc.cpp	10 Dec 2004 19:28:41 -0000	1.20
+++ cmdmisc.cpp	12 Dec 2004 15:25:51 -0000
@@ -31,7 +31,7 @@
 	{
 		if (it.current()->UseFont)
 		{
-			PyList_SetItem(l, cc, PyString_FromString(it.currentKey()));
+			PyList_SetItem(l, cc, PyString_FromString(it.currentKey().utf8()));
 			cc++;
 		}
 	}
@@ -47,14 +47,14 @@
 	for ( ; it.current() ; ++it)
 	{
 		row = Py_BuildValue((char*)"(sssiis)",
-		                    it.currentKey().ascii(),// it.currentKey().length(),
-		                    it.current()->Family.ascii(),
-		                    it.current()->RealName().ascii(),
+		                    it.currentKey().utf8(),
+		                    it.current()->Family.utf8(),
+		                    it.current()->RealName().utf8(),
 		                    it.current()->Subset,
 		                    it.current()->EmbedPS,
-		                    it.current()->Datei.ascii()//, it.current()->Datei.length()
+		                    it.current()->Datei.utf8()
 		                   );
-		PyList_SetItem(l, cc, row);//PyString_FromString(it.currentKey()));
+		PyList_SetItem(l, cc, row);
 		cc++;
 	} // for
 	return l;
@@ -67,27 +67,27 @@
 	char *Sample = "";
 	int Size;
 	bool ret = false;
-	if (!PyArg_ParseTuple(args, "sssi", &Name, &FileName, &Sample, &Size))
+	if (!PyArg_ParseTuple(args, "esesesi", "utf-8", &Name, "utf-8", &FileName, "utf-8", &Sample, &Size))
 		return NULL;
-	if (!Carrier->Prefs.AvailFonts.find(QString(Name)))
+	if (!Carrier->Prefs.AvailFonts.find(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
-	QString ts = QString(Sample);
+	QString ts = QString::fromUtf8(Sample);
 	if (ts == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't render an empty sample","python error"));
 		return NULL;
 	}
-	if (QString(FileName) == "")
+	if (QString::fromUtf8(FileName) == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't save to a blank filename","python error"));
 		return NULL;
 	}
-	QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
+	QString da = Carrier->Prefs.AvailFonts[QString::fromUtf8(Name)]->Datei;
 	QPixmap pm = FontSample(da, Size, ts, Qt::white);
-	ret = pm.save(QString(FileName), "PPM");
+	ret = pm.save(QString::fromUtf8(FileName), "PPM");
 	// FIXME: we should probably return None on success and throw an exception on failure
 	// rather than returning an error code here.
 	return PyInt_FromLong(static_cast<long>(ret));
@@ -100,18 +100,18 @@
 	PyObject *l;
 	l = PyList_New(Carrier->doc->Layers.count());
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
-		PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Layers[lam].Name));
+		PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Layers[lam].Name.utf8()));
 	return l;
 }
 
 PyObject *scribus_setactlayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == 0)
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -120,7 +120,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(lam);
 			Carrier->doc->ActiveLayer = i;
@@ -142,30 +142,30 @@
 {
 	if(!checkHaveDocument())
 		return NULL;
-	return PyString_FromString(Carrier->doc->Layers[Carrier->doc->ActiveLayer].Name);
+	return PyString_FromString(Carrier->doc->Layers[Carrier->doc->ActiveLayer].Name.utf8());
 }
 
 PyObject *scribus_senttolayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	char *Layer = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Layer, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Layer, "utf8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Layer, "") == 0)
+	if (Layer == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->OwnPage->SelectItemNr(i->ItemNr);
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Layer))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Layer))
 		{
 			i->LayerNr = static_cast<int>(lam);
 			found = true;
@@ -185,11 +185,11 @@
 {
 	char *Name = "";
 	int vis = 1;
-	if (!PyArg_ParseTuple(args, "si", &Name, &vis))
+	if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -197,7 +197,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			Carrier->doc->Layers[lam].Sichtbar = vis;
 			found = true;
@@ -217,7 +217,7 @@
 {
 	char *Name = "";
 	int vis = 1;
-	if (!PyArg_ParseTuple(args, "si", &Name, &vis))
+	if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -229,7 +229,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			Carrier->doc->Layers[lam].Drucken = vis;
 			found = true;
@@ -248,11 +248,11 @@
 PyObject *scribus_glayervisib(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -261,7 +261,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(Carrier->doc->Layers[lam].Sichtbar);
 			found = true;
@@ -279,11 +279,11 @@
 PyObject *scribus_glayerprint(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -292,7 +292,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(Carrier->doc->Layers[lam].Drucken);
 			found = true;
@@ -310,11 +310,11 @@
 PyObject *scribus_removelayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, ""))
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -327,7 +327,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			QValueList<Layer>::iterator it2 = Carrier->doc->Layers.at(lam);
 			int num2 = (*it2).LNr;
@@ -365,11 +365,11 @@
 PyObject *scribus_createlayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't create layer without a name","python error"));
 		return NULL;
@@ -379,7 +379,7 @@
 	ll.LNr = Carrier->doc->Layers.last().LNr + 1;
 	ll.Level = Carrier->doc->Layers.count();
 	// FIXME: what if the name exists?
-	ll.Name = QString(Name);
+	ll.Name = QString::fromUtf8(Name);
 	ll.Sichtbar = true;
 	ll.Drucken = true;
 	Carrier->doc->Layers.append(ll);
@@ -391,6 +391,6 @@
 
 PyObject *scribus_getlanguage(PyObject *self)
 {
-	return PyString_FromString(Carrier->GuiLanguage);
+	return PyString_FromString(Carrier->GuiLanguage.utf8());
 }
 
utf_fixes_cmdmisc.cpp.diff (9,262 bytes)   

ringerc

2004-12-14 07:08

reporter   ~0003145

cbradney has committed:

 utf_fixes_cmdgetprop.cpp.diff
 utf_fixes_cmdsetprop.cpp.diff
 utf_fixes_cmdmani.cpp.diff
 utf_fixes_cmddoc.cpp.diff
 utf_fixes_cmdpage.cpp.diff
 utf_fixes_cmdmisc.cpp.diff

to 1.2.1 .

As there haven't been any explosions or screaming, I'm preparing patches to bring 1.3 into sync now.

2004-12-14 09:55

 

translations_and_fixups_UNICODE_INOUT_13.diff (157,477 bytes)   
? .deps
? .libs
? Makefile
? Makefile.in
? cmdcolor.lo
? cmddialog.lo
? cmddoc.lo
? cmdgetprop.lo
? cmdmani.lo
? cmdmisc.lo
? cmdobj.lo
? cmdpage.lo
? cmdsetprop.lo
? cmdtext.lo
? cmdutil.lo
? conswin.lo
? conswin.moc
? diffs
? guiapp.lo
? libscriptplugin.la
? objpdffile.lo
? objprinter.lo
? pconsole.lo
? pconsole.moc
? scriptplugin.lo
? scriptplugin.moc
? valuedialog.lo
? valuedialog.moc
? samples/Makefile
? samples/Makefile.in
? scripts/Makefile
? scripts/Makefile.in
Index: cmdcolor.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp,v
retrieving revision 1.5.2.4
diff -u -r1.5.2.4 cmdcolor.cpp
--- cmdcolor.cpp	3 Dec 2004 15:05:48 -0000	1.5.2.4
+++ cmdcolor.cpp	14 Dec 2004 09:22:16 -0000
@@ -11,7 +11,7 @@
 	l = PyList_New(edc.count());
 	for (it = edc.begin(); it != edc.end(); ++it)
 		{
-		PyList_SetItem(l, cc, PyString_FromString(it.key()));
+		PyList_SetItem(l, cc, PyString_FromString(it.key().utf8()));
 		cc++;
 		}
 	return l;
@@ -22,15 +22,21 @@
 	CListe edc;
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
-	if (Name == "")
-		return Py_BuildValue("(iiii)", 0, 0, 0, 0);
+	if (strcmp(Name, "") == 0)
+	{
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot get a colour with an empty name.","python error"));
+		return NULL;
+	}
 	edc = Carrier->HaveDoc ? Carrier->doc->PageColors : Carrier->Prefs.DColors;
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (!edc.contains(col))
-		return Py_BuildValue("(iiii)", 0, 0, 0, 0);
-  edc[col].getCMYK(&c, &m, &y, &k);
+	{
+		PyErr_SetString(NotFoundError, QObject::tr("Colour not found","python error"));
+		return NULL;
+	}
+	edc[col].getCMYK(&c, &m, &y, &k);
 	return Py_BuildValue("(iiii)", static_cast<long>(c), static_cast<long>(m), static_cast<long>(y), static_cast<long>(k));
 }
 
@@ -38,19 +44,19 @@
 {
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
+	if (!PyArg_ParseTuple(args, "esiiii", "utf-8", &Name, &c, &m, &y, &k))
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot change a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot change a colour with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (Carrier->HaveDoc)
 	{
 		if (!Carrier->doc->PageColors.contains(col))
 		{
-			PyErr_SetString(ScribusException, QString("Colour does not exist in document"));
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in document","python error"));
 			return NULL;
 		}
 		Carrier->doc->PageColors[col].setColor(c, m, y, k);
@@ -59,7 +65,7 @@
 	{
 		if (!Carrier->Prefs.DColors.contains(col))
 		{
-			PyErr_SetString(ScribusException, QString("Colour does not exist in preferences"));
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in default colors","python error"));
 			return NULL;
 		}
 		Carrier->Prefs.DColors[col].setColor(c, m, y, k);
@@ -72,14 +78,14 @@
 {
 	char *Name = "";
 	int c, m, y, k;
-	if (!PyArg_ParseTuple(args, "siiii", &Name, &c, &m, &y, &k))
+	if (!PyArg_ParseTuple(args, "esiiii", "utf-8", &Name, &c, &m, &y, &k))
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot create a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create a colour with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
+	QString col = QString::fromUtf8(Name);
 	if (Carrier->HaveDoc)
 		{
 			if (!Carrier->doc->PageColors.contains(col))
@@ -106,31 +112,37 @@
 {
 	char *Name = "";
 	char *Repl = "None";
-	if (!PyArg_ParseTuple(args, "s|s", &Name, &Repl))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Name, "utf-8", &Repl))
 		return NULL;
 	if (Name == "")
 	{
-		PyErr_SetString(ScribusException, QString("Cannot delete a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot delete a colour with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
-	QString rep = QString(Repl);
+	QString col = QString::fromUtf8(Name);
+	QString rep = QString::fromUtf8(Repl);
 	if (Carrier->HaveDoc)
 	{
-		// FIXME: should we raise an exception when the user tries to delete a colour that
-		// does not exist?
 		if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
 			{
 				Carrier->doc->PageColors.remove(col);
 				ReplaceColor(col, rep);
 			}
+		else
+		{
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in document","python error"));
+			return NULL;
+		}
 	}
 	else
 	{
-		// FIXME: should we raise an exception when the user tries to delete a colour that
-		// does not exist?
 		if (Carrier->Prefs.DColors.contains(col))
 			Carrier->Prefs.DColors.remove(col);
+		else
+		{
+			PyErr_SetString(NotFoundError, QObject::tr("Colour not found in default colors","python error"));
+			return NULL;
+		}
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -138,24 +150,27 @@
 
 PyObject *scribus_replcolor(PyObject *self, PyObject* args)
 {
-	char *Name = "";
+	char *Name = NULL;
 	char *Repl = "None";
 	//FIXME: this should definitely use keyword arguments
-	if (!PyArg_ParseTuple(args, "s|s", &Name, &Repl))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Name, "utf-8", &Repl))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Cannot replace a colour with an empty name."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot replace a colour with an empty name.","python error"));
 		return NULL;
 	}
-	QString col = QString(Name);
-	QString rep = QString(Repl);
-	// FIXME: should we raise an error when the user tries to replace a colour and the colour
-	// they're trying to replace does not exist?
+	QString col = QString::fromUtf8(Name);
+	QString rep = QString::fromUtf8(Repl);
 	if (Carrier->doc->PageColors.contains(col) && (Carrier->doc->PageColors.contains(rep) || (rep == "None")))
 		ReplaceColor(col, rep);
+	else
+	{
+		PyErr_SetString(NotFoundError, QObject::tr("Colour not found","python error"));
+		return NULL;
+	}
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdcolor.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.h,v
retrieving revision 1.4.2.4
diff -u -r1.4.2.4 cmdcolor.h
--- cmdcolor.h	3 Dec 2004 15:05:48 -0000	1.4.2.4
+++ cmdcolor.h	14 Dec 2004 09:22:16 -0000
@@ -8,50 +8,81 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_colornames__doc__,
-    "getColorNames() -> list\n\n\
-Returns a list with the names of all defined colors.");
+QT_TR_NOOP("getColorNames() -> list\n\
+\n\
+Returns a list containing the names of all defined colors in the document.\n\
+If no document is open, returns a list of the default document colors.\n\
+"));
 /** Returns a list with colours available in doc or in prefs. */
 PyObject *scribus_colornames(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcolor__doc__,
-    "getColor(\"name\") -> tuple\n\n\
-Returns a tuple (C, M, Y, K) containing the four color components\
-of the color \"name\".");
+QT_TR_NOOP("getColor(\"name\") -> tuple\n\
+\n\
+Returns a tuple (C, M, Y, K) containing the four color components of the\n\
+color \"name\" from the current document. If no document is open, returns\n\
+the value of the named color from the default document colors.\n\
+\n\
+May raise NotFoundError if the named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Returns a CMYK tuple of the specified color. */
 PyObject *scribus_getcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcolor__doc__,
-    "changeColor(\"name\", c, m, y, k)\n\n\
-Changes the color \"name\", The color value is defined via four\
-components c = Cyan, m = Magenta, y = Yellow and k = Black.\
-Color compontens should be in the range from 0 to 255.");
+QT_TR_NOOP("changeColor(\"name\", c, m, y, k)\n\
+\n\
+Changes the color \"name\" to the specified CMYK value. The color value is\n\
+defined via four components c = Cyan, m = Magenta, y = Yellow and k = Black.\n\
+Color components should be in the range from 0 to 255.\n\
+\n\
+May raise NotFoundError if the named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Sets named color with C,M,Y,K params. */
 PyObject *scribus_setcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newcolor__doc__,
-    "newColor(\"name\", c, m, y, k)\n\n\
-Defines a new color \"name\". The color Value is defined via four\
-components c = Cyan, m = Magenta, y = Yello and k = Black.\
-color compontens should be in the range from 0 to 255.");
+QT_TR_NOOP("defineColor(\"name\", c, m, y, k)\n\
+\n\
+Defines a new color \"name\". The color Value is defined via four components:\n\
+c = Cyan, m = Magenta, y = Yello and k = Black. Color components should be in\n\
+the range from 0 to 255.\n\
+\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Creates new color with name, C, M, Y, K params. */
 PyObject *scribus_newcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_delcolor__doc__,
-    "deleteColor(\"name\", \"replace\")\n\n\
-Deletes the color \"name\". Every occurence of that color\
-is replaced by the color \"replace\".");
+QT_TR_NOOP("deleteColor(\"name\", \"replace\")\n\
+\n\
+Deletes the color \"name\". Every occurence of that color is replaced by the\n\
+color \"replace\". If not specified, \"replace\" defaults to the color\n\
+\"None\" - transparent.\n\
+\n\
+deleteColor works on the default document colors if there is no document open.\n\
+In that case, \"replace\", if specified, has no effect.\n\
+\n\
+May raise NotFoundError if a named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Deletes named color */
 PyObject *scribus_delcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_replcolor__doc__,
-    "replaceColor(\"name\", \"replace\")\n\n\
-Every occurence of that color \"name\" is replaced by the\
-color \"replace\".");
+QT_TR_NOOP("replaceColor(\"name\", \"replace\")\n\
+\n\
+Every occurence of the color \"name\" is replaced by the color \"replace\".\n\
+\n\
+May raise NotFoundError if a named color wasn't found.\n\
+May raise ValueError if an invalid color name is specified.\n\
+"));
 /** Replaces color with the 2nd one. */
 PyObject *scribus_replcolor(PyObject *self, PyObject* args);
 
Index: cmddialog.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp,v
retrieving revision 1.12.2.9
diff -u -r1.12.2.9 cmddialog.cpp
--- cmddialog.cpp	3 Dec 2004 15:05:48 -0000	1.12.2.9
+++ cmddialog.cpp	14 Dec 2004 09:22:16 -0000
@@ -14,32 +14,33 @@
 	return PyInt_FromLong(static_cast<long>(ret));
 }
 
-PyObject *scribus_filedia(PyObject *self, PyObject* args)
+PyObject *scribus_filedia(PyObject *self, PyObject* args, PyObject* kw)
 {
-	char *caption;
-	char *filter;
-	char *defName;
-	QString fName;
-	int pre = 0;
-	int mode = 0;
-	if (!PyArg_ParseTuple(args, "sss|ii", &caption, &filter, &defName, &pre, &mode))
+	char *caption = NULL;
+	char *filter = "";
+	char *defName = "";
+	int haspreview = 0;
+	int issave = 0;
+	char* kwargs[] = {"caption", "filter", "defaultname", "haspreview", "issave", NULL};
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssii", kwargs, &caption, &filter, &defName, &haspreview, &issave))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(pre), static_cast<bool>(mode), 0, 0);
+	QString fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(haspreview), static_cast<bool>(issave), 0, 0);
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyString_FromString(fName.utf8());
 }
 
-PyObject *scribus_messdia(PyObject *self, PyObject* args)
+PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw)
 {
 	char *caption = "";
 	char *message = "";
 	uint result;
 	QMessageBox::Icon ico = QMessageBox::NoIcon;
-	int butt1 = QMessageBox::NoButton;
+	int butt1 = QMessageBox::Ok|QMessageBox::Default;
 	int butt2 = QMessageBox::NoButton;
 	int butt3 = QMessageBox::NoButton;
-	if (!PyArg_ParseTuple(args, "ssii|ii", &caption, &message, &ico, &butt1, &butt2, &butt3))
+	char* kwargs[] = {"caption", "message", "icon", "button1", "button2", "button3", NULL};
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "ss|iiii", kwargs, &caption, &message, &ico, &butt1, &butt2, &butt3))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
 	QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
Index: cmddialog.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.h,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 cmddialog.h
--- cmddialog.h	3 Dec 2004 15:05:48 -0000	1.5.2.5
+++ cmddialog.h	14 Dec 2004 09:22:16 -0000
@@ -8,55 +8,91 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newdocdia__doc__,
-    "newDocDialog() -> bool\n\n\
-Shows the \"New Document\" dialog box. Returns true if\
-a new document was created.");
+QT_TR_NOOP("newDocDialog() -> bool\n\
+\n\
+Displays the \"New Document\" dialog box. Creates a new document if the user\n\
+accepts the settings. Does not create a document if the user presses cancel.\n\
+Returns true if a new document was created.\n\
+"));
 /** Raises the Scribus New Document dialog */
 PyObject *scribus_newdocdia(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_filedia__doc__,
-    "fileDialog(\"caption\", \"filter\", \"defaultName\" [,preview, mode]) -> string with filename\n\n\
-Shows a FileSelect box with the caption \"caption\". Files are\
-filtered with the filter string \"filter\", refer to the\
-Qt-Documentation for it's use. A default filename can also\
-supplied, leave this string empty when you don't want to use it.\
-A Value of 1 for preview enables a small preview widget in the\
-FileSelect box. When the mode parameter is set to 1 the dialog\
-acts like a \"Save As\" dialog otherwise it acts like\
-a \"File Open Dialog\". The default for both of the opional\
-Parameters is 0.");
+QT_TR_NOOP("fileDialog(\"caption\", [\"filter\", \"defaultname\" ,haspreview, issave]) -> string with filename\n\
+\n\
+Shows a File Open dialog box with the caption \"caption\". Files are filtered\n\
+with the filter string \"filter\". A default filename or file path can also\n\
+supplied, leave this string empty when you don't want to use it.  A value of\n\
+True for haspreview enables a small preview widget in the FileSelect box.  When\n\
+the issave parameter is set to True the dialog acts like a \"Save As\" dialog\n\
+otherwise it acts like a \"File Open Dialog\". The default for both of the\n\
+opional parameters is False.\n\
+\n\
+The filter, if specified, takes the form 'comment (*.type *.type2 ...)'.\n\
+For example 'Images (*.png *.xpm *.jpg)'.\n\
+\n\
+Refer to the Qt-Documentation for QFileDialog for details on filters.\n\
+\n\
+Example: fileDialog('Open input', 'CSV files (*.csv)')\n\
+Example: fileDialog('Save report', defaultname='report.txt', issave=True)\n\
+"));
 /** Raises file dialog.
  Params - caption, filter, default name and opt. pre, mode. */
-PyObject *scribus_filedia(PyObject *self, PyObject* args);
+PyObject *scribus_filedia(PyObject *self, PyObject* args, PyObject* kw);
 /* diplicity Sends a string into the Message Bar
 PyObject *scribus_mess(PyObject *self, PyObject* args);
 */
 
 /*! docstring */
 PyDoc_STRVAR(scribus_messdia__doc__,
-    "messageBox(\"caption\", \"message\", icon, Button1 [, Button2, Button3]) -> integer (see constants below)\n\n\
-Shows a message box with the title \"caption\", the message \"message\",\
-and an icon \"icon\" and up to 3 Buttons. Button1 is always needed. For\
-the icon and the button parameters there are predefined constants\
-available with the same names as in the Qt Documentation. Returns\
-the number of the selected button. Buttons and returning values:\
-BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO, BUTTON_NONE,\
-BUTTON_OK, BUTTON_RETRY, BUTTON_YES");
+QT_TR_NOOP("messageBox(\"caption\", \"message\",\n\
+    icon=ICON_NONE, button1=BUTTON_OK|BUTTONOPT_DEFAULT,\n\
+    button2=BUTTON_NONE, button3=BUTTON_NONE) -> integer\n\
+\n\
+Displays a message box with the title \"caption\", the message \"message\", and\n\
+an icon \"icon\" and up to 3 buttons. By default no icon is used and a single\n\
+button, OK, is displayed. Only the caption and message arguments are required,\n\
+though setting an icon and appropriate button(s) is strongly\n\
+recommended. The message text may contain simple HTML-like markup.\n\
+\n\
+Returns the number of the button the user pressed. Button numbers start\n\
+at 1.\n\
+\n\
+For the icon and the button parameters there are predefined constants available\n\
+with the same names as in the Qt Documentation. These are the BUTTON_* and\n\
+ICON_* constants defined in the module. There are also two extra constants that\n\
+can be binary-ORed with button constants:\n\
+    BUTTONOPT_DEFAULT   Pressing enter presses this button.\n\
+    BUTTONOPT_ESCAPE    Pressing escape presses this button.\n\
+\n\
+Usage examples:\n\
+result = messageBox('Script failed',\n\
+                    'This script only works when you have a text frame selected.',\n\
+                    ICON_ERROR)\n\
+result = messageBox('Monkeys!', 'Something went ook! <i>Was it a monkey?</i>',\n\
+                    ICON_WARNING, BUTTON_YES|BUTTONOPT_DEFAULT,\n\
+                    BUTTON_NO, BUTTON_IGNORE|BUTTONOPT_ESCAPE)\n\
+\n\
+Defined button and icon constants:\n\
+BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO,\n\
+BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL,\n\
+ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.\n\
+"));
 /** Displays a message box with - caption, message, icon, button
  and two more buttons optional. */
-PyObject *scribus_messdia(PyObject *self, PyObject* args);
+PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_valdialog__doc__,
-    "valueDialog(caption, message [,defaultvalue]) -> string\n\n\
-Shows the common 'Ask for string' dialog and returns its value as string\
-Parameters: window title, text in the window and optional 'default' value.\
-Example: valueDialog('title', 'text in the window', 'optional'");
-/** Raises the common 'Ask for string' dialog and returns its value
-params: window title, text in the window and optional 'default value.
-ValueDialog('title', 'text in the window', 'optional')
-09/24/2004 petr vanek */
+QT_TR_NOOP("valueDialog(caption, message [,defaultvalue]) -> string\n\
+\n\
+Shows the common 'Ask for string' dialog and returns its value as a string\n\
+Parameters: window title, text in the window and optional 'default' value.\n\
+\n\
+Example: valueDialog('title', 'text in the window', 'optional')\n\
+"));
+/* 09/24/2004 petr vanek */
 PyObject *scribus_valdialog(PyObject *self, PyObject* args);
 
 #endif
Index: cmddoc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp,v
retrieving revision 1.9.2.9
diff -u -r1.9.2.9 cmddoc.cpp
--- cmddoc.cpp	3 Dec 2004 15:05:48 -0000	1.9.2.9
+++ cmddoc.cpp	14 Dec 2004 09:22:16 -0000
@@ -68,7 +68,13 @@
 	if (!PyArg_ParseTuple(args, "s", &Name))
 		return NULL;
 	bool ret = Carrier->LadeDoc(QString(Name));
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to open document","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True); // compatibility: return true, not none, on success
+	return Py_True;
 }
 
 PyObject *scribus_savedoc(PyObject *self)
@@ -76,7 +82,8 @@
 	if(!checkHaveDocument())
 		return NULL;
 	Carrier->slotFileSave();
-	return PyInt_FromLong(0L);
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 PyObject *scribus_savedocas(PyObject *self, PyObject* args)
@@ -87,7 +94,13 @@
 	if(!checkHaveDocument())
 		return NULL;
 	bool ret = Carrier->DoFileSave(QString(Name));
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to save document","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True); // compatibility: return true, not none, on success
+	return Py_True;
 }
 
 PyObject *scribus_setinfo(PyObject *self, PyObject* args)
@@ -116,7 +129,7 @@
 		return NULL;
 	if ((e < 0) || (e > 3))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Unit out of range. Use one of the scribus.UNIT_* constants."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Unit out of range. Use one of the scribus.UNIT_* constants.","python error"));
 		return NULL;
 	}
 	Carrier->slotChangeUnit(e);
Index: cmddoc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.h,v
retrieving revision 1.4.2.5
diff -u -r1.4.2.5 cmddoc.h
--- cmddoc.h	3 Dec 2004 15:05:48 -0000	1.4.2.5
+++ cmddoc.h	14 Dec 2004 09:22:16 -0000
@@ -8,105 +8,161 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newdoc__doc__,
-    "newDoc(size, margins, orientation, firstPageNumber, unit, facingPages, firstSideLeft) -> bool\n\n\
-Creates a new document and returns true if successful. The parameters have the following meaning:\n\
-size = A Tuple (width, height) describing the Size of the Document.\
-You can use predefined cosntants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\
-margins = A Tuple (Left, Right, Top, Bottom) describing the Margins of the Document.\n\
-orientation = the Page Orientation - constants PORTRAIT, LANDSCAPE\n\
-firstPageNumer = is the number of the first page in the document used for pagenumbering\n\
-unit: this Value sets the Measurement Unit of the Document\
-UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS\n\
-facingPages = FACINGPAGES, NOFACINGPAGES\n\
-firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\
-The values for Width, Height and the Margins are expressed in the given unit for the document.\n\n\
-example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_PICAS, FACINGPAGES, FIRSTPAGERIGHT)");
+QT_TR_NOOP("newDoc(size, margins, orientation, firstPageNumber,\n\
+                   unit, facingPages, firstSideLeft) -> bool\n\
+\n\
+Creates a new document and returns true if successful. The parameters have the\n\
+following meaning:\n\
+\n\
+    size = A tuple (width, height) describing the size of the document. You can\n\
+    use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\
+\n\
+    margins = A tuple (left, right, top, bottom) describing the document\n\
+    margins\n\
+\n\
+    orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\
+\n\
+    firstPageNumer = is the number of the first page in the document used for\n\
+    pagenumbering. While you'll usually want 1, it's useful to have higher\n\
+    numbers if you're creating a document in several parts.\n\
+\n\
+    unit: this value sets the measurement units used by the document. Use a\n\
+    predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\
+    UNIT_PICAS, UNIT_POINTS.\n\
+\n\
+    facingPages = FACINGPAGES, NOFACINGPAGES\n\
+\n\
+    firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\
+\n\
+The values for width, height and the margins are expressed in the given unit\n\
+for the document. PAPER_* constants are expressed in points. If your document\n\
+is not in points, make sure to account for this.\n\
+\n\
+example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS,\n\
+                FACINGPAGES, FIRSTPAGERIGHT)\n\
+"));
 /** Creates a new document e.g. (Paper_A4, Margins, 1, 1, 1, NoFacingPages, FirstPageLeft)
  first 2 args are lists (tuples) */
 PyObject *scribus_newdoc(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_closedoc__doc__,
-    "closeDoc() -> bool\n\n\
-Closes the current Document. Returns true if successful.");
+QT_TR_NOOP("closeDoc()\n\
+\n\
+Closes the current document without prompting to save.\n\
+\n\
+May throw NoDocOpenError if there is no document to close\n\
+"));
 /** Closes active doc. No params */
 PyObject *scribus_closedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_havedoc__doc__,
-    "haveDoc() -> bool\n\n\
-Returns true if there is a document open.");
+QT_TR_NOOP("haveDoc() -> bool\n\
+\n\
+Returns true if there is a document open.\n\
+"));
 /** Checks if is a document opened. */
 PyObject *scribus_havedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_opendoc__doc__,
-    "openDoc(\"name\") -> bool\n\n\
-Opens the document \"name\". Returns true if successful.");
+QT_TR_NOOP("openDoc(\"name\")\n\
+\n\
+Opens the document \"name\".\n\
+\n\
+May raise ScribusError if the document could not be opened.\n\
+"));
 /** Opens a document with given name. */
 PyObject *scribus_opendoc(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savedoc__doc__,
-    "saveDoc() -> bool\n\n\
-Saves the document with its actual name, returns true if successful.");
+QT_TR_NOOP("saveDoc()\n\
+\n\
+Saves the current document with its current name, returns true if successful.\n\
+If the document has not already been saved, this may bring up an interactive\n\
+save file dialog.\n\
+\n\
+If the save fails, there is currently no way to tell.\n\
+"));
 PyObject *scribus_savedoc(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savedocas__doc__,
-    "saveDocAs(\"name\") -> bool\n\n\
-    Saves the actual Document under the new Name \"name\". Returns true if successful.");
+QT_TR_NOOP("saveDocAs(\"name\")\n\
+\n\
+Saves the current document under the new name \"name\" (which may be a full or\n\
+relative path).\n\
+\n\
+May raise ScribusError if the save fails.\n\
+"));
 /** Saves active document with given name */
 PyObject *scribus_savedocas(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setinfo__doc__,
-    "saveDocAs(\"author\", \"info\", \"description\") -> bool\n\n\
-Sets the document information. \"Author\", \"Info\", \"Description\" are strings.\
-Returns true if successful.");
+QT_TR_NOOP("saveDocAs(\"author\", \"info\", \"description\") -> bool\n\
+\n\
+Sets the document information. \"Author\", \"Info\", \"Description\" are\n\
+strings.\n\
+"));
 /** Sets document infos - author, title and description */
 PyObject *scribus_setinfo(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setmargins__doc__,
-    "setMargins(lr, rr, tr, br)\n\n\
-Sets the print margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\
-Margins are given in the measurement unit of the document - see UNIT_<type> constants.");
+QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\
+\n\
+Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\
+margins are given in the measurement units of the document - see UNIT_<type>\n\
+constants.\n\
+"));
 /** Sets document margins - left, right, top and bottom. */
 PyObject *scribus_setmargins(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setunit__doc__,
-    "setUnit(type)\n\n\
-Changes the Measurement Unit of the Document. Possible Values for Unit are\
-defined as constants UNIT_<type>.");
+QT_TR_NOOP("setUnit(type)\n\
+\n\
+Changes the measurement unit of the document. Possible values for \"unit\" are\n\
+defined as constants UNIT_<type>.\n\
+\n\
+May raise ValueError if an invalid unit is passed.\n\
+"));
 /** Changes unit scale. */
 PyObject *scribus_setunit(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getunit__doc__,
-    "getUnit() -> integer (Scribus typo unit)\n\n\
-Returns the Measurement Unit of the Document.\
-Possible Values for Unit are defined as constants.\
-Constants are:\n\
-UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.");
+QT_TR_NOOP("getUnit() -> integer (Scribus unit constant)\n\
+\n\
+Returns the measurement units of the document. The returned value will be one\n\
+of the UNIT_* constants:\n\
+UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.\n\
+"));
 /** Returns actual unit scale. */
 PyObject *scribus_getunit(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_loadstylesfromfile__doc__,
-    "loadStylesFromFile(\"filename\")\n\n\
-Loads styles specified in the \"filename\" document into actual one.");
+QT_TR_NOOP("loadStylesFromFile(\"filename\")\n\
+\n\
+Loads paragraph styles from the Scribus document at \"filename\" into the\n\
+current document.\n\
+"));
 /** Loads styles from another .sla file (craig r.)*/
 PyObject *scribus_loadstylesfromfile(PyObject *self, PyObject *args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setdoctype__doc__,
-	"setDocType(facingPages, firstPageLeft)\n\n\
-Sets the type of the documents, to get facing pages set the first parameter\
-to FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead.\
-If you want to be the first page a left side set the second parameter\
-to FIRSTPAGELEFT, for a right rage use FIRSTPAGERIGHT.");
+QT_TR_NOOP("setDocType(facingPages, firstPageLeft)\n\
+\n\
+Sets the document type. To get facing pages set the first parameter to\n\
+FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead.  If you want\n\
+to be the first page a left side set the second parameter to FIRSTPAGELEFT, for\n\
+a right page use FIRSTPAGERIGHT.\n\
+"));
 /*! TODO: comment */
 PyObject *scribus_setdoctype(PyObject *self, PyObject* args);
 
Index: cmdgetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp,v
retrieving revision 1.8.2.8
diff -u -r1.8.2.8 cmdgetprop.cpp
--- cmdgetprop.cpp	3 Dec 2004 15:05:48 -0000	1.8.2.8
+++ cmdgetprop.cpp	14 Dec 2004 09:22:16 -0000
@@ -23,7 +23,7 @@
 	it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->HasSel) && ((it->PType == 4) || (it->PType == 8)))
+	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
@@ -58,7 +58,7 @@
 	it = GetUniqueItem(QString(Name));
 	if (it == NULL)
 		return NULL;
-	if ((it->HasSel) && ((it->PType == 4) || (it->PType == 8)))
+	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
 	{
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
Index: cmdgetprop.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 cmdgetprop.h
--- cmdgetprop.h	3 Dec 2004 15:05:48 -0000	1.2.2.3
+++ cmdgetprop.h	14 Dec 2004 09:22:17 -0000
@@ -8,128 +8,159 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfillcolor__doc__,
-    "getFillColor([\"name\"]) -> string\n\n\
-Returns the name of the fill color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFillColor([\"name\"]) -> string\n\
+\n\
+Returns the name of the fill color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns fill color of the object */
 PyObject *scribus_getfillcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinecolor__doc__,
-    "getLineColor([\"name\"]) -> string\n\n\
-Returns the name of the line color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getLineColor([\"name\"]) -> string\n\
+\n\
+Returns the name of the line color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns color of the line */
 PyObject *scribus_getlinecolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinewidth__doc__,
-    "getLineWidth([\"name\"]) -> integer\n\n\
-Returns the line width of the object \"name\". If \"name\"\
-is not given the currently selected Item is used.");
+QT_TR_NOOP("getLineWidth([\"name\"]) -> integer\n\
+\n\
+Returns the line width of the object \"name\". If \"name\"\n\
+is not given the currently selected Item is used.\n\
+"));
 /*! Returns width of the line */
 PyObject *scribus_getlinewidth(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlineshade__doc__,
-    "getLineShade([\"name\"]) -> integer\n\n\
-Returns the shading value of the line color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getLineShade([\"name\"]) -> integer\n\
+\n\
+Returns the shading value of the line color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns shading of the line */
 PyObject *scribus_getlineshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinejoin__doc__,
-    "getLineJoin([\"name\"]) -> integer (see contants)\n\n\
-Returns the line join style of the object \"name\". If \"name\"\
-is not given the currently selected item is used.\
-The join types are: JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND");
+QT_TR_NOOP("getLineJoin([\"name\"]) -> integer (see contants)\n\
+\n\
+Returns the line join style of the object \"name\". If \"name\" is not given\n\
+the currently selected item is used.  The join types are:\n\
+JOIN_BEVEL, JOIN_MITTER, JOIN_ROUND\n\
+"));
 /*! Returns join type of the line */
 PyObject *scribus_getlinejoin(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlineend__doc__,
-    "getLineEnd([\"name\"]) -> integer (see constants)\n\n\
-Returns the line cap style of the object \"name\". If \"name\"\
-is not given the currently selected item is used.\
-The cap types are: CAP_FLAT, CAP_ROUND, CAP_SQUARE");
+QT_TR_NOOP("getLineEnd([\"name\"]) -> integer (see constants)\n\
+\n\
+Returns the line cap style of the object \"name\". If \"name\" is not given the\n\
+currently selected item is used. The cap types are:\n\
+CAP_FLAT, CAP_ROUND, CAP_SQUARE\n\
+"));
 /*! Returns cap type of the line */
 PyObject *scribus_getlineend(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinestyle__doc__,
-    "getLineStyle([\"name\"]) -> integer (see constants)\n\n\
-Returns the line style of the object \"name\". If \"name\" is\
-not given the currently selected item is used.\
-Linestyles: LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID");
+QT_TR_NOOP("getLineStyle([\"name\"]) -> integer (see constants)\n\
+\n\
+Returns the line style of the object \"name\". If \"name\" is not given the\n\
+currently selected item is used. Line style constants are:\n\
+LINE_DASH, LINE_DASHDOT, LINE_DASHDOTDOT, LINE_DOT, LINE_SOLID\n\
+"));
 /*! Returns style type of the line */
 PyObject *scribus_getlinestyle(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getfillshade__doc__,
-    "getFillShade([\"name\"]) -> integer\n\n\
-Returns the shading value of the fill color of the object \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getFillShade([\"name\"]) -> integer\n\
+\n\
+Returns the shading value of the fill color of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns fill shade of the object */
 PyObject *scribus_getfillshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getcornerrad__doc__,
-    "getCornerRadius([\"name\"]) -> integer\n\n\
+QT_TR_NOOP("getCornerRadius([\"name\"]) -> integer\n\
+\n\
 Returns the corner radius of the object \"name\". The radius is\
 expressed in points. If \"name\" is not given the currently\
-selected Item is used.");
+selected item is used.\n\
+"));
 /*! Returns corner radius of the object */
 PyObject *scribus_getcornerrad(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getimgscale__doc__,
-    "getImageScale([\"name\"]) -> tuple\n\n\
-Returns a (x, y) tuple containing the scaling values of the image frame \"name\".\
-If \"name\" is not given the currently selected Item is used.");
+QT_TR_NOOP("getImageScale([\"name\"]) -> (x,y)\n\
+\n\
+Returns a (x, y) tuple containing the scaling values of the image frame\n\
+\"name\".  If \"name\" is not given the currently selected item is used.\n\
+"));
 /*! Returns image scale of the object */
 PyObject *scribus_getimgscale(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getimgname__doc__,
-    "getImageName([\"name\"]) -> string\n\n\
-Returns the filename for the image in the image frame.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getImageName([\"name\"]) -> string\n\
+\n\
+Returns the filename for the image in the image frame. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Returns image name of the object */
 PyObject *scribus_getimgname(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getposi__doc__,
-    "getPosition([\"name\"]) -> tuple\n\n\
-Returns a (x, y) tuple with the actual position of the object \"name\".\
+QT_TR_NOOP("getPosition([\"name\"]) -> (x,y)\n\
+\n\
+Returns a (x, y) tuple with the position of the object \"name\".\n\
 If \"name\" is not given the currently selected item is used.\
-The position is expressed in the actual measurement unit of the document\
-- see UNIT_<type> for reference.");
+The position is expressed in the actual measurement unit of the document\n\
+- see UNIT_<type> for reference.\n\
+"));
 /*! Returns position of the object */
 PyObject *scribus_getposi(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getsize__doc__,
-    "getSize([\"name\"]) -> tuple\n\n\
-Returns a (width, height) tuple with the actual size of the object \"name\".\
-If \"name\" is not given the currently selected item is used.\
-The size is expressed in the actual measurement unit of the document\
-- see UNIT_<type> for reference.");
+QT_TR_NOOP("getSize([\"name\"]) -> (width,height)\n\
+\n\
+Returns a (width, height) tuple with the size of the object \"name\".\n\
+If \"name\" is not given the currently selected item is used. The size is\n\
+expressed in the current measurement unit of the document - see UNIT_<type>\n\
+for reference.\n\
+"));
 /*! Returns size of the object */
 PyObject *scribus_getsize(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getrotation__doc__,
-    "getRotation([\"name\"]) -> integer\n\n\
-Returns the rotation of the object \"name\". The value is expressed\
-in degrees. If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("getRotation([\"name\"]) -> integer\n\
+\n\
+Returns the rotation of the object \"name\". The value is expressed in degrees,\n\
+and clockwise is positive. If \"name\" is not given the currently selected item\n\
+is used.\n\
+"));
 /*! Returns rotation of the object */
 PyObject *scribus_getrotation(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getallobj__doc__,
-    "getAllObjects() -> list\n\n\
-Returns a list containing the names of all objects on the actual page.");
+QT_TR_NOOP("getAllObjects() -> list\n\
+\n\
+Returns a list containing the names of all objects on the current page.\n\
+"));
 /*! Returns a list with all objects in page */
 PyObject *scribus_getallobj(PyObject *self, PyObject* args);
 
Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.7.2.9
diff -u -r1.7.2.9 cmdmani.cpp
--- cmdmani.cpp	3 Dec 2004 15:05:48 -0000	1.7.2.9
+++ cmdmani.cpp	14 Dec 2004 09:22:17 -0000
@@ -12,6 +12,11 @@
 	PageItem *item = GetUniqueItem(QString(Name));
 	if (item == NULL)
 		return NULL;
+	if (item->PType != FRAME_IMAGE)
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
+		return NULL;
+	}
 	Carrier->view->LoadPict(QString(Image), item->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -28,16 +33,13 @@
 	PageItem *item = GetUniqueItem(Name);
 	if (item == NULL)
 		return NULL;
-	if (item->PType == 2)
-	{
-		item->LocalScX = x;
-		item->LocalScY = y;
-	}
-	else
+	if (item->PType != FRAME_IMAGE)
 	{
-		PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame"));
+		PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error"));
 		return NULL;
 	}
+	item->LocalScX = x;
+	item->LocalScY = y;
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -198,7 +200,7 @@
 		return NULL;
 	if (sc == 0.0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't scale by 0%"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't scale by 0%","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
Index: cmdmani.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v
retrieving revision 1.3.2.4
diff -u -r1.3.2.4 cmdmani.h
--- cmdmani.h	3 Dec 2004 15:05:48 -0000	1.3.2.4
+++ cmdmani.h	14 Dec 2004 09:22:17 -0000
@@ -8,141 +8,177 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_moveobjrel__doc__,
-    "moveObject(dx, dy [, \"name\"])\n\n\
-Moves the object \"name\" by dx and dy relative to its origin.\
-The distances are expressed in the actual measurement unit of\
-the document (see UNIT constants). If \"name\" is not given\
-the currently selected item is used. If the object \"name\"\
-belongs to a group, the whole group is moved.");
+QT_TR_NOOP("moveObject(dx, dy [, \"name\"])\n\
+\n\
+Moves the object \"name\" by dx and dy relative to its current position. The\n\
+distances are expressed in the current measurement unit of the document (see\n\
+UNIT constants). If \"name\" is not given the currently selected item is used.\n\
+If the object \"name\" belongs to a group, the whole group is moved.\n\
+"));
 /*! Move REL the object */
 PyObject *scribus_moveobjrel(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_moveobjabs__doc__,
-    "moveObjectAbs(x, y [, \"name\"])\n\n\
-Moves the object \"name\" to a new location. The coordinates are\
-expressed in the actual measurement unit of the document (see UNIT constants).\
-If \"name\" is not given the currently selected item is used.\
-If the object \"name\" belongs to a group, the whole group is moved.");
+QT_TR_NOOP("moveObjectAbs(x, y [, \"name\"])\n\
+\n\
+Moves the object \"name\" to a new location. The coordinates are expressed in\n\
+the current measurement unit of the document (see UNIT constants).  If \"name\"\n\
+is not given the currently selected item is used.  If the object \"name\"\n\
+belongs to a group, the whole group is moved.\n\
+"));
 /*! Move ABS the object */
 PyObject *scribus_moveobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_rotobjrel__doc__,
-    "rotateObject(rot [, \"name\"])\n\n\
-Rotates the object \"name\" by \"rot\" degrees relatively. Positve values mean\
-counter clockwise rotation. If \"name\" is not given the currently\
-selected Item is used.");
+QT_TR_NOOP("rotateObject(rot [, \"name\"])\n\
+\n\
+Rotates the object \"name\" by \"rot\" degrees relatively. The object is\n\
+rotated by the vertex that is currently selected as the rotation point - by\n\
+default, the top left vertext at zero rotation. Positive values mean counter\n\
+clockwise rotation when the default rotation point is used. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
 /*! Rotate REL the object */
 PyObject *scribus_rotobjrel(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_rotobjabs__doc__,
-    "rotateObjectAbs(rot [, \"name\"])\n\n\
-Sets the rotation of the object \"name\" to \"rot\". Positve values\
-mean counter clockwise rotation. If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("rotateObjectAbs(rot [, \"name\"])\n\
+\n\
+Sets the rotation of the object \"name\" to \"rot\". Positve values\n\
+mean counter clockwise rotation. If \"name\" is not given the currently\n\
+selected item is used.\n\
+"));
 /*! Rotate ABS the object */
 PyObject *scribus_rotobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_sizeobjabs__doc__,
-    "sizeObject(width, height [, \"name\"])\n\n\
-Resizes the object \"name\" to the given width and height. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("sizeObject(width, height [, \"name\"])\n\
+\n\
+Resizes the object \"name\" to the given width and height. If \"name\"\n\
+is not given the currently selected item is used.\n\
+"));
 /*! Resize ABS the object */
 PyObject *scribus_sizeobjabs(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getselobjnam__doc__,
-    "getSelectedObject([nr]) -> string\n\n\
-Returns the name of the selected object. \"nr\" if given indicates\
-the number of the selected object, e.g. 0 means the first selected object,\
-1 means the second selected Object and so on.");
+QT_TR_NOOP("getSelectedObject([nr]) -> string\n\
+\n\
+Returns the name of the selected object. \"nr\" if given indicates the number\n\
+of the selected object, e.g. 0 means the first selected object, 1 means the\n\
+second selected Object and so on.\n\
+"));
 /*! Returns name of the selected object */
 PyObject *scribus_getselobjnam(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selcount__doc__,
-    "selectionCount() -> integer\n\n\
-Returns the number of selected objects.");
+QT_TR_NOOP("selectionCount() -> integer\n\
+\n\
+Returns the number of selected objects.\n\
+"));
 /*! Returns count of the selected object */
 PyObject *scribus_selcount(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_selectobj__doc__,
-    "selectObject(\"name\")\n\n\
-Selects the object with the given \"name\".");
+QT_TR_NOOP("selectObject(\"name\")\n\
+\n\
+Selects the object with the given \"name\".\n\
+"));
 /*! Count selection */
 PyObject *scribus_selectobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deselect__doc__,
-    "deselectAll()\n\n\
-Deselects all objects in the whole document.");
+QT_TR_NOOP("deselectAll()\n\
+\n\
+Deselects all objects in the whole document.\n\
+"));
 /*! Remove all selection */
 PyObject *scribus_deselect(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_groupobj__doc__,
-    "groupObjects(list)\n\n\
-Groups the objects named in \"list\" together. \"list\" must contain\
-the names of the objects to be grouped. If \"list\" is\
-not given the currently selected items are used.");
+QT_TR_NOOP("groupObjects(list)\n\
+\n\
+Groups the objects named in \"list\" together. \"list\" must contain the names\n\
+of the objects to be grouped. If \"list\" is not given the currently selected\n\
+items are used.\n\
+"));
 /*! Group objects named in list. */
 PyObject *scribus_groupobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_ungroupobj__doc__,
-    "unGroupObjects(\"name\")\n\n\
+QT_TR_NOOP("unGroupObjects(\"name\")\n\n\
 Destructs the group the object \"name\" belongs to.\
-If \"name\" is not given the currently selected item is used.");
+If \"name\" is not given the currently selected item is used."));
 /*! Ungroup objects named in list. */
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_scalegroup__doc__,
-    "scaleGroup(factor [,\"name\"])\n\n\
-Scales the group the object \"name\" belongs to. Values greater\
-than 1 enlarge the group, values smaller than 1 make the group\
-smaller e.g a value of 0.5 scales the group to 50 % of its original\
-size, a value of 1.5 scales the group to 150 % of its original size.\
-The value for \"factor\" must be greater than 0. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("scaleGroup(factor [,\"name\"])\n\
+\n\
+Scales the group the object \"name\" belongs to. Values greater than 1 enlarge\n\
+the group, values smaller than 1 make the group smaller e.g a value of 0.5\n\
+scales the group to 50 % of its original size, a value of 1.5 scales the group\n\
+to 150 % of its original size.  The value for \"factor\" must be greater than\n\
+0. If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise ValueError if an invalid scale factor is passed.\n\
+"));
 /*! Scale group with object name */
 PyObject *scribus_scalegroup(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_loadimage__doc__,
-    "loadImage(\"filename\" [, \"name\"])\n\n\
-Loads the picture \"picture\" into the image frame \"name\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("loadImage(\"filename\" [, \"name\"])\n\
+\n\
+Loads the picture \"picture\" into the image frame \"name\". If \"name\" is\n\
+not given the currently selected item is used.\n\
+\n\
+May raise WrongFrameTypeError if the target frame is not an image frame\n\
+"));
 /*! Loads image file into frame. */
 PyObject *scribus_loadimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_scaleimage__doc__,
-    "scaleImage(x, y [, \"name\"])\n\n\
-Sets the scaling factors of the picture in the image frame \"name\".\
-If \"name\" is not given the currently selected item is used.\
-A Number of 1 means 100 %.");
+QT_TR_NOOP("scaleImage(x, y [, \"name\"])\n\
+\n\
+Sets the scaling factors of the picture in the image frame \"name\".\n\
+If \"name\" is not given the currently selected item is used. A number of 1\n\
+means 100 %.\n\
+\n\
+May raise WrongFrameTypeError if the target frame is not an image frame\n\
+"));
 /*! Scale Image. */
 PyObject *scribus_scaleimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_lockobject__doc__,
-    "lockObject([\"name\"]) -> bool\n\n\
-Locks the object \"name\" if it's unlocked or unlock it if it's locked.\
-If \"name\" is not given the currently selected item is used.\
-Returns true if locked.");
+QT_TR_NOOP("lockObject([\"name\"]) -> bool\n\
+\n\
+Locks the object \"name\" if it's unlocked or unlock it if it's locked.\n\
+If \"name\" is not given the currently selected item is used. Returns true\n\
+if locked.\n\
+"));
 /*! (Un)Lock the object 2004/7/10 pv.*/
 PyObject *scribus_lockobject(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_islocked__doc__,
-    "isLocked([\"name\"]) -> bool\n\n\
-Returns true if is the object \"name\" locked.\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("isLocked([\"name\"]) -> bool\n\
+\n\
+Returns true if is the object \"name\" locked.  If \"name\" is not given the\n\
+currently selected item is used.\n\
+"));
 /*! Status of locking 2004/7/10 pv.*/
 PyObject *scribus_islocked(PyObject *self, PyObject* args);
 
Index: cmdmisc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp,v
retrieving revision 1.12.2.11
diff -u -r1.12.2.11 cmdmisc.cpp
--- cmdmisc.cpp	3 Dec 2004 15:05:48 -0000	1.12.2.11
+++ cmdmisc.cpp	14 Dec 2004 09:22:17 -0000
@@ -71,18 +71,18 @@
 		return NULL;
 	if (!Carrier->Prefs.AvailFonts.find(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("Font not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
 	QString ts = QString(Sample);
 	if (ts == "")
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't render an empty sample"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't render an empty sample","python error"));
 		return NULL;
 	}
 	if (QString(FileName) == "")
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't save to a blank filename"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't save to a blank filename","python error"));
 		return NULL;
 	}
 	QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
@@ -111,9 +111,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = -1;
@@ -131,7 +131,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -153,9 +153,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Layer == "")
+	if (strcmp(Layer, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -209,7 +209,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -224,9 +224,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	bool found = false;
@@ -241,7 +241,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -255,9 +255,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = 0;
@@ -273,7 +273,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	return PyInt_FromLong(static_cast<long>(i));
@@ -286,9 +286,9 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	int i = 0;
@@ -304,7 +304,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	return PyInt_FromLong(static_cast<long>(i));
@@ -317,14 +317,14 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, ""))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Can't have an empty layer name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
 	if (Carrier->doc->Layers.count() == 1)
 	{
-		PyErr_SetString(ScribusException, QString("Can't remove the last layer"));
+		PyErr_SetString(ScribusException, QObject::tr("Can't remove the last layer","python error"));
 		return NULL;
 	}
 	bool found = false;
@@ -358,7 +358,7 @@
 	}
 	if (!found)
 	{
-		PyErr_SetString(ScribusException, QString("Layer not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Layer not found","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
@@ -372,16 +372,16 @@
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (Name == "")
+	if (strcmp(Name, "") == 0)
 	{
-		PyErr_SetString(ScribusException, QString("Can't create layer without a name"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't create layer without a name","python error"));
 		return NULL;
 	}
 	QString tmp;
 	struct Layer ll;
 	ll.LNr = Carrier->doc->Layers.last().LNr + 1;
 	ll.Level = Carrier->doc->Layers.count();
-    // FIXME: what if the name exists?
+	// FIXME: what if the name exists?
 	ll.Name = QString(Name);
 	ll.Sichtbar = true;
 	ll.Drucken = true;
Index: cmdmisc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.h,v
retrieving revision 1.5.2.4
diff -u -r1.5.2.4 cmdmisc.h
--- cmdmisc.h	3 Dec 2004 15:05:48 -0000	1.5.2.4
+++ cmdmisc.h	14 Dec 2004 09:22:17 -0000
@@ -8,23 +8,31 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setredraw__doc__,
-    "setRedraw(bool)\n\n\
-Disables page redraw when bool = 0, otherwise redrawing is enabled.");
+QT_TR_NOOP("setRedraw(bool)\n\
+\n\
+Disables page redraw when bool = False, otherwise redrawing is enabled.\n\
+This change will persist even after the script exits, so make sure to call\n\
+setRedraw(True) in a finally: clause at the top level of your script.\n\
+"));
 /*! Enable/disable page redrawing. */
 PyObject *scribus_setredraw(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_fontnames__doc__,
-    "getFontNames() -> list\n\n\
-Returns a list with the names of all available fonts.");
+QT_TR_NOOP("getFontNames() -> list\n\
+\n\
+Returns a list with the names of all available fonts.\n\
+"));
 /*! simple list of font names. */
 PyObject *scribus_fontnames(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_xfontnames__doc__,
-    "getXFontNames() -> list of tuples\n\n\
-Returns a larger font info. It's a list of the tuples with: \
-[ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]");
+QT_TR_NOOP("getXFontNames() -> list of tuples\n\
+\n\
+Returns a larger font info. It's a list of the tuples with:\n\
+[ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]\n\
+"));
 /*!
  return a list of the tuples with
  Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file
@@ -33,97 +41,144 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_renderfont__doc__,
-    "rendeFont(\"name\", \"filename\", \"sample\", size) -> bool\n\n\
-Creates an image preview of font \"name\" with given text \"sample\"\
-and size. Image is saved into \"filename\". Returns true when success.");
+QT_TR_NOOP("rendeFont(\"name\", \"filename\", \"sample\", size) -> bool\n\
+\n\
+Creates an image preview of font \"name\" with given text \"sample\" and size.\n\
+Image is saved into \"filename\". Returns true when success.\n\
+\n\
+May raise NotFoundError if the specified font can't be found.\n\
+May raise ValueError if an empty sample or filename is passed.\n\
+"));
 /*! Font example to image. */
 PyObject *scribus_renderfont(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlayers__doc__,
-    "getLayers() -> list\n\n\
-Returns a list with the names of all defined layers.");
+QT_TR_NOOP("getLayers() -> list\n\
+\n\
+Returns a list with the names of all defined layers.\n\
+"));
 /*! List of the layers */
 PyObject *scribus_getlayers(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setactlayer__doc__,
-    "setActiveLayer(\"name\")\n\n\
-Sets the active layer to the layer named \"name\".");
+QT_TR_NOOP("setActiveLayer(\"name\")\n\
+\n\
+Sets the active layer to the layer named \"name\".\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Move into layer */
 PyObject *scribus_setactlayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getactlayer__doc__,
-    "getActiveLayer() -> string\n\n\
-Returns the name of the current active layer.");
+QT_TR_NOOP("getActiveLayer() -> string\n\
+\n\
+Returns the name of the current active layer.\n\
+"));
 /*! Get layer name */
 PyObject *scribus_getactlayer(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_senttolayer__doc__,
-    "sentToLayer(\"layer\" [, \"name\"])\n\n\
-Sends the object \"name\" to the layer \"layer\". The layer\
-must exist. If \"name\" is not given the currently selected\
-item is used.");
+QT_TR_NOOP("sentToLayer(\"layer\" [, \"name\"])\n\
+\n\
+Sends the object \"name\" to the layer \"layer\". The layer must exist.\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Move object from one layer to other one */
 PyObject *scribus_senttolayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_layervisible__doc__,
-    "setLayerVisible(\"layer\", visible)\n\n\
-Sets the layer \"layer\" to be visible or not. If is the\
-visible set to false the layer is invisible.");
+QT_TR_NOOP("setLayerVisible(\"layer\", visible)\n\
+\n\
+Sets the layer \"layer\" to be visible or not. If is the visible set to false\n\
+the layer is invisible.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer visible */
 PyObject *scribus_layervisible(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_layerprint__doc__,
-    "setLayerPrintable(\"layer\", printable)\n\n\
-Sets the layer \"layer\" to be printable or not. If is the\
-printable set to false the layer won't be printed.");
+QT_TR_NOOP("setLayerPrintable(\"layer\", printable)\n\
+\n\
+Sets the layer \"layer\" to be printable or not. If is the printable set to\n\
+false the layer won't be printed.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer printable */
 PyObject *scribus_layerprint(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_glayervisib__doc__,
-    "isLayerPrintable(\"layer\") -> bool\n\n\
-Returns wether the Layer \"layer\" is visible or not, a value\
-of true means that the layer \"layer\" is visible, a Value of false\
-means that the layer \"layer\" is invisible.");
+QT_TR_NOOP("isLayerPrintable(\"layer\") -> bool\n\
+\n\
+Returns wether the Layer \"layer\" is visible or not, a value of True means\n\
+that the layer \"layer\" is visible, a value of False means that the layer\n\
+\"layer\" is invisible.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer visible */
 PyObject *scribus_glayervisib(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_glayerprint__doc__,
-    "isLayerPrintable(\"layer\") -> bool\n\n\
-Returns wether the layer \"layer\" is printable or not,\
-a value of true means that the layer \"layer\" can be printed,\
-a value of false means that printing the layer \"layer\"\
-is disabled.");
+QT_TR_NOOP("isLayerPrintable(\"layer\") -> bool\n\
+\n\
+Returns wether the layer \"layer\" is printable or not, a value of True means\n\
+that the layer \"layer\" can be printed, a value of False means that printing\n\
+the layer \"layer\" is disabled.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Set layer printable */
 PyObject *scribus_glayerprint(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_removelayer__doc__,
-    "deleteLayer(\"layer\")\n\n\
-Deletes the layer with the name \"layer\". Nothing happens\
-if the layer doesn't exists or if it's the only layer in\
-the document.");
+QT_TR_NOOP("deleteLayer(\"layer\")\n\
+\n\
+Deletes the layer with the name \"layer\". Nothing happens if the layer doesn't\n\
+exists or if it's the only layer in the document.\n\
+\n\
+May raise NotFoundError if the layer can't be found.\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! Remove layer */
 PyObject *scribus_removelayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_createlayer__doc__,
-    "createLayer(layer)\n\n\
-Creates a new layer with the name \"name\".");
+QT_TR_NOOP("createLayer(layer)\n\
+\n\
+Creates a new layer with the name \"name\".\n\
+\n\
+May raise ValueError if the layer name isn't acceptable.\n\
+"));
 /*! New layer */
 PyObject *scribus_createlayer(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlanguage__doc__,
-    "getGuiLanguage() -> string\n\n\
-Returns a string with the -lang value.");
+QT_TR_NOOP("getGuiLanguage() -> string\n\
+\n\
+Returns a string with the -lang value.\n\
+"));
 /*! Language of the GUI */
 PyObject *scribus_getlanguage(PyObject *self);
 
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.11.2.11
diff -u -r1.11.2.11 cmdobj.cpp
--- cmdobj.cpp	9 Dec 2004 16:52:52 -0000	1.11.2.11
+++ cmdobj.cpp	14 Dec 2004 09:22:17 -0000
@@ -13,7 +13,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	int i = Carrier->view->PaintRect(ValueToPoint(x), ValueToPoint(y),
@@ -37,7 +37,7 @@
 	int i = Carrier->view->PaintEllipse(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h), Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetOvalFrame(Carrier->doc->Items.at(i));
@@ -58,7 +58,7 @@
 	int i = Carrier->view->PaintPict(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h));
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetRectFrame(Carrier->doc->Items.at(i));
@@ -79,7 +79,7 @@
 	int i = Carrier->view->PaintText(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h), Carrier->doc->Dwidth, Carrier->doc->DpenText);
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetRectFrame(Carrier->doc->Items.at(i));
@@ -102,7 +102,7 @@
 	b = ValueToPoint(b);
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	h = ValueToPoint(h);
@@ -143,17 +143,17 @@
 	int len = PyList_Size(il);
 	if (len < 4)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least two points (four values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least two points (four values)","python error"));
 		return NULL;
 	}
 	if ((len % 2) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain an even number of values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h;
@@ -217,17 +217,17 @@
 	int len = PyList_Size(il);
 	if (len < 6)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least three points (six values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least three points (six values)","python error"));
 		return NULL;
 	}
 	if ((len % 2) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain an even number of values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h;
@@ -293,17 +293,17 @@
 	int len = PyList_Size(il);
 	if (len < 8)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must contain at least four points (eight values)"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain at least four points (eight values)","python error"));
 		return NULL;
 	}
 	if ((len % 6) != 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Point list must have a multiple of six values"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must have a multiple of six values","python error"));
 		return NULL;
 	}
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	double x, y, b, h, kx, ky, kx2, ky2;
@@ -382,7 +382,7 @@
 		return NULL;
 	if (ItemExists(QString(Name)))
 	{
-		PyErr_SetString(ScribusException, QString("An object with the requested name already exists"));
+		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	//FIXME: Why use GetItem not GetUniqueItem? Maybe use GetUniqueItem and use the exceptions
@@ -391,7 +391,7 @@
 	int ii = GetItem(QString(PolyB));
 	if ((i == -1) || (ii == -1))
 	{
-		PyErr_SetString(ScribusException, QString("You're calling an object doesn't exist!"));
+		PyErr_SetString(NotFoundError, QObject::tr("Object not found","python error"));
 		return NULL;
 	}
 	Carrier->view->SelItem.clear();
@@ -479,7 +479,7 @@
 	PageItem *item = GetUniqueItem(QString(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType == 4)
+	if (item->PType == FRAME_TEXT)
 	{
 		/*
 		 * First, find the style number associated with the requested style
@@ -500,7 +500,7 @@
 		}
 		if (!found) {
 			// whoops, the user specified an invalid style, complain loudly.
-			PyErr_SetString(PyExc_Exception, QString("Style not found"));
+			PyErr_SetString(NotFoundError, QObject::tr("Style not found","python error"));
 			return NULL;
 		}
 		// quick hack to always apply on the right frame - pv
@@ -511,7 +511,7 @@
 	}
 	else
 	{
-		PyErr_SetString(ScribusException, QString("Can't set style on a non-text frame"));
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set style on a non-text frame","python error"));
 		return NULL;
 	}
 	Py_INCREF(Py_None);
Index: cmdobj.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.h,v
retrieving revision 1.6.2.5
diff -u -r1.6.2.5 cmdobj.h
--- cmdobj.h	9 Dec 2004 16:52:52 -0000	1.6.2.5
+++ cmdobj.h	14 Dec 2004 09:22:17 -0000
@@ -8,12 +8,16 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newrect__doc__,
-    "createRect(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new rectangle on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createRect(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new rectangle on the current page and returns its name. The\n\
+coordinates are given in the current measurement units of the document\n\
+(see UNIT constants). \"name\" should be a unique identifier for the object\n\
+because you need this name to reference that object in future. If \"name\"\n\
+is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a rectangular with params X, Y (base position)
  b, h (width, height) and optional name of the object.
  */
@@ -21,12 +25,16 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newellipse__doc__,
-    "createEllipse(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new ellipse on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createEllipse(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new ellipse on the current page and returns its name.\n\
+The coordinates are given in the current measurement units of the document\n\
+(see UNIT constants). \"name\" should be a unique identifier for the object\n\
+because you need this name for further referencing of that object. If \"name\"\n\
+is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates an ellipse with x, y, b and h - name optionally
  params.
  */
@@ -34,90 +42,121 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newimage__doc__,
-    "createImage(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new picture on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createImage(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new picture frame on the current page and returns its name. The\n\
+coordinates are given in the current measurement units of the document.\n\
+\"name\" should be a unique identifier for the object because you need this\n\
+name for further access to that object. If \"name\" is not given Scribus will\n\
+create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates an image frame - x, y, b, h and opt. name. */
 PyObject *scribus_newimage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newtext__doc__,
-    "createText(x, y, width, height, [\"name\"]) -> string\n\n\
-Creates a new textframe on the actual page and returns its name.\
-The coordinates are given in the actual measurement unit of the\
-document (see UNIT constants). \"name\" should be a unique identifier for the object\
-because you need this name for further referencing of that object.\
-If \"name\" is not given Scribus will create one for you.");
+QT_TR_NOOP("createText(x, y, width, height, [\"name\"]) -> string\n\
+\n\
+Creates a new text frame on the actual page and returns its name.\n\
+The coordinates are given in the actual measurement unit of the document (see\n\
+UNIT constants). \"name\" should be a unique identifier for the object because\n\
+you need this name for further referencing of that object. If \"name\" is not\n\
+given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a text frame - x, y, b, h and opt. name. */
 PyObject *scribus_newtext(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newline__doc__,
-    "createLine(x1, y1, x2, y2, [\"name\"]) -> string\n\n\
-Creates a new line from the point(x1, y1) to the point(x2, y2)\
-and returns its name. The coordinates are given in the actual\
-measurement unit of the document (see UNIT constants). \"name\" should be a unique\
-identifier for the object because you need this name for further\
-referencing of that object. If \"name\" is not given Scribus\
-will create one for you.");
+QT_TR_NOOP("createLine(x1, y1, x2, y2, [\"name\"]) -> string\n\
+\n\
+Creates a new line from the point(x1, y1) to the point(x2, y2) and returns\n\
+its name. The coordinates are given in the current measurement unit of the\n\
+document (see UNIT constants). \"name\" should be a unique identifier for the\n\
+object because you need this name for further access to that object. If\n\
+\"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+"));
 /** Creates a line object - x, y, b, h and opt. name. */
 PyObject *scribus_newline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_polyline__doc__,
-    "createPolyLine(list, [\"name\"]) -> string\n\n\
-Creates a new polyline and returns its name. The pPoints for the\
-polyline are stored in the list \"list\" in the following order:\
-[x1, y1, x2, y2...xn. yn]. The coordinates are given in the actual\
-measurement unit of the document (see UNIT constants). \"name\" should be a unique\
-identifier for the object because you need this name for further\
-referencing of that object. If \"name\" is not given Scribus will\
-create one for you.");
+QT_TR_NOOP("createPolyLine(list, [\"name\"]) -> string\n\
+\n\
+Creates a new polyline and returns its name. The points for the polyline are\n\
+stored in the list \"list\" in the following order: [x1, y1, x2, y2...xn. yn].\n\
+The coordinates are given in the current measurement units of the document (see\n\
+UNIT constants). \"name\" should be a unique identifier for the object because\n\
+you need this name for further access to that object. If \"name\" is not given\n\
+Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a polygon line - list with points and opt. name as params. */
 PyObject *scribus_polyline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_polygon__doc__,
-    "createPolygon(list, [\"name\"]) -> string\n\n\
-Creates a new polygon and returns its name. The points for the\
-polygon are stored in the list \"list\" in the following order:\
-[x1, y1, x2, y2...xn. yn]. At least three points are required. There\
-is no need to repeat the first point to close the polygon. The polygon\
-is automatically closed by connecting the first and the last point.\
-The coordinates are given in the actual measurement unit of the document (see UNIT constants).\
-\"name\" should be a unique identifier for the object because you need\
-this name for further referencing of that object. If \"name\" is not\
-given Scribus will create one for you.");
+QT_TR_NOOP("createPolygon(list, [\"name\"]) -> string\n\
+\n\
+Creates a new polygon and returns its name. The points for the polygon are\n\
+stored in the list \"list\" in the following order: [x1, y1, x2, y2...xn. yn].\n\
+At least three points are required. There is no need to repeat the first point\n\
+to close the polygon. The polygon is automatically closed by connecting the\n\
+first and the last point.  The coordinates are given in the current measurement\n\
+units of the document (see UNIT constants).  \"name\" should be a unique\n\
+identifier for the object because you need this name for further access to that\n\
+object. If \"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a polygon - list with points and opt. name as params. */
 PyObject *scribus_polygon(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_bezierline__doc__,
-    "createBezierLine(list, [\"name\"]) -> string\n\n\
-Creates a new bezier curve and returns its name. The points for\
-the bezier curve are stored in the list \"list\" in the following\
-order: [x1, y1, kx1, ky1, x2, y2, kx2, ky2...xn. yn, kxn. kyn].\
-Where x and y mean the x and y coordinates of the point and kx and\
-ky meaning the controlpoint for the curve. The coordinates are given\
-in the actual measurement unit of the document (see UNIT constants). \"name\" should be a\
-unique identifier for the object because you need this name for\
-further referencing of that object. If \"name\" is not given Scribus\
-will create one for you.");
+QT_TR_NOOP("createBezierLine(list, [\"name\"]) -> string\n\
+\n\
+Creates a new bezier curve and returns its name. The points for the bezier\n\
+curve are stored in the list \"list\" in the following order:\n\
+[x1, y1, kx1, ky1, x2, y2, kx2, ky2...xn. yn, kxn. kyn]\n\
+In the points list, x and y mean the x and y coordinates of the point and kx\n\
+and ky meaning the control point for the curve.  The coordinates are given in\n\
+the current measurement units of the document (see UNIT constants). \"name\"\n\
+should be a unique identifier for the object because you need this name for\n\
+further access to that object. If \"name\" is not given Scribus will create one\n\
+for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise ValueError if an insufficient number of points is passed or if\n\
+the number of values passed don't group into points without leftovers.\n\
+"));
 /** Creates a Bezier line - list with points and opt. name as params. */
 PyObject *scribus_bezierline(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pathtext__doc__,
-    "createPathText(x, y, \"textbox\", \"beziercurve\", [\"name\"]) -> string\n\n\
-Creates a new pathText by merging the 2 objects \"textbox\" and\
-\"beziercurve\" and returns its name. The coordinates are given\
-in the actual measurement unit of the document (see UNIT constants). \"name\" should\
-be a unique identifier for the object because you need this name\
-for further referencing of that object. If \"name\" is not given\
-Scribus will create one for you.");
+QT_TR_NOOP("createPathText(x, y, \"textbox\", \"beziercurve\", [\"name\"]) -> string\n\
+\n\
+Creates a new pathText by merging the two objects \"textbox\" and\n\
+\"beziercurve\" and returns its name. The coordinates are given in the current\n\
+measurement unit of the document (see UNIT constants). \"name\" should be a\n\
+unique identifier for the object because you need this name for further access\n\
+to that object. If \"name\" is not given Scribus will create one for you.\n\
+\n\
+May raise NameExistsError if you explicitly pass a name that's already used.\n\
+May raise NotFoundError if one or both of the named base object don't exist.\n\
+"));
 /** Joins 2 objects - textframe and line - into text on path.
  Uses x, y (base of the new object), name of the text frame,
  name of the line and opt. new name as params. */
@@ -125,19 +164,23 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deleteobj__doc__,
-    "deleteObject([\"name\"])\n\n\
-Deletes the item with the name \"name\". If \"name\" is not\
-given the currently selected item is deleted.");
+QT_TR_NOOP("deleteObject([\"name\"])\n\
+\n\
+Deletes the item with the name \"name\". If \"name\" is not given the currently\n\
+selected item is deleted.\n\
+"));
 /** Deletes an object - if is the name given the named object is
  deleted else the active object erased. */
 PyObject *scribus_deleteobj(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_textflow__doc__,
-    "textFlowsAroundFrame(\"name\" [, state])\n\n\
-Enables/disables \"Text Flows Around Frame\" feature for object \"name\".\
-Called with parameters string name and voluntary boolean state 1|0. When 1 set flowing\
-to true (0 to false). When is second param empty flowing is reverted.");
+QT_TR_NOOP("textFlowsAroundFrame(\"name\" [, state])\n\
+\n\
+Enables/disables \"Text Flows Around Frame\" feature for object \"name\".\n\
+Called with parameters string name and optional boolean \"state\". If \"state\"\n\
+is not passed, text flow is toggled.\n\
+"));
 /**
 Enables/disables "Text Flows Around Box" feature for object.
 Called with params string objectName and voluntary 1|0.
@@ -149,10 +192,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_objectexists__doc__,
-    "objectExists([\"name\"]) -> bool\n\n\
-User test if an object with specified name really exists in the document.\
-Optional parameter is the object name. When no param given returns\
-if there is something selected.");
+QT_TR_NOOP("objectExists([\"name\"]) -> bool\n\
+\n\
+Test if an object with specified name really exists in the document.\n\
+The optional parameter is the object name. When no object name is given,\n\
+returns True if there is something selected.\n\
+"));
 /**
 User test if an object with specified name really exists in
 the doc. Object name as param.
@@ -164,9 +209,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setstyle__doc__,
-    "setStyle(\"style\" [, \"name\"])\n\n\
-Apply the named \"style\" to the object named \"name\". If is no\
-name given, it's applied on the selected object.");
+QT_TR_NOOP("setStyle(\"style\" [, \"name\"])\n\
+\n\
+Apply the named \"style\" to the object named \"name\". If is no object name\n\
+given, it's applied on the selected object.\n\
+"));
 /**
  Craig Ringer, 2004-09-09
  Apply the named style to the currently selected object.
@@ -177,8 +224,10 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getstylenames__doc__,
-    "getAllStyles() -> list\n\n\
-Enumerate all known paragraph styles.");
+QT_TR_NOOP("getAllStyles() -> list\n\
+\n\
+Return a list of the names of all paragraph styles in the current document.\n\
+"));
 /**
  Craig Ringer, 2004-09-09
  Enumerate all known paragraph styles
Index: cmdpage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v
retrieving revision 1.11.2.10
diff -u -r1.11.2.10 cmdpage.cpp
--- cmdpage.cpp	3 Dec 2004 15:05:48 -0000	1.11.2.10
+++ cmdpage.cpp	14 Dec 2004 09:22:17 -0000
@@ -25,8 +25,13 @@
 	if(!checkHaveDocument())
 		return NULL;
 	bool ret = Carrier->DoSaveAsEps(QString(Name));
-	//FIXME: Should we really be returning a bool here? -- cr
-	return PyInt_FromLong(static_cast<long>(ret));
+	if (!ret)
+	{
+		PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS","python error"));
+		return NULL;
+	}
+	Py_INCREF(Py_True);	// return True not None for backward compat
+	return Py_True;
 }
 
 PyObject *scribus_deletepage(PyObject *self, PyObject* args)
@@ -39,7 +44,7 @@
 	e--;
 	if ((e < 0) || (e > static_cast<int>(Carrier->doc->Pages.count())-1))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 		return NULL;
 	}
 	Carrier->DeletePage2(e);
@@ -57,7 +62,7 @@
 	e--;
 	if ((e < 0) || (e > static_cast<int>(Carrier->doc->Pages.count())-1))
 	{
-		PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+		PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 		return NULL;
 	}
 	Carrier->view->GotoPage(e);
@@ -80,7 +85,7 @@
 		e--;
 		if ((e < 0) || (e > static_cast<int>(Carrier->doc->Pages.count())-1))
 		{
-			PyErr_SetString(PyExc_IndexError, QString("Page number out of range"));
+			PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 			return NULL;
 		}
 		Carrier->slotNewPageP(e, QString(name));
@@ -158,7 +163,7 @@
 		return NULL;
 	if (!PyList_Check(l))
 	{
-		PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
+		PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values","python error"));
 		return NULL;
 	}
 	int i, n;
@@ -169,7 +174,7 @@
 	{
 		if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
 		{
-			PyErr_SetString(PyExc_TypeError, QString("argument contains non-numeric values: must be list of float values"));
+			PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains non-numeric values: must be list of float values","python error"));
 			return NULL;
 		}
 		Carrier->doc->ActPage->YGuides += ValueToPoint(guide);
@@ -207,7 +212,7 @@
 		return NULL;
 	if (!PyList_Check(l))
 	{
-		PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
+		PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values","python error"));
 		return NULL;
 	}
 	int i, n;
@@ -218,7 +223,7 @@
 	{
 		if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
 		{
-			PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
+			PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains no-numeric values: must be list of float values","python error"));
 			return NULL;
 		}
 		Carrier->doc->ActPage->XGuides += ValueToPoint(guide);
Index: cmdpage.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.h,v
retrieving revision 1.6.2.5
diff -u -r1.6.2.5 cmdpage.h
--- cmdpage.h	3 Dec 2004 15:05:48 -0000	1.6.2.5
+++ cmdpage.h	14 Dec 2004 09:22:17 -0000
@@ -8,99 +8,132 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_newpage__doc__,
-    "newPage(where [,\"template\"])\n\n\
-Creates a new page. If \"where\" is -1 the new Page is appended\
-to the document, otherwise the new page is inserted at \"where\".\
-The pagenumbers are counted from 1 upwards. The optional parameter\
-\"template\" specifies the name of the template page for the new page.");
+QT_TR_NOOP("newPage(where [,\"template\"])\n\
+\n\
+Creates a new page. If \"where\" is -1 the new Page is appended to the\n\
+document, otherwise the new page is inserted before \"where\". Page numbers are\n\
+counted from 1 upwards, no matter what the displayed first page number of your\n\
+document is. The optional parameter \"template\" specifies the name of the\n\
+template page for the new page.\n\
+\n\
+May raise IndexError if the page number is out of range\n\
+"));
 /*! new page */
 PyObject *scribus_newpage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_actualpage__doc__,
-    "currentPage() -> integer\n\n\
-Returns the number of the current working page. Pagenumbers are\
-counted from 1 upwards.");
+QT_TR_NOOP("currentPage() -> integer\n\
+\n\
+Returns the number of the current working page. Page numbers are counted from 1\n\
+upwards, no matter what the displayed first page number of your document is.\n\
+"));
 /*! get actual page */
 PyObject *scribus_actualpage(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_redraw__doc__,
-    "redrawAll()\n\n\
-Redraws all Pages.");
+QT_TR_NOOP("redrawAll()\n\
+\n\
+Redraws all pages.\n\
+"));
 /*! redraw all */
 PyObject *scribus_redraw(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_savepageeps__doc__,
-    "savePageAsEPS(\"name\") -> bool\n\n\
-Saves the actual page as an EPS with name, returns true if successful.");
+QT_TR_NOOP("savePageAsEPS(\"name\")\n\
+\n\
+Saves the current page as an EPS to the file \"name\".\n\
+\n\
+May raise ScribusError if the save failed.\n\
+"));
 /*! Export page as EPS file */
 PyObject *scribus_savepageeps(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_deletepage__doc__,
-    "deletePage(nr)\n\n\
-Deletes the given Page, does nothing if the Document contains\
-only one Page. Pagenumbers are counted from 1 upwards.");
+QT_TR_NOOP("deletePage(nr)\n\
+\n\
+Deletes the given page. Does nothing if the document contains only one page.\n\
+Page numbers are counted from 1 upwards, no matter what the displayed first\n\
+page number is.\n\
+\n\
+May raise IndexError if the page number is out of range\n\
+"));
 /*! Delete page */
 PyObject *scribus_deletepage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gotopage__doc__,
-    "gotoPage(nr)\n\n\
-    Moves to the page \"nr\". If \"nr\" is outside the current\
-rage of pages \"Page number out of range\" exception raised.");
+QT_TR_NOOP("gotoPage(nr)\n\
+\n\
+Moves to the page \"nr\" (that is, makes the current page \"nr\"). Note that\n\
+gotoPage doesn't (curently) change the page the user's view is displaying, it\n\
+just sets the page that script commands will operates on.\n\
+\n\
+May raise IndexError if the page number is out of range.\n\
+"));
 /*! Go to page */
 PyObject *scribus_gotopage(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pagecount__doc__,
-    "pageCount() -> integer\n\n\
-Returns the Number of Pages in the Document.");
+QT_TR_NOOP("pageCount() -> integer\n\
+\n\
+Returns the number of pages in the document.\n\
+"));
 /*! Go to page */
 PyObject *scribus_pagecount(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getHguides__doc__,
-    "getHGuides() -> list\n\n\
-Returns the list containing positions of the horizontal guides.\
-Values are in specified typo unit - see UNIT_<type> constants.");
+QT_TR_NOOP("getHGuides() -> list\n\
+\n\
+Returns a list containing positions of the horizontal guides. Values are in the\n\
+document's current units - see UNIT_<type> constants.\n\
+"));
 /*! get H guides */
 PyObject *scribus_getHguides(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setHguides__doc__,
-    "setHGuides(list)\n\n\
-Sets horizontal guides. Input parameter must be a list with typo\
-units values - see UNIT_<type> constants.\n\
-E.g.: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost");
+QT_TR_NOOP("setHGuides(list)\n\
+\n\
+Sets horizontal guides. Input parameter must be a list of guide positions\n\
+measured in the current document units - see UNIT_<type> constants.\n\
+\n\
+Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost\n\
+         setHGuides([90,250]) # replace current guides entirely\n\
+"));
 /*! set H guides */
 PyObject *scribus_setHguides(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getVguides__doc__,
-    "getVGuides()\n\n\
-Returns the list containing positions of the vertical guides.\
-Values are in specified typo unit - see UNIT_<type> constants.");
+QT_TR_NOOP("getVGuides()\n\
+\n\
+See getHGuides.\n\
+"));
 /*! get V guides */
 PyObject *scribus_getVguides(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setVguides__doc__,
-    "setVGuides()\n\n\
-Sets vertical guides. Input parameter must be a list with typo\
-units values - see UNIT_<type> constants.\n\
-E.g.: setVGuides(getVGuides() + [200.0, 210.0] # add new guides without any lost");
+QT_TR_NOOP("setVGuides()\n\
+\n\
+See setHGuides.\n\
+"));
 /*! set V guides */
 PyObject *scribus_setVguides(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_pagedimension__doc__,
-    "getPageSize() -> tuple\n\n\
-Returns a tuple with page dimensions in used system e.g. when\
-the document's page is in picas - picas are returned. See UNIT_<type>\
-constants and getPageMargins()");
+QT_TR_NOOP("getPageSize() -> tuple\n\
+\n\
+Returns a tuple with page dimensions measured in the document's current units.\n\
+See UNIT_<type> constants and getPageMargins()\n\
+"));
 /**
 returns a tuple with page domensions in used system
 e.g. when is the doc in picas returns picas ;)
@@ -110,12 +143,13 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getpageitems__doc__,
-    "getPageItems() -> list\n\n\
-Returns a list of tuples with items on the actual page.\
-(name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\
-means that object named 'Text1' is a text frame (type 4)\
-and is the first at the page...\
-TODO: implement constants for types for item type etc.");
+QT_TR_NOOP("getPageItems() -> list\n\
+\n\
+Returns a list of tuples with items on the current page. The tuple is:\n\
+(name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\n\
+means that object named 'Text1' is a text frame (type 4) and is the first at\n\
+the page...\n\
+"));
 /**
 returns a list of tuples with items on the actual page
 TODO: solve utf/iso chars in object names
@@ -125,10 +159,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getpagemargins__doc__,
-    "getPageMargins()\n\n\
-Returns a tuple with page margins in used system e.g. when\
-the document's page is in picas - picas are returned. See UNIT_<type>\
-constants and getPageSize().");
+QT_TR_NOOP("getPageMargins()\n\
+\n\
+Returns the page margins as a (left, right, top, bottom) tuple in the current\n\
+units. See UNIT_<type> constants and getPageSize().\n\
+"));
 /**
 returns a tuple with page margins
 Craig Ringer, Petr Vanek 09/25/2004
Index: cmdsetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp,v
retrieving revision 1.8.2.8
diff -u -r1.8.2.8 cmdsetprop.cpp
--- cmdsetprop.cpp	3 Dec 2004 15:05:48 -0000	1.8.2.8
+++ cmdsetprop.cpp	14 Dec 2004 09:22:17 -0000
@@ -71,7 +71,7 @@
 		return NULL;
 	if ((w < 0.0) || (w > 12.0))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line width out of bounds, must be 0 <= line_width <= 12"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line width out of bounds, must be 0 <= line_width <= 12","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -92,7 +92,7 @@
 		return NULL;
 	if ((w < 0) || (w > 100))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Line shade out of bounds, must be 0 <= shade <= 100"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Line shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
 	PageItem *it = GetUniqueItem(QString(Name));
@@ -113,7 +113,7 @@
 		return NULL;
 	if ((w < 0) || (w > 100))
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Fill shade out of bounds, must be 0 <= shade <= 100"));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Fill shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
 	PageItem *i = GetUniqueItem(QString(Name));
@@ -182,13 +182,14 @@
 		return NULL;
 	if (w < 0)
 	{
-		PyErr_SetString(PyExc_ValueError, QString("Corner radius must be a positive number."));
+		PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error"));
 		return NULL;
 	}
 	PageItem *b = GetUniqueItem(QString(Name));
 	if (b == NULL)
 		return NULL;
-	if ((b->PType == 2) || (b->PType == 3) || (b->PType == 4))
+	// What the heck is a type 3 frame?
+	if ((b->PType == FRAME_IMAGE) || (b->PType == 3) || (b->PType == FRAME_TEXT))
 	{
 		if ((b->PType == 2) || (b->PType == 3) || (b->PType == 4))
 		{
@@ -208,20 +209,20 @@
 PyObject *scribus_setmultiline(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	char *Style = NULL;
+	if (!PyArg_ParseTuple(args, "s|s", &Style, &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	PageItem *b = GetUniqueItem(QString(Name));
 	if (b == NULL)
 		return NULL;
-	if (!Carrier->doc->MLineStyles.contains(QString(Color)))
+	if (!Carrier->doc->MLineStyles.contains(QString(Style)))
 	{
-		PyErr_SetString(ScribusException, QString("Color not found"));
+		PyErr_SetString(NotFoundError, QObject::tr("Line style not found","python error"));
 		return NULL;
 	}
-	b->NamedLStyle = QString(Color);
+	b->NamedLStyle = QString(Style);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdsetprop.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 cmdsetprop.h
--- cmdsetprop.h	3 Dec 2004 15:05:48 -0000	1.2.2.3
+++ cmdsetprop.h	14 Dec 2004 09:22:17 -0000
@@ -8,99 +8,131 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setgradfill__doc__,
-    "setGradientFill(type, \"color1\", shade1, \"color2\", shade2, [\"name\"])\n\n\
-Sets the gradient fill of the object \"name\" to type.\
-Color descriptions are the same as for setFillColor()\
-and setFillShade(). See the constants for available types (FILL_<type>).");
+QT_TR_NOOP("setGradientFill(type, \"color1\", shade1, \"color2\", shade2, [\"name\"])\n\
+\n\
+Sets the gradient fill of the object \"name\" to type. Color descriptions are\n\
+the same as for setFillColor() and setFillShade(). See the constants for\n\
+available types (FILL_<type>).\n\
+"));
 /*! Set gradient */
 PyObject *scribus_setgradfill(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfillcolor__doc__,
-    "setFillColor(\"color\", [\"name\"])\n\n\
-Sets the fill color of the object \"name\" to the color \"color\".\
-\"color\" is the name of one of the defined colors. If \"name\"\
-is not given the currently selected item is used.");
+QT_TR_NOOP("setFillColor(\"color\", [\"name\"])\n\
+\n\
+Sets the fill color of the object \"name\" to the color \"color\". \"color\"\n\
+is the name of one of the defined colors. If \"name\" is not given the\n\
+currently selected item is used.\n\
+"));
 /*! Set fill color */
 PyObject *scribus_setfillcolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinecolor__doc__,
-    "setLineColor(\"color\", [\"name\"])\n\n\
-Sets the line color of the object \"name\" to the color \"color\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setLineColor(\"color\", [\"name\"])\n\
+\n\
+Sets the line color of the object \"name\" to the color \"color\". If \"name\"\n\
+is not given the currently selected item is used.\n\
+"));
 /*! Set line color */
 PyObject *scribus_setlinecolor(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinewidth__doc__,
-    "setLineWidth(width, [\"name\"])\n\n\
-Sets line width of the object \"name\" to \"width\". \"width\" must\
-be in the range from 0.0 to 12.0 inclusive. If \"name\" is not given\
-the currently selected item is used.");
+QT_TR_NOOP("setLineWidth(width, [\"name\"])\n\
+\n\
+Sets line width of the object \"name\" to \"width\". \"width\" must be in the\n\
+range from 0.0 to 12.0 inclusive, and is measured in points. If \"name\" is not\n\
+given the currently selected item is used.\n\
+\n\
+May raise ValueError if the line width is out of bounds.\n\
+"));
 /*! Set line width */
 PyObject *scribus_setlinewidth(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlineshade__doc__,
-    "setLineShade(shade, [\"name\"])\n\n\
-Sets the shading of the line color of the object \"name\" to \"shade\".\
-\"shade\" must be an integer value in the range from 0 (lightest) to\
-100 (full color intensity). If \"name\" is not given the currently\
-selected item is used.");
+QT_TR_NOOP("setLineShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the line color of the object \"name\" to \"shade\".\n\
+\"shade\" must be an integer value in the range from 0 (lightest) to 100\n\
+(full color intensity). If \"name\" is not given the currently selected item\n\
+is used.\n\
+\n\
+May raise ValueError if the line shade is out of bounds.\n\
+"));
 /*! Set line shade */
 PyObject *scribus_setlineshade(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinejoin__doc__,
-    "setLineJoin(join, [\"name\"])\n\n\
-Sets the line join style of the object \"name\" to the style \"join\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for join - JOIN_<type>.");
+QT_TR_NOOP("setLineJoin(join, [\"name\"])\n\
+\n\
+Sets the line join style of the object \"name\" to the style \"join\".\n\
+If \"name\" is not given the currently selected item is used. There are\n\
+predefined constants for join - JOIN_<type>.\n\
+"));
 /*! Set line join */
 PyObject *scribus_setlinejoin(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlineend__doc__,
-    "setLineEnd(endtype, [\"name\"])\n\n\
-Sets the line cap style of the object \"name\" to the style \"cap\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for \"cap\" - CAP_<type>.");
+QT_TR_NOOP("setLineEnd(endtype, [\"name\"])\n\
+\n\
+Sets the line cap style of the object \"name\" to the style \"cap\".\n\
+If \"name\" is not given the currently selected item is used. There are\n\
+predefined constants for \"cap\" - CAP_<type>.\n\
+"));
 /*! Set line end */
 PyObject *scribus_setlineend(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setlinestyle__doc__,
-    "setLineStyle(style, [\"name\"])\n\n\
-Sets the line style of the object \"name\" to the style \"style\".\
-If \"name\" is not given the currently selected item is used. There\
-are predefined constants for \"style\" - LINE_<style>.");
+QT_TR_NOOP("setLineStyle(style, [\"name\"])\n\
+\n\
+Sets the line style of the object \"name\" to the style \"style\". If \"name\"\n\
+is not given the currently selected item is used. There are predefined\n\
+constants for \"style\" - LINE_<style>.\n\
+"));
 /*! Set line end */
 PyObject *scribus_setlinestyle(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setfillshade__doc__,
-    "setFillShade(shade, [\"name\"])\n\n\
-Sets the shading of the fill color of the object \"name\" to \"shade\".\
-\"shade\" must be an integer value in the range from 0 (lightest) to 100\
-(full Color intensity). If \"name\" is not given the currently selected\
-Item is used.");
+QT_TR_NOOP("setFillShade(shade, [\"name\"])\n\
+\n\
+Sets the shading of the fill color of the object \"name\" to \"shade\".\n\
+\"shade\" must be an integer value in the range from 0 (lightest) to 100\n\
+(full Color intensity). If \"name\" is not given the currently selected\n\
+Item is used.\n\
+\n\
+May raise ValueError if the fill shade is out of bounds.\n\
+"));
 /*! Set fill shade */
 PyObject *scribus_setfillshade(PyObject *self, PyObject* args);
 
 /*! docstringscribus_setmultiline__doc__ */
 PyDoc_STRVAR(scribus_setcornerrad__doc__,
-    "setCornerRadius(radius, [\"name\"])\n\n\
-Sets the corner radius of the object \"name\". The radius is expressed\
-in points. If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setCornerRadius(radius, [\"name\"])\n\
+\n\
+Sets the corner radius of the object \"name\". The radius is expressed\n\
+in points. If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise ValueError if the corner radius is negative.\n\
+"));
 /*! Set corner radius */
 PyObject *scribus_setcornerrad(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setmultiline__doc__,
-    "setMultiLine(\"namedStyle\", [\"name\"])\n\n\
-Sets the line style of the object \"name\" to the named style \"namedStyle\".\
-If \"name\" is not given the currently selected item is used.");
+QT_TR_NOOP("setMultiLine(\"namedStyle\", [\"name\"])\n\
+\n\
+Sets the line style of the object \"name\" to the named style \"namedStyle\".\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise NotFoundError if the line style doesn't exist.\n\
+"));
 /*! Set multiline */
 PyObject *scribus_setmultiline(PyObject *self, PyObject* args);
 
Index: cmdvar.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdvar.h,v
retrieving revision 1.6.2.5
diff -u -r1.6.2.5 cmdvar.h
--- cmdvar.h	9 Dec 2004 16:52:52 -0000	1.6.2.5
+++ cmdvar.h	14 Dec 2004 09:22:17 -0000
@@ -24,6 +24,10 @@
 extern PyObject* WrongFrameTypeError;
 /*! Exception raised by GetUniqueItem when it can't find a valid frame or a suitable selection to use. */
 extern PyObject* NoValidObjectError;
+/*! A general exception for when objects such as colors and fonts cannot be found. */
+extern PyObject* NotFoundError;
+/*! Exception raised when the user tries to create an object with the same name as one that already exists */
+extern PyObject* NameExistsError;
 
 #endif
 
Index: conswin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/conswin.cpp,v
retrieving revision 1.5.2.3
diff -u -r1.5.2.3 conswin.cpp
--- conswin.cpp	28 Nov 2004 17:43:18 -0000	1.5.2.3
+++ conswin.cpp	14 Dec 2004 09:22:17 -0000
@@ -29,9 +29,7 @@
 	font without family specification.
 	TODO: get user defined font by (future) KDE integration
 	TODO: is there any component with more user friendly pythonic interface? readline etc?
-	TODO: script console won't handle national (czech) characters.
-	as in somescript.py do. it inserts ??? instead. why? kill all
-	special alphabets :)))*/
+	*/
 	QFont font = QFont("nonexisting:)");
 	font.setStyleHint(QFont::TypeWriter);
 	font.setPointSize(ScApp->Prefs.AppFontSize);
Index: guiapp.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.h,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 guiapp.h
--- guiapp.h	3 Dec 2004 15:05:48 -0000	1.2.2.3
+++ guiapp.h	14 Dec 2004 09:22:17 -0000
@@ -8,9 +8,11 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_messagebartext__doc__,
-    "messagebarText(\"string\")\n\n\
-Writes the \"string\" into the Scribus message bar (status line).\
-The text must be UTF8 encoded.");
+QT_TR_NOOP("messagebarText(\"string\")\n\
+\n\
+Writes the \"string\" into the Scribus message bar (status line). The text\n\
+must be UTF8 encoded or 'unicode' string(recommended).\n\
+"));
 /**
 Changes the status bar string.
 TODO: national chars handling.
@@ -20,10 +22,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progressreset__doc__,
-    "progressReset()\n\n\
-Cleans up the Scribus progress bar previous settings. It is called\
-before the new progress bar use.");
-/**
+QT_TR_NOOP("progressReset()\n\
+\n\
+Cleans up the Scribus progress bar previous settings. It is called before the\n\
+new progress bar use. See progressSet.\n\
+"));
+/*
 Progressbar handling
 TODO: check total vs. set values.
 (Petr Vanek 02/19/04)
@@ -32,26 +36,33 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssettotalsteps__doc__,
-    "progressTotal(max)\n\n\
-Sets the progress bar's maximum steps value to the specified number.");
+QT_TR_NOOP("progressTotal(max)\n\
+\n\
+Sets the progress bar's maximum steps value to the specified number.\n\
+See progressSet.\n\
+"));
 PyObject *scribus_progresssettotalsteps(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssetprogress__doc__,
-    "progressSet(nr)\n\n\
-Progress bar handling. The progress bar uses the concept of steps;\
-you give it the total number of steps and the number of steps completed\
-so far and it will display the percentage of steps that have been\
-completed. You can specify the total number of steps in the constructor\
-or later with progressTotal(). The current number of steps is set with\
-progressSet(). The progress bar can be rewound to the beginning with\
-progressReset(). [taken from Trolltech's Qt docs]");
+QT_TR_NOOP("progressSet(nr)\n\
+\n\
+Set the progress bar position to \"nr\", a value relative to the previously set\n\
+progressTotal. The progress bar uses the concept of steps; you give it the\n\
+total number of steps and the number of steps completed so far and it will\n\
+display the percentage of steps that have been completed. You can specify the\n\
+total number of steps with progressTotal(). The current number of steps is set\n\
+with progressSet(). The progress bar can be rewound to the beginning with\n\
+progressReset(). [based on info taken from Trolltech's Qt docs]\n\
+"));
 PyObject *scribus_progresssetprogress(PyObject *self, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setcursor__doc__,
-    "setCursor()\n\n\
-[UNSUPPORTED!]");
+QT_TR_NOOP("setCursor()\n\
+\n\
+[UNSUPPORTED!] This might break things, so steer clear for now.\n\
+"));
 /**
 Cursor handling
 (Petr Vanek 02/19/04)
@@ -60,9 +71,12 @@
 
 /*! docstring */
 PyDoc_STRVAR(scribus_docchanged__doc__,
-    "docChanged(bool)\n\n\
-Enable/disable save icon in the Scribus icon bar. It's useful to call\
-this procedure when you're changing the document.");
+QT_TR_NOOP("docChanged(bool)\n\
+\n\
+Enable/disable save icon in the Scribus icon bar and the Save menu item. It's\n\
+useful to call this procedure when you're changing the document, because Scribus\n\
+won't automatically notice when you change the document using a script.\n\
+"));
 /**
 Enable/disable save icon
 (Petr Vanek 02/20/04)
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.33.2.24
diff -u -r1.33.2.24 scriptplugin.cpp
--- scriptplugin.cpp	11 Dec 2004 23:02:53 -0000	1.33.2.24
+++ scriptplugin.cpp	14 Dec 2004 09:22:17 -0000
@@ -59,6 +59,8 @@
 PyObject* NoDocOpenError;
 PyObject* WrongFrameTypeError;
 PyObject* NoValidObjectError;
+PyObject* NotFoundError;
+PyObject* NameExistsError;
 
 QString Name()
 {
@@ -79,6 +81,11 @@
 {
 	QString cm;
 	Py_Initialize();
+	if (PyUnicode_SetDefaultEncoding("utf-8"))
+	{
+		qDebug("Failed to set default encoding to utf-8.\n");
+		PyErr_Clear();
+	}
 	Carrier = plug;
 	RetVal = 0;
 	initscribus(Carrier);
@@ -246,6 +253,7 @@
 		qDebug("Failed to get __main__ - aborting script");
 	else
 	{
+		// FIXME: If filename contains chars outside 7bit ascii, might be problems
 		PyObject* globals = PyModule_GetDict(m);
 		// Build the Python code to run the script
 		QString cm = QString("import sys,StringIO,traceback\n");
@@ -264,6 +272,7 @@
 		// We re-raise the exception so the return value of PyRun_String reflects
 		// the fact that an exception has ocurred.
 		cm        += QString("    raise\n");
+		// FIXME: if cmd contains chars outside 7bit ascii, might be problems
 		QCString cmd = cm.latin1();
 		// Now run the script in the interpreter's global scope
 		PyObject* result = PyRun_String(cmd.data(), Py_file_input, globals, globals);
@@ -315,6 +324,7 @@
 		initscribus(Carrier);
 		if (RetVal == 0)
 		{
+			// FIXME: if CurDir contains chars outside 7bit ascii, might be problems
 			cm = "import sys\nsys.path[0] = \""+CurDir+"\"\n";
 			cm += "import cStringIO\n";
 			cm += "from scribus import *\n";
@@ -332,6 +342,7 @@
 		cm += "\tre = bu.getvalue()\n";
 		cm += "retval(re, rv)\n";
 	}
+	// FIXME: if cmd contains chars outside 7bit ascii, might be problems
 	QCString cmd = cm.latin1();
 	comm[0] = "scribus";
 	PySys_SetArgv(1, comm);
@@ -470,7 +481,7 @@
 	wrapperFunc += QString("    \"\"\"Deprecated alias for function %1 - see help(%2).\"\"\"\n").arg(oldName).arg(oldName);
 	wrapperFunc += QString("    warnings.warn(\"Warning, script function %1 is deprecated, use %2 instead.\\n\",exceptions.DeprecationWarning)\n").arg(newName).arg(oldName);
 	wrapperFunc += QString("    return %1(*args,**kwargs)\n").arg(oldName);
-	QCString wsData = wrapperFunc.latin1();
+	QCString wsData = wrapperFunc.latin1();	//this should probably be utf8 now
 	// And run it in the namespace of the scribus module
 	PyObject* result = PyRun_String(wsData, Py_file_input, scribusdict, scribusdict);
 	// NULL is returned if an exception is set. We don't care about any other return value and
@@ -513,20 +524,21 @@
 
 static PyObject *scribus_retval(PyObject *self, PyObject* args)
 {
-	char *Name;
-	int retV;
+	char *Name = NULL;
+	int retV = 0;
 	if (!PyArg_ParseTuple(args, "si", &Name, &retV))
 		return NULL;
-	RetString = QString(Name);
+	// Because sysdefaultencoding is not utf-8, Python is returning utf-8 encoded
+	// 8-bit char* strings. Make sure Qt understands that the input is utf-8 not
+	// the default local encoding (usually latin-1) by using QString::fromUtf8()
+	RetString = QString::fromUtf8(Name);
 	RetVal = retV;
 	return PyInt_FromLong(0L);
 }
 
-static PyObject *scribus_getval(PyObject *self, PyObject* args)
+static PyObject *scribus_getval(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-		return NULL;
-	return PyString_FromString(InValue);
+	return PyString_FromString(InValue.utf8().data());
 }
 
 /*!
@@ -535,17 +547,31 @@
  */
 char* tr(const char* docstringConstant)
 {
-    // Alas, there's a lot of wasteful string copying going on
-    // here.
-    QString translated = QObject::tr(docstringConstant, "scripter docstring");
-    const char* trch = translated.latin1();
-    return strndup(trch, strlen(trch));
+	// Alas, there's a lot of wasteful string copying going on
+	// here.
+	QString translated = QObject::tr(docstringConstant, "scripter docstring");
+	/*
+	 * Python doesn't support 'unicode' object docstrings in the PyMethodDef,
+	 * and has no way to specify what encoding docstrings are in. The passed C
+	 * strings passed are made into 'str' objects as-is. These are interpreted
+	 * as being in the Python sysdefaultencoding, usually 'ascii', when used.
+	 * We now set systemdefaultencoding to 'utf-8' ...  so we're going to pass
+	 * Python an 8-bit utf-8 encoded string in a char* .  With
+	 * sysdefaultencoding set correctly, Python will interpret it correctly and
+	 * we'll have our unicode docstrings. It's not as ugly a hack as it sounds,
+	 * you just have to remember that C and Python strings can both be
+	 * considered 8-bit strings of binary data that can be later interpreted as
+	 * a text string in a particular text encoding.
+	 */
+	//QCString utfTranslated = translated.utf8();
+	const char* trch = translated.utf8().data();
+	return strndup(trch, strlen(trch));
 }
 
-/* Now we're using the more pyhtonic convention for names:
-	class - ClassName
-	procedure/function/method - procedureName
-etc. */
+/* Now we're using the more pythonic convention for names:
+ * class - ClassName
+ * procedure/function/method - procedureName
+ * etc. */
 PyMethodDef scribus_methods[] = {
 	// 2004/10/03 pv - aliases with common Python syntax - ClassName methodName
 	// 2004-11-06 cr - move aliasing to dynamically generated wrapper functions, sort methoddef
@@ -570,7 +596,7 @@
 	{"deleteText", scribus_deletetext, METH_VARARGS, tr(scribus_deletetext__doc__)},
 	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, tr(scribus_deselect__doc__)},
 	{"docChanged", scribus_docchanged, METH_VARARGS, tr(scribus_docchanged__doc__)},
-	{"fileDialog", scribus_filedia, METH_VARARGS, tr(scribus_filedia__doc__)},
+	{"fileDialog", (PyCFunction)scribus_filedia, METH_VARARGS|METH_KEYWORDS, tr(scribus_filedia__doc__)},
 	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
 	{"getAllObjects", scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
 	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
@@ -623,7 +649,7 @@
 	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},
 	{"lockObject", scribus_lockobject, METH_VARARGS, tr(scribus_lockobject__doc__)},
 	{"messagebarText", scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
-	{"messageBox", scribus_messdia, METH_VARARGS, tr(scribus_messdia__doc__)},
+	{"messageBox", (PyCFunction)scribus_messdia, METH_VARARGS|METH_KEYWORDS, tr(scribus_messdia__doc__)},
 	{"moveObjectAbs", scribus_moveobjabs, METH_VARARGS, tr(scribus_moveobjabs__doc__)},
 	{"moveObject", scribus_moveobjrel, METH_VARARGS, tr(scribus_moveobjrel__doc__)},
 	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, tr(scribus_newdocdia__doc__)},
@@ -694,7 +720,7 @@
 	{"valueDialog", scribus_valdialog, METH_VARARGS, tr(scribus_valdialog__doc__)},
 	// end of aliases
 	{"retval", scribus_retval, METH_VARARGS, "TODO: docstring"},
-	{"getval", scribus_getval, METH_VARARGS, "TODO: docstring"},
+	{"getval", (PyCFunction)scribus_getval, METH_NOARGS, "TODO: docstring"},
 	{"frametype", (PyCFunction)scribus_getframetype, METH_VARARGS|METH_KEYWORDS, "Return the internal type ID of the frame\n"},
 	{NULL,		NULL}		/* sentinel */
 };
@@ -729,6 +755,14 @@
 	NoValidObjectError = PyErr_NewException((char*)"scribus.NoValidObjectError", ScribusException, NULL);
 	Py_INCREF(NoValidObjectError);
 	PyModule_AddObject(m, (char*)"NoValidObjectError", NoValidObjectError);
+	// Couldn't find the specified resource - font, color, etc.
+	NotFoundError = PyErr_NewException((char*)"scribus.NotFoundError", ScribusException, NULL);
+	Py_INCREF(NotFoundError);
+	PyModule_AddObject(m, (char*)"NotFoundError", NotFoundError);
+	// Tried to create an object with the same name as one that already exists
+	NameExistsError = PyErr_NewException((char*)"scribus.NameExistsError", ScribusException, NULL);
+	Py_INCREF(NameExistsError);
+	PyModule_AddObject(m, (char*)"NameExistsError", NameExistsError);
 	// Done with exception setup
 
 	// CONSTANTS
Index: scriptplugin.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.h,v
retrieving revision 1.5.2.6
diff -u -r1.5.2.6 scriptplugin.h
--- scriptplugin.h	17 Nov 2004 20:36:16 -0000	1.5.2.6
+++ scriptplugin.h	14 Dec 2004 09:22:17 -0000
@@ -31,7 +31,7 @@
 
 /** Some useful Subroutines */
 static PyObject *scribus_retval(PyObject *self, PyObject* args);
-static PyObject *scribus_getval(PyObject *self, PyObject* args);
+static PyObject *scribus_getval(PyObject *self);
 QString RetString;
 QString InValue;
 int RetVal;
Index: samples/3columnA4.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/3columnA4.py,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 3columnA4.py
--- samples/3columnA4.py	17 Nov 2004 20:33:08 -0000	1.1.2.2
+++ samples/3columnA4.py	14 Dec 2004 09:22:17 -0000
@@ -1,20 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Creates 3 column layout on A4 paper and save it under 3columnA4.sla filename"""
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (50, 50, 50, 50)
 size = (612, 792)
-if newDoc(PAPER_A4, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
-	a = createText(50, 50, 230, 512)
-	setTextAlignment(1,a)
-	setText("Column A", a)
-	setFontSize(12, a)
-	b = createText(280, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column B", b)
-	setFontSize(12, b)
-	c = createText(510, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column C", c)
-	setFontSize(12, c)
-	saveDocAs("3columnA4.sla")
-	closeDoc()
+
+def main():
+    if newDoc(PAPER_A4, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
+        a = createText(50, 50, 230, 512)
+        setTextAlignment(1,a)
+        setText("Column A", a)
+        setFontSize(12, a)
+        b = createText(280, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column B", b)
+        setFontSize(12, b)
+        c = createText(510, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column C", c)
+        setFontSize(12, c)
+        saveDocAs("3columnA4.sla")
+        closeDoc()
+
+if __name__ == '__main__':
+    main()
Index: samples/3columnUSLTR.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/3columnUSLTR.py,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 3columnUSLTR.py
--- samples/3columnUSLTR.py	17 Nov 2004 20:33:08 -0000	1.1.2.2
+++ samples/3columnUSLTR.py	14 Dec 2004 09:22:17 -0000
@@ -1,21 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Creates 3 column layout on Letter paper and save it under 3columnUS.sla filename"""
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (50, 50, 50, 50)
 size = (612, 792)
-if newDoc(PAPER_LETTER, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
-	a = createText(50, 50, 230, 512)
-	setTextAlignment(1,a)
-	setText("Column A", a)
-	setFontSize(12, a)
-	b = createText(280, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column B", b)
-	setFontSize(12, b)
-	c = createText(510, 50, 230, 512)
-	setTextAlignment(1,b)
-	setText("Column C", c)
-	setFontSize(12, c)
-	saveDocAs("3columnUS.sla")
-	closeDoc()
 
+def main():
+    if newDoc(PAPER_LETTER, margins, LANDSCAPE, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGELEFT):
+        a = createText(50, 50, 230, 512)
+        setTextAlignment(1,a)
+        setText("Column A", a)
+        setFontSize(12, a)
+        b = createText(280, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column B", b)
+        setFontSize(12, b)
+        c = createText(510, 50, 230, 512)
+        setTextAlignment(1,b)
+        setText("Column C", c)
+        setFontSize(12, c)
+        saveDocAs("3columnUS.sla")
+        closeDoc()
+
+if __name__ == '__main__':
+    main()
Index: samples/Calender.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/Calender.py,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 Calender.py
--- samples/Calender.py	17 Nov 2004 20:33:08 -0000	1.2.2.2
+++ samples/Calender.py	14 Dec 2004 09:22:17 -0000
@@ -1,57 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ This Script creates a Calendar Sheet for the Current Month """
 
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 import calendar
 import time
-from scribus import *
 
-if haveDoc():
-	setRedraw(0)
-	Month = time.localtime()[1]
-	Year = time.localtime()[0]
-	Objects = []
-	MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
-	DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
-	Xcoor = 10
-	Ycoor = 30
-	DayC = 0
-	Calend = calendar.monthcalendar(Year, Month)
-	ob = createText(10, 10, 245, 20)
-	Title = MonthList[Month-1] + " " + str(Year)
-	setText(Title, ob)
-	Objects.append(ob)
-	for lx in range(45, 245, 35):
-		ob = createLine(lx, 30, lx, 20*len(Calend)+50)
-		Objects.append(ob)
-	for ly in range(50, 20*len(Calend)+50, 20):
-		ob = createLine(10, ly, 255, ly)
-		Objects.append(ob)
-	ob = createRect(10, 30, 245, 20*len(Calend)+20)
-	setFillColor("None", ob)
-	Objects.append(ob)
-	for day in range(7):
-		ob = createText(Xcoor, Ycoor, 35, 20)
-		setTextAlignment(Centered, ob)
-		setFontSize(12, ob)
-		if day == 6:
-			setTextColor("Red", ob)
-		setText(DaysList[day], ob)
-		Objects.append(ob)
-		Xcoor = Xcoor + 35
-	Ycoor = Ycoor + 20
-	for lines in Calend:
-		Xcoor = 10
-		DayC = 0
-		for rows in lines:
-			if rows != 0:
-				ob = createText(Xcoor, Ycoor, 35, 20)
-				setTextAlignment(Centered, ob)
-				if DayC == 6:
-					setTextColor("Red", ob)
-				setText(str(rows), ob)
-				Objects.append(ob)
-			Xcoor = Xcoor + 35
-			DayC = DayC + 1
-		Ycoor = Ycoor + 20
-	groupObjects(Objects)
-	setRedraw(1)
-	redrawAll
+def main():
+    Month = time.localtime()[1]
+    Year = time.localtime()[0]
+    Objects = []
+    MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"]
+    DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
+    Xcoor = 10
+    Ycoor = 30
+    DayC = 0
+    Calend = calendar.monthcalendar(Year, Month)
+    ob = createText(10, 10, 245, 20)
+    Title = MonthList[Month-1] + " " + str(Year)
+    setText(Title, ob)
+    Objects.append(ob)
+    for lx in range(45, 245, 35):
+        ob = createLine(lx, 30, lx, 20*len(Calend)+50)
+        Objects.append(ob)
+    for ly in range(50, 20*len(Calend)+50, 20):
+        ob = createLine(10, ly, 255, ly)
+        Objects.append(ob)
+    ob = createRect(10, 30, 245, 20*len(Calend)+20)
+    setFillColor("None", ob)
+    Objects.append(ob)
+    for day in range(7):
+        ob = createText(Xcoor, Ycoor, 35, 20)
+        setTextAlignment(Centered, ob)
+        setFontSize(12, ob)
+        if day == 6:
+            setTextColor("Red", ob)
+        setText(DaysList[day], ob)
+        Objects.append(ob)
+        Xcoor = Xcoor + 35
+    Ycoor = Ycoor + 20
+    for lines in Calend:
+        Xcoor = 10
+        DayC = 0
+        for rows in lines:
+            if rows != 0:
+                ob = createText(Xcoor, Ycoor, 35, 20)
+                setTextAlignment(Centered, ob)
+                if DayC == 6:
+                    setTextColor("Red", ob)
+                setText(str(rows), ob)
+                Objects.append(ob)
+            Xcoor = Xcoor + 35
+            DayC = DayC + 1
+        Ycoor = Ycoor + 20
+    groupObjects(Objects)
+
+if __name__ == '__main__':
+    if haveDoc():
+        try:
+            setRedraw(False)
+            main()
+        finally:
+            setRedraw(True)
+            redrawAll()
+    else:
+        messageBox("Calendar Script", "Please run this script with a document open.", ICON_INFORMATION);
Index: samples/Sample1.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/Sample1.py,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 Sample1.py
--- samples/Sample1.py	17 Nov 2004 20:33:08 -0000	1.2.2.2
+++ samples/Sample1.py	14 Dec 2004 09:22:17 -0000
@@ -1,12 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ A sample script """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 margins = (10, 10, 10, 30)
-if newDoc(PAPER_A4, margins, PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
-	a = createText(50, 50, 200, 80)
-	setText("A Test for Scribus", a)
-	setFontSize(20, a)
-	b = createEllipse(267, 391, 60, 60)
-	setFillColor("Red", b)
-	saveDocAs("Sample1.sla")
-	closeDoc()
+
+def main():
+    if newDoc(PAPER_A4, margins, PORTRAIT, 1, UNIT_POINTS, NOFACINGPAGES, FIRSTPAGERIGHT):
+        a = createText(50, 50, 200, 80)
+        setText("A Test for Scribus", a)
+        setFontSize(20, a)
+        b = createEllipse(267, 391, 60, 60)
+        setFillColor("Red", b)
+        saveDocAs("Sample1.sla")
+
+if __name__ == '__main__':
+    main()
Index: samples/golden-mean.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/golden-mean.py,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 golden-mean.py
--- samples/golden-mean.py	17 Nov 2004 20:29:38 -0000	1.1.2.1
+++ samples/golden-mean.py	14 Dec 2004 09:22:17 -0000
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """Golden Mean for Scribus.
 
 This script creates supplementary marks on the page to
@@ -38,8 +41,15 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 """
 
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 from math import sqrt
-from scribus import *
 
 GMLAYER = "Golden Mean Layer"
 
@@ -58,8 +68,7 @@
          X-D, Y, X, Y-D, X, Y+D, X+D, Y], aName)
 
 
-# main
-if haveDoc():
+def main():
     # remember user settings
     unit = getUnit()
     layer = getActiveLayer()
@@ -89,3 +98,9 @@
     # restore user settings
     setUnit(unit)
     setActiveLayer(layer)
+
+if __name__ == '__main__':
+    if haveDoc():
+        main()
+    else:
+        messageBox("Golden Mean.py", "Please run this script with a document already open", ICON_INFORMATION);
Index: samples/htmlimport.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/htmlimport.py,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 htmlimport.py
--- samples/htmlimport.py	17 Nov 2004 20:33:08 -0000	1.3.2.2
+++ samples/htmlimport.py	14 Dec 2004 09:22:17 -0000
@@ -1,4 +1,13 @@
-from scribus import *
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 from sgmllib import SGMLParser
 from htmlentitydefs import entitydefs
 
@@ -14,57 +23,57 @@
 BUTTON_OK = 1
 ICON_WARNING = 2
 NEWLINE = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6',
-		   'br', 'p', 'li', 'div', 'tr']
+           'br', 'p', 'li', 'div', 'tr']
 
 class HTMLParser(SGMLParser):
 
-	def __init__(self, textbox):
-		self.encoding = valueDialog(TITLE, 'Set encoding of the imported file', ENCODING)
-		SGMLParser.__init__(self)
-		self.in_body = 0
-		self.textbox = textbox
-
-	def append(self, text):
-		insertText(unicode(text, self.encoding), getTextLength(self.textbox), self.textbox)
-
-	def start_body(self, attrs):
-		self.in_body = 1
-
-	def end_body(self):
-		self.in_body = 0
-
-	def unknown_starttag(self, name, attrs):
-		if name in NEWLINE:
-			self.append('\n')
-
-	def unknown_endtag(self, name):
-		if name in NEWLINE:
-			self.append('\n')
-
-	def handle_data(self, raw_data):
-		if self.in_body:
-			data = ' '.join(
-				raw_data.replace('\n', ' ').split())
-			if raw_data.startswith(' '):
-				data = ' ' + data
-			if raw_data.endswith(' ') and len(raw_data) > 1:
-				data = data + ' '
-			self.append(data)
+    def __init__(self, textbox):
+        self.encoding = valueDialog(TITLE, 'Set encoding of the imported file', ENCODING)
+        SGMLParser.__init__(self)
+        self.in_body = 0
+        self.textbox = textbox
+
+    def append(self, text):
+        insertText(unicode(text, self.encoding), getTextLength(self.textbox), self.textbox)
+
+    def start_body(self, attrs):
+        self.in_body = 1
+
+    def end_body(self):
+        self.in_body = 0
+
+    def unknown_starttag(self, name, attrs):
+        if name in NEWLINE:
+            self.append('\n')
+
+    def unknown_endtag(self, name):
+        if name in NEWLINE:
+            self.append('\n')
+
+    def handle_data(self, raw_data):
+        if self.in_body:
+            data = ' '.join(
+                raw_data.replace('\n', ' ').split())
+            if raw_data.startswith(' '):
+                data = ' ' + data
+            if raw_data.endswith(' ') and len(raw_data) > 1:
+                data = data + ' '
+            self.append(data)
 
-	def unknown_entityref(self, entity):
-		self.handle_data(entitydefs.get(entity, ''))
+    def unknown_entityref(self, entity):
+        self.handle_data(entitydefs.get(entity, ''))
 
 
 if haveDoc():
-	filename = fileDialog(TITLE, "*.htm*", "", 0, 1)
-	if filename:
-		unit = getUnit()
-		setUnit(UNIT_MILLIMETERS)
-		textbox = createText(20, 20, 70, 250)
-		parser = HTMLParser(textbox)
-		parser.feed(open(filename).read())
-		setUnit(unit)
+    filename = fileDialog(TITLE, "*.htm*", "", 0, 1)
+    if filename:
+        unit = getUnit()
+        setUnit(UNIT_MILLIMETERS)
+        textbox = createText(20, 20, 70, 250)
+        parser = HTMLParser(textbox)
+        parser.feed(open(filename).read())
+        setUnit(unit)
 else:
-	MessageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
 
 
Index: samples/legende.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/legende.py,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 legende.py
--- samples/legende.py	17 Nov 2004 20:29:38 -0000	1.1.2.1
+++ samples/legende.py	14 Dec 2004 09:22:17 -0000
@@ -1,17 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ When you have an image selected this script creates small text legende
-below the image. The new textframe contains name of the file. """
+(caption) below the image. The new textframe contains name of the file. """
+
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-from scribus import *
 import os
 
-userUnit = getUnit()
-setUnit(1)
-x,y = getPosition()
-l,h = getSize()
-texte = getImageFile()
-image = os.path.basename(texte)
-a = createText(x,y+h+2,l,8)
-insertText(image,0,a)
-setTextAlignment(2,a)
-setFontSize(7,a)
-setUnit(userUnit)
+def main():
+    userUnit = getUnit()
+    setUnit(1)
+    sel_count = selectionCount()
+
+    if sel_count == 0:
+        messageBox("legende.py",
+                "Please select the object to add a caption to before running this script.",
+                ICON_INFORMATION)
+        sys.exit(1)
+
+    x,y = getPosition()
+    l,h = getSize()
+    texte = getImageFile()
+    image = os.path.basename(texte)
+    a = createText(x,y+h+2,l,8)
+    insertText(image,0,a)
+    setTextAlignment(2,a)
+    setFontSize(7,a)
+    setUnit(userUnit)
+
+if __name__ == '__main__':
+    main()
Index: samples/moins_10_pourcent_group.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/moins_10_pourcent_group.py,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 moins_10_pourcent_group.py
--- samples/moins_10_pourcent_group.py	17 Nov 2004 20:29:38 -0000	1.1.2.1
+++ samples/moins_10_pourcent_group.py	14 Dec 2004 09:22:17 -0000
@@ -1,5 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Make selected group smaller by 10% """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-scaleGroup(0.9)
+if haveDoc() and selectionCount():
+    scaleGroup(1/1.1)
+else:
+    messageBox("moins_10_pourcent_group.py", "Please select an object to scale before running this script.", ICON_INFORMATION)
Index: samples/plus_10_pourcent_group.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/plus_10_pourcent_group.py,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 plus_10_pourcent_group.py
--- samples/plus_10_pourcent_group.py	17 Nov 2004 20:29:38 -0000	1.1.2.1
+++ samples/plus_10_pourcent_group.py	14 Dec 2004 09:22:17 -0000
@@ -1,5 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Make selected group larger by 10% """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-scaleGroup(1.1)
+if haveDoc() and selectionCount():
+    scaleGroup(1.1)
+else:
+    messageBox("plus_10_pourcent_group.py", "Please select an object to scale before running this script.", ICON_INFORMATION)
Index: samples/pochette_cd.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/pochette_cd.py,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 pochette_cd.py
--- samples/pochette_cd.py	17 Nov 2004 20:33:08 -0000	1.1.2.2
+++ samples/pochette_cd.py	14 Dec 2004 09:22:17 -0000
@@ -1,104 +1,117 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ This script creates a CD Pochette - a paper pocket for CD/DVD disc """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
 margins = (0, 0, 0, 0)
 paper = (210, 297)
 
-if newDoc(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT):
-	setUnit(1)
-	newPage(-1)
-	gotoPage(1)
-	createLayer("normal")
-	setActiveLayer("normal")
-	a = createText(98.5, 20, 100, 10)
-	setText("CD pochette - front page", a)
-	setFontSize(11, a)
-	setTextAlignment(1, a)
-	b = createText(28.5, 45, 120, 120)
-	setFillColor("None", b)
-	c = createText(148.5, 45, 120, 120)
-	setFillColor("None", c)
-	createLayer("bords_perdus")
-	setActiveLayer("bords_perdus")
-	img1 = createImage(24.35, 41.25 , 124.20, 127.95,)
-	img2 = createImage(148.55, 41.25 , 124.20, 127.95,)
-	createLayer("coupe")
-	setActiveLayer("coupe")
-	t1 = createLine(28.5, 38, 28.5, 43)
-	setLineWidth(0.1, t1)
-	t2 = createLine(148.5, 38, 148.5, 43)
-	setLineWidth(0.1, t2)
-	t3 = createLine(268.5, 38, 268.5, 43)
-	setLineWidth(0.1, t3)
-	t4 = createLine(28.5, 172, 28.5, 167)
-	setLineWidth(0.1, t4)
-	t5 = createLine(148.5, 172, 148.5, 167)
-	setLineWidth(0.1, t5)
-	t6 = createLine(268.5, 172, 268.5, 167)
-	setLineWidth(0.1, t6)
-	t7 = createLine(21.5, 45, 26.5, 45)
-	setLineWidth(0.1, t7)
-	t8 = createLine(21.5, 165, 26.5, 165)
-	setLineWidth(0.1, t8)
-	t9 = createLine(270.5, 45, 275.5, 45)
-	setLineWidth(0.1, t9)
-	t10 = createLine(270.5, 165, 275.5, 165)
-	setLineWidth(0.1, t10)
-	gotoPage(2)
-	setActiveLayer("normal")
-	a2 = createText(98.5, 20, 100, 10)
-	setText("CD pochette - back page", a2)
-	setFontSize(11, a2)
-	setTextAlignment(1, a2)
-	a2t = createText(204, 44, 78, 9)
-	setText("Mode d'emploi :", a2t)
-	setFontSize(13, a2t)
-	setTextAlignment(1, a2t)
-	a21 = createText(204, 54, 78, 87)
-	setText("Usage. TODO: tranlslate it from french", a21)
-	setFontSize(11, a21)
-	setTextAlignment(0, a21)
-	b2 = createText(28.5, 162.10, 117, 6)
-	setText("Texte sur la tranche", b2)
-	setFontSize(9, b2)
-	setTextAlignment(1, b2)
-	rotateObjectAbs(90, b2)
-	setFillColor("None", b2)
-	c2 = createText(34.5, 45, 137.5, 117)
-	setFillColor("None", c2)
-	d2 = createText(28.5, 162.10, 117, 6)
-	setText("Texte sur la tranche", d2)
-	setFontSize(9, d2)
-	setTextAlignment(1, d2)
-	rotateObjectAbs(90, d2)
-	setFillColor("None", d2)
-	moveObject(143.5, 0, d2)
-	setActiveLayer("bords_perdus")
-	img3 = createImage(24.35, 41.25 , 157.50, 126.50,)
-	setActiveLayer("coupe")
-	t21 = createLine(28.5, 38, 28.5, 43)
-	setLineWidth(0.1, t21)
-	t22 = createLine(34.5, 38, 34.5, 43)
-	setLineWidth(0.1, t22)
-	t23 = createLine(172, 38, 172, 43)
-	setLineWidth(0.1, t23)
-	t24 = createLine(178, 38, 178, 43)
-	setLineWidth(0.1, t24)
-	t25 = createLine(28.5, 164.5, 28.5, 169.5)
-	setLineWidth(0.1, t25)
-	t26 = createLine(34.5, 164, 34.5, 169.5)
-	setLineWidth(0.1, t26)
-	t27 = createLine(172, 164, 172, 169.5)
-	setLineWidth(0.1, t27)
-	t28 = createLine(178, 164, 178, 169.5)
-	setLineWidth(0.1, t28)
-	t29 = createLine(22.5, 45, 27.5, 45)
-	setLineWidth(0.1, t29)
-	t30 = createLine(22.5, 162, 27.5, 162)
-	setLineWidth(0.1, t30)
-	t31 = createLine(179.5, 45, 184.5, 45)
-	setLineWidth(0.1, t31)
-	t32 = createLine(179.5, 162, 184.5, 162)
-	setLineWidth(0.1, t32)
-	saveDocAs("pochette_CD.sla")
+def main():
+    if newDoc(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT):
+        setUnit(1)
+        newPage(-1)
+        gotoPage(1)
+        createLayer("normal")
+        setActiveLayer("normal")
+        a = createText(98.5, 20, 100, 10)
+        setText("CD pochette - front page", a)
+        setFontSize(11, a)
+        setTextAlignment(1, a)
+        b = createText(28.5, 45, 120, 120)
+        setFillColor("None", b)
+        c = createText(148.5, 45, 120, 120)
+        setFillColor("None", c)
+        createLayer("bords_perdus")
+        setActiveLayer("bords_perdus")
+        img1 = createImage(24.35, 41.25 , 124.20, 127.95,)
+        img2 = createImage(148.55, 41.25 , 124.20, 127.95,)
+        createLayer("coupe")
+        setActiveLayer("coupe")
+        t1 = createLine(28.5, 38, 28.5, 43)
+        setLineWidth(0.1, t1)
+        t2 = createLine(148.5, 38, 148.5, 43)
+        setLineWidth(0.1, t2)
+        t3 = createLine(268.5, 38, 268.5, 43)
+        setLineWidth(0.1, t3)
+        t4 = createLine(28.5, 172, 28.5, 167)
+        setLineWidth(0.1, t4)
+        t5 = createLine(148.5, 172, 148.5, 167)
+        setLineWidth(0.1, t5)
+        t6 = createLine(268.5, 172, 268.5, 167)
+        setLineWidth(0.1, t6)
+        t7 = createLine(21.5, 45, 26.5, 45)
+        setLineWidth(0.1, t7)
+        t8 = createLine(21.5, 165, 26.5, 165)
+        setLineWidth(0.1, t8)
+        t9 = createLine(270.5, 45, 275.5, 45)
+        setLineWidth(0.1, t9)
+        t10 = createLine(270.5, 165, 275.5, 165)
+        setLineWidth(0.1, t10)
+        gotoPage(2)
+        setActiveLayer("normal")
+        a2 = createText(98.5, 20, 100, 10)
+        setText("CD pochette - back page", a2)
+        setFontSize(11, a2)
+        setTextAlignment(1, a2)
+        a2t = createText(204, 44, 78, 9)
+        setText("Mode d'emploi :", a2t)
+        setFontSize(13, a2t)
+        setTextAlignment(1, a2t)
+        a21 = createText(204, 54, 78, 87)
+        setText("Usage. TODO: tranlslate it from french", a21)
+        setFontSize(11, a21)
+        setTextAlignment(0, a21)
+        b2 = createText(28.5, 162.10, 117, 6)
+        setText("Texte sur la tranche", b2)
+        setFontSize(9, b2)
+        setTextAlignment(1, b2)
+        rotateObjectAbs(90, b2)
+        setFillColor("None", b2)
+        c2 = createText(34.5, 45, 137.5, 117)
+        setFillColor("None", c2)
+        d2 = createText(28.5, 162.10, 117, 6)
+        setText("Texte sur la tranche", d2)
+        setFontSize(9, d2)
+        setTextAlignment(1, d2)
+        rotateObjectAbs(90, d2)
+        setFillColor("None", d2)
+        moveObject(143.5, 0, d2)
+        setActiveLayer("bords_perdus")
+        img3 = createImage(24.35, 41.25 , 157.50, 126.50,)
+        setActiveLayer("coupe")
+        t21 = createLine(28.5, 38, 28.5, 43)
+        setLineWidth(0.1, t21)
+        t22 = createLine(34.5, 38, 34.5, 43)
+        setLineWidth(0.1, t22)
+        t23 = createLine(172, 38, 172, 43)
+        setLineWidth(0.1, t23)
+        t24 = createLine(178, 38, 178, 43)
+        setLineWidth(0.1, t24)
+        t25 = createLine(28.5, 164.5, 28.5, 169.5)
+        setLineWidth(0.1, t25)
+        t26 = createLine(34.5, 164, 34.5, 169.5)
+        setLineWidth(0.1, t26)
+        t27 = createLine(172, 164, 172, 169.5)
+        setLineWidth(0.1, t27)
+        t28 = createLine(178, 164, 178, 169.5)
+        setLineWidth(0.1, t28)
+        t29 = createLine(22.5, 45, 27.5, 45)
+        setLineWidth(0.1, t29)
+        t30 = createLine(22.5, 162, 27.5, 162)
+        setLineWidth(0.1, t30)
+        t31 = createLine(179.5, 45, 184.5, 45)
+        setLineWidth(0.1, t31)
+        t32 = createLine(179.5, 162, 184.5, 162)
+        setLineWidth(0.1, t32)
+        saveDocAs("pochette_CD.sla")
+
+if __name__ == '__main__':
+    main()
Index: samples/quote.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/quote.py,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 quote.py
--- samples/quote.py	17 Nov 2004 20:33:53 -0000	1.2.2.2
+++ samples/quote.py	14 Dec 2004 09:22:17 -0000
@@ -1,56 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+
 """ This script changes quotation marks from " " to french style """
 
-# -*- coding: ISO-8859-1 -*-
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
 import re
 
 TITLE = "Text quoting"
-BUTTON_OK = 1
-ICON_INFORMATION = 1
-ICON_WARNING = 2
-QUOTE_START = "�"
-QUOTE_END = "�"
 
+# These need to be declared as unicode strings until some
+# charset issues in the scripter are worked out.
+QUOTE_START = u"�"
+QUOTE_END = u"�"
 
 def quote(textobj):
-	quoted_re = re.compile('"[^"]*"')
-	text = getText(textobj)
-	count = 0
-	i = 0
-	selectText(0, 0, textobj)
-	while i < len(text):
-		match = quoted_re.match(text[i:])
-		if match:
-			end = match.end()
-			selectText(i, 1, textobj)
-			deleteText(textobj)
-			insertText(QUOTE_START, i, textobj)
-			selectText(i + end - 1, 1, textobj)
-			deleteText(textobj)
-			insertText(QUOTE_END, i + end - 1, textobj)
-			count += 1
-			i = i + end
-		else:
-			i = i + 1
-	return count
-
-
-if haveDoc():
-	changed = 0
-	sel_count = selectionCount()
-	setRedraw(0)
-	if sel_count:
-		for i in range(sel_count):
-			changed += quote(getSelectedObject(i))
-	else:
-		for page in range(pageCount()):
-			gotoPage(page)
-			for obj in getAllObjects():
-				changed += quote(obj)
-	setRedraw(1)
-	redrawAll()
-	messageBox(TITLE, "%s quotations changed" % changed,
-			   ICON_INFORMATION, BUTTON_OK)
-
-else:
-	messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    quoted_re = re.compile('"[^"]*"')
+    try:
+        text = getText(textobj)
+    except WrongFrameTypeError:
+        messageBox("quote.py", "Can't quote text in a non-text frame", ICON_INFORMATION);
+        sys.exit(1)
+    if len(text) == 0:
+        return 0    # We can't very well change anything in an empty frame
+    count = 0
+    i = 0
+    selectText(0, 0, textobj)
+    while i < len(text):
+        match = quoted_re.match(text[i:])
+        if match:
+            end = match.end()
+            selectText(i, 1, textobj)
+            deleteText(textobj)
+            insertText(QUOTE_START, i, textobj)
+            selectText(i + end - 1, 1, textobj)
+            deleteText(textobj)
+            insertText(QUOTE_END, i + end - 1, textobj)
+            count += 1
+            i = i + end
+        else:
+            i = i + 1
+    return count
+
+
+def main():
+    changed = 0
+    sel_count = selectionCount()
+    if sel_count:
+        for i in range(sel_count):
+            changed += quote(getSelectedObject(i))
+    else:
+        for page in range(pageCount()):
+            gotoPage(page)
+            for obj in getAllObjects():
+                changed += quote(obj)
+    messageBox(TITLE, "%s quotations changed" % changed,
+               ICON_INFORMATION, BUTTON_OK)
+
+if __name__ == '__main__':
+    if haveDoc():
+        try:
+            setRedraw(False)
+            main()
+        finally:
+            setRedraw(True)
+            redrawAll()
+    else:
+        messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
Index: samples/trait_de_coupe.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/trait_de_coupe.py,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 trait_de_coupe.py
--- samples/trait_de_coupe.py	17 Nov 2004 20:29:38 -0000	1.1.2.1
+++ samples/trait_de_coupe.py	14 Dec 2004 09:22:17 -0000
@@ -1,27 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
 """ Draws a "crop marks" around selected object """
 
-from scribus import *
+import sys
+
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
+
+def main():
+    userUnit = getUnit()
+    setUnit(1)
+    x,y = getPosition()
+    l,h = getSize()
+    t1 = createLine(x, y-2, x, y-7)
+    setLineWidth(0.1, t1)
+    t2 = createLine(x+l, y-2, x+l, y-7)
+    setLineWidth(0.1, t2)
+    t3 = createLine(x, y+7+h, x, y+2+h)
+    setLineWidth(0.1, t3)
+    t4 = createLine(x+l, y+7+h, x+l, y+2+h)
+    setLineWidth(0.1, t4)
+    t5 = createLine(x-2, y, x-7, y)
+    setLineWidth(0.1, t5)
+    t6 = createLine(x-2, y+h, x-7, y+h)
+    setLineWidth(0.1, t6)
+    t7 = createLine(x+l+2, y+h, x+l+7, y+h)
+    setLineWidth(0.1, t7)
+    t7 = createLine(x+l+2, y, x+l+7, y)
+    setLineWidth(0.1, t7)
+    deselectAll()
+    setUnit(userUnit)
 
-if haveDoc():
-	userUnit = getUnit()
-	setUnit(1)
-	x,y = getPosition()
-	l,h = getSize()
-	t1 = createLine(x, y-2, x, y-7)
-	setLineWidth(0.1, t1)
-	t2 = createLine(x+l, y-2, x+l, y-7)
-	setLineWidth(0.1, t2)
-	t3 = createLine(x, y+7+h, x, y+2+h)
-	setLineWidth(0.1, t3)
-	t4 = createLine(x+l, y+7+h, x+l, y+2+h)
-	setLineWidth(0.1, t4)
-	t5 = createLine(x-2, y, x-7, y)
-	setLineWidth(0.1, t5)
-	t6 = createLine(x-2, y+h, x-7, y+h)
-	setLineWidth(0.1, t6)
-	t7 = createLine(x+l+2, y+h, x+l+7, y+h)
-	setLineWidth(0.1, t7)
-	t7 = createLine(x+l+2, y, x+l+7, y)
-	setLineWidth(0.1, t7)
-	deselectAll()
-	setUnit(userUnit)
+if __name__ == '__main__':
+    if haveDoc() and selectionCount():
+        main()
+    else:
+        messageBox("trait_de_coupe.py", "Please select an object to put crop marks around<i>before</i> running this script.", ICON_INFORMATION)
Index: samples/wordcount.py
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/samples/wordcount.py,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 wordcount.py
--- samples/wordcount.py	17 Nov 2004 20:33:08 -0000	1.2.2.2
+++ samples/wordcount.py	14 Dec 2004 09:22:17 -0000
@@ -1,45 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: latin-1 -*-
+
 """ Counts the words in the whole document or in a textframe """
 
-# -*- coding: ISO-8859-1 -*-
-from scribus import *
-import re
+import sys
 
+try:
+    from scribus import *
+except ImportError:
+    print "This script only runs from within Scribus."
+    sys.exit(1)
 
-TITLE = "Word count"
-BUTTON_OK = 1
-ICON_INFORMATION = 1
-ICON_WARNING = 2
+import re
 
+TITLE = "Word count"
 
 def wordsplit(text):
-	word_pattern = "([A-Za-z�����]+)"
-	words = []
-	for x in re.split(word_pattern, text):
-		if re.match(word_pattern, x):
-			words.append(x)
-	return words
-
-
-if haveDoc():
-	words = 0
-	sel_count = selectionCount()
-	if sel_count:
-		source = "selected textframe"
-		if sel_count > 1: source += "s" #plural
-		for i in range(sel_count):
-			text = getText(getSelectedObject(i))
-			words += len(wordsplit(text))
-	else:
-		source = "whole document"
-		for page in range(pageCount()):
-			gotoPage(page)
-			for obj in getAllObjects():
-				text = getText(obj)
-				words += len(wordsplit(text))
-
-	if words == 0: words = "No"
-	messageBox(TITLE, "%s words counted in %s" % (words, source),
-			   ICON_INFORMATION, BUTTON_OK)
-
-else:
-	messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK)
+    word_pattern = "([A-Za-z�����]+)"
+    words = []
+    for x in re.split(word_pattern, text):
+        if re.match(word_pattern, x):
+            words.append(x)
+    return words
+
+
+def main():
+    words = 0
+    sel_count = selectionCount()
+    if sel_count:
+        source = "selected textframe"
+        if sel_count > 1: source += "s" #plural
+        for i in range(sel_count):
+            try:
+                text = getText(getSelectedObject(i))
+            except WrongFrameTypeError:
+                if sel_count == 1:
+                    # If there's only one object selected, display a message
+                    messageBox(TITLE, "Can't count words in a non-text frame", ICON_INFORMATION);
+                    sys.exit(1)
+                else:
+                    # otherwise ignore
+                    pass
+            words += len(wordsplit(text))
+    else:
+        source = "whole document"
+        for page in range(1,pageCount() + 1):
+            gotoPage(page)
+            for obj in getAllObjects():
+                try:
+                    text = getText(obj)
+                except WrongFrameTypeError:
+                    pass # ignore the error, it just wasn't a frame we can count
+                words += len(wordsplit(text))
+
+    if words == 0: words = "No"
+    messageBox(TITLE, "%s words counted in %s" % (words, source),
+               ICON_INFORMATION)
+
+
+if __name__ == '__main__':
+    if haveDoc():
+        main()
+    else:
+        messageBox(TITLE, "No document open", ICON_WARNING)

ringerc

2004-12-14 09:56

reporter   ~0003151

Last edited: 2004-12-14 11:14

I've built a version of the base docstrings / unicode patch for 1.3:

translations_and_fixups_UNICODE_INOUT_13.diff

It's the same as the 1.2.1 version except in trivial details where required by changes between 1.2.1 and 1.3.

Also provided is a unicode fixup patch for 1.3 .

UPDATE: Both have been applied.

cbradney

2004-12-14 10:16

administrator   ~0003152

Applied unicode patch to 1.3

2004-12-14 10:36

 

utf_fixes_13.diff (66,345 bytes)   
Index: cmdcolor.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 cmdcolor.cpp
--- cmdcolor.cpp	14 Dec 2004 10:06:14 -0000	1.5.2.5
+++ cmdcolor.cpp	14 Dec 2004 10:36:17 -0000
@@ -10,10 +10,10 @@
 	CListe::Iterator it;
 	l = PyList_New(edc.count());
 	for (it = edc.begin(); it != edc.end(); ++it)
-		{
+	{
 		PyList_SetItem(l, cc, PyString_FromString(it.key().utf8()));
 		cc++;
-		}
+	}
 	return l;
 }
 
Index: cmddialog.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp,v
retrieving revision 1.12.2.10
diff -u -r1.12.2.10 cmddialog.cpp
--- cmddialog.cpp	14 Dec 2004 10:06:14 -0000	1.12.2.10
+++ cmddialog.cpp	14 Dec 2004 10:36:17 -0000
@@ -22,28 +22,33 @@
 	int haspreview = 0;
 	int issave = 0;
 	char* kwargs[] = {"caption", "filter", "defaultname", "haspreview", "issave", NULL};
-	if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssii", kwargs, &caption, &filter, &defName, &haspreview, &issave))
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "es|esesii", kwargs,
+									 "utf-8", &caption, "utf-8", &filter, "utf-8", &defName,
+									 &haspreview, &issave))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	QString fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(haspreview), static_cast<bool>(issave), 0, 0);
+	QString fName = Carrier->CFileDialog(".", QString::fromUtf8(caption), QString::fromUtf8(filter),
+										 QString::fromUtf8(defName), static_cast<bool>(haspreview),
+										 static_cast<bool>(issave), 0, 0);
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+	// FIXME: filename return unicode OK?
 	return PyString_FromString(fName.utf8());
 }
 
 PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw)
 {
-	char *caption = "";
-	char *message = "";
+	char *caption = NULL;
+	char *message = NULL;
 	uint result;
 	QMessageBox::Icon ico = QMessageBox::NoIcon;
 	int butt1 = QMessageBox::Ok|QMessageBox::Default;
 	int butt2 = QMessageBox::NoButton;
 	int butt3 = QMessageBox::NoButton;
 	char* kwargs[] = {"caption", "message", "icon", "button1", "button2", "button3", NULL};
-	if (!PyArg_ParseTupleAndKeywords(args, kw, "ss|iiii", kwargs, &caption, &message, &ico, &butt1, &butt2, &butt3))
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "eses|iiii", kwargs, "utf-8", &caption, "utf-8", &message, &ico, &butt1, &butt2, &butt3))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
-	QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
+	QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, Carrier);
 	result = mb.exec();
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyInt_FromLong(static_cast<long>(result));
@@ -51,16 +56,16 @@
 
 PyObject *scribus_valdialog(PyObject *self, PyObject* args)
 {
-	char *caption = "";
-	char *message = "";
+	char *caption = NULL;
+	char *message = NULL;
 	char *value = "";
-	if (!PyArg_ParseTuple(args, "ss|s", &caption, &message, &value))
+	if (!PyArg_ParseTuple(args, "eses|es", "utf-8", &caption, "utf-8", &message, "utf-8", &value))
 		return NULL;
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
 	ValueDialog *d = new ValueDialog(Carrier, "d", TRUE, 0);
-	d->dialogLabel->setText(message);
-	d->valueEdit->setText(value);
-	d->setCaption(caption);
+	d->dialogLabel->setText(QString::fromUtf8(message));
+	d->valueEdit->setText(QString::fromUtf8(value));
+	d->setCaption(QString::fromUtf8(caption));
 	d->exec();
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 	return PyString_FromString(d->valueEdit->text().utf8());
Index: cmddoc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp,v
retrieving revision 1.9.2.10
diff -u -r1.9.2.10 cmddoc.cpp
--- cmddoc.cpp	14 Dec 2004 10:06:14 -0000	1.9.2.10
+++ cmddoc.cpp	14 Dec 2004 10:36:17 -0000
@@ -65,9 +65,9 @@
 PyObject *scribus_opendoc(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
-	bool ret = Carrier->LadeDoc(QString(Name));
+	bool ret = Carrier->LadeDoc(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to open document","python error"));
@@ -89,11 +89,11 @@
 PyObject *scribus_savedocas(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	bool ret = Carrier->DoFileSave(QString(Name));
+	bool ret = Carrier->DoFileSave(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to save document","python error"));
@@ -108,13 +108,15 @@
 	char *Author;
 	char *Title;
 	char *Desc;
+	// z means string, but None becomes a NULL value. QString()
+	// will correctly handle NULL.
 	if (!PyArg_ParseTuple(args, "zzz", &Author, &Title, &Desc))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	Carrier->doc->DocAutor = QString(Author);
-	Carrier->doc->DocTitel = QString(Title);
-	Carrier->doc->DocComments = QString(Desc);
+	Carrier->doc->DocAutor = QString::fromUtf8(Author);
+	Carrier->doc->DocTitel = QString::fromUtf8(Title);
+	Carrier->doc->DocComments = QString::fromUtf8(Desc);
 	Carrier->slotDocCh();
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -147,11 +149,11 @@
 PyObject *scribus_loadstylesfromfile(PyObject *self, PyObject *args)
 {
 	char *fileName;
-	if (!PyArg_ParseTuple(args, "s", &fileName))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &fileName))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	Carrier->doc->loadStylesFromFile(QString(fileName));
+	Carrier->doc->loadStylesFromFile(QString::fromUtf8(fileName));
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdgetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp,v
retrieving revision 1.8.2.9
diff -u -r1.8.2.9 cmdgetprop.cpp
--- cmdgetprop.cpp	14 Dec 2004 10:06:14 -0000	1.8.2.9
+++ cmdgetprop.cpp	14 Dec 2004 10:36:17 -0000
@@ -3,24 +3,24 @@
 
 PyObject *scribus_getfillcolor(PyObject *self, PyObject* args)
 {
-	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	char *Name = NULL;
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyString_FromString(i->Pcolor) : NULL;
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+	return i != NULL ? PyString_FromString(i->Pcolor.utf8()) : NULL;
 }
 
 PyObject *scribus_getlinecolor(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	PageItem *it;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	it = GetUniqueItem(QString(Name));
+	it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
@@ -28,22 +28,21 @@
 		for (uint b = 0; b < it->Ptext.count(); ++b)
 		{
 			if (it->Ptext.at(b)->cselect)
-				return PyString_FromString(it->Ptext.at(b)->ccolor);
+				return PyString_FromString(it->Ptext.at(b)->ccolor.utf8());
 		}
 	}
 	else
-		return PyString_FromString(it->Pcolor2);
-	return PyString_FromString("");
+		return PyString_FromString(it->Pcolor2.utf8());
 }
 
 PyObject *scribus_getlinewidth(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->Pwidth)) : NULL;
 }
 
@@ -51,11 +50,11 @@
 {
 	char *Name = "";
 	PageItem *it;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	it = GetUniqueItem(QString(Name));
+	it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT)))
@@ -74,110 +73,110 @@
 PyObject *scribus_getlinejoin(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineJoin)) : NULL;
 }
 
 PyObject *scribus_getlineend(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineEnd)) : NULL;
 }
 
 PyObject *scribus_getlinestyle(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineArt)) : NULL;
 }
 
 PyObject *scribus_getfillshade(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->Shade)) : NULL;
 }
 
 PyObject *scribus_getcornerrad(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyInt_FromLong(static_cast<long>(i->RadRect)) : NULL;
 }
 
 PyObject *scribus_getimgscale(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? Py_BuildValue("(ff)", i->LocalScX, i->LocalScY) : NULL;
 }
 
 PyObject *scribus_getimgname(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
-	return i != NULL ? PyString_FromString(i->Pfile) : NULL;
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+	return i != NULL ? PyString_FromString(i->Pfile.utf8()) : NULL;
 }
 
 PyObject *scribus_getposi(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return (i != NULL) ? Py_BuildValue("(ff)", PointToValue(i->Xpos), PointToValue(i->Ypos)) : NULL;
 }
 
 PyObject *scribus_getsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return (i != NULL) ? Py_BuildValue("(ff)", PointToValue(i->Width), PointToValue(i->Height)) : NULL;
 }
 
 PyObject *scribus_getrotation(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->Rot * -1)) : NULL;
 }
 
@@ -210,12 +209,12 @@
 		{
 			if (Carrier->doc->Items.at(lam)->PType == typ)
 			{
-				PyList_SetItem(l, counter2, PyString_FromString(Carrier->doc->Items.at(lam)->AnName));
+				PyList_SetItem(l, counter2, PyString_FromString(Carrier->doc->Items.at(lam)->AnName.utf8()));
 				counter2++;
 			}
 		}
 		else
-			PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Items.at(lam)->AnName));
+			PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Items.at(lam)->AnName.utf8()));
 	}
 	return l;
 }
Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.7.2.10
diff -u -r1.7.2.10 cmdmani.cpp
--- cmdmani.cpp	14 Dec 2004 10:06:14 -0000	1.7.2.10
+++ cmdmani.cpp	14 Dec 2004 10:36:17 -0000
@@ -5,11 +5,11 @@
 {
 	char *Name = "";
 	char *Image;
-	if (!PyArg_ParseTuple(args, "s|s", &Image, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Image, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_IMAGE)
@@ -17,20 +17,21 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error"));
 		return NULL;
 	}
-	Carrier->view->LoadPict(QString(Image), item->ItemNr);
+	Carrier->view->LoadPict(QString::fromUtf8(Image), item->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
 
 PyObject *scribus_scaleimage(PyObject *self, PyObject* args)
 {
+	// FIXME: This function doesn't seem to work...
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(Name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_IMAGE)
@@ -48,11 +49,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item==NULL)
 		return NULL;
 	if (Carrier->view->GroupSel)
@@ -67,11 +68,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	if (Carrier->view->GroupSel)
@@ -95,11 +96,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	Carrier->view->RotateItem(item->Rot - x, item->ItemNr);
@@ -111,11 +112,11 @@
 {
 	char *Name = "";
 	double x;
-	if (!PyArg_ParseTuple(args, "d|s", &x, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &x, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	Carrier->view->RotateItem(x * -1.0, item->ItemNr);
@@ -127,11 +128,11 @@
 {
 	char *Name = "";
 	double x, y;
-	if (!PyArg_ParseTuple(args, "dd|s", &x, &y, &Name))
+	if (!PyArg_ParseTuple(args, "dd|es", &x, &y, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(Name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
 	Carrier->view->SizeItem(ValueToPoint(x) - item->Xpos, ValueToPoint(y) - item->Ypos, item->ItemNr);
@@ -158,8 +159,11 @@
 		}
 		for (int i = 0; i < len; i++)
 		{
+			// FIXME: We might need to explicitly get this string as utf8
+			// but as sysdefaultencoding is utf8 it should be a no-op to do
+			// so anyway.
 			Name = PyString_AsString(PyList_GetItem(il, i));
-			PageItem *ic = GetUniqueItem(QString(Name));
+			PageItem *ic = GetUniqueItem(QString::fromUtf8(Name));
 			if (ic == NULL)
 				return NULL;
 			Carrier->view->SelectItemNr(ic->ItemNr);
@@ -178,11 +182,11 @@
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";;
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	Carrier->UnGroupObj();
@@ -194,7 +198,7 @@
 {
 	char *Name = "";
 	double sc;
-	if (!PyArg_ParseTuple(args, "d|s", &sc, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &sc, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -203,7 +207,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't scale by 0%","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	Carrier->view->Deselect();
@@ -224,8 +228,9 @@
 	if(!checkHaveDocument())
 		return NULL;
 	if ((i < static_cast<int>(Carrier->view->SelItem.count())) && (i > -1))
-		return PyString_FromString(Carrier->view->SelItem.at(i)->AnName);
+		return PyString_FromString(Carrier->view->SelItem.at(i)->AnName.utf8());
 	else
+		// FIXME: Should probably return None if no selection?
 		return PyString_FromString("");
 }
 
@@ -239,11 +244,11 @@
 PyObject *scribus_selectobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	Carrier->view->SelectItemNr(i->ItemNr);
@@ -263,11 +268,11 @@
 PyObject *scribus_lockobject(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	item->Locked = !item->Locked;
@@ -279,13 +284,13 @@
 PyObject *scribus_islocked(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	// FIXME: Rather than toggling the lock, we should probably let the user set the lock state
 	// and instead provide a different function like toggleLock()
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->Locked)
Index: cmdmisc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp,v
retrieving revision 1.12.2.12
diff -u -r1.12.2.12 cmdmisc.cpp
--- cmdmisc.cpp	14 Dec 2004 10:06:14 -0000	1.12.2.12
+++ cmdmisc.cpp	14 Dec 2004 10:36:17 -0000
@@ -31,7 +31,7 @@
 	{
 		if (it.current()->UseFont)
 		{
-			PyList_SetItem(l, cc, PyString_FromString(it.currentKey()));
+			PyList_SetItem(l, cc, PyString_FromString(it.currentKey().utf8()));
 			cc++;
 		}
 	}
@@ -47,14 +47,14 @@
 	for ( ; it.current() ; ++it)
 	{
 		row = Py_BuildValue((char*)"(sssiis)",
-		                    it.currentKey().ascii(),// it.currentKey().length(),
-		                    it.current()->Family.ascii(),
-		                    it.current()->RealName().ascii(),
+		                    it.currentKey().utf8(),
+		                    it.current()->Family.utf8(),
+		                    it.current()->RealName().utf8(),
 		                    it.current()->Subset,
 		                    it.current()->EmbedPS,
-		                    it.current()->Datei.ascii()//, it.current()->Datei.length()
+		                    it.current()->Datei.utf8()
 		                   );
-		PyList_SetItem(l, cc, row);//PyString_FromString(it.currentKey()));
+		PyList_SetItem(l, cc, row);
 		cc++;
 	} // for
 	return l;
@@ -67,27 +67,27 @@
 	char *Sample = "";
 	int Size;
 	bool ret = false;
-	if (!PyArg_ParseTuple(args, "sssi", &Name, &FileName, &Sample, &Size))
+	if (!PyArg_ParseTuple(args, "esesesi", "utf-8", &Name, "utf-8", &FileName, "utf-8", &Sample, &Size))
 		return NULL;
-	if (!Carrier->Prefs.AvailFonts.find(QString(Name)))
+	if (!Carrier->Prefs.AvailFonts.find(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Font not found","python error"));
 		return NULL;
 	}
-	QString ts = QString(Sample);
+	QString ts = QString::fromUtf8(Sample);
 	if (ts == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't render an empty sample","python error"));
 		return NULL;
 	}
-	if (QString(FileName) == "")
+	if (QString::fromUtf8(FileName) == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't save to a blank filename","python error"));
 		return NULL;
 	}
-	QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
+	QString da = Carrier->Prefs.AvailFonts[QString::fromUtf8(Name)]->Datei;
 	QPixmap pm = FontSample(da, Size, ts, Qt::white);
-	ret = pm.save(QString(FileName), "PPM");
+	ret = pm.save(QString::fromUtf8(FileName), "PPM");
 	// FIXME: we should probably return None on success and throw an exception on failure
 	// rather than returning an error code here.
 	return PyInt_FromLong(static_cast<long>(ret));
@@ -100,18 +100,18 @@
 	PyObject *l;
 	l = PyList_New(Carrier->doc->Layers.count());
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
-		PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Layers[lam].Name));
+		PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Layers[lam].Name.utf8()));
 	return l;
 }
 
 PyObject *scribus_setactlayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == 0)
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -120,7 +120,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(lam);
 			Carrier->doc->ActiveLayer = i;
@@ -142,23 +142,23 @@
 {
 	if(!checkHaveDocument())
 		return NULL;
-	return PyString_FromString(Carrier->doc->Layers[Carrier->doc->ActiveLayer].Name);
+	return PyString_FromString(Carrier->doc->Layers[Carrier->doc->ActiveLayer].Name.utf8());
 }
 
 PyObject *scribus_senttolayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	char *Layer = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Layer, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Layer, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Layer, "") == 0)
+	if (Layer == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	Carrier->view->SelectItemNr(i->ItemNr);
@@ -167,7 +167,7 @@
 	{
 		Carrier->view->SelectItemNr(i->ItemNr);
 		for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
-			if (Carrier->doc->Layers[lam].Name == QString(Layer))
+			if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Layer))
 			{
 				i->LayerNr = static_cast<int>(lam);
 				found = true;
@@ -188,7 +188,7 @@
 {
 	char *Name = "";
 	int vis = 1;
-	if (!PyArg_ParseTuple(args, "si", &Name, &vis))
+	if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -200,7 +200,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			Carrier->doc->Layers[lam].Sichtbar = vis;
 			found = true;
@@ -220,11 +220,11 @@
 {
 	char *Name = "";
 	int vis = 1;
-	if (!PyArg_ParseTuple(args, "si", &Name, &vis))
+	if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -232,7 +232,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			Carrier->doc->Layers[lam].Drucken = vis;
 			found = true;
@@ -251,11 +251,11 @@
 PyObject *scribus_glayervisib(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -264,7 +264,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(Carrier->doc->Layers[lam].Sichtbar);
 			found = true;
@@ -282,11 +282,11 @@
 PyObject *scribus_glayerprint(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -295,7 +295,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			i = static_cast<int>(Carrier->doc->Layers[lam].Drucken);
 			found = true;
@@ -313,11 +313,11 @@
 PyObject *scribus_removelayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, ""))
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't have an empty layer name","python error"));
 		return NULL;
@@ -330,7 +330,7 @@
 	bool found = false;
 	for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
 	{
-		if (Carrier->doc->Layers[lam].Name == QString(Name))
+		if (Carrier->doc->Layers[lam].Name == QString::fromUtf8(Name))
 		{
 			QValueList<Layer>::iterator it2 = Carrier->doc->Layers.at(lam);
 			int num2 = (*it2).LNr;
@@ -368,11 +368,11 @@
 PyObject *scribus_createlayer(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (strcmp(Name, "") == 0)
+	if (Name == "")
 	{
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Can't create layer without a name","python error"));
 		return NULL;
@@ -382,7 +382,7 @@
 	ll.LNr = Carrier->doc->Layers.last().LNr + 1;
 	ll.Level = Carrier->doc->Layers.count();
 	// FIXME: what if the name exists?
-	ll.Name = QString(Name);
+	ll.Name = QString::fromUtf8(Name);
 	ll.Sichtbar = true;
 	ll.Drucken = true;
 	Carrier->doc->Layers.append(ll);
@@ -394,6 +394,6 @@
 
 PyObject *scribus_getlanguage(PyObject *self)
 {
-	return PyString_FromString(Carrier->getGuiLanguage());
+	return PyString_FromString(Carrier->getGuiLanguage().utf8());
 }
 
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.11.2.12
diff -u -r1.11.2.12 cmdobj.cpp
--- cmdobj.cpp	14 Dec 2004 10:06:14 -0000	1.11.2.12
+++ cmdobj.cpp	14 Dec 2004 10:36:17 -0000
@@ -6,12 +6,12 @@
 PyObject *scribus_newrect(PyObject *self, PyObject* args)
 {
 	double x, y, b, h;
-	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	char *Name = NULL;
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -21,8 +21,8 @@
 															Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
 	Carrier->view->SetRectFrame(Carrier->doc->Items.at(i));
 	if (Name != "")
-		Carrier->doc->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->Items.at(i)->AnName);
+		Carrier->doc->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->Items.at(i)->AnName.utf8());
 }
 
 
@@ -30,20 +30,20 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	int i = Carrier->view->PaintEllipse(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h), Carrier->doc->Dwidth, Carrier->doc->Dbrush, Carrier->doc->Dpen);
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetOvalFrame(Carrier->doc->Items.at(i));
 	if (Name != "")
-		Carrier->doc->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->Items.at(i)->AnName);
+		Carrier->doc->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->Items.at(i)->AnName.utf8());
 }
 
 
@@ -51,20 +51,20 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	int i = Carrier->view->PaintPict(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h));
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetRectFrame(Carrier->doc->Items.at(i));
 	if (Name != "")
-		Carrier->doc->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->Items.at(i)->AnName);
+		Carrier->doc->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->Items.at(i)->AnName.utf8());
 }
 
 
@@ -72,20 +72,20 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	int i = Carrier->view->PaintText(ValueToPoint(x), ValueToPoint(y), ValueToPoint(b), ValueToPoint(h), Carrier->doc->Dwidth, Carrier->doc->DpenText);
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	Carrier->view->SetRectFrame(Carrier->doc->Items.at(i));
 	if (Name != "")
-		Carrier->doc->Items.at(i)->AnName = QString(Name);
-	return PyString_FromString(Carrier->doc->Items.at(i)->AnName);
+		Carrier->doc->Items.at(i)->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(Carrier->doc->Items.at(i)->AnName.utf8());
 }
 
 
@@ -93,14 +93,14 @@
 {
 	double x, y, b, h;
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "dddd|s", &x, &y, &b, &h, &Name))
+	if (!PyArg_ParseTuple(args, "dddd|es", &x, &y, &b, &h, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	x =	ValueToPoint(x);
 	y = ValueToPoint(y);
 	b = ValueToPoint(b);
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -127,8 +127,8 @@
 	Carrier->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), i, false, false);
 	Carrier->view->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -136,7 +136,8 @@
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -151,7 +152,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -200,9 +201,9 @@
 	Carrier->view->AdjustItemSize(it);
 	if (Name != "")
 	{
-		it->AnName = QString(Name);
+		it->AnName = QString::fromUtf8(Name);
 	}
-	return PyString_FromString(it->AnName);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -210,7 +211,8 @@
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -225,7 +227,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must contain an even number of values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -278,15 +280,16 @@
 	Carrier->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false);
 	Carrier->view->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 PyObject *scribus_bezierline(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	PyObject *il;
-	if ((!PyArg_ParseTuple(args, "O|s", &il, &Name)) || (!PyList_Check(il)))
+	// FIXME: PyList_Check failing will cause the function to return NULL w/o an exception. Separarate out the check.
+	if ((!PyArg_ParseTuple(args, "O|es", &il, "utf-8", &Name)) || (!PyList_Check(il)))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -301,7 +304,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Point list must have a multiple of six values","python error"));
 		return NULL;
 	}
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
@@ -363,8 +366,8 @@
 	Carrier->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false);
 	Carrier->view->AdjustItemSize(it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -376,19 +379,19 @@
 	char *Name = "";
 	char *TextB = "";
 	char *PolyB = "";
-	if (!PyArg_ParseTuple(args, "ddss|s", &x, &y, &TextB, &PolyB, &Name))
+	if (!PyArg_ParseTuple(args, "ddeses|es", &x, &y, "utf-8", &TextB, "utf-8", &PolyB, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(Name)))
+	if (ItemExists(QString::fromUtf8(Name)))
 	{
 		PyErr_SetString(NameExistsError, QObject::tr("An object with the requested name already exists","python error"));
 		return NULL;
 	}
 	//FIXME: Why use GetItem not GetUniqueItem? Maybe use GetUniqueItem and use the exceptions
 	// its sets for us?
-	int i = GetItem(QString(TextB));
-	int ii = GetItem(QString(PolyB));
+	int i = GetItem(QString::fromUtf8(TextB));
+	int ii = GetItem(QString::fromUtf8(PolyB));
 	if ((i == -1) || (ii == -1))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Object not found","python error"));
@@ -401,8 +404,8 @@
 	Carrier->view->ToPathText();
 	Carrier->view->MoveItem(ValueToPoint(x) - it->Xpos, ValueToPoint(y) - it->Ypos, it);
 	if (Name != "")
-		it->AnName = QString(Name);
-	return PyString_FromString(it->AnName);
+		it->AnName = QString::fromUtf8(Name);
+	return PyString_FromString(it->AnName.utf8());
 }
 
 
@@ -411,11 +414,11 @@
 PyObject *scribus_deleteobj(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	Carrier->view->SelItem.clear();
@@ -433,11 +436,11 @@
 	char *name = "";
 	int state = -1;
 
-	if (!PyArg_ParseTuple(args, "s|i", &name, &state))
+	if (!PyArg_ParseTuple(args, "es|i", "utf-8", &name, &state))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(name));
 	if (i == NULL)
 		return NULL;
 	if (state == -1)
@@ -454,11 +457,11 @@
 PyObject *scribus_objectexists(PyObject *self, PyObject* args)
 {
 	char* name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	if (ItemExists(QString(name)))
+	if (ItemExists(QString::fromUtf8(name)))
 		return PyBool_FromLong(static_cast<long>(true));
 	return PyBool_FromLong(static_cast<long>(false));
 }
@@ -470,16 +473,16 @@
  */
 PyObject *scribus_setstyle(PyObject *self, PyObject* args)
 {
-	char *Style = "";
+	char *style = "";
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Style, &name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &style, "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
-	if (item->PType == FRAME_TEXT)
+	if ((item->PType == FRAME_TEXT) || (item->PType == FRAME_PATHTEXT))
 	{
 		/*
 		 * First, find the style number associated with the requested style
@@ -492,7 +495,7 @@
 		// We start at zero here because it's OK to match an internal name
 		for (uint i=0; i < Carrier->doc->Vorlagen.count(); ++i)
 		{
-			if (Carrier->doc->Vorlagen[i].Vname == Style) {
+			if (Carrier->doc->Vorlagen[i].Vname == QString::fromUtf8(style)) {
 				found = true;
 				styleid = i;
 				break;
@@ -535,7 +538,7 @@
 	*/
 	for (uint i=0; i < Carrier->doc->Vorlagen.count(); ++i)
 	{
-		if (PyList_Append(styleList, PyString_FromString(Carrier->doc->Vorlagen[i].Vname)))
+		if (PyList_Append(styleList, PyString_FromString(Carrier->doc->Vorlagen[i].Vname.utf8())))
 		{
 			// An exception will have already been set by PyList_Append apparently.
 			return NULL;
Index: cmdpage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v
retrieving revision 1.11.2.11
diff -u -r1.11.2.11 cmdpage.cpp
--- cmdpage.cpp	14 Dec 2004 10:06:14 -0000	1.11.2.11
+++ cmdpage.cpp	14 Dec 2004 10:36:17 -0000
@@ -20,11 +20,11 @@
 PyObject *scribus_savepageeps(PyObject *self, PyObject* args)
 {
 	char *Name;
-	if (!PyArg_ParseTuple(args, "s", &Name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	bool ret = Carrier->DoSaveAsEps(QString(Name));
+	bool ret = Carrier->DoSaveAsEps(QString::fromUtf8(Name));
 	if (!ret)
 	{
 		PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS","python error"));
@@ -74,12 +74,12 @@
 {
 	int e;
 	char *name = "Normal";
-	if (!PyArg_ParseTuple(args, "i|s", &e, &name))
+	if (!PyArg_ParseTuple(args, "i|es", &e, "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	if (e < 0)
-		Carrier->slotNewPageP(Carrier->doc->Pages.count(), QString(name));
+		Carrier->slotNewPageP(Carrier->doc->Pages.count(), QString::fromUtf8(name));
 	else
 	{
 		e--;
@@ -88,7 +88,7 @@
 			PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range","python error"));
 			return NULL;
 		}
-		Carrier->slotNewPageP(e, QString(name));
+		Carrier->slotNewPageP(e, QString::fromUtf8(name));
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
Index: cmdsetprop.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp,v
retrieving revision 1.8.2.9
diff -u -r1.8.2.9 cmdsetprop.cpp
--- cmdsetprop.cpp	14 Dec 2004 10:06:14 -0000	1.8.2.9
+++ cmdsetprop.cpp	14 Dec 2004 10:36:17 -0000
@@ -7,17 +7,17 @@
 	char *Color1;
 	char *Color2;
 	int typ, shade1, shade2;
-	if (!PyArg_ParseTuple(args, "isisi|s", &typ, &Color1, &shade1, &Color2, &shade2, &Name))
+	if (!PyArg_ParseTuple(args, "iesiesi|es", &typ, "utf-8", &Color1, &shade1, "utf-8", &Color2, &shade2, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
 	QColor tmp;
 	b->fill_gradient.clearStops();
-	QString c1 = QString(Color1);
-	QString c2 = QString(Color2);
+	QString c1 = QString::fromUtf8(Color1);
+	QString c2 = QString::fromUtf8(Color2);
 	b->SetFarbe(&tmp, c1, shade1);
 	b->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, c1, shade1);
 	b->SetFarbe(&tmp, c2, shade2);
@@ -33,14 +33,14 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
-	i->Pcolor = QString(Color);
+	i->Pcolor = QString::fromUtf8(Color);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -49,14 +49,14 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
-	it->Pcolor2 = QString(Color);
+	it->Pcolor2 = QString::fromUtf8(Color);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -65,7 +65,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -74,7 +74,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line width out of bounds, must be 0 <= line_width <= 12","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->Pwidth = w;
@@ -86,7 +86,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -95,7 +95,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	it->Shade2 = w;
@@ -107,7 +107,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -116,7 +116,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Fill shade out of bounds, must be 0 <= shade <= 100","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->Shade = w;
@@ -128,11 +128,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineJoin = Qt::PenJoinStyle(w);
@@ -144,11 +144,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineEnd = Qt::PenCapStyle(w);
@@ -160,11 +160,11 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	i->PLineArt = Qt::PenStyle(w);
@@ -176,7 +176,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -185,10 +185,11 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error"));
 		return NULL;
 	}
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
 	// What the heck is a type 3 frame?
+	// FIXME: Doesn't seem to work, at least on rect/polygon frames
 	if ((b->PType == FRAME_IMAGE) || (b->PType == 3) || (b->PType == FRAME_TEXT))
 	{
 		if ((b->PType == 2) || (b->PType == 3) || (b->PType == 4))
@@ -210,19 +211,19 @@
 {
 	char *Name = "";
 	char *Style = NULL;
-	if (!PyArg_ParseTuple(args, "s|s", &Style, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Style, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *b = GetUniqueItem(QString(Name));
+	PageItem *b = GetUniqueItem(QString::fromUtf8(Name));
 	if (b == NULL)
 		return NULL;
-	if (!Carrier->doc->MLineStyles.contains(QString(Style)))
+	if (!Carrier->doc->MLineStyles.contains(QString::fromUtf8(Style)))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Line style not found","python error"));
 		return NULL;
 	}
-	b->NamedLStyle = QString(Style);
+	b->NamedLStyle = QString::fromUtf8(Style);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
Index: cmdtext.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp,v
retrieving revision 1.19.2.10
diff -u -r1.19.2.10 cmdtext.cpp
--- cmdtext.cpp	9 Dec 2004 16:52:52 -0000	1.19.2.10
+++ cmdtext.cpp	14 Dec 2004 10:36:17 -0000
@@ -4,11 +4,11 @@
 PyObject *scribus_getfontsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -29,11 +29,11 @@
 PyObject *scribus_getfont(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -45,20 +45,20 @@
 	{
 		for (uint b = 0; b < it->Ptext.count(); b++)
 			if (it->Ptext.at(b)->cselect)
-				return PyString_FromString(it->Ptext.at(b)->cfont);
+				return PyString_FromString(it->Ptext.at(b)->cfont.utf8());
 	}
 	else
-		return PyString_FromString(it->IFont);
+		return PyString_FromString(it->IFont.utf8());
 }
 
 PyObject *scribus_gettextsize(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
@@ -72,11 +72,11 @@
 PyObject *scribus_getcolumns(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -90,11 +90,11 @@
 PyObject *scribus_getlinespace(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -108,11 +108,11 @@
 PyObject *scribus_getcolumngap(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -126,12 +126,12 @@
 PyObject *scribus_getframetext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	QString text = "";
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -151,18 +151,18 @@
 			text += it->Ptext.at(a)->ch;
 		}
 	}
-	return PyString_FromString(text);
+	return PyString_FromString(text.utf8());
 }
 
 PyObject *scribus_gettext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
 	QString text = "";
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -227,18 +227,18 @@
 			}
 		} // for
 	} // while
-	return PyString_FromString(text);
+	return PyString_FromString(text.utf8());
 }
 
 PyObject *scribus_setboxtext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
 	char *Text;
-	if (!PyArg_ParseTuple(args, "es|s", "utf-8", &Text, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Text, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -293,11 +293,11 @@
 	char *Name = "";
 	char *Text;
 	int pos;
-	if (!PyArg_ParseTuple(args, "esi|s", "utf-8", &Text, &pos, &Name))
+	if (!PyArg_ParseTuple(args, "esi|es", "utf-8", &Text, &pos, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -346,7 +346,7 @@
 {
 	char *Name = "";
 	int alignment;
-	if (!PyArg_ParseTuple(args, "i|s", &alignment, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &alignment, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -355,7 +355,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of range. Use one of the scribus.ALIGN* constants.","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -379,7 +379,7 @@
 {
 	char *Name = "";
 	double size;
-	if (!PyArg_ParseTuple(args, "d|s", &size, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &size, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -388,7 +388,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Font size out of bounds - must be 1 <= size <= 512","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	
@@ -413,11 +413,11 @@
 {
 	char *Name = "";
 	char *Font = "";
-	if (!PyArg_ParseTuple(args, "s|s", &Font, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Font, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT))
@@ -425,14 +425,14 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font on a non-text frame","python error"));
 		return NULL;
 	}
-	if (Carrier->Prefs.AvailFonts.find(QString(Font)))
+	if (Carrier->Prefs.AvailFonts.find(QString::fromUtf8(Font)))
 	{
 		int Apm = Carrier->doc->AppMode;
 		Carrier->view->SelItem.clear();
 		Carrier->view->SelItem.append(i);
 		if (i->HasSel)
 			Carrier->doc->AppMode = 7;
-		Carrier->SetNewFont(QString(Font));
+		Carrier->SetNewFont(QString::fromUtf8(Font));
 		Carrier->doc->AppMode = Apm;
 		Carrier->view->Deselect();
 	}
@@ -449,7 +449,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -458,7 +458,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Line space out of bounds, must be >= 0.1","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -475,7 +475,7 @@
 {
 	char *Name = "";
 	double w;
-	if (!PyArg_ParseTuple(args, "d|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "d|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -484,7 +484,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Column gap out of bounds, must be positive","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -501,7 +501,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -510,7 +510,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("Column count out of bounds, must be > 1","python error"));
 		return NULL;
 	}
-	PageItem *i = GetUniqueItem(QString(Name));
+	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
 	if (i->PType != FRAME_TEXT)
@@ -527,11 +527,11 @@
 {
 	char *Name = "";
 	int start, ende;
-	if (!PyArg_ParseTuple(args, "ii|s", &start, &ende, &Name))
+	if (!PyArg_ParseTuple(args, "ii|es", &start, &ende, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((start < 0) || ((start + ende) > static_cast<int>(it->Ptext.count()-1)))
@@ -569,11 +569,11 @@
 PyObject *scribus_deletetext(PyObject *self, PyObject* args)
 {
 	char *Name = "";
-	if (!PyArg_ParseTuple(args, "|s", &Name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -596,11 +596,11 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -615,12 +615,12 @@
 			if (it->HasSel)
 			{
 				if (it->Ptext.at(b)->cselect)
-					it->Ptext.at(b)->ccolor = QString(Color);
+					it->Ptext.at(b)->ccolor = QString::fromUtf8(Color);
 			}
 			else
-				it->Ptext.at(b)->ccolor = QString(Color);
+				it->Ptext.at(b)->ccolor = QString::fromUtf8(Color);
 		}
-		it->TxtFill = QString(Color);
+		it->TxtFill = QString::fromUtf8(Color);
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -630,11 +630,11 @@
 {
 	char *Name = "";
 	char *Color;
-	if (!PyArg_ParseTuple(args, "s|s", &Color, &Name))
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Color, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -649,12 +649,12 @@
 			if (it->HasSel)
 			{
 				if (it->Ptext.at(b)->cselect)
-					it->Ptext.at(b)->cstroke = QString(Color);
+					it->Ptext.at(b)->cstroke = QString::fromUtf8(Color);
 			}
 			else
-				it->Ptext.at(b)->cstroke = QString(Color);
+				it->Ptext.at(b)->cstroke = QString::fromUtf8(Color);
 		}
-		it->TxtStroke = QString(Color);
+		it->TxtStroke = QString::fromUtf8(Color);
 	}
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -664,7 +664,7 @@
 {
 	char *Name = "";
 	int w;
-	if (!PyArg_ParseTuple(args, "i|s", &w, &Name))
+	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
@@ -673,7 +673,7 @@
 		Py_INCREF(Py_None);
 		return Py_None;
 	}
-	PageItem *it = GetUniqueItem(QString(Name));
+	PageItem *it = GetUniqueItem(QString::fromUtf8(Name));
 	if (it == NULL)
 		return NULL;
 	if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT))
@@ -704,14 +704,14 @@
 	char *name1;
 	char *name2;
 
-	if (!PyArg_ParseTuple(args, "ss", &name1, &name2))
+	if (!PyArg_ParseTuple(args, "eses", "utf-8", &name1, "utf-8", &name2))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *fromitem = GetUniqueItem(QString(name1));
+	PageItem *fromitem = GetUniqueItem(QString::fromUtf8(name1));
 	if (fromitem == NULL)
 		return NULL;
-	PageItem *toitem = GetUniqueItem(QString(name2));
+	PageItem *toitem = GetUniqueItem(QString::fromUtf8(name2));
 	if (toitem == NULL)
 		return NULL;
 	if ((fromitem->PType != FRAME_TEXT) || (toitem->PType != FRAME_TEXT))
@@ -752,11 +752,11 @@
 PyObject *scribus_unlinktextframes(PyObject * self, PyObject* args)
 {
 	char *name;
-	if (!PyArg_ParseTuple(args, "s", &name))
+	if (!PyArg_ParseTuple(args, "es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(name);
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_TEXT)
@@ -804,11 +804,11 @@
 PyObject *scribus_tracetext(PyObject *self, PyObject* args)
 {
 	char *name = "";
-	if (!PyArg_ParseTuple(args, "|s", &name))
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
 		return NULL;
 	if(!checkHaveDocument())
 		return NULL;
-	PageItem *item = GetUniqueItem(QString(name));
+	PageItem *item = GetUniqueItem(QString::fromUtf8(name));
 	if (item == NULL)
 		return NULL;
 	if (item->PType != FRAME_TEXT)
Index: guiapp.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.cpp,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 guiapp.cpp
--- guiapp.cpp	3 Dec 2004 15:05:48 -0000	1.5.2.5
+++ guiapp.cpp	14 Dec 2004 10:36:17 -0000
@@ -14,10 +14,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_progressreset(PyObject *self, PyObject* args)
+PyObject *scribus_progressreset(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-		return NULL;
 	Carrier->FProg->reset();
 	qApp->processEvents();
 	Py_INCREF(Py_None);
@@ -57,9 +55,9 @@
 {
 	char *aCursor;
 	qDebug("WARNING! SetCursor() is not stable!");
-	if (!PyArg_ParseTuple(args, "s", &aCursor))
+	if (!PyArg_ParseTuple(args, "es", "ascii", &aCursor))
 		return NULL;
-	if (aCursor=="wait")
+	if (strcmp(aCursor, "wait") == 0)
 		qApp->setOverrideCursor(Qt::WaitCursor);
 	else
 		qApp->restoreOverrideCursor();
Index: guiapp.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/guiapp.h,v
retrieving revision 1.2.2.4
diff -u -r1.2.2.4 guiapp.h
--- guiapp.h	14 Dec 2004 10:06:14 -0000	1.2.2.4
+++ guiapp.h	14 Dec 2004 10:36:17 -0000
@@ -32,7 +32,7 @@
 TODO: check total vs. set values.
 (Petr Vanek 02/19/04)
 */
-PyObject *scribus_progressreset(PyObject *self, PyObject* args);
+PyObject *scribus_progressreset(PyObject *self);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_progresssettotalsteps__doc__,
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.33.2.25
diff -u -r1.33.2.25 scriptplugin.cpp
--- scriptplugin.cpp	14 Dec 2004 10:06:14 -0000	1.33.2.25
+++ scriptplugin.cpp	14 Dec 2004 10:36:18 -0000
@@ -659,7 +659,7 @@
 	{"openDoc", scribus_opendoc, METH_VARARGS, tr(scribus_opendoc__doc__)},
 	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, tr(scribus_pagecount__doc__)},
 	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)},
-	{"progressReset", scribus_progressreset, METH_VARARGS, tr(scribus_progressreset__doc__)},
+	{"progressReset", (PyCFunction)scribus_progressreset, METH_NOARGS, tr(scribus_progressreset__doc__)},
 	{"progressSet", scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
 	{"progressTotal", scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
 	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
utf_fixes_13.diff (66,345 bytes)   

cbradney

2004-12-19 16:47

administrator   ~0003181

Is this one we can now resolve and close? IE, It would be good to close for 1.2.1 release so its in the bug list, and closing this should not really depends on other Scripter bugs that have their own bug. The major part of the work has been done AFAIK and any new work should probably only happen to 1.3 anyway.

1287? CR please send me the file you want to replace calendier.py with
1317?

ringerc

2004-12-19 17:21

reporter   ~0003182

cbradney, I agree that closing this seems sensible.

0001287 still needs some work. I do not want to replace the current calendar script, as mine is ... very complicated. Too complicated, really, but useful. I hope to have that done soon.

0001317 could really use some input from others, but otherwise should probably go in. I need HTML-ize the FAQ, I assume?

subik

2004-12-20 12:28

manager   ~0003186

The Scripter BigBang is finished as we decided together. Now we can test it.

thanks to all esp. CraigR ;)

Issue History

Date Modified Username Field Change
2004-11-07 19:56 subik New Issue
2004-11-07 19:58 subik Note Added: 0002807
2004-11-08 10:47 plinnell Relationship added related to 0001287
2004-11-10 15:34 ringerc Note Added: 0002861
2004-11-10 15:38 ringerc Note Added: 0002862
2004-11-10 16:10 subik Note Added: 0002863
2004-11-10 16:19 ringerc Note Added: 0002865
2004-11-10 17:15 ringerc Note Added: 0002866
2004-11-10 17:23 ringerc Note Added: 0002867
2004-11-10 19:30 ringerc File Added: untested_error_handling.diff
2004-11-10 19:36 ringerc Note Added: 0002870
2004-11-11 06:36 ringerc File Deleted: untested_error_handling.diff
2004-11-11 06:37 ringerc File Added: untested_error_handling_2.diff
2004-11-12 11:00 ringerc File Deleted: untested_error_handling_2.diff
2004-11-12 11:01 ringerc File Added: error_handling_3.diff
2004-11-12 11:07 ringerc Note Added: 0002884
2004-11-12 11:09 ringerc Note Edited: 0002870
2004-11-12 12:36 ringerc Note Added: 0002886
2004-11-12 16:53 cbradney Note Added: 0002887
2004-11-12 17:08 ringerc Note Added: 0002888
2004-11-12 17:11 ringerc Note Edited: 0002888
2004-11-14 17:26 subik Note Added: 0002889
2004-11-16 04:25 ringerc File Added: make_redraw_not_havedoc.diff
2004-11-16 04:28 ringerc File Deleted: make_redraw_not_havedoc.diff
2004-11-16 04:40 ringerc Relationship added related to 0001317
2004-11-21 07:49 ringerc Note Added: 0002918
2004-11-21 08:52 ringerc Note Added: 0002919
2004-11-21 09:14 ringerc Note Edited: 0002861
2004-11-21 13:16 subik Note Added: 0002922
2004-11-21 13:45 ringerc Note Added: 0002923
2004-11-21 13:47 ringerc File Added: error_handling_3_Version13.diff
2004-11-21 14:13 ringerc Note Added: 0002924
2004-11-21 14:21 ringerc Note Added: 0002925
2004-11-21 16:09 ringerc File Deleted: error_handling_3.diff
2004-11-21 16:09 ringerc File Deleted: error_handling_3_Version13.diff
2004-11-21 16:09 ringerc File Added: error_handling_4.diff
2004-11-21 16:09 ringerc File Added: error_handling_4_Version13.diff
2004-11-21 16:10 ringerc Note Added: 0002929
2004-11-25 06:41 subik Additional Information Updated
2004-11-25 06:49 ringerc Additional Information Updated
2004-11-25 07:00 ringerc Description Updated
2004-11-25 07:04 ringerc Note Added: 0002943
2004-11-25 07:09 ringerc Description Updated
2004-11-25 18:14 subik Note Added: 0002945
2004-11-25 18:14 subik File Added: scripter-docs.tar.gz
2004-11-25 18:15 subik File Deleted: error_handling_4_Version13.diff
2004-11-25 18:15 subik File Deleted: error_handling_4.diff
2004-11-25 18:16 subik Additional Information Updated
2004-11-25 19:13 ringerc Note Added: 0002946
2004-11-25 19:14 ringerc File Added: scriptplugin_constant_aliasing.diff
2004-11-26 16:57 subik File Deleted: scriptplugin_constant_aliasing.diff
2004-11-26 17:01 subik Additional Information Updated
2004-11-26 19:02 subik File Deleted: scripter-docs.tar.gz
2004-11-26 19:03 subik Additional Information Updated
2004-11-26 19:05 subik Note Added: 0002947
2004-11-26 19:16 subik Note Added: 0002948
2004-11-26 19:45 ringerc Note Added: 0002949
2004-11-26 19:46 ringerc Note Edited: 0002949
2004-11-27 10:33 cbradney Note Added: 0002950
2004-11-27 10:33 cbradney Note Edited: 0002950
2004-11-27 11:10 ringerc Note Added: 0002951
2004-11-27 21:34 subik Description Updated
2004-11-27 21:34 subik Additional Information Updated
2004-11-30 14:15 subik Note Added: 0002955
2004-11-30 14:15 subik Description Updated
2004-11-30 14:15 subik Additional Information Updated
2004-11-30 14:20 ringerc Description Updated
2004-11-30 14:20 ringerc Additional Information Updated
2004-11-30 14:37 ringerc File Added: arg_excptions_121.diff
2004-11-30 14:37 ringerc File Added: arg_excptions_13.diff
2004-11-30 14:40 ringerc Note Added: 0002956
2004-11-30 14:42 ringerc Description Updated
2004-11-30 14:42 ringerc Additional Information Updated
2004-11-30 14:56 ringerc Note Added: 0002957
2004-11-30 14:59 ringerc Note Edited: 0002957
2004-11-30 15:13 ringerc Note Edited: 0002957
2004-12-01 07:14 subik Note Added: 0002961
2004-12-01 16:22 subik Note Added: 0002964
2004-12-01 16:22 subik Additional Information Updated
2004-12-03 11:21 ringerc File Deleted: arg_excptions_121.diff
2004-12-03 11:21 ringerc File Deleted: arg_excptions_13.diff
2004-12-03 11:26 ringerc Note Added: 0002973
2004-12-03 11:27 ringerc File Added: header_tidy_121.diff
2004-12-03 11:28 ringerc File Added: header_tidy_13.diff
2004-12-03 11:32 ringerc Note Edited: 0002973
2004-12-03 15:55 subik File Deleted: header_tidy_13.diff
2004-12-03 15:55 subik File Deleted: header_tidy_121.diff
2004-12-03 15:55 subik Note Added: 0002975
2004-12-03 16:45 ringerc Description Updated
2004-12-03 16:49 ringerc Note Added: 0002976
2004-12-08 08:12 ringerc Description Updated
2004-12-08 08:12 ringerc Additional Information Updated
2004-12-08 10:24 ringerc Additional Information Updated
2004-12-08 11:39 ringerc Additional Information Updated
2004-12-08 11:39 ringerc File Added: scripter_translate_13a.diff
2004-12-08 11:39 ringerc File Added: scripter_translate_121a.diff
2004-12-08 11:48 ringerc Note Added: 0003025
2004-12-08 12:39 ringerc File Deleted: scripter_translate_13a.diff
2004-12-08 13:57 ringerc File Deleted: scripter_translate_121a.diff
2004-12-08 13:58 ringerc File Added: scripter_translate_121a.diff
2004-12-08 13:58 ringerc File Added: scripter_translate_13a.diff
2004-12-08 14:15 ringerc Note Edited: 0003025
2004-12-08 14:20 ringerc Note Edited: 0003025
2004-12-09 16:48 subik Note Added: 0003076
2004-12-09 16:58 subik Note Edited: 0003076
2004-12-09 17:16 ringerc Note Added: 0003077
2004-12-09 17:20 ringerc Note Edited: 0003077
2004-12-09 20:35 ringerc File Added: translations_and_fixups2.diff
2004-12-09 20:41 ringerc Note Added: 0003079
2004-12-09 20:52 ringerc Note Edited: 0003079
2004-12-09 20:53 ringerc Note Edited: 0003079
2004-12-09 21:03 ringerc Additional Information Updated
2004-12-09 21:06 ringerc Note Edited: 0003079
2004-12-09 21:08 ringerc Description Updated
2004-12-09 21:27 ringerc Note Added: 0003080
2004-12-09 21:28 ringerc Note Edited: 0003080
2004-12-10 06:55 subik Note Added: 0003084
2004-12-10 15:21 ringerc File Deleted: translations_and_fixups2.diff
2004-12-10 15:22 ringerc File Added: translations_and_fixups3.diff
2004-12-10 15:27 ringerc Note Added: 0003093
2004-12-10 15:29 ringerc Note Edited: 0003093
2004-12-10 16:14 ringerc File Deleted: translations_and_fixups3.diff
2004-12-10 16:14 ringerc File Added: translations_and_fixups_UNICODE.diff
2004-12-10 16:18 ringerc Note Added: 0003094
2004-12-10 16:28 ringerc Note Edited: 0003094
2004-12-10 17:00 ringerc File Added: translations_and_fixups_UNICODE_INOUT.diff
2004-12-10 17:00 ringerc File Deleted: translations_and_fixups_UNICODE.diff
2004-12-10 17:06 ringerc Note Added: 0003095
2004-12-10 17:06 ringerc File Deleted: translations_and_fixups_UNICODE_INOUT.diff
2004-12-10 17:07 ringerc File Added: translations_and_fixups_UNICODE.diff
2004-12-10 18:20 ringerc Note Added: 0003096
2004-12-10 18:21 ringerc File Added: translations_and_fixups_UNICODE_INOUT.diff
2004-12-10 18:54 ringerc Note Edited: 0003096
2004-12-10 18:55 ringerc Description Updated
2004-12-10 18:55 ringerc Additional Information Updated
2004-12-10 20:21 cbradney Note Added: 0003097
2004-12-11 15:25 ringerc Description Updated
2004-12-11 15:25 ringerc Additional Information Updated
2004-12-11 15:37 ringerc Note Edited: 0003093
2004-12-11 16:38 ringerc File Added: utf_fixes_cmddialog.diff
2004-12-11 16:40 ringerc Note Added: 0003104
2004-12-11 18:19 ringerc File Deleted: utf_fixes_cmddialog.diff
2004-12-11 18:19 ringerc File Added: utf_fixes_cmddialog.diff
2004-12-11 18:19 ringerc File Added: utf_fixes_cmdobj.cpp
2004-12-11 18:19 ringerc File Added: utf_fixes_cmdtext.cpp
2004-12-11 18:28 ringerc Note Added: 0003108
2004-12-11 18:29 ringerc Note Edited: 0003108
2004-12-11 18:39 ringerc Note Edited: 0003108
2004-12-11 18:39 ringerc File Deleted: utf_fixes_cmdobj.cpp
2004-12-11 18:39 ringerc File Deleted: utf_fixes_cmdtext.cpp
2004-12-11 18:40 ringerc File Added: utf_fixes_cmdtext.cpp.diff
2004-12-11 18:40 ringerc File Added: utf_fixes_cmdobj.cpp.diff
2004-12-11 18:41 ringerc Note Edited: 0003104
2004-12-11 18:49 cbradney Note Added: 0003109
2004-12-12 11:42 ringerc File Added: utf_fixes_cmdcolor.cpp.diff
2004-12-12 11:42 ringerc File Added: utf_fixes_cmdgetprop.cpp.diff
2004-12-12 11:43 ringerc File Added: utf_fixes_cmdsetprop.cpp.diff
2004-12-12 11:45 ringerc Note Added: 0003116
2004-12-12 13:59 ringerc File Added: utf_fixes_cmdmani.cpp.diff
2004-12-12 14:00 ringerc Note Edited: 0003116
2004-12-12 14:37 ringerc File Added: utf_fixes_cmddoc.cpp.diff
2004-12-12 14:38 ringerc Note Edited: 0003116
2004-12-12 15:26 ringerc File Added: utf_fixes_cmdmisc.cpp
2004-12-12 15:27 ringerc Note Edited: 0003116
2004-12-12 15:58 ringerc File Added: utf_fixes_cmdpage.cpp
2004-12-12 15:58 ringerc File Deleted: utf_fixes_cmdmisc.cpp
2004-12-12 15:58 ringerc File Deleted: utf_fixes_cmdpage.cpp
2004-12-12 16:00 ringerc File Added: utf_fixes_cmdpage.cpp.diff
2004-12-12 16:00 ringerc File Added: utf_fixes_cmdmisc.cpp.diff
2004-12-12 16:01 ringerc Note Edited: 0003116
2004-12-14 06:57 ringerc File Deleted: translations_and_fixups_UNICODE.diff
2004-12-14 07:08 ringerc Note Added: 0003145
2004-12-14 07:11 ringerc Additional Information Updated
2004-12-14 09:55 ringerc File Added: translations_and_fixups_UNICODE_INOUT_13.diff
2004-12-14 09:56 ringerc Note Added: 0003151
2004-12-14 10:16 cbradney Note Added: 0003152
2004-12-14 10:36 ringerc File Added: utf_fixes_13.diff
2004-12-14 11:13 ringerc Additional Information Updated
2004-12-14 11:14 ringerc Note Edited: 0003151
2004-12-19 16:47 cbradney Note Added: 0003181
2004-12-19 17:16 ringerc Summary Scripter code cleanup (do not close, please) => Scripter code cleanup
2004-12-19 17:16 ringerc Description Updated
2004-12-19 17:21 ringerc Note Added: 0003182
2004-12-20 12:28 subik Status assigned => resolved
2004-12-20 12:28 subik Fixed in Version => 1.2.1cvs
2004-12-20 12:28 subik Resolution open => fixed
2004-12-20 12:28 subik Note Added: 0003186
2004-12-20 23:31 cbradney Status resolved => closed
2006-05-13 21:53 christoph_s Relationship added child of 0003813