? .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)
