Scribus > Scripts and Plugins

Accessing item attributes



Is there a way (with scripter) to access a frame attributes as defined in rightClick on frame -> attributes...?
I would like to retreive data from the value and parameter fields...

I know how to access the frame:

--- Code: ---...
    while (page <= pagenum):
        d = scribus.getPageItems()
        strpage = str(page)
        for item in d:
            if (item[1] == 4):
                rawname = item[0]

--- End code ---

but not how to get the value inserted into it's attributes
is this possible?


I realise this topic is more deceased than Monty Python's dead parrot, but I couldn't find any documentation about accessing attributes and kept finding myself back here, so if this stops someone else joining me in my rabbit hole, here's what I found ....

Attributes are stored as a dictionary, and can be accessed using (example snippet):

--- Code: ---attributes = getObjectAttributes(item[0]) # Get list of attributes for item
for attribute in attributes: # For each attribute in current item
    if attribute.get('Name') == "TOC": # If the attribute name is "TOC"
        tocList[attribute.get('Value')] = page         # Add/update the value of the attribute to/on the tocList

--- End code ---

Fields which can be accessed are:

* Name
* Type
* Value
* Parameter
* Relationship
* RelationshipTo
* AutoAddTo
As I only needed to use Name and Value I didn't dive in any further, so can't comment further.


XMLCopyEditor can open any *.sla file (which is XML format).  Attributes can be inspected. But of course you can use other methods like scripting.


[0] Message Index

Go to full version