[scribus] Scribus script - set different margins for odd and even pages.

Patrick Wallace mental at mentalware.com
Thu Jul 9 01:10:06 CEST 2009


Stefano,

Your logic is working, but you need to specify the scribus namespace when calling Scribus functions. Also,
I don't think you needed the various 'self' references.

Here's a working version of the script you posted:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import scribus

#-------------------------------------------------------------------
def isodd(n): return 1 == n % 2;
#-------------------------------------------------------------------

def appendPage(self) :
    scribus.messageBox("Debug","AppendingNewPage")
    scribus.newPage(-1)
    if not isodd(scribus.currentPage()):
        scribus.messageBox("Debug","IS Even!!!")
        pgTop,pgLeft,pgRight,pgBottom=scribus.getPageMargins()
        # Now swap left and right margins
        scribus.setMargins(pgRight,pgLeft, pgTop,pgBottom)
#-------------------------------------------------------------------
appendPage(scribus.currentPage)








More information about the scribus mailing list