[Scribus] Scripter setProperty(object, property, value) function

Jeremy Brown jeremy.brown
Thu Sep 13 04:40:38 CEST 2007


In trying to figure out how to do some scripting on images (flipping,
image offset in frame, etc.), I have run across the getPropertyNames(...),
getProperty(...) and setProperty(...) functions.  I was able to make a
script with getPropertyNames and getProperty that would return all the
properties, their values, and their types for the selected object(s) in
message boxes.

However, I can't figure out how to use the setProperty command.  It keeps
giving me an error:
TypeError: Property type '' not supported

I don't know if it is possible to use this function or not.  I am probably
just formatting my "value" field improperly, but I can't find anywhere
that shows me how to format it properly so it can recognize what type it
is.

Can anyone give me any insight on this?

Here is my script that shows the getProperty() working, and setProperty()
not working:

PropertyInfo.py:
from scribus import *

if haveDoc():
    nbrSelected = selectionCount()

objList = []
	
for i in range(nbrSelected):
    objList.append(getSelectedObject(i))
	
for i in range(nbrSelected):
    try:
        obj = objList[i]
        props = ""
        propList = getPropertyNames(obj)
        for p in propList:
            props = props + p + ": " + str(getProperty(obj, p)) + " | " +
str(getPropertyCType(obj, p)) + "\n"
        messageBox("Property Info for " + obj, "Below is a property list
for the selected object named " + obj + "\n" + props, ICON_INFORMATION)
        #setProperty(obj, "imgXOffset", "10.0")
        rev = True
        setProperty(obj, "reverse", rev)
        setProperty(obj, "imgXOffset", 10.0)
    except WrongFrameTypeError:
	    nothing = "nothing"




More information about the scribus mailing list