View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002160 | Scribus | Scripter | public | 2005-06-29 18:37 | 2007-03-17 04:53 |
Reporter | Assigned To | ||||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0002160: Import SVGs with Python | ||||
Description | I extended scripter to call svgimplugin. The the attached files contain patches for scriptplugin. This makes my OpenClipArt extension finally useable :) See http://home.cco-ev.de/~henning/scribus/openclipart1.png for an example. | ||||
Additional Information | Please consider adding this patch for 1.3 or tell me how to improve it. Thanks :) It won't work with the 1.2 branch because svgimplugin doesn't use the dllInput parameter. | ||||
Tags | No tags attached. | ||||
Patch | |||||
2005-06-29 18:37
|
svgimport.cpp (561 bytes)
#include "svgimport.h" #include "cmdvar.h" #include "cmdutil.h" #include <qstring.h> PyObject *scribus_importsvg(PyObject */*self*/, PyObject* args) { if(!checkHaveDocument()) return NULL; if (!Carrier->pluginManager->DLLexists(10)) return NULL; char *aText; if (!PyArg_ParseTuple(args, "es", "utf-8", &aText)) return NULL; Carrier->pluginManager->dllInput = QString::fromUtf8(aText); Carrier->pluginManager->callDLL(10); Carrier->doc->loading = false; Py_INCREF(Py_None); return Py_None; } |
2005-06-29 18:39
|
svgimport.h (470 bytes)
#ifndef IMPORTSVG_H #define IMPORTSVG_H // Brings in <Python.h> first #include "cmdvar.h" #include "pluginmanager.h" PyDoc_STRVAR(scribus_importsvg__doc__, QT_TR_NOOP("importSVG(\"string\")\n\ \n\ The \"string\" must be a valid filename for a SVG image. The text\n\ must be UTF8 encoded or 'unicode' string(recommended).\n\ ")); /** Imports a SVG image file. (Henning Schroeder 2005-06-29) */ PyObject *scribus_importsvg(PyObject */*self*/, PyObject* args); #endif |
2005-06-29 18:39
|
Makefile.am.diff (2,237 bytes)
Index: Makefile.am =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/Makefile.am,v retrieving revision 1.9.2.13 diff -u -3 -p -r1.9.2.13 Makefile.am --- Makefile.am 17 Jun 2005 16:05:52 -0000 1.9.2.13 +++ Makefile.am 29 Jun 2005 20:38:38 -0000 @@ -4,8 +4,8 @@ plugins_LTLIBRARIES = libscriptplugin.la INCLUDES = $(LIBFREETYPE_CFLAGS) $(all_includes) libscriptplugin_la_LDFLAGS = -version-info 0:0:0 libscriptplugin_la_METASOURCES = AUTO -libscriptplugin_la_SOURCES = scriptercore.cpp valuedialog.cpp cmdutil.cpp cmddialog.cpp cmddoc.cpp cmdpage.cpp cmdobj.cpp cmdgetprop.cpp cmdsetprop.cpp cmdtext.cpp cmdmani.cpp cmdcolor.cpp cmdmisc.cpp objprinter.cpp objpdffile.cpp guiapp.cpp pconsole.cpp scriptplugin.cpp objimageexport.cpp cmdgetsetprop.cpp -EXTRA_DIST = valuedialog.h cmdvar.h cmdutil.cpp cmdutil.h cmddialog.cpp cmddialog.h cmddoc.cpp cmddoc.h cmdpage.cpp cmdpage.h cmdobj.cpp cmdobj.h cmdgetprop.cpp cmdgetprop.h cmdsetprop.cpp cmdsetprop.h cmdtext.cpp cmdtext.h cmdmani.cpp cmdmani.h cmdcolor.cpp cmdcolor.h cmdmisc.cpp cmdmisc.h objprinter.cpp objprinter.h objpdffile.cpp objpdffile.h guiapp.cpp guiapp.h scriptplugin.cpp scriptplugin.h pconsole.cpp pconsole.h objimageexport.h cmdgetsetprop.h cmdgetsetprop.cpp scriptercore.h +libscriptplugin_la_SOURCES = scriptercore.cpp valuedialog.cpp cmdutil.cpp cmddialog.cpp cmddoc.cpp cmdpage.cpp cmdobj.cpp cmdgetprop.cpp cmdsetprop.cpp cmdtext.cpp cmdmani.cpp cmdcolor.cpp cmdmisc.cpp objprinter.cpp objpdffile.cpp guiapp.cpp svgimport.cpp pconsole.cpp scriptplugin.cpp objimageexport.cpp cmdgetsetprop.cpp +EXTRA_DIST = valuedialog.h cmdvar.h cmdutil.cpp cmdutil.h cmddialog.cpp cmddialog.h cmddoc.cpp cmddoc.h cmdpage.cpp cmdpage.h cmdobj.cpp cmdobj.h cmdgetprop.cpp cmdgetprop.h cmdsetprop.cpp cmdsetprop.h cmdtext.cpp cmdtext.h cmdmani.cpp cmdmani.h cmdcolor.cpp cmdcolor.h cmdmisc.cpp cmdmisc.h objprinter.cpp objprinter.h objpdffile.cpp objpdffile.h guiapp.cpp guiapp.h svgimport.cpp svgimport.h scriptplugin.cpp scriptplugin.h pconsole.cpp pconsole.h objimageexport.h cmdgetsetprop.h cmdgetsetprop.cpp scriptercore.h KDE_OPTIONS = qtonly AM_LDFLAGS = $(PYTHONLIB) $(LIBPYTHON) $(MODULE_LINK_FLAGS) |
2005-06-29 18:41
|
scriptplugin.cpp.diff (1,296 bytes)
Index: scriptplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v retrieving revision 1.33.2.63 diff -u -3 -p -r1.33.2.63 scriptplugin.cpp --- scriptplugin.cpp 12 Jun 2005 14:30:33 -0000 1.33.2.63 +++ scriptplugin.cpp 29 Jun 2005 20:40:06 -0000 @@ -35,6 +35,7 @@ #include "objpdffile.h" #include "objimageexport.h" #include "guiapp.h" +#include "svgimport.h" #include "scriptercore.h" #include "customfdialog.h" @@ -299,6 +300,7 @@ PyMethodDef scribus_methods[] = { {const_cast<char*>("gotoPage"), scribus_gotopage, METH_VARARGS, tr(scribus_gotopage__doc__)}, {const_cast<char*>("groupObjects"), scribus_groupobj, METH_VARARGS, tr(scribus_groupobj__doc__)}, {const_cast<char*>("haveDoc"), (PyCFunction)scribus_havedoc, METH_NOARGS, tr(scribus_havedoc__doc__)}, + {const_cast<char*>("importSVG"), scribus_importsvg, METH_VARARGS, tr(scribus_importsvg__doc__)}, {const_cast<char*>("insertText"), scribus_inserttext, METH_VARARGS, tr(scribus_inserttext__doc__)}, {const_cast<char*>("isLayerPrintable"), scribus_glayerprint, METH_VARARGS, tr(scribus_glayerprint__doc__)}, {const_cast<char*>("isLayerVisible"), scribus_glayervisib, METH_VARARGS, tr(scribus_glayervisib__doc__)}, |
|
Hi Sorry I didn't respond about the issue you were having getting this going earlier. It's been a screaming nightmare at work. I'll look over and merge these in the next couple of days. |
|
Patch looks sensible. I'm running a few tests before I merge it now. |
|
By the way, I have some plans for the scripter and plugin API that might be interesting to you for your OpenClipArt work. First, I'm looking at providing a callback mechanism to trigger on events in Scribus. If you're using PyQt you'll be able to just connect() to an object as I add suitable signals. Alternately, it'll be possible to attach ordinary Python functions by registering a callback using planned new scripter API. Now that we have a proper QApplication subclass, I'm planning on making one of the first callbacks be "mainWindow created" so you can more easily access the main window from startup scripts without timer hacks, etc. DocOpened, DocClosed, and CurrentDocChanged should be others that're pretty high on the priority list. The other thing I'm hoping to do is improve the plug-in API to provide more access into Plug-ins. This should permit things like calling the SVG import plugin with the name prefix you want the items to have, and the desired size and/or (0,0) co-ordinate. |
|
Applied |
|
Craig, Has the plugin API matured to the point that http://wiki.scribus.net/index.php/Improve_scripting_and_its_experience_in_Scribus is feasible for GSOC 2007? |
|
No. Once we're over to Qt4 we'll want to investigate PyQt 4, which I think might provide a decent way to expose our API. Basically, we can use PyQt and SIP to wrap some C++ interfaces that're written for both plugins and scripts to use. Those interfaces, not the wrapper, will be the real work, and they may well deserve a SoC project. The advantage of using SIP rather than Boost::Python to generate the wrapper is that PyQt uses it so we get better integration with that, and we can better expose features that integrate our features with Qt ones (eg expose ScMainWindow as a true QMainWindow subclass). A reasonable SoC project would be a totally new C++ API for plugins and scripts, plus a SIP wrapper for it. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-06-29 18:37 |
|
New Issue | |
2005-06-29 18:37 |
|
File Added: svgimport.cpp | |
2005-06-29 18:39 |
|
File Added: svgimport.h | |
2005-06-29 18:39 |
|
File Added: Makefile.am.diff | |
2005-06-29 18:41 |
|
File Added: scriptplugin.cpp.diff | |
2005-06-30 00:20 |
|
Status | new => assigned |
2005-06-30 00:20 |
|
Assigned To | => ringerc |
2005-06-30 00:21 |
|
Note Added: 0005245 | |
2005-06-30 04:29 |
|
Note Added: 0005248 | |
2005-06-30 04:45 |
|
Note Added: 0005249 | |
2005-06-30 04:52 |
|
Status | assigned => resolved |
2005-06-30 04:52 |
|
Fixed in Version | => 1.3.0cvs |
2005-06-30 04:52 |
|
Resolution | open => fixed |
2005-06-30 04:52 |
|
Note Added: 0005250 | |
2005-07-03 09:17 | cbradney | Status | resolved => closed |
2006-05-13 21:34 | christoph_s | Relationship added | child of 0003813 |
2006-05-17 19:22 | christoph_s | Relationship added | related to 0002931 |
2007-03-16 22:00 | malex | Note Added: 0015546 | |
2007-03-17 04:53 |
|
Note Added: 0015547 |