View Issue Details

IDProjectCategoryView StatusLast Update
0002160ScribusScripterpublic2007-03-17 04:53
Reporteruser23Assigned Toringerc 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0cvs 
Target VersionFixed in Version1.3.0cvs 
Summary0002160: Import SVGs with Python
DescriptionI 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 InformationPlease 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.
TagsNo tags attached.
Patch

Relationships

related to 0002931 acknowledged Metabug: SVG 
child of 0003813 acknowledged Metabug: Scripter 

Activities

2005-06-29 18:37

 

svgimport.cpp (561 bytes)

2005-06-29 18:39

 

svgimport.h (470 bytes)

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)
 
Makefile.am.diff (2,237 bytes)

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__)},
scriptplugin.cpp.diff (1,296 bytes)

ringerc

2005-06-30 00:21

reporter   ~0005245

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.

ringerc

2005-06-30 04:29

reporter   ~0005248

Patch looks sensible. I'm running a few tests before I merge it now.

ringerc

2005-06-30 04:45

reporter   ~0005249

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.

ringerc

2005-06-30 04:52

reporter   ~0005250

Applied

malex

2007-03-16 22:00

administrator   ~0015546

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?

ringerc

2007-03-17 04:53

reporter   ~0015547

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.

Issue History

Date Modified Username Field Change
2005-06-29 18:37 user23 New Issue
2005-06-29 18:37 user23 File Added: svgimport.cpp
2005-06-29 18:39 user23 File Added: svgimport.h
2005-06-29 18:39 user23 File Added: Makefile.am.diff
2005-06-29 18:41 user23 File Added: scriptplugin.cpp.diff
2005-06-30 00:20 ringerc Status new => assigned
2005-06-30 00:20 ringerc Assigned To => ringerc
2005-06-30 00:21 ringerc Note Added: 0005245
2005-06-30 04:29 ringerc Note Added: 0005248
2005-06-30 04:45 ringerc Note Added: 0005249
2005-06-30 04:52 ringerc Status assigned => resolved
2005-06-30 04:52 ringerc Fixed in Version => 1.3.0cvs
2005-06-30 04:52 ringerc Resolution open => fixed
2005-06-30 04:52 ringerc 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 ringerc Note Added: 0015547