Lable Change by HAL Radio Button?
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
02 Feb 2016 16:14 - 02 Feb 2016 16:16 #69460
by Todd Zuercher
Lable Change by HAL Radio Button? was created by Todd Zuercher
I have been struggling trying to make a GladeVCP. In my panel I want to have a label that changes to show the state of a group of radio buttons. I have it to where It mostly seems to work when testing the panel by its self from the command line. The label will change to what I want when each radio button is selected. The only problem here, is when the window is first opened the label only says "label" until I select one of the buttons. (not to big of a deal)
The bigger problem is that when I open the panel in Linuxcnc (using Axis), the label never changes and always says "label".
Any idea where I'm going wrong.
At this point I'm really just not quit getting the python programming thing, still waiting for that epiphany when it finally clicks and makes sense. Up until now I am mostly just plagiarizing examples of code from places like JT's tutorials pages.
The bigger problem is that when I open the panel in Linuxcnc (using Axis), the label never changes and always says "label".
Any idea where I'm going wrong.
At this point I'm really just not quit getting the python programming thing, still waiting for that epiphany when it finally clicks and makes sense. Up until now I am mostly just plagiarizing examples of code from places like JT's tutorials pages.
Last edit: 02 Feb 2016 16:16 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
03 Feb 2016 03:29 - 03 Feb 2016 03:30 #69481
by cmorley
Replied by cmorley on topic Lable Change by HAL Radio Button?
What exact command are you using to load gladevcp into axis?
in your class's __int__ function you could add:
self.jog_increment.set_text('1.000') for an initial text output (but pick the default output of course)
also I might change this:to :
You would need to define the button name in the __intit__ section:
self.g54inch = self.builder.get_object('g54inch_jog')
(of course all the others too)
and finally I would temporarily add a print command in the activ_inc section to confirm that it is actually getting called.
I would bet it is not getting called.
(you would need to run linuxcnc from a terminal to see the output)
Chris M
in your class's __int__ function you could add:
self.jog_increment.set_text('1.000') for an initial text output (but pick the default output of course)
also I might change this:
def activ_inc(self, widget):
if widget.get_active():
# if the active widget name is equal to 'g54inch_jog': then set the label text
if gtk.Buildable.get_name(widget)=='g54inch_jog':self.jog_increment.set_text('1.000')
def activ_inc(self, widget):
if widget.get_active():
# if the active widget name is equal to 'g54inch_jog': then set the label text
if widget==self.g54inch: self.jog_increment.set_text('1.000')
You would need to define the button name in the __intit__ section:
self.g54inch = self.builder.get_object('g54inch_jog')
(of course all the others too)
and finally I would temporarily add a print command in the activ_inc section to confirm that it is actually getting called.
I would bet it is not getting called.
(you would need to run linuxcnc from a terminal to see the output)
Chris M
Last edit: 03 Feb 2016 03:30 by cmorley.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
03 Feb 2016 14:58 #69515
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
This is the line I'm using in the ini file.
GLADEVCP = -u dig1.py dig1.glade
GLADEVCP = -u dig1.py dig1.glade
Please Log in or Create an account to join the conversation.
04 Feb 2016 01:46 #69550
by cmorley
Replied by cmorley on topic Lable Change by HAL Radio Button?
hmm well that does seem right.
If you can do some debugging prints lines on the python file to see what is getting called and what is not that would help.
Chris M
If you can do some debugging prints lines on the python file to see what is getting called and what is not that would help.
Chris M
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
04 Feb 2016 04:02 #69560
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
I tried a little without much success to add some print lines.
What would you suggest they should be and where to put them?
Starting the panel from the command line with
python dig1.py
opens the panel in a window and the lable change works fine then, (but none of the linuxcnc connections work) even if Linuxcnc is already open.
Tomorrow I'll try some more, and post some of the errors that are showing up in the terminal.
What would you suggest they should be and where to put them?
Starting the panel from the command line with
python dig1.py
opens the panel in a window and the lable change works fine then, (but none of the linuxcnc connections work) even if Linuxcnc is already open.
Tomorrow I'll try some more, and post some of the errors that are showing up in the terminal.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
04 Feb 2016 21:03 #69615
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
This is what I get when I run Linuxcnc from the terminal, using this python script
Please Log in or Create an account to join the conversation.
04 Feb 2016 21:33 - 04 Feb 2016 21:36 #69618
by newbynobi
Replied by newbynobi on topic Lable Change by HAL Radio Button?
I think there is an error in your script.
See the line
Self.jog_increment
And the following line, Imho you missed a "=" and the line brake should mot be there.
This small error do avoid loading the tab correctly and that is the reason it does not work.
But there are sure more problems if i see the bulk of errors.
Norbert
See the line
Self.jog_increment
And the following line, Imho you missed a "=" and the line brake should mot be there.
This small error do avoid loading the tab correctly and that is the reason it does not work.
But there are sure more problems if i see the bulk of errors.
Norbert
Last edit: 04 Feb 2016 21:36 by newbynobi.
Please Log in or Create an account to join the conversation.
05 Feb 2016 03:25 #69632
by cmorley
Replied by cmorley on topic Lable Change by HAL Radio Button?
here is your files editted to work as best i could.
You will only be able to load this using gladevcp no more calling it directly with python.
You will not be able to set a default 'jog' speed as you are using O codes through MDI.
MDI cannot be done until linuccnc is homed.
You would have to do this using more python code - calling MDI commands from the python handler file, rather then action widgets.
If you can live with no default jog speed then the code seems to work for me.
Hope that helps.
Chris M
You will only be able to load this using gladevcp no more calling it directly with python.
You will not be able to set a default 'jog' speed as you are using O codes through MDI.
MDI cannot be done until linuccnc is homed.
You would have to do this using more python code - calling MDI commands from the python handler file, rather then action widgets.
If you can live with no default jog speed then the code seems to work for me.
Hope that helps.
Chris M
The following user(s) said Thank You: Todd Zuercher
Please Log in or Create an account to join the conversation.
05 Feb 2016 03:27 #69633
by cmorley
Replied by cmorley on topic Lable Change by HAL Radio Button?
I am also curious what you are doing as your 'jog' commands seem to actually just move the origin using g10?
Chris M
Chris M
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
05 Feb 2016 13:23 #69650
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
I'm sure there are lots of problems but I'm too much of a neophyte to see any of them.
So what should the line be?
self.jog_increment = self.builder.get_object('jog_increment')
So what should the line be?
self.jog_increment = self.builder.get_object('jog_increment')
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.131 seconds