#!/home/boza/usr/bin/scribus-1.5.3.svn --python-script # -*- coding: utf-8 -*- import sys import scribus ######################### # YOUR IMPORTS GO HERE # ######################### def main(argv): """Test setting and getting attributes on pageItem.""" ######################### # YOUR CODE GOES HERE # ######################### scribus.newDocument(scribus.PAPER_A4, (15,15, 20, 20), scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.PAGE_1, 0, 1) txt=scribus.createText(250, 70, 100, 150) scribus.setText('Some text!', txt) a1 = { "Name": 'MyAttribute', 'Type': 'string', 'Value': 'Something', 'Parameter': '', 'Relationship': 'none', 'RelationshipTo': '', 'AutoAddTo': 'none' } a2 = { "Name": 'Fancy Name', 'Type': 'string', 'Value': 'funny ľščťžýáíé', 'Parameter': '', 'Relationship': 'none', 'RelationshipTo': '', 'AutoAddTo': 'none' } attr = [] attr.append(a1) attr.append(a2) scribus.setObjectAttributes(attr, txt) attr2 = scribus.getObjectAttributes(txt) for d in attr2: print d for key in d.keys(): print key, d[key] def main_wrapper(argv): """The main_wrapper() function disables redrawing, sets a sensible generic status bar message, and optionally sets up the progress bar. It then runs the main() function. Once everything finishes it cleans up after the main() function, making sure everything is sane before the script terminates.""" try: scribus.statusMessage("Running script...") scribus.progressReset() main(argv) finally: # Exit neatly even if the script terminated with an exception, # so we leave the progress bar and status bar blank and make sure # drawing is enabled. if scribus.haveDoc(): scribus.setRedraw(True) scribus.statusMessage("") scribus.progressReset() # This code detects if the script is being run as a script, or imported as a module. # It only runs main() if being run as a script. This permits you to import your script # and control it manually for debugging. if __name__ == '__main__': main_wrapper(sys.argv)