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

Gregory Pittman gpittman
Sun Sep 16 17:22:22 CEST 2007


Jeremy Brown wrote:
> 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"
>   
Perhaps Craig Ringer knows more about this. I can't find setProperty 
referred to in the docs. Either it's something in progress  or something 
abandoned. Unfortunately, in what is documented I can't find a way to 
reverse/flip a frame.

Greg



More information about the scribus mailing list