extension and param

Discussion about writing code for Inkscape.
jeromebdx
Posts: 2
Joined: Sun Mar 04, 2012 12:39 pm

extension and param

Postby jeromebdx » Fri Mar 23, 2012 12:04 am

Hello everyone,

I try to develop an extension, but I have a problem :
I would like to set a value in my gui extension, for example if I have this line in my .inx :
<param name="flatness" type="float" min="0.0" max="1000.0" _gui-text="Flatness">10.0</param>
I would like to change the default value by a value from my svg file. Read the xml tag and affect the value.

Is it possible ?

Thanks,

jerome

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: extension and param

Postby ~suv » Fri Mar 23, 2012 1:43 pm

jeromebdx wrote:I would like to change the default value by a value from my svg file. Read the xml tag and affect the value.

Is it possible ?
No.

mathog
Posts: 82
Joined: Tue Feb 08, 2011 6:05 am

Re: extension and param

Postby mathog » Sat Mar 24, 2012 9:33 am

At least on Windows the last value set is maintained between program runs. (Where does Inkscape keep this information?) Anyway, the only time the default value shows up is if the parameter has never been set, once it is set you always see the last set value.

So I'm not sure that changing the default parameter value would do anything anyway.

Did you want to change the last value set?

jeromebdx
Posts: 2
Joined: Sun Mar 04, 2012 12:39 pm

Re: extension and param

Postby jeromebdx » Mon Mar 26, 2012 7:15 am

ok thranks for your response,

I want to read past value in extra xml tag and load it, but it's not really necessary.

mathog
Posts: 82
Joined: Tue Feb 08, 2011 6:05 am

Re: extension and param

Postby mathog » Mon Apr 23, 2012 4:00 am

jeromebdx wrote:I would like to set a value in my gui extension, for example if I have this line in my .inx :
<param name="flatness" type="float" min="0.0" max="1000.0" _gui-text="Flatness">10.0</param>
I would like to change the default value by a value from my svg file. Read the xml tag and affect the value.


Stumbled onto a way to read the XML (see other thread here), which is:

object->getAttribute("flatness")

I believe there is a setAttribute equivalent (don't recall where this is, grep -R from the top of src for the header file which defines getattribute, the set variant was defined in the same place).

Is that what you are after?


Return to “Programming”