[scribus-dev] GSoC 2011: Need help to make api design better.

Henning Schröder henning.schroeder at gmail.com
Wed Jul 20 07:32:36 UTC 2011


Hi!
Last weekend I looked into the code and made the same observation.
It's nice to see the progress :) but the API could be improved.
I think you would have to create simple proxy objects which inherit
from QObject and have a reference to the native Scribus object
(ScColor, etc.).  This also makes to scripting API more stable if the
internals change.
The only real problem with proxy objects might be that they still
exist although the wrapped object is already deleted.

Greets
Henning

2011/7/20 Jain Basil Aliyas <jainbasil at gmail.com>:
> Hello,
> Currently, the APIs like layers, color, objects etc. in scripter is designed
> in such a way that each function has one parameter "name" to get the
> object/layer upon which the function is to be operated upon.
> For eg. : Scripter.color.getColorAsCMYK("black") will return a list
> [C,M,Y,K] containing the components.
> It'd be nice if a getColor function returned a ScColor object itself, but
> since it is not inherited from QObject, I am unable to do it. If we had a
> workaround to implement it in this way, the following may be possible:
> colorlist =Scripter.activeDocument.colors() #here, colorlist should be of
> the type ColorList (defined in sccolor.*), so that we can define set and get
> functions associated with ColorList in Q_PROPERTY.
> Same will be the case, if we could access the ScLayer object. I found that
> if we need to make this possible, the object should be typecasted to
> QObject*, which is not possible for us now. This is because these classes
> isn't associated with QObject.
> But, this is possible in case of PageItem class, which has some properties
> defined as Q_PROPERTY. i.e.
> Scripter.activeDocument.activePage.items[i].itemName will return the name of
> ith item in the list.
> I'd like to know if there's some method to make feature this possible :)
> Thanks,
> --
> jain basil aliyas.
> http://blog.jainbasil.net
>
> _______________________________________________
> scribus-dev mailing list
> scribus-dev at lists.scribus.net
> http://lists.scribus.net/mailman/listinfo/scribus-dev
>
>



More information about the scribus-dev mailing list