View Issue Details

IDProjectCategoryView StatusLast Update
0001264ScribusScripterpublic2004-11-09 00:27
ReporterringercAssigned Tofschmid  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Platformx86 LinuxOSFedora CoreOS Version1
Product Version1.2.1cvs 
Fixed in Version1.2.1cvs 
Summary0001264: PATCH: Convert functions that take no arguments to METH_NOARGS
DescriptionThe attached patch removes all argument processing code from functions that do not accept arguments and converts them to use the METH_NOARGS calling convention.

Explanation:

Currently, in all functions - even those that don't take arguments - there is code to call PyArg_ParseTuple and raise an exeception with usage information if called incorrectly. Some of these functions would be one line long but for this argument processing. The custom exception contains usage information, but for functions without arguments the usage information doesn't say much and would IMO be better placed in the docstring anyway. The usage information exception also obscures the original exception set by PyArg_BuildValue and makes the code behave in a non-standard way compared to most Python modules.

This patch removes that argument processing and exception code from functions that take no arguments and changes the calling method in the function's description in the PyMethodDef struct to METH_NOARGS. This tells Python the function takes no arguments, so don't bother sending it any.

The end result is less code, neater code, and a small performance improvement due to the lack of redundant argument processing. The functions also behave in a way that's more consistent with other Python code.

If a user tries to call one of these functions with arguments, they'll get an error like:

>>>closeDoc("fred")
Traceback (most recent call last):
  File "<console>", line 1, in ?
TypeError: closeDoc() takes no arguments (1 given)

which is pretty hard to misunderstand, and is the normal error Python always gives when a user makes this mistake.

The current code raises an exception with a custom usage message instead. It is my opinion that that usage summary is better placed in the docstring, so the user can run:

>>> help(closeDoc)

like they can on all other Python modules. If this change is applied, I will then provide a patch that adds a calling convention summary to all docstrings in the scripter. That way when the user runs help(funcname) they'll get something like this:

  CreatePolygon([x1,y1,x2,y2, ..., xn,yn])
  or
  CreatePolygon([x1,y1,x2,y2, ..., xn,yn], "objectname")

  Creates a new polygon and returns its name. The ....

(I think this is a good thing to do anyway, but such a patch would conflict with this one and I'm heartily sick of maintaining and merging conflicting patches.)

This change will not affect existing code. First, the change only affects an error condition bought about by programmer error. Second, because the current code throws Exception (dangerous, and another reason to remove it), users can only catch the error with an unqualified 'except:' or an 'except Exception:' The patched code throws TypeError in the same case (that's what PyArg_ParseTuple throws), which is a subclass of Exception and will be caught by anything that catches Exception. The only way code could break would be if it explicitly looked at the error string, and that is warned against as very bad style for Python, as well as being a really bizarre thing to do in this situation. Consequently I am confident that the patch will introduce no compatibility problems in existing code, barring a stupid error on my part.
Additional InformationThe next step after this patch is to convert most of the functions that currently take variable length arguments so that they can take keyword arguments instead. In the process I would remove the custom incorrect call exception in favour of an expanded docstring. Again, this just makes things more consistent with normal Python style, and will not affect existing code. That's for another bug, anyway.

Regarding stupid errors, I am currently considering attempting to write a test suite for the scripter. Comments appreciated.
TagsNo tags attached.
Patch

Relationships

related to 0001276 closedfschmid PATCH: Change function aliasing to use a dynamically created Python wrapper function 
child of 0003813 acknowledged Metabug: Scripter 

Activities

2004-11-03 12:52

 

scripter_NOARGS3_1.0.diff (47,543 bytes)   
Index: cmdcolor.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.cpp,v
retrieving revision 1.5
diff -u -r1.5 cmdcolor.cpp
--- cmdcolor.cpp	4 Oct 2004 21:34:12 -0000	1.5
+++ cmdcolor.cpp	3 Nov 2004 12:05:32 -0000
@@ -3,16 +3,11 @@
 #include "cmdutil.h"
 #include "cmdvar.h"
 
-PyObject *scribus_colornames(PyObject *self, PyObject* args)
+PyObject *scribus_colornames(PyObject *self)
 {
 	CListe edc;
 	PyObject *l;
 	int cc = 0;
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getColorNames()"));
-		return NULL;
-	}
 	edc = Carrier->HaveDoc ? Carrier->doc->PageColors : Carrier->Prefs.DColors;
 	CListe::Iterator it;
 	l = PyList_New(edc.count());
Index: cmdcolor.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdcolor.h,v
retrieving revision 1.4
diff -u -r1.4 cmdcolor.h
--- cmdcolor.h	5 Apr 2004 21:52:21 -0000	1.4
+++ cmdcolor.h	3 Nov 2004 12:05:32 -0000
@@ -5,7 +5,7 @@
 /** Managing Colors */
 
 /** Returns a list with colours available in doc or in prefs. */
-PyObject *scribus_colornames(PyObject *self, PyObject* args);
+PyObject *scribus_colornames(PyObject *self);
 /** Returns a CMYK tuple of the specified color. */
 PyObject *scribus_getcolor(PyObject *self, PyObject* args);
 /** Sets named color with C,M,Y,K params. */
Index: cmddialog.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmddialog.cpp
--- cmddialog.cpp	2 Nov 2004 18:36:05 -0000	1.14
+++ cmddialog.cpp	3 Nov 2004 12:05:32 -0000
@@ -6,13 +6,8 @@
 #include <qmessagebox.h>
 #include <qcursor.h>
 
-PyObject *scribus_newdocdia(PyObject *self, PyObject* args)
+PyObject *scribus_newdocdia(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("newDocDialog()"));
-		return NULL;
-	}
 	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
 	bool ret = Carrier->slotFileNew();
 	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
Index: cmddialog.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddialog.h,v
retrieving revision 1.6
diff -u -r1.6 cmddialog.h
--- cmddialog.h	2 Nov 2004 18:36:05 -0000	1.6
+++ cmddialog.h	3 Nov 2004 12:05:32 -0000
@@ -4,7 +4,7 @@
 
 /** Calling Dialogs from Scribus */
 /** Raises the Scribus New Document dialog */
-PyObject *scribus_newdocdia(PyObject *self, PyObject* args);
+PyObject *scribus_newdocdia(PyObject *self);
 /** Raises file dialog.
  Params - caption, filter, default name and opt. pre, mode. */
 PyObject *scribus_filedia(PyObject *self, PyObject* args);
Index: cmddoc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp,v
retrieving revision 1.12
diff -u -r1.12 cmddoc.cpp
--- cmddoc.cpp	30 Oct 2004 13:08:17 -0000	1.12
+++ cmddoc.cpp	3 Nov 2004 12:05:32 -0000
@@ -55,13 +55,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_closedoc(PyObject *self, PyObject* args)
+PyObject *scribus_closedoc(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("closeDoc()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	Carrier->doc->setUnModified();
@@ -70,13 +65,8 @@
 	return PyInt_FromLong(static_cast<long>(ret));
 }
 
-PyObject *scribus_havedoc(PyObject *self, PyObject* args)
+PyObject *scribus_havedoc(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("haveDoc()"));
-		return NULL;
-	}
 	return PyInt_FromLong(static_cast<long>(Carrier->HaveDoc));
 }
 
@@ -92,13 +82,8 @@
 	return PyInt_FromLong(static_cast<long>(ret));
 }
 
-PyObject *scribus_savedoc(PyObject *self, PyObject* args)
+PyObject *scribus_savedoc(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("saveDoc()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	Carrier->slotFileSave();
@@ -156,13 +141,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_getunit(PyObject *self, PyObject* args)
+PyObject *scribus_getunit(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getUnit()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	return PyInt_FromLong(static_cast<long>(Carrier->doc->Einheit));
Index: cmddoc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmddoc.h,v
retrieving revision 1.4
diff -u -r1.4 cmddoc.h
--- cmddoc.h	20 Sep 2004 22:19:09 -0000	1.4
+++ cmddoc.h	3 Nov 2004 12:05:32 -0000
@@ -7,13 +7,13 @@
  first 2 args are lists (tuples) */
 PyObject *scribus_newdoc(PyObject *self, PyObject* args);
 /** Closes active doc. No params */
-PyObject *scribus_closedoc(PyObject *self, PyObject* args);
+PyObject *scribus_closedoc(PyObject *self);
 /** Checks if is a document opened. */
-PyObject *scribus_havedoc(PyObject *self, PyObject* args);
+PyObject *scribus_havedoc(PyObject *self);
 /** Opens a document with given name. */
 PyObject *scribus_opendoc(PyObject *self, PyObject* args);
 /** Saves active document (only save slot call). */
-PyObject *scribus_savedoc(PyObject *self, PyObject* args);
+PyObject *scribus_savedoc(PyObject *self);
 /** Saves active document with given name */
 PyObject *scribus_savedocas(PyObject *self, PyObject* args);
 /** Sets document infos - author, title and description */
@@ -23,7 +23,7 @@
 /** Changes unit scale. */
 PyObject *scribus_setunit(PyObject *self, PyObject* args);
 /** Returns actual unit scale. */
-PyObject *scribus_getunit(PyObject *self, PyObject* args);
+PyObject *scribus_getunit(PyObject *self);
 /** Loads styles from another .sla file (craig r.)*/
 PyObject *scribus_loadstylesfromfile(PyObject *self, PyObject *args);
 PyObject *scribus_setdoctype(PyObject *self, PyObject* args);
Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.9
diff -u -r1.9 cmdmani.cpp
--- cmdmani.cpp	30 Oct 2004 13:08:17 -0000	1.9
+++ cmdmani.cpp	3 Nov 2004 12:05:32 -0000
@@ -262,13 +262,8 @@
 		return PyString_FromString("");
 }
 
-PyObject *scribus_selcount(PyObject *self, PyObject* args)
+PyObject *scribus_selcount(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("selectionCount()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	return PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->SelItem.count()));
@@ -291,13 +286,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_deselect(PyObject *self, PyObject* args)
+PyObject *scribus_deselect(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("deselectAll()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	for (uint i = 0; i < Carrier->view->Pages.count(); i++)
Index: cmdmani.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v
retrieving revision 1.3
diff -u -r1.3 cmdmani.h
--- cmdmani.h	12 Jul 2004 23:26:45 -0000	1.3
+++ cmdmani.h	3 Nov 2004 12:05:32 -0000
@@ -9,9 +9,9 @@
 PyObject *scribus_rotobjabs(PyObject *self, PyObject* args);
 PyObject *scribus_sizeobjabs(PyObject *self, PyObject* args);
 PyObject *scribus_getselobjnam(PyObject *self, PyObject* args);
-PyObject *scribus_selcount(PyObject *self, PyObject* args);
+PyObject *scribus_selcount(PyObject *self);
 PyObject *scribus_selectobj(PyObject *self, PyObject* args);
-PyObject *scribus_deselect(PyObject *self, PyObject* args);
+PyObject *scribus_deselect(PyObject *self);
 PyObject *scribus_groupobj(PyObject *self, PyObject* args);
 PyObject *scribus_ungroupobj(PyObject *self, PyObject* args);
 PyObject *scribus_scalegroup(PyObject *self, PyObject* args);
Index: cmdmisc.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdmisc.cpp
--- cmdmisc.cpp	30 Oct 2004 13:08:17 -0000	1.14
+++ cmdmisc.cpp	3 Nov 2004 12:05:32 -0000
@@ -20,13 +20,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_fontnames(PyObject *self, PyObject* args)
+PyObject *scribus_fontnames(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getFontNames()"));
-		return NULL;
-	}
 	int cc2 = 0;
 	SCFontsIterator it2(Carrier->Prefs.AvailFonts);
 	for ( ; it2.current() ; ++it2)
@@ -48,13 +43,8 @@
 	return l;
 }
 
-PyObject *scribus_xfontnames(PyObject *self, PyObject* args)
+PyObject *scribus_xfontnames(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getXFontNames()"));
-		return NULL;
-	}
 	PyObject *l = PyList_New(Carrier->Prefs.AvailFonts.count());
 	SCFontsIterator it(Carrier->Prefs.AvailFonts);
 	int cc = 0;
@@ -98,13 +88,8 @@
 	return PyInt_FromLong(static_cast<long>(ret));
 }
 
-PyObject *scribus_getlayers(PyObject *self, PyObject* args)
+PyObject *scribus_getlayers(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getLayers()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	PyObject *l;
@@ -144,13 +129,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_getactlayer(PyObject *self, PyObject* args)
+PyObject *scribus_getactlayer(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getActiveLayer()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	return PyString_FromString(Carrier->doc->Layers[Carrier->doc->ActiveLayer].Name);
@@ -362,12 +342,7 @@
 	return Py_None;
 }
 
-PyObject *scribus_getlanguage(PyObject *self, PyObject* args)
+PyObject *scribus_getlanguage(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getGuiLanguage()"));
-		return NULL;
-	}
 	return PyString_FromString(Carrier->GuiLanguage);
 }
Index: cmdmisc.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmisc.h,v
retrieving revision 1.5
diff -u -r1.5 cmdmisc.h
--- cmdmisc.h	14 May 2004 22:34:05 -0000	1.5
+++ cmdmisc.h	3 Nov 2004 12:05:32 -0000
@@ -4,16 +4,16 @@
 
 /** Other Commands */
 PyObject *scribus_setredraw(PyObject *self, PyObject* args);
-PyObject *scribus_fontnames(PyObject *self, PyObject* args);
+PyObject *scribus_fontnames(PyObject *self);
  /**
  return a list of the tuples with
  Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file
  */
-PyObject *scribus_xfontnames(PyObject *self, PyObject* args);
+PyObject *scribus_xfontnames(PyObject *self);
 PyObject *scribus_renderfont(PyObject *self, PyObject* args);
-PyObject *scribus_getlayers(PyObject *self, PyObject* args);
+PyObject *scribus_getlayers(PyObject *self);
 PyObject *scribus_setactlayer(PyObject *self, PyObject* args);
-PyObject *scribus_getactlayer(PyObject *self, PyObject* args);
+PyObject *scribus_getactlayer(PyObject *self);
 PyObject *scribus_senttolayer(PyObject *self, PyObject* args);
 PyObject *scribus_layervisible(PyObject *self, PyObject* args);
 PyObject *scribus_layerprint(PyObject *self, PyObject* args);
@@ -21,7 +21,7 @@
 PyObject *scribus_glayerprint(PyObject *self, PyObject* args);
 PyObject *scribus_removelayer(PyObject *self, PyObject* args);
 PyObject *scribus_createlayer(PyObject *self, PyObject* args);
-PyObject *scribus_getlanguage(PyObject *self, PyObject* args);
+PyObject *scribus_getlanguage(PyObject *self);
 
 #endif
 
Index: cmdobj.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v
retrieving revision 1.13
diff -u -r1.13 cmdobj.cpp
--- cmdobj.cpp	30 Oct 2004 13:08:17 -0000	1.13
+++ cmdobj.cpp	3 Nov 2004 12:05:32 -0000
@@ -507,14 +507,9 @@
  * Craig Ringer, 2004-09-09
  * Enumerate all known paragraph styles
  */
-PyObject *scribus_getstylenames(PyObject *self, PyObject* args)
+PyObject *scribus_getstylenames(PyObject *self)
 {
 	PyObject *styleList;
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getAllStyles()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	styleList = PyList_New(0);
Index: cmdobj.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.h,v
retrieving revision 1.6
diff -u -r1.6 cmdobj.h
--- cmdobj.h	20 Sep 2004 22:19:09 -0000	1.6
+++ cmdobj.h	3 Nov 2004 12:05:32 -0000
@@ -58,7 +58,7 @@
  Craig Ringer, 2004-09-09
  Enumerate all known paragraph styles
 */
-PyObject *scribus_getstylenames(PyObject *self, PyObject* args);
+PyObject *scribus_getstylenames(PyObject *self);
 
 #endif
 
Index: cmdpage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v
retrieving revision 1.14
diff -u -r1.14 cmdpage.cpp
--- cmdpage.cpp	30 Oct 2004 13:08:17 -0000	1.14
+++ cmdpage.cpp	3 Nov 2004 12:05:32 -0000
@@ -3,25 +3,15 @@
 #include "cmdvar.h"
 #include "cmdutil.h"
 
-PyObject *scribus_actualpage(PyObject *self, PyObject* args)
+PyObject *scribus_actualpage(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("currentPage()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	return PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->PageNr + 1));
 }
 
-PyObject *scribus_redraw(PyObject *self, PyObject* args)
+PyObject *scribus_redraw(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("redrawAll()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	Carrier->view->DrawNew();
@@ -112,25 +102,15 @@
 	return Py_None;
 }
 
-PyObject *scribus_pagecount(PyObject *self, PyObject* args)
+PyObject *scribus_pagecount(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("pageCount()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	return PyInt_FromLong(static_cast<long>(Carrier->view->Pages.count()));
 }
 
-PyObject *scribus_pagedimension(PyObject *self, PyObject *args)
+PyObject *scribus_pagedimension(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getPageSize()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	PyObject *t;
@@ -142,13 +122,8 @@
 	return t;
 }
 
-PyObject *scribus_getpageitems(PyObject *self, PyObject* args)
+PyObject *scribus_getpageitems(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getPageItems()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	if (Carrier->doc->ActPage->Items.count() == 0)
@@ -167,13 +142,8 @@
 	return l;
 }
 
-PyObject *scribus_getHguides(PyObject *self, PyObject* args)
+PyObject *scribus_getHguides(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getHGuides()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	int n = Carrier->doc->ActPage->YGuides.count();
@@ -227,13 +197,8 @@
 	return Py_None;
 }
 
-PyObject *scribus_getVguides(PyObject *self, PyObject* args)
+PyObject *scribus_getVguides(PyObject *self)
 {
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getVGuides()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	int n = Carrier->doc->ActPage->XGuides.count();
@@ -287,14 +252,9 @@
 	return Py_None;
 }
 
-PyObject *scribus_getpagemargins(PyObject *self,  PyObject* args)
+PyObject *scribus_getpagemargins(PyObject *self)
 {
 	PyObject *margins = NULL;
-	if (!PyArg_ParseTuple(args, ""))
-	{
-		PyErr_SetString(PyExc_Exception, ERRPARAM + QString("getPageMargins()"));
-		return NULL;
-	}
 	if(!checkHaveDocument())
 		return NULL;
 	margins = Py_BuildValue("ffff", Carrier->doc->PageM.Top, Carrier->doc->PageM.Left,
Index: cmdpage.h
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.h,v
retrieving revision 1.6
diff -u -r1.6 cmdpage.h
--- cmdpage.h	28 Sep 2004 22:42:25 -0000	1.6
+++ cmdpage.h	3 Nov 2004 12:05:32 -0000
@@ -4,33 +4,33 @@
 
 /** Page related Commands */
 PyObject *scribus_newpage(PyObject *self, PyObject* args);
-PyObject *scribus_actualpage(PyObject *self, PyObject* args);
-PyObject *scribus_redraw(PyObject *self, PyObject* args);
+PyObject *scribus_actualpage(PyObject *self);
+PyObject *scribus_redraw(PyObject *self);
 PyObject *scribus_savepageeps(PyObject *self, PyObject* args);
 PyObject *scribus_deletepage(PyObject *self, PyObject* args);
 PyObject *scribus_gotopage(PyObject *self, PyObject* args);
-PyObject *scribus_pagecount(PyObject *self, PyObject* args);
-PyObject *scribus_getHguides(PyObject *self, PyObject* args);
+PyObject *scribus_pagecount(PyObject *self);
+PyObject *scribus_getHguides(PyObject *self);
 PyObject *scribus_setHguides(PyObject *self, PyObject* args);
-PyObject *scribus_getVguides(PyObject *self, PyObject* args);
+PyObject *scribus_getVguides(PyObject *self);
 PyObject *scribus_setVguides(PyObject *self, PyObject* args);
 /** 
 returns a tuple with page domensions in used system
 e.g. when is the doc in picas returns picas ;)
 (Petr Vanek 02/17/04) 
 */
-PyObject *scribus_pagedimension(PyObject *self, PyObject* args);
+PyObject *scribus_pagedimension(PyObject *self);
 /**
 returns a list of tuples with items on the actual page
 TODO: solve utf/iso chars in object names
 (Petr Vanek 03/02/2004)
 */
-PyObject *scribus_getpageitems(PyObject *self, PyObject* args);
+PyObject *scribus_getpageitems(PyObject *self);
 /**
 returns a tuple with page margins
 Craig Ringer, Petr Vanek 09/25/2004
 */
-PyObject *scribus_getpagemargins(PyObject *self, PyObject* args);
+PyObject *scribus_getpagemargins(PyObject *self);
 
 #endif
 
Index: scriptplugin.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v
retrieving revision 1.38
diff -u -r1.38 scriptplugin.cpp
--- scriptplugin.cpp	2 Nov 2004 18:34:29 -0000	1.38
+++ scriptplugin.cpp	3 Nov 2004 12:05:32 -0000
@@ -441,10 +441,10 @@
 	// 2004/09/26 pv
 	{"ValueDialog", scribus_valdialog, METH_VARARGS, "TODO: docstring"},
 	{"valueDialog", scribus_valdialog, METH_VARARGS, "TODO: docstring"},
-	{"GetPageSize", scribus_pagedimension, METH_VARARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"}, // just an alias to PageDimension()
-	{"getPageSize", scribus_pagedimension, METH_VARARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"}, // just an alias to PageDimension()
-	{"GetPageMargins", scribus_getpagemargins, METH_VARARGS, "TODO: docstring"},
-	{"getPageMargins", scribus_getpagemargins, METH_VARARGS, "TODO: docstring"},
+	{"GetPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"}, // just an alias to PageDimension()
+	{"getPageSize", (PyCFunction)scribus_pagedimension, METH_NOARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"}, // just an alias to PageDimension()
+	{"GetPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, "TODO: docstring"},
+	{"getPageMargins", (PyCFunction)scribus_getpagemargins, METH_NOARGS, "TODO: docstring"},
 	// 2004/09/13 pv
 	{"TraceText", scribus_tracetext, METH_VARARGS, "TODO: docstring"},
 	{"traceText", scribus_tracetext, METH_VARARGS, "TODO: docstring"},
@@ -452,8 +452,8 @@
 	{"loadStylesFromFile", scribus_loadstylesfromfile, METH_VARARGS, "TODO: docstring"},
 	{"SetStyle", scribus_setstyle, METH_VARARGS, "TODO: docstring"},
 	{"setStyle", scribus_setstyle, METH_VARARGS, "TODO: docstring"},
-	{"GetAllStyles", scribus_getstylenames, METH_VARARGS, "TODO: docstring"},
-	{"getAllStyles", scribus_getstylenames, METH_VARARGS, "TODO: docstring"},
+	{"GetAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, "TODO: docstring"},
+	{"getAllStyles", (PyCFunction)scribus_getstylenames, METH_NOARGS, "TODO: docstring"},
 	// before 2004/09/13 pv
 	{"LockObject", scribus_lockobject, METH_VARARGS, "TODO: docstring"},
 	{"lockObject", scribus_lockobject, METH_VARARGS, "TODO: docstring"},
@@ -461,12 +461,12 @@
 	{"isLocked", scribus_islocked, METH_VARARGS, "TODO: docstring"},
 	{"ObjectExists",scribus_objectexists, METH_VARARGS, "User test if an object with specified name really exists in the doc. Optional parameter is the object name. When no param given returns if there is something selected."},
 	{"objectExists",scribus_objectexists, METH_VARARGS, "User test if an object with specified name really exists in the doc. Optional parameter is the object name. When no param given returns if there is something selected."},
-	{"GetPageItems", scribus_getpageitems, METH_VARARGS, "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..."},
-	{"getPageItems", scribus_getpageitems, METH_VARARGS, "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..."},
+	{"GetPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, "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..."},
+	{"getPageItems", (PyCFunction)scribus_getpageitems, METH_NOARGS, "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..."},
 	{"TextFlowsAroundFrame", scribus_textflow, METH_VARARGS, "Enables/disables \"Text Flows Around Frame\" feature for object. Called with params string name and voluntary 1|0. When 1 set flowing to true (0 to false). When is second param empty flowing is reverted."},
 	{"textFlowsAroundFrame", scribus_textflow, METH_VARARGS, "Enables/disables \"Text Flows Around Frame\" feature for object. Called with params string name and voluntary 1|0. When 1 set flowing to true (0 to false). When is second param empty flowing is reverted."},
-	{"GetXFontNames",scribus_xfontnames, METH_VARARGS, "Returns a list of the tuples with: [ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]"},
-	{"getXFontNames",scribus_xfontnames, METH_VARARGS, "Returns a list of the tuples with: [ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]"},
+	{"GetXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, "Returns a list of the tuples with: [ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]"},
+	{"getXFontNames", (PyCFunction)scribus_xfontnames, METH_NOARGS, "Returns a list of the tuples with: [ (Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file), (...), ... ]"},
 	{"LinkTextFrames", scribus_linktextframes, METH_VARARGS, "Create the linked text frames. Parameters are the object names."},
 	{"linkTextFrames", scribus_linktextframes, METH_VARARGS, "Create the linked text frames. Parameters are the object names."},
 	{"UnlinkTextFrames", scribus_unlinktextframes, METH_VARARGS, "Remove the specified (named) object from the text frame flows/linkage."},
@@ -483,10 +483,10 @@
 	{"docChanged", scribus_docchanged, METH_VARARGS, "Enable/disable save icon."},
 	{"SetCursor", scribus_setcursor, METH_VARARGS, "TODO: docstring"},
 	{"setCursor", scribus_setcursor, METH_VARARGS, "TODO: docstring"},
-	{"PageDimension", scribus_pagedimension, METH_VARARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"},
-	{"pageDimension", scribus_pagedimension, METH_VARARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"},
-	{"NewDocDialog", scribus_newdocdia, METH_VARARGS, "Shows the \"New Document\" Dialog Box. Returns true if a new Document was created."},
-	{"newDocDialog", scribus_newdocdia, METH_VARARGS, "Shows the \"New Document\" Dialog Box. Returns true if a new Document was created."},
+	{"PageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"},
+	{"pageDimension", (PyCFunction)scribus_pagedimension, METH_NOARGS, "Returns a tuple with page dimensions in used system e.g. when the document's page is in picas - picas are returned"},
+	{"NewDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, "Shows the \"New Document\" Dialog Box. Returns true if a new Document was created."},
+	{"newDocDialog", (PyCFunction)scribus_newdocdia, METH_NOARGS, "Shows the \"New Document\" Dialog Box. Returns true if a new Document was created."},
 	{"FileDialog", scribus_filedia, METH_VARARGS, "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."},
 	{"fileDialog", scribus_filedia, METH_VARARGS, "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."},
 	{"StatusMessage", scribus_messagebartext, METH_VARARGS, "Displays the Message \"string\" in the StatusBar."},
@@ -495,14 +495,14 @@
 	{"messageBox", scribus_messdia, METH_VARARGS, "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."},
 	{"NewDoc", scribus_newdoc, METH_VARARGS, "Creates a new Document. The Parameters have the following Meaning:\n\tsize = A Tuple (width, height) describing the Size of the Document.\n\tmargins = A Tuple (Left, Right, Top, Bottom) describing the Margins of the Document.\n\torientation = the Page Orientation, 0 means Portrait, 1 is Landscape\n\tfirstPageNumer is the Number of the first Page in the Document used for Pagenumbering\n\tunit: this Value sets the Measurement Unit of the Document\n\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas\n\n\tFacingPages: 1 means FacingPages turned on, 0 means FacingPages turned off\n\tFirstSideLeft: 1 means that the first Page in the Document is a left Page, 0 means a right Page as first Page\n\tThe values for Width, Height and the Margins are expressed in the given unit for the Document."},
 	{"newDoc", scribus_newdoc, METH_VARARGS, "Creates a new Document. The Parameters have the following Meaning:\n\tsize = A Tuple (width, height) describing the Size of the Document.\n\tmargins = A Tuple (Left, Right, Top, Bottom) describing the Margins of the Document.\n\torientation = the Page Orientation, 0 means Portrait, 1 is Landscape\n\tfirstPageNumer is the Number of the first Page in the Document used for Pagenumbering\n\tunit: this Value sets the Measurement Unit of the Document\n\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas\n\n\tFacingPages: 1 means FacingPages turned on, 0 means FacingPages turned off\n\tFirstSideLeft: 1 means that the first Page in the Document is a left Page, 0 means a right Page as first Page\n\tThe values for Width, Height and the Margins are expressed in the given unit for the Document."},
-	{"CloseDoc", scribus_closedoc, METH_VARARGS, "Closes the current Document. Returns true if successful."},
-	{"closeDoc", scribus_closedoc, METH_VARARGS, "Closes the current Document. Returns true if successful."},
-	{"HaveDoc", scribus_havedoc, METH_VARARGS, "Returns true if there is a Document open."},
-	{"haveDoc", scribus_havedoc, METH_VARARGS, "Returns true if there is a Document open."},
+	{"CloseDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, "Closes the current Document. Returns true if successful."},
+	{"closeDoc", (PyCFunction)scribus_closedoc, METH_NOARGS, "Closes the current Document. Returns true if successful."},
+	{"HaveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, "Returns true if there is a Document open."},
+	{"haveDoc", (PyCFunction)scribus_havedoc, METH_NOARGS, "Returns true if there is a Document open."},
 	{"OpenDoc", scribus_opendoc, METH_VARARGS, "Opens the Document \"name\". Returns true if successful."},
 	{"openDoc", scribus_opendoc, METH_VARARGS, "Opens the Document \"name\". Returns true if successful."},
-	{"SaveDoc", scribus_savedoc, METH_VARARGS, "Saves the Document under its actual Name, returns true if successful."},
-	{"saveDoc", scribus_savedoc, METH_VARARGS, "Saves the Document under its actual Name, returns true if successful."},
+	{"SaveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, "Saves the Document under its actual Name, returns true if successful."},
+	{"saveDoc", (PyCFunction)scribus_savedoc, METH_NOARGS, "Saves the Document under its actual Name, returns true if successful."},
 	{"SaveDocAs", scribus_savedocas, METH_VARARGS, "Saves the actual Document under the new Name \"name\". Returns true if successful."},
 	{"saveDocAs", scribus_savedocas, METH_VARARGS, "Saves the actual Document under the new Name \"name\". Returns true if successful."},
 	{"SetInfo", scribus_setinfo, METH_VARARGS, "Sets the Document Information. \"Author\", \"Info\", \"Description\""},
@@ -511,14 +511,14 @@
 	{"setMargins", scribus_setmargins, METH_VARARGS, "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."},
 	{"SetUnit", scribus_setunit, METH_VARARGS, "Changes the Measurement Unit of the Document. Possible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
 	{"setUnit", scribus_setunit, METH_VARARGS, "Changes the Measurement Unit of the Document. Possible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
-	{"GetUnit", scribus_getunit, METH_VARARGS, "Returns the Measurement Unit of the Document.\nPossible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
-	{"getUnit", scribus_getunit, METH_VARARGS, "Returns the Measurement Unit of the Document.\nPossible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
-	{"CurrentPage", scribus_actualpage, METH_VARARGS, "Returns the Number of the current working Page. Pagenumbers are counted from 1 upwards."},
-	{"currentPage", scribus_actualpage, METH_VARARGS, "Returns the Number of the current working Page. Pagenumbers are counted from 1 upwards."},
+	{"GetUnit", (PyCFunction)scribus_getunit, METH_NOARGS, "Returns the Measurement Unit of the Document.\nPossible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
+	{"getUnit", (PyCFunction)scribus_getunit, METH_NOARGS, "Returns the Measurement Unit of the Document.\nPossible Values for Unit are:\n\t0 = Typographic Points\n\t1 = Millimeters\n\t2 = Inches\n\t3 = Picas "},
+	{"CurrentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, "Returns the Number of the current working Page. Pagenumbers are counted from 1 upwards."},
+	{"currentPage", (PyCFunction)scribus_actualpage, METH_NOARGS, "Returns the Number of the current working Page. Pagenumbers are counted from 1 upwards."},
 	{"SetRedraw", scribus_setredraw, METH_VARARGS, "Disables Page Redraw when bool = 0, otherwise redrawing is enabled."},
 	{"setRedraw", scribus_setredraw, METH_VARARGS, "Disables Page Redraw when bool = 0, otherwise redrawing is enabled."},
-	{"RedrawAll", scribus_redraw, METH_VARARGS, "Redraws all Pages."},
-	{"redrawAll", scribus_redraw, METH_VARARGS, "Redraws all Pages."},
+	{"RedrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, "Redraws all Pages."},
+	{"redrawAll", (PyCFunction)scribus_redraw, METH_NOARGS, "Redraws all Pages."},
 	{"SavePageAsEPS", scribus_savepageeps, METH_VARARGS, "Saves the actual Page as an EPS, returns true if successful."},
 	{"savePageAsEPS", scribus_savepageeps, METH_VARARGS, "Saves the actual Page as an EPS, returns true if successful."},
 	{"NewPage", scribus_newpage, METH_VARARGS, "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."},
@@ -527,8 +527,8 @@
 	{"deletePage", scribus_deletepage, METH_VARARGS, "Deletes the given Page, does nothing if the Document contains only one Page. Pagenumbers are counted from 1 upwards."},
 	{"GotoPage", scribus_gotopage, METH_VARARGS, "Moves to the Page \"nr\". If \"nr\" is outside the current rage of Pages nothing happens."},
 	{"gotoPage", scribus_gotopage, METH_VARARGS, "Moves to the Page \"nr\". If \"nr\" is outside the current rage of Pages nothing happens."},
-	{"PageCount", scribus_pagecount, METH_VARARGS, "Returns the Number of Pages in the Document."},
-	{"pageCount", scribus_pagecount, METH_VARARGS, "Returns the Number of Pages in the Document."},
+	{"PageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, "Returns the Number of Pages in the Document."},
+	{"pageCount", (PyCFunction)scribus_pagecount, METH_NOARGS, "Returns the Number of Pages in the Document."},
 	{"CreateRect", scribus_newrect, METH_VARARGS, "Creates a new Rectangle on the actual Page and returns its Name. The Coordinates are given in the actual measurement Unit of the Document. \"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."},
 	{"createRect", scribus_newrect, METH_VARARGS, "Creates a new Rectangle on the actual Page and returns its Name. The Coordinates are given in the actual measurement Unit of the Document. \"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."},
 	{"CreateEllipse", scribus_newellipse, METH_VARARGS, "Creates a new Ellipse on the actual Page and returns its Name. The Coordinates are given in the actual measurement Unit of the Document. \"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."},
@@ -639,20 +639,20 @@
 	{"unGroupObject", scribus_ungroupobj, METH_VARARGS, "Destructs the Group the Object \"name\" belongs to. If \"name\" is not given the currently selected Item is used."},
 	{"scaleGroup", scribus_scalegroup, METH_VARARGS, "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 is 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."},
 	{"setSelectedObject", scribus_getselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
-	{"selectionCount", scribus_selcount, METH_VARARGS, "Returns the Number of selected Objects."},
+	{"selectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, "Returns the Number of selected Objects."},
 	{"selectObject", scribus_selectobj, METH_VARARGS, "Selects the Object with the given Name."},
-	{"deselectAll", scribus_deselect, METH_VARARGS, "Deselects all Objects."},
-	{"getColorNames", scribus_colornames, METH_VARARGS, "Returns a List with the Names of all defined Colors."},
+	{"deselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, "Deselects all Objects."},
+	{"getColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, "Returns a List with the Names of all defined Colors."},
 	{"getColor", scribus_getcolor, METH_VARARGS, "Returns a Tuple containing the four Color Components of the Color \"name\"."},
 	{"changeColor", scribus_setcolor, METH_VARARGS, "Changes the 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."},
 	{"defineColor", scribus_newcolor, METH_VARARGS, "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."},
 	{"deleteColor", scribus_delcolor, METH_VARARGS, "Deletes the Color \"name\". Every occurence of that Color is replaced by the Color \"replace\"."},
 	{"replaceColor", scribus_replcolor, METH_VARARGS, "Every occurence of that Color is replaced by the Color \"replace\"."},
-	{"getFontNames", scribus_fontnames, METH_VARARGS, "Returns a List with the Names of all available Fonts."},
+	{"getFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, "Returns a List with the Names of all available Fonts."},
 	{"renderFont", scribus_renderfont, METH_VARARGS, "Creates an image preview of font with given text"},
-	{"getLayers", scribus_getlayers, METH_VARARGS, "Returns a List with the Names of all defined Layers."},
+	{"getLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, "Returns a List with the Names of all defined Layers."},
 	{"setActiveLayer", scribus_setactlayer, METH_VARARGS, "Sets the active Layer to the Layer named \"name\"."},
-	{"getActiveLayer", scribus_getactlayer, METH_VARARGS, "Returns the Name of the current active Layer."},
+	{"getActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, "Returns the Name of the current active Layer."},
 	{"sentToLayer", scribus_senttolayer, METH_VARARGS, "Sends the Object \"name\" to the Layer \"layer\". The Layer must exist. If \"name\" is not given the currently selected Item is used."},
 	{"setLayerVisible", scribus_layervisible, METH_VARARGS, "Sets the Layer \"layer\" to be visible or not. A Value of 1 for \"flag\" means that the Layer \"layer\" is visible, a Value of 0 means that the Layer \"layer\" is invisible."},
 	{"setLayerPrintable", scribus_layerprint, METH_VARARGS, "Sets the Layer \"layer\" to be printable or not. A Value of 1 for \"flag\" means that the Layer \"layer\" can be printed, a Value of 0 means that printing the Layer \"layer\" is disabled."},
@@ -660,10 +660,10 @@
 	{"isLayerPrintable", scribus_glayerprint, METH_VARARGS, "Returns wether the Layer \"layer\" is printable or not, a Value of 1 means that the Layer \"layer\" can be printed, a Value of 0 means that printing the Layer \"layer\" is disabled."},
 	{"createLayer", scribus_createlayer, METH_VARARGS, "Creates a new Layer with the Name \"name\"."},
 	{"deleteLayer", scribus_removelayer, METH_VARARGS, "Deletes the Layer with the Name \"name\". Nothing happens if the Layer doesn't exists or if it's the only Layer in the Document."},
-	{"getGuiLanguage", scribus_getlanguage, METH_VARARGS, "Returns a string with the -lang value."},
-	{"getHGuides", scribus_getHguides, METH_VARARGS, "TODO: docstring"},
+	{"getGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, "Returns a string with the -lang value."},
+	{"getHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, "TODO: docstring"},
 	{"setHGuides", scribus_setHguides, METH_VARARGS, "TODO: docstring"},
-	{"getVGuides", scribus_getVguides, METH_VARARGS, "TODO: docstring"},
+	{"getVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, "TODO: docstring"},
 	{"setVGuides", scribus_setVguides, METH_VARARGS, "TODO: docstring"},
 	{"setDocType", scribus_setdoctype, METH_VARARGS, "Sets the Type of the Documents, to get Facing Pages set the first Parameter to 1, to switch FacingPages off use 0 instead. If you want to be the first Page a left Side set the second Parameter to 1, for a right Page use 0."},
 	// aliases (old convention)
@@ -698,20 +698,20 @@
 	{"UnGroupObject", scribus_ungroupobj, METH_VARARGS, "Destructs the Group the Object \"name\" belongs to. If \"name\" is not given the currently selected Item is used."},
 	{"ScaleGroup", scribus_scalegroup, METH_VARARGS, "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 is 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."},
 	{"GetSelectedObject", scribus_getselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
-	{"SelectionCount", scribus_selcount, METH_VARARGS, "Returns the Number of selected Objects."},
+	{"SelectionCount", (PyCFunction)scribus_selcount, METH_NOARGS, "Returns the Number of selected Objects."},
 	{"SelectObject", scribus_selectobj, METH_VARARGS, "Selects the Object with the given Name."},
-	{"DeselectAll", scribus_deselect, METH_VARARGS, "Deselects all Objects."},
-	{"GetColorNames", scribus_colornames, METH_VARARGS, "Returns a List with the Names of all defined Colors."},
+	{"DeselectAll", (PyCFunction)scribus_deselect, METH_NOARGS, "Deselects all Objects."},
+	{"GetColorNames", (PyCFunction)scribus_colornames, METH_NOARGS, "Returns a List with the Names of all defined Colors."},
 	{"GetColor", scribus_getcolor, METH_VARARGS, "Returns a Tuple containing the four Color Components of the Color \"name\"."},
 	{"ChangeColor", scribus_setcolor, METH_VARARGS, "Changes the 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."},
 	{"DefineColor", scribus_newcolor, METH_VARARGS, "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."},
 	{"DeleteColor", scribus_delcolor, METH_VARARGS, "Deletes the Color \"name\". Every occurence of that Color is replaced by the Color \"replace\"."},
 	{"ReplaceColor", scribus_replcolor, METH_VARARGS, "Every occurence of that Color is replaced by the Color \"replace\"."},
-	{"GetFontNames", scribus_fontnames, METH_VARARGS, "Returns a List with the Names of all available Fonts."},
+	{"GetFontNames", (PyCFunction)scribus_fontnames, METH_NOARGS, "Returns a List with the Names of all available Fonts."},
 	{"RenderFont", scribus_renderfont, METH_VARARGS, "Creates an image preview of font with given text"},
-	{"GetLayers", scribus_getlayers, METH_VARARGS, "Returns a List with the Names of all defined Layers."},
+	{"GetLayers", (PyCFunction)scribus_getlayers, METH_NOARGS, "Returns a List with the Names of all defined Layers."},
 	{"SetActiveLayer", scribus_setactlayer, METH_VARARGS, "Sets the active Layer to the Layer named \"name\"."},
-	{"GetActiveLayer", scribus_getactlayer, METH_VARARGS, "Returns the Name of the current active Layer."},
+	{"GetActiveLayer", (PyCFunction)scribus_getactlayer, METH_NOARGS, "Returns the Name of the current active Layer."},
 	{"SentToLayer", scribus_senttolayer, METH_VARARGS, "Sends the Object \"name\" to the Layer \"layer\". The Layer must exist. If \"name\" is not given the currently selected Item is used."},
 	{"SetLayerVisible", scribus_layervisible, METH_VARARGS, "Sets the Layer \"layer\" to be visible or not. A Value of 1 for \"flag\" means that the Layer \"layer\" is visible, a Value of 0 means that the Layer \"layer\" is invisible."},
 	{"SetLayerPrintable", scribus_layerprint, METH_VARARGS, "Sets the Layer \"layer\" to be printable or not. A Value of 1 for \"flag\" means that the Layer \"layer\" can be printed, a Value of 0 means that printing the Layer \"layer\" is disabled."},
@@ -719,10 +719,10 @@
 	{"IsLayerPrintable", scribus_glayerprint, METH_VARARGS, "Returns wether the Layer \"layer\" is printable or not, a Value of 1 means that the Layer \"layer\" can be printed, a Value of 0 means that printing the Layer \"layer\" is disabled."},
 	{"CreateLayer", scribus_createlayer, METH_VARARGS, "Creates a new Layer with the Name \"name\"."},
 	{"DeleteLayer", scribus_removelayer, METH_VARARGS, "Deletes the Layer with the Name \"name\". Nothing happens if the Layer doesn't exists or if it's the only Layer in the Document."},
-	{"GetGuiLanguage", scribus_getlanguage, METH_VARARGS, "Returns a string with the -lang value."},
-	{"GetHGuides", scribus_getHguides, METH_VARARGS, "TODO: docstring"},
+	{"GetGuiLanguage", (PyCFunction)scribus_getlanguage, METH_NOARGS, "Returns a string with the -lang value."},
+	{"GetHGuides", (PyCFunction)scribus_getHguides, METH_NOARGS, "TODO: docstring"},
 	{"SetHGuides", scribus_setHguides, METH_VARARGS, "TODO: docstring"},
-	{"GetVGuides", scribus_getVguides, METH_VARARGS, "TODO: docstring"},
+	{"GetVGuides", (PyCFunction)scribus_getVguides, METH_NOARGS, "TODO: docstring"},
 	{"SetVGuides", scribus_setVguides, METH_VARARGS, "TODO: docstring"},
 	{"SetDocType", scribus_setdoctype, METH_VARARGS, "Sets the Type of the Documents, to get Facing Pages set the first Parameter to 1, to switch FacingPages off use 0 instead. If you want to be the first Page a left Side set the second Parameter to 1, for a right Page use 0."},
 	// end of aliases
scripter_NOARGS3_1.0.diff (47,543 bytes)   

Issue History

Date Modified Username Field Change
2004-11-03 12:52 ringerc New Issue
2004-11-03 12:52 ringerc File Added: scripter_NOARGS3_1.0.diff
2004-11-06 08:58 ringerc Summary Convert functions that take no arguments to METH_NOARGS => PATCH: Convert functions that take no arguments to METH_NOARGS
2004-11-06 09:39 cbradney Status new => assigned
2004-11-06 09:39 cbradney Assigned To => fschmid
2004-11-06 11:07 ringerc Additional Information Updated
2004-11-06 14:41 ringerc Relationship added related to 0001276
2004-11-07 13:45 fschmid Status assigned => resolved
2004-11-07 13:45 fschmid Fixed in Version => 1.2.1cvs
2004-11-07 13:45 fschmid Resolution open => fixed
2004-11-09 00:27 cbradney Status resolved => closed
2006-05-13 21:54 christoph_s Relationship added child of 0003813