GSoC 2008 ScripterNG: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
m (Unprotected "GSoC 2008 ScripterNG": Superseded by GSoC 2010)
(No difference)

Revision as of 14:32, 1 February 2010

Google Summer of Code 2008

Project: ScripterNG plug-in for Scribus


Abstract

(Summary visible to anyone on the Google Summer of Code 2008 page, max. 2500 characters)

Scribus shows that professional desktop publishing is possible with Free Software. But - in my opinion - the potential of the scripting interface is mostly underestimated. Other Open Source projects like Firefox, Blender, Inkscape, OpenOffice.org or Gimp have shown that having bindings to scripting languages results in many new features and make it easier for others to extend the functionality of the application.

The current Scripter plug-in has some limitations, a less than optimal architecture and is very difficult to extend. Therefore, I want to create a new scripting plug-in (called ScripterNG), which will also support QtScript besides Python and is easily extendible. Besides the technical aspects I want to make sure that extensions are easily accessible and configurable. Another important issue is integration. An extension should look native in Scribus and can hook directly into the GUI. To make the plug-in usable it has to provide a wide API which includes most of the functionality of the old plug-in plus many new features.

The current way of writing bindings by hand is very hard and error-prone. I ended up writing my own small system to dynamically access any Qt object. It requires sip (the PyQt bindings generator) at build-time and PyQt at runtime. Since QtScript also uses the Qt meta-object-system, one can get support for this EcmaScript-compatible scripting language without additional work.

The API has to be carefully designed to keep it stable across releases. Several people already thought about it and I will try to consider as much of the ideas as possible.

For a transition period old scripts for the old Scripter plug-in can still be used side by side with the new ScripterNG. I also plan to write a compatibility module.

Motivation

Scribus shows that professional desktop publishing is possible with Free Software. Scribus has many powerful features which are often mentioned in articles, eg. high quality PDF export and color management. But the potential of the scripting interface is mostly underestimated. The scripter plug-in is included in the Scribus main distribution together with some example scripts. However, from my point of view it does not get the attention it deserves.

Other Open Source projects like Firefox, Blender, Inkscape, OpenOffice.org or Gimp have shown that having bindings to scripting languages results in many new features and make it easier for others to extend the functionality of the application. People without knowledge of C/C++ but some Python, JavaScript or Perl skills can easily write import-/export-filters, create wizards, write plug-ins or create something nobody else has thought about before. The distributed scripts can be used without recompiling and often without knowledge of the scripting language.

Scripts can help to automate tasks and can adjust a program to the special needs of a user. It is also possible to test new ideas, as languages like Python are great for prototyping. And sometimes it makes more sense to stay with Python instead of rewriting everything in a compiled language.

Project

The current Scripter plug-in has some limitations and a less than optimal architecture and is very difficult to extend. Some experiments with boost-bindings never proceeded beyond preliminary testing.

Therefore, I want to create a new scripting plug-in (called ScripterNG), which also will support QtScript besides Python and is easily extendible. I hope that this plug-in will catch-up with scripting solutions in other major software products. Besides the technical aspects I want to make sure that extensions are easily accessible and configurable. Another important issue is integration. An extension should look native in Scribus and can hook directly into the GUI.

To make the plug-in usable it has to provide a wide API which includes most of the functionality of the old plug-in plus many new features.

Architecture

As a general rule in software development, rewriting everything from scratch is a bad idea. But the current approach does not work anymore with the growing requirements of users and the growing code base. The current way of writing bindings by hand is very hard and error-prone. Automated systems exist (like swig and boost), and I have evaluated most of them.

Some are really interesting, but I ended up writing my own small system to dynamically access any Qt object. Like Smoke, Kross (http://kross.dipe.org) or PythonQt (http://pythonqt.sf.net, do no confuse with PyQt!), it uses the Qt meta-object-system. It requires sip (the PyQt bindings generator) at build-time and PyQt at runtime. I kept the base small and chose an approach where I can move things like configuration dialogs or a scripting console into Python extensions. Since QtScript also uses the Qt meta-object-system, one can get support for this EcmaScript-compatible scripting language without additional work.

The API has to be carefully designed to keep it stable across releases. Several people already thought about it and I will try to consider as much of the ideas as possible:

For a transition period old scripts for the old Scripter plug-in can still be used side by side with the new ScripterNG. I also plan to write a compatibility module.

Roadmap

The roadmap tries to follow the proposed time line published at http://code.google.com/opensource/gsoc/2008/faqs.html#0.1_timeline

Work on the project will start in the middle of April (selected students are announced and the project can officially start):

First week

  • Setting up the infrastructure (weblog, code repository, ...)
  • Adding details to project plan about exact API, extension meta-data file-format, ...
  • Publishing document on my research of binding technologies
  • Getting additional feedback from developers and from the community about the project

Week 2-3

  • Cleaning up current prototype of ScripterNG and epyqt (build system, i18n, ..)
  • Completing current prototype of the extension manager and extension repository

Until 7th of July

  • Working on extending the ScripterNG API
  • Porting most needed features from old Scripter

Until 14th of July

  • Writing mid-term evaluation
  • Until 1st of August
  • Further improving the API
  • Writing examples
  • Porting old extensions like the OpenClipArt browser

Until 11th of August

  • Fixing bugs
  • Reviewing and improving usability
  • Writing documentation for users and developers

Until 18th of august ('pencils down')

  • Writing final evaluation

Benefits

1. Scribus gets a new easy extendible and maintainable scripting plug-in and API.

2. Other developers without knowledge of a given scripting language can make their enhancements available for scripting.

3. Scribus gets an additional popular scripting language: JavaScript (QtScript).

4. Scribus users get a powerful and more freely extendible desktop publishing platform. This will lead to more features, many new ideas and hopefully even more satisfied users.

Questionnaire

Name / University / current enrolment information.

Henning Schröder, currently studying computer science (diploma and bachelor) at the University of Oldenburg.

Biographical sketch.

1978 I was born in a town called Leer in northern Germany near the North Sea and the Dutch border. In 1993 I learned programming on a 80386. Typically I started with Basic and moved on to Pascal, Assembler and C. Because compiling took such a long time on my Linux 1.2 system I also investigated dynamic languages like Tcl/TK, Perl and Python.

From 1992 to 1998 I visited grammar school where I founded a school news paper and used Ventura Publisher and Aldus PageMager on a 80486 at a time where everyone else was doing layout with paper snippets, scissors and glue.

Since 1999 I am studying computer science in Oldenburg which is fortunately not that far away. To finance my studies I had some jobs mostly as a software developer but also as a programming tutor and as a designer for websites and leaflets. There I improved my skills in Java, Python, Photoshop and InDesign. Additionally I learnt a lot about project management, feature based programming, versioning (cvs, svn, bzr), bug tracking (mantis, roundup, trac) and team-work.

In my free time I like drinking tea, reading, watching good movies, bicycling and doing some non-profit activities: Until last year I was second chairman of one of Germany's largest computer clubs. I remain involved and I am still the person of charge for some servers as well as the Linux users group. We are involved in several FOSS-activities , e.g. I organized some events like installfests and we participate regularly in regional Linux information fairs. For things like leaflets, posters and club magazines I was using QuarkXPress for a few years. I was pleased when I could switch to Scribus which is free and runs on my preferred platform. At university I got involved in some political activities around tuition fees. Thus, I have used Scribus successfully for publications such as newsletters.

Did you ever code in C, C++ or Python? Please provide examples of code.

For work I have written a lot of code but obviously I cannot provide anything from it. Below there are a few links to recent projects

Some of my other projects are hosted on Google Code: http://code.google.com/u/henning.schroeder/


Do you use Scribus? Please provide examples if you do.

Yes: http://henning.cco-ev.de/scribus/gsoc/examples/

Do you make other use of Scribus than for laying out articles? Please describe and show examples.

Besides newsletters, leaflets, posters, magazines, business cards and mouse-pads I also extended Scribus in various ways using the Python plug-in. See below for details.

Were you involved in Scribus development in the past? What were your contributions?

I followed Scribus development closely since version 0.2 (which was still Python-based). Although I am currently no Scribus developer I know the code base quite well.

Some scripts I posted on the mailing list ended up in the samples directory (wordcount.py, quote.py, htmlimport.py).

As a passionate PyQt user I experimented with creating GUI elements inside Scribus. This resulted in a OpenClipArt browser. Unfortunately I needed a function to call the SVG-import plug-in which was not possible at that time. So I dug deep into the source and submitted a patch which added this feature: http://bugs.scribus.net/view.php?id=2160

After having so much fun creating this extension I wrote some more extensions and made them available on my own repository.

I started a new scripting plug-in based on the experiences I got and the flaws I found in the scripter plug-in. While writing the prototype I fixed the myplugin example plug-in which had bugs and did not compile: http://bugs.scribus.net/view.php?id=6474

Were you involved in other OpenSource development projects in the past? If yes, please tell us project, when and in what role were you involved.

I created the first web-mail application (BoboMail) in Python a few years ago which was used by some individuals and institutions like universities and small companies. It was also included in the Amphora groupware server for a short time. Now the project is obsolete because a lot of other solutions evolved and I concentrated on new ideas. But I learnt a lot about the free software development process and working with a community of users and contributors.

Why have you chosen your development idea and what do you expect from your implementation?

The extension manager I wrote for the extension repository was inspired by the Firefox add-ons manager. The popularity of Firefox comes from its numerous available add-ons. I thought that Scribus can benefit using the same concept. My implementation consists of two parts. On the one hand I will establish a technology which makes it easy to expose functionality to Python and QtScript. On the other hand the user will see that he can easily add features on-line without recompiling and without waiting for a new release.

Are you confident that you will be able to dedicate time and effort necessary for the successful completion of your GSoC 2008 project?

Yes I am confident. During the last year I did a lot of research on the topic and even built a prototype. So now I know exactly what I am doing and how much time it takes. I am very interested that this project succeeds and I will do everything necessary.

Are you you ready and willing to sustain a good level of communication with your mentor and the Scribus Team overall and be open and forthcoming about the progress of your project including coding and personal problems related to your GSoC project?

Two weeks ago I had the chance to meet Franz at his CeBIT booth (I was helping out at the KDE booth) which was quite nice. Also I have been in contact with other developers via mail and IRC and I often hang out on #scribus. So communicating with the Scribus team is nothing new for me. But I am looking forward to intensify the communication. Additionally I would blog about my project so that anyone can read reports about its progress.