[scribus] Scripter issue using createMasterPage('Test')

Stefano Danzi s.danzi at hawai.it
Fri Apr 5 17:36:50 UTC 2013


I'm writing a script that create a new masterpage, place some elements 
on this new masterpage and close it.

When I run this script object are placed on current page and not in new 
created masterpage.

If I place element on an existing masterpage the script work.

I tryed to create masterpage, close masterpage and reopen masterpage but 
this not solve.

Someone know any workaround?

See this code, found on scribus forum and modifed:

import sys

try:
     import scribus
except ImportError,err:
     print "This script must be run within Scribus."
     sys.exit(1)


def main(argv):
     """
     Test function: Master pages just created not edited.
     """
     try:
         scribus.createMasterPage('Test')
         #scribus.closeMasterPage()
         #scribus.editMasterPage('Test')
         w, h = scribus.getPageSize()
         scribus.createText(0.0,0.0,w,h,'test_frame')
         scribus.setText('Hello from the Master Page!','test_frame')
     finally:
         scribus.closeMasterPage()


def main_wrapper(argv):
     """ Boiler plate from /share/samples/boilerplate.py """
     try:
         scribus.statusMessage("Running script...")
         scribus.progressReset()
         main(argv)
     finally:
         if scribus.haveDoc():
             scribus.setRedraw(True)
         scribus.statusMessage("")
         scribus.progressReset()

if __name__ == '__main__':
     main_wrapper(sys.argv)





More information about the scribus mailing list