[scribus] Scripter2: Iteration of pages and setting activePage

Mark Heieis mheieis at alois.ca
Tue Dec 4 19:15:25 UTC 2012


Hi A.l.e.

You don't like it where?

mrh.

On 2012-12-04 10:42, ale rimoldi wrote:
> hi mark
>
>>>> In Scripter2 (1.5.0.svn), how does one iterate the pages in an
>>>> activeDocument, ie there doesn't seem to be a page[] list?
>>>>
>>>> Alternatively, how does one set/select the
>>>> activeDocument.activePage from Scripter2, which would solve the
>>>> above, as activePage.pageCount is available?
>> I see that in api_page.cpp there is a method "setNumber", which
>> appears to be intended as a set active page function. I've tried
>> calling it in the console but it fails (eg.
>> Scripter.activeDocument.activePage.setNumber(2) of a 4 page doc).
>> Perhaps it is not exposed to the interpreter?
> somehow i don't like it there...
>
> API change proposal: shouldn't it be document.setActivePage(i) ?
>
>
> for the short term i can offer you:
>
>
> Index: scribus/plugins/scripter/api_page.h
> ===================================================================
> --- scribus/plugins/scripter/api_page.h (revision 17929)
> +++ scribus/plugins/scripter/api_page.h (working copy)
> @@ -17,7 +17,7 @@
>   class PageAPI : public QObject
>   {
>          Q_OBJECT
> -    Q_PROPERTY(int number READ number WRITE setNumber)
> +    Q_PROPERTY(int number READ number)
>       Q_PROPERTY(int position READ position)
>       Q_PROPERTY(QList<QVariant> items READ items)
>       Q_PROPERTY(QList<QVariant> selection READ selection)
> @@ -25,6 +25,7 @@
>   
>   public slots:
>          void remove();
> +       void setNumber(int value);
>          QObject *newRectangle(double x, double y, double width, double
> height); QObject *newEllipse(double x, double y, double width, double
> height); QObject *newImage(double x, double y, double width, double
> height); @@ -43,7 +44,6 @@
>   private:
>          int position();
>          int number();
> -       void setNumber(int value);
>          QList<QVariant> items();
>          QList<QVariant> selection();
>          PageItem *newItem(const PageItem::ItemType itemType,
>
>
>
> ciao
> a.l.e
>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net




More information about the scribus mailing list