NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 

Welcome, Guest
Username: Password: Remember me

TOPIC: hal_spinbutton

hal_spinbutton 01 Jan 2012 10:55 #16189

  • dab77
  • dab77's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 199
  • Karma: 6
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.
The administrator has disabled public write access.

Re:hal_spinbutton 02 Jan 2012 23:24 #16236

  • mhaberler
  • mhaberler's Avatar
  • OFFLINE
  • Moderator
  • Posts: 197
  • Thank you received: 8
  • Karma: 54
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
The administrator has disabled public write access.

Re:hal_spinbutton 03 Jan 2012 07:38 #16258

  • dab77
  • dab77's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 199
  • Karma: 6
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.
The administrator has disabled public write access.

Re:hal_spinbutton 03 Jan 2012 15:05 #16276

  • mhaberler
  • mhaberler's Avatar
  • OFFLINE
  • Moderator
  • Posts: 197
  • Thank you received: 8
  • Karma: 54
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
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 04:33 #16288

  • dab77
  • dab77's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 199
  • Karma: 6
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.
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 07:04 #16295

  • dab77
  • dab77's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 199
  • Karma: 6
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.
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 07:21 #16296

  • mhaberler
  • mhaberler's Avatar
  • OFFLINE
  • Moderator
  • Posts: 197
  • Thank you received: 8
  • Karma: 54
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
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 07:36 #16297

  • andypugh
  • andypugh's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 4138
  • Thank you received: 141
  • Karma: 130
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.
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 08:22 #16300

  • mhaberler
  • mhaberler's Avatar
  • OFFLINE
  • Moderator
  • Posts: 197
  • Thank you received: 8
  • Karma: 54
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
The administrator has disabled public write access.

Re:hal_spinbutton 04 Jan 2012 08:41 #16302

  • dab77
  • dab77's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 199
  • Karma: 6
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.
The administrator has disabled public write access.
Moderators: mhaberler
Time to create page: 1.347 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.