[scribus] Get articles content online

Juraj Fedel wtxnh-scribus at yahoo.com.au
Tue May 8 06:25:13 UTC 2018


On Mon, May 07, 2018 at 03:17:49PM +0200, niilos wrote:
> Hi,
> Thanks for your reply. I think an external file would be cleaner.
> However, I will have to mantain a correspondance between URLs and scribus
> objects name. It was the point of storing it in the object.

scribus module have getObjectAttributes() and setObjectAttributes() functons.

To learn what data they requre you can create sample document, text
frame in it, manualy set attributes on that frame,
select frame, show Scripter Console, there type command:
getObjectAttributes()
and run it. That will show you all attributes you set on selected frame.

Following script show how to use those functions.

###########
scribus.newDocument(scribus.PAPER_A4,  (15,15,  20, 20),  scribus.PORTRAIT, 1, scribus.UNIT_POINTS,  scribus.PAGE_1, 0, 1)
txt=scribus.createText(70, 70, 200,  150)
scribus.setText('Hello World!', txt)

attr = scribus.getObjectAttributes(txt)
attr.append({
    'Name':"SourceUrl",
    'Type': "string",
    'Value': "http://example.com/data.txt",
    'Parameter': "",
    'Relationship': "none",
    'RelationshipTo': "",
    'AutoAddTo': "none"
    })
scribus.setObjectAttributes(attr, txt)
attr = scribus.getObjectAttributes(txt)

scribus.saveDocAs("objattr.sla")
pdf = scribus.PDFfile()
pdf.save()
###########



More information about the scribus mailing list