r14342 by cbradney - #8597: Add getDocName to scripter
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 24 23:45:35 CET 2009
Revision: 14342
Author: cbradney
Date: 2009-11-24T13:33:05.019816Z
Commit message: #8597: Add getDocName to scripter
Changeset:
M /trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
M /trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h
M /trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Diffs:
Index: scribus/plugins/scriptplugin/cmddoc.h
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.h (revision 14341)
+++ scribus/plugins/scriptplugin/cmddoc.h (revision 14342)
@@ -142,6 +142,16 @@
PyObject *scribus_savedoc(PyObject * /*self*/);
/*! docstring */
+PyDoc_STRVAR(scribus_getdocname__doc__,
+QT_TR_NOOP("getDocName() -> string\n\
+\n\
+Returns the name the document was saved under.\n\
+If the document was not saved before the name is empty.\n\
+"));
+/** Saves active document with given name */
+PyObject *scribus_getdocname(PyObject * /*self*/);
+
+/*! docstring */
PyDoc_STRVAR(scribus_savedocas__doc__,
QT_TR_NOOP("saveDocAs(\"name\")\n\
\n\
Index: scribus/plugins/scriptplugin/cmddoc.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.cpp (revision 14341)
+++ scribus/plugins/scriptplugin/cmddoc.cpp (revision 14342)
@@ -170,6 +170,17 @@
Py_RETURN_NONE;
}
+PyObject *scribus_getdocname(PyObject* /* self */)
+{
+ if(!checkHaveDocument())
+ return NULL;
+ if (! ScCore->primaryMainWindow()->doc->hasName)
+ {
+ return PyString_FromString("");
+ }
+ return PyString_FromString(ScCore->primaryMainWindow()->doc->DocName.toUtf8());
+}
+
PyObject *scribus_savedocas(PyObject* /* self */, PyObject* args)
{
char *Name;
@@ -364,5 +375,5 @@
void cmddocdocwarnings()
{
QStringList s;
- s << scribus_newdocument__doc__ << scribus_newdoc__doc__ << scribus_closedoc__doc__ << scribus_havedoc__doc__ << scribus_opendoc__doc__ << scribus_savedoc__doc__ << scribus_savedocas__doc__ << scribus_setinfo__doc__ <<scribus_setmargins__doc__ <<scribus_setunit__doc__ <<scribus_getunit__doc__ <<scribus_loadstylesfromfile__doc__ <<scribus_setdoctype__doc__ <<scribus_closemasterpage__doc__ <<scribus_masterpagenames__doc__ <<scribus_editmasterpage__doc__ <<scribus_createmasterpage__doc__ <<scribus_deletemasterpage__doc__;
+ s << scribus_newdocument__doc__ << scribus_newdoc__doc__ << scribus_closedoc__doc__ << scribus_havedoc__doc__ << scribus_opendoc__doc__ << scribus_savedoc__doc__ << scribus_getdocname__doc__ << scribus_savedocas__doc__ << scribus_setinfo__doc__ <<scribus_setmargins__doc__ <<scribus_setunit__doc__ <<scribus_getunit__doc__ <<scribus_loadstylesfromfile__doc__ <<scribus_setdoctype__doc__ <<scribus_closemasterpage__doc__ <<scribus_masterpagenames__doc__ <<scribus_editmasterpage__doc__ <<scribus_createmasterpage__doc__ <<scribus_deletemasterpage__doc__;
}
Index: scribus/plugins/scriptplugin/scriptplugin.cpp
===================================================================
--- scribus/plugins/scriptplugin/scriptplugin.cpp (revision 14341)
+++ scribus/plugins/scriptplugin/scriptplugin.cpp (revision 14342)
@@ -412,6 +412,7 @@
{const_cast<char*>("replaceColor"), scribus_replcolor, METH_VARARGS, tr(scribus_replcolor__doc__)},
{const_cast<char*>("rotateObjectAbs"), scribus_rotobjabs, METH_VARARGS, tr(scribus_rotobjabs__doc__)},
{const_cast<char*>("rotateObject"), scribus_rotobjrel, METH_VARARGS, tr(scribus_rotobjrel__doc__)},
+ {const_cast<char*>("getDocName"), (PyCFunction)scribus_getdocname, METH_NOARGS, tr(scribus_getdocname__doc__)},
{const_cast<char*>("saveDocAs"), scribus_savedocas, METH_VARARGS, tr(scribus_savedocas__doc__)},
{const_cast<char*>("saveDoc"), (PyCFunction)scribus_savedoc, METH_NOARGS, tr(scribus_savedoc__doc__)},
{const_cast<char*>("savePageAsEPS"), scribus_savepageeps, METH_VARARGS, tr(scribus_savepageeps__doc__)},
More information about the scribus-commit
mailing list