initval is not working in scale

More
19 Jun 2012 19:46 #21118 by babis
Hi

I use this line in my pyvcp:
<scale halpin="heater1.set-sv" initval="10" min_="300" max_="0" orient="vertical" width="25" length="500" />

Whatever the initval i use the scale always start at 300 or whatever is the min value.
If i reverse the order of min and max then it works ok. Is any way to force the initial value to apply?

Thank you
Charalampos Alexopoulos

Please Log in or Create an account to join the conversation.

More
19 Jun 2012 19:55 #21119 by BigJohnT
I would assume that min must be less than the initial value and max must be more than the initial value to work. You seem to have it backwards...

John

Please Log in or Create an account to join the conversation.

More
19 Jun 2012 20:22 #21121 by babis
Thank you for your answer. You are right, after some search i found in the [pyvcp_widgets.py] file in the [pyvcp_scale] class this code fragment:

if initval < min_:
self.value=min_
elif initval > max_:
self.value=max_
else:
self.value=initval

I change it to:

if max_ > min_:
if initval < min_:
self.value=min_
elif initval > max_:
self.value=max_
else:
self.value=initval
else:
if initval > min_:
self.value=min_
elif initval < max_:
self.value=max_
else:
self.value=initval

Now it working both ways. It will be nice if it is added to the next release. When you use verical scale is more user friendly to have the lower value in the bottom.

Regards

Please Log in or Create an account to join the conversation.

More
19 Jun 2012 20:48 #21122 by BigJohnT
Makes sense to me...

John

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum