[scribus-dev] access members of a group? (a.l.e)

gh garyhurtz at gmail.com
Sat Mar 14 12:39:35 CET 2009


a.l.e - thanks a lot for the response. Yes, returning a list from
unGroupObject() should do the job.

The most basic example I can think of (for demonstration purposes) is
something like this. Suppose I draw a bunch of shapes, get them organized
how I want them, then want to do some iterative formatting:

linewidth = 1

for each Obj in ObjGroup:
    setLineWidth(linewidth, Obj)
    setLineColor('Black', Obj)
    linewidth +=1

with your suggestion, it would be something like this:

linewidth = 1

objs = unGroupObj(Group)
for each obj in objs:
    setLineWidth(linewidth, obj)
    setLineColor('Black', obj)
    linewidth +=1
groupObjects(objs)

I suppose it would be a smidge cleaner to be able to operate on the objects
without ungrouping them first, but this is fine if it is easier for you to
implement.

Sorry to convolute the issue, but since I often group different types of
objects together another useful function would allow something like this:

linewidth = 1
fontsize = 10

for each Obj in ObjGroup:
    if isRect(Obj):
        setLineWidth(linewidth, Obj)
        setLineColor('Black', Obj)
        linewidth +=1
     elif isText(Obj):
        setFontSize(fontsize)
        fontsize += 1

Again, I know these are silly examples, but I hope you get the idea of how
this can be a useful function.

Thanks again!

-g


Date: Thu, 12 Mar 2009 13:58:42 +0100
From: "a.l.e" <ale.comp_06 at xox.ch>
Subject: Re: [scribus-dev] access members of a group?
To: Scribus Development Mailing List <scribus-dev at lists.scribus.net>
Message-ID: <49B90702.8040702 at xox.ch>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

salve

> I am new to scribus and playing around with the scripter. I am trying to
> write a script that will operate on members of a group of objects. For
> example, I might want to step through each object and increment a color
> setting, some text, etc.
>
> Although I can group or ungroup a list of objects, I cant figure out how
to
> access each member in the group.
>
> Seems like a pretty basic thing to do, am I missing something


i guess that the easiest way, would be to return a list of objects from
unGroupObject()...


woul it fit your needs?

ciao
a.l.e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20090314/12dfbce2/attachment.htm>


More information about the scribus-dev mailing list