hal_spinbutton

More
01 Jan 2012 18:55 #16189 by dab77
hal_spinbutton was created by dab77
Hi, does anyone know if it's possible to set an initial value of a spinbutton?
i thought it was the Value field inside Adjustment Properties, but it doesn't work.

any suggestion?

thanks, Davide.

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

More
03 Jan 2012 07:24 #16236 by mhaberler
Replied by mhaberler on topic Re:hal_spinbutton
dab77 wrote:

Hi, does anyone know if it's possible to set an initial value of a spinbutton?
i thought it was the Value field inside Adjustment Properties, but it doesn't work.

any suggestion?

thanks, Davide.


Let me google that for you: lmgtfy.com/?q=gtk+spinbutton+glade+no+default+value

See www.gtkforums.com/viewtopic.php?t=4355

This is due to the old Gtk version in 10.04. This means currently you'll have to hand-edit the gui file to fix this.

- Michael

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

More
03 Jan 2012 15:38 #16258 by dab77
Replied by dab77 on topic Re:hal_spinbutton
Michael, thanks for googling 'in my place'..
i simply didn't think it was a bug. Please, don't think i'm just waitin' for help from here. It's two weeks that i'm studying and setting up this panel the best i can, all day long.

now... manually setting the .ui file as suggested in that thread works to set initial value, but the initial value that appear inside the spinbutton, isn't passed to its hal_pin.

my hal config looks like:

...
net BX-mux-sel tgvcp.hal_button1 => mux2.1.sel
net BX-mux-in tgvcp.hal_spinbutton1-f => mux2.1.in1
net BX-mux-out mux2.1.out => mux2.1.in0 dab_tetrapodkins.Bx
...

this hal is loaded into the main .ini file:

GLADEVCP = -c tgvcp -u tgvcp.py -H tgvcp.hal tgvcp.ui

then if i set the spinbutton initial value to 2000, as i start emc2, the spinbutton is set at 2000, but mux2.1.in1 is 0, and so dab_tetrapodkins.Bx.
tried also to set directly:

net BX-prova tgvcp.hal_spinbutton1-f dab_tetrapodkins.Bx

but it's the same.

I also tried your method to record widget values, but i have the same problem: the widget start with the right value, but its hal pin don't.

any suggestion, please? (tried some googling, without any result).
Davide.

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

More
03 Jan 2012 23:05 #16276 by mhaberler
Replied by mhaberler on topic Re:hal_spinbutton
I found a better workaround.

Define a signal handler for the realize (widget creation) event and set the value there like so:

def on_realize(self,widget):
widget.set_value(3.14)

Associate the GtkWidget 'realize' signal with this 'on_realize' handler in glade.

- Michael

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

More
04 Jan 2012 12:33 #16288 by dab77
Replied by dab77 on topic Re:hal_spinbutton
If i understood, it means that when (just after) the widget is created, that line assign the new-value. in this way the hal_pin should change as well, Did I ?

i'm trying that right now.
Thanks, Davide.

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

More
04 Jan 2012 15:04 #16295 by dab77
Replied by dab77 on topic Re:hal_spinbutton
Hi, that's what i wrote:

def on_hal_spinbutton1_realize(self,widget):
widget.set_value(30)

and as the widget is drawn it assumes the value of 30, but unfortunately the hal_pin associated to that doesn't change.

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

More
04 Jan 2012 15:21 #16296 by mhaberler
Replied by mhaberler on topic Re:hal_spinbutton
dab77 wrote:

Hi, that's what i wrote:

def on_hal_spinbutton1_realize(self,widget):
widget.set_value(30)

and as the widget is drawn it assumes the value of 30, but unfortunately the hal_pin associated to that doesn't change.


1. It does work for me, again I have no idea what version of emc you are running. I cannot help you with some random branch with hasnt been merged with recent fixes.

2. You can try to add
widget.hal_update()

and see wether that improves things.

If not, try with master or v2.5_branch. If this helps, merge your branch upwards.

- Michael

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

More
04 Jan 2012 15:36 #16297 by andypugh
Replied by andypugh on topic Re:hal_spinbutton
mhaberler wrote:

I cannot help you with some random branch with hasnt been merged with recent fixes.


I think Davide is on joints_axes3. It looks like that is merging to 2.4 not 2.5.

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

More
04 Jan 2012 16:22 #16300 by mhaberler
Replied by mhaberler on topic Re:hal_spinbutton
the last time master was merged into joints_axes3 was almost a year ago:

git.linuxcnc.org/gitweb?p=emc2.git;a=com...c785ac63d5eb22053496

any support for gladevcp is bound to be a hit and miss game

I suggest you talk to the author to merge it with master again

- Michael

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

More
04 Jan 2012 16:41 #16302 by dab77
Replied by dab77 on topic Re:hal_spinbutton
Michael, I have to work with JA3 branch, because is the only one where manual jogging is supported with non-trivial kinematics.
it's almost 2 years i'm try to solve that bug, and only in last months i could with a great help from this forum and mailing list.

Now that i finally have the machine worknig, i want to add some functionality, as a good and useful glade panel. and i have it, but if something into this panel doesn't work it's not the case to restart changing the source of emc 2.5 to make manual jogging work!! I'm also a supporter of the logics under Joints_Axes branch, because i think that's the way it should be..

But, going back to this case: my setup is an inverted cable tetrapod, and i have 4 pin to set up the positions of the 4 pulleys (Bx,Cx,Cy and Dy) into my kinematic module.
since i'll have different places where to 'play' this machine, i wanted to use a .ini file to recall each place dimensions. to do that, first i have to make this thing work: setup a value of the spinbutton from outside (for example a set_value from the python file..) in a way that the hal_pin associated to that change as well.

2. You can try to add
widget.hal_update()

I'm going to try also that. i tried before with widget.update, i didn't know of the existance of hal_update (even if i could imagine...)

1. It does work for me, again I have no idea what version of emc you are running. I cannot help you with some random branch with hasnt been merged with recent fixes.

Thanks to tell me this, it's important for me, so i know that maybe the different version could be the problem.

i'm going on trying. Thanks, Davide.

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

Moderators: mhaberlerHansU
Time to create page: 0.157 seconds
Powered by Kunena Forum