r19126 by craig - #12315: Provide getCharStyles
scribus-commit
scribus-commit at lists.scribus.net
Mon May 19 19:52:54 UTC 2014
Author: craig
Date: Mon May 19 19:52:54 2014
New Revision: 19126
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19126
Log:
#12315: Provide getCharStyles
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19126&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp Mon May 19 19:52:54 2014
@@ -673,6 +673,23 @@
return styleList;
}
+PyObject *scribus_getcharstylenames(PyObject* /* self */)
+{
+ PyObject *charStyleList;
+ if(!checkHaveDocument())
+ return NULL;
+ charStyleList = PyList_New(0);
+ for (int i=0; i < ScCore->primaryMainWindow()->doc->charStyles().count(); ++i)
+ {
+ if (PyList_Append(charStyleList, PyString_FromString(ScCore->primaryMainWindow()->doc->charStyles()[i].name().toUtf8())))
+ {
+ // An exception will have already been set by PyList_Append apparently.
+ return NULL;
+ }
+ }
+ return charStyleList;
+}
+
PyObject *scribus_duplicateobject(PyObject * /* self */, PyObject *args)
{
char* name = const_cast<char*>("");
@@ -704,5 +721,5 @@
void cmdobjdocwarnings()
{
QStringList s;
- s << scribus_newrect__doc__ <<scribus_newellipse__doc__ << scribus_newimage__doc__ << scribus_newtext__doc__ << scribus_newtable__doc__ << scribus_newline__doc__ <<scribus_polyline__doc__ << scribus_polygon__doc__ << scribus_bezierline__doc__ <<scribus_pathtext__doc__ <<scribus_deleteobj__doc__ <<scribus_textflow__doc__ <<scribus_objectexists__doc__ <<scribus_setstyle__doc__ <<scribus_getstylenames__doc__ <<scribus_duplicateobject__doc__;
-}
+ s << scribus_newrect__doc__ <<scribus_newellipse__doc__ << scribus_newimage__doc__ << scribus_newtext__doc__ << scribus_newtable__doc__ << scribus_newline__doc__ <<scribus_polyline__doc__ << scribus_polygon__doc__ << scribus_bezierline__doc__ <<scribus_pathtext__doc__ <<scribus_deleteobj__doc__ <<scribus_textflow__doc__ <<scribus_objectexists__doc__ <<scribus_setstyle__doc__ <<scribus_getstylenames__doc__ <<scribus_getcharstylenames__doc__ <<scribus_duplicateobject__doc__;
+}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19126&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h Mon May 19 19:52:54 2014
@@ -262,6 +262,15 @@
PyObject *scribus_getstylenames(PyObject * /*self*/);
/*! docstring */
+PyDoc_STRVAR(scribus_getcharstylenames__doc__,
+QT_TR_NOOP("getCharStyles() -> list\n\
+\n\
+Return a list of the names of all character styles in the current document.\n\
+"));
+PyObject *scribus_getcharstylenames(PyObject * /*self*/);
+
+
+/*! docstring */
PyDoc_STRVAR(scribus_duplicateobject__doc__,
QT_TR_NOOP("duplicateObject([\"name\"]) -> string\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19126&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Mon May 19 19:52:54 2014
@@ -338,6 +338,7 @@
{const_cast<char*>("getActiveLayer"), (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
{const_cast<char*>("getAllObjects"), scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
{const_cast<char*>("getAllStyles"), (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
+ {const_cast<char*>("getCharStyles"), (PyCFunction)scribus_getcharstylenames, METH_NOARGS, tr(scribus_getcharstylenames__doc__)},
{const_cast<char*>("getAllText"), scribus_gettext, METH_VARARGS, tr(scribus_gettext__doc__)},
{const_cast<char*>("getCellStyle"), scribus_getcellstyle, METH_VARARGS, tr(scribus_getcellstyle__doc__)},
{const_cast<char*>("getCellColumnSpan"), scribus_getcellcolumnspan, METH_VARARGS, tr(scribus_getcellcolumnspan__doc__)},
More information about the scribus-commit
mailing list