r19332 by gpittman - adding new Scripter commands copyObject() and pasteObject()
scribus-commit
scribus-commit at lists.scribus.net
Tue Jul 8 17:36:37 UTC 2014
Author: gpittman
Date: Tue Jul 8 17:36:37 2014
New Revision: 19332
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19332
Log:
adding new Scripter commands copyObject() and pasteObject()
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=19332&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp Tue Jul 8 17:36:37 2014
@@ -715,11 +715,52 @@
Py_RETURN_NONE;
}
+PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args)
+{
+ char* name = const_cast<char*>("");
+ if (!PyArg_ParseTuple(args, "|es", "utf-8", &name)) {
+ return NULL;
+ }
+ if(!checkHaveDocument()) {
+ return NULL;
+ }
+ // Is there a special name given? Yes -> add this to selection
+ PageItem *i = GetUniqueItem(QString::fromUtf8(name));
+ if (i != NULL) {
+ ScCore->primaryMainWindow()->doc->m_Selection->clear();
+ ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
+ }
+ else
+ return NULL;
+ // do the copy
+ ScCore->primaryMainWindow()->slotEditCopy();
+// Py_INCREF(Py_None);
+// return Py_None;
+ Py_RETURN_NONE;
+}
+
+PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args)
+{
+ char* name = const_cast<char*>("");
+ if (!PyArg_ParseTuple(args, "|es", "utf-8", &name)) {
+ return NULL;
+ }
+ if(!checkHaveDocument()) {
+ return NULL;
+ }
+
+ // do the paste
+ ScCore->primaryMainWindow()->slotEditPaste();
+// Py_INCREF(Py_None);
+// return Py_None;
+ Py_RETURN_NONE;
+}
+
/*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
with header files structure untouched (docstrings are kept near declarations)
PV */
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_getcharstylenames__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__ <<scribus_copyobject__doc__ <<scribus_pasteobject__doc__;
+}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19332&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h Tue Jul 8 17:36:37 2014
@@ -282,6 +282,30 @@
*/
PyObject *scribus_duplicateobject(PyObject * /* self */, PyObject *args);
+/*! docstring */
+PyDoc_STRVAR(scribus_copyobject__doc__,
+QT_TR_NOOP("copyObject([\"name\"]) -> string\n\
+\n\
+copies the selected Object (or Selection Group).\n\
+"));
+/**
+ Gregory Pittman, 2012-01-12
+ copy an object
+*/
+PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_pasteobject__doc__,
+QT_TR_NOOP("pasteObject([\"name\"]) -> string\n\
+\n\
+pastes a Duplicate of the selected Object (or Selection Group).\n\
+"));
+/**
+ Gregory Pittman, 2012-01-29
+ pastes an object
+*/
+PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args);
+
/* Internal function not intended for general use; no docstring */
PyObject* scribus_getframetype(PyObject* self, PyObject* args, PyObject* kw);
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19332&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Tue Jul 8 17:36:37 2014
@@ -559,6 +559,8 @@
// {const_cast<char*>("getChild"), (PyCFunction)scribus_getchild, METH_KEYWORDS, tr(scribus_getchild__doc__)},
// by Christian Hausknecht
{const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)},
+ {const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)},
+ {const_cast<char*>("pasteObject"), scribus_pasteobject, METH_VARARGS, tr(scribus_pasteobject__doc__)},
// Internal methods - Not for public use
{const_cast<char*>("retval"), (PyCFunction)scribus_retval, METH_VARARGS, const_cast<char*>("Scribus internal.")},
{const_cast<char*>("getval"), (PyCFunction)scribus_getval, METH_NOARGS, const_cast<char*>("Scribus internal.")},
More information about the scribus-commit
mailing list