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

Jain Basil Aliyas jainbasil at gmail.com
Wed Jul 20 06:33:22 UTC 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20110720/9d311fe7/attachment-0001.html>


More information about the scribus-dev mailing list