getting work offsets to show in panel.
- Willheg
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 2
28 Feb 2021 07:01 - 28 Feb 2021 08:14 #200377
by Willheg
getting work offsets to show in panel. was created by Willheg
Hello all,
I'm hoping if this has been asked before or solved if someone could point me in the right direction.
I am building a panel (linuxcnc 2.7.xx using glade 3.8.0 and some python code) and have been going for a few weeks now, it has been a lot of fun researching and trying different code to make happen what I require.
I have managed to get some image changing python to work to change images which was a huge trial and error from the code I found but have it working.
Also got a few buttons to do stuff I require which I'm happy about, mostly linked to run gcodes to change things a bit.
What I'm struggling with is
1, If I change the buttons to an on_image event box what would the code be in python to make things happen like a button, i have seen a few examples but am unalde to get my head around it to make it work for me.
2, I intend to use work offsets and would like a label to tell me what Work Offset i'm using, either from the running g-code or from the buttons I have made which just run some gcode, I have found some GSTAT items of interest or the g5x_index but am struggling to implement this to work or understand how to make it work. or could it be made to work from the 5220 in gcode somehow??
3, when i have clicked a button on the GladeVCP then go to jog with the arrow keys or anything i need to click back on the axis screen before i can do so as it seems to lose focus, is there a way around this as well.
I'm no programmer by a long shot but I am able to read bits and pieces of things a understand it pretty fast as to how it works, it's just getting something that i can adapt to my requirements.
Hope this all makes sense there is someone out there that understands what I'm trying to achieve and can point me in the right direction or offer there advise.
Until i have some replies i will keep on trolling other code, googling etc and see what comes out of it all.
Thanks all
I'm hoping if this has been asked before or solved if someone could point me in the right direction.
I am building a panel (linuxcnc 2.7.xx using glade 3.8.0 and some python code) and have been going for a few weeks now, it has been a lot of fun researching and trying different code to make happen what I require.
I have managed to get some image changing python to work to change images which was a huge trial and error from the code I found but have it working.
Also got a few buttons to do stuff I require which I'm happy about, mostly linked to run gcodes to change things a bit.
What I'm struggling with is
1, If I change the buttons to an on_image event box what would the code be in python to make things happen like a button, i have seen a few examples but am unalde to get my head around it to make it work for me.
2, I intend to use work offsets and would like a label to tell me what Work Offset i'm using, either from the running g-code or from the buttons I have made which just run some gcode, I have found some GSTAT items of interest or the g5x_index but am struggling to implement this to work or understand how to make it work. or could it be made to work from the 5220 in gcode somehow??
3, when i have clicked a button on the GladeVCP then go to jog with the arrow keys or anything i need to click back on the axis screen before i can do so as it seems to lose focus, is there a way around this as well.
I'm no programmer by a long shot but I am able to read bits and pieces of things a understand it pretty fast as to how it works, it's just getting something that i can adapt to my requirements.
Hope this all makes sense there is someone out there that understands what I'm trying to achieve and can point me in the right direction or offer there advise.
Until i have some replies i will keep on trolling other code, googling etc and see what comes out of it all.
Thanks all
Last edit: 28 Feb 2021 08:14 by Willheg. Reason: added a 3rd question
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7758
- Thank you received: 2043
28 Feb 2021 13:37 #200415
by cmorley
Replied by cmorley on topic getting work offsets to show in panel.
1) why do you want to use a event window? button can hold an image if that's why.
2) in 2.7 Gstat was quite limited. you would need to use the linuxcnc python module to read the user system attribute and show it on a lebel.
3) The focus problem you are talking of is a compromise - some keystrokes get through(f1 f2 etc) but not all.
If all did when you cursor-ed through a list the machine might jog.
2) in 2.7 Gstat was quite limited. you would need to use the linuxcnc python module to read the user system attribute and show it on a lebel.
3) The focus problem you are talking of is a compromise - some keystrokes get through(f1 f2 etc) but not all.
If all did when you cursor-ed through a list the machine might jog.
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
Less
More
- Posts: 2075
- Thank you received: 406
28 Feb 2021 21:53 #200468
by newbynobi
Replied by newbynobi on topic getting work offsets to show in panel.
The eventbox needs to be connected to a button press event, that signal can than be handled in your python code.
Norbert
Norbert
Please Log in or Create an account to join the conversation.
- Willheg
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 2
01 Mar 2021 02:07 #200497
by Willheg
Replied by Willheg on topic getting work offsets to show in panel.
Hi cmorley,
to answer
1) i was thinking of doing this so I then could have a transparent background on the button of so the background color changes shades a little instead of going from the transparent state that can be set to the solid grey, and also so i could use different fonts and font color,
2) yeah I had read a little on GSTAT being limited, but am still trying to find out how to work with it like you suggested, but I'm having trouble finding source or understanding how this is done. Like I said I'm no programmer by any means but am enjoying the fun of learning and making something work.
I have from the last time I posted got the label to change after clicking a button and setting the new work offset but it seams clunky to me, but just trying to see if it Changes while running a program.
3) It is a little annoying but i guess it is what it is, I wounder if there is a way to pass key presses to axis if the focus is on the glade panel to allow you to carry on as normal.
to answer
1) i was thinking of doing this so I then could have a transparent background on the button of so the background color changes shades a little instead of going from the transparent state that can be set to the solid grey, and also so i could use different fonts and font color,
2) yeah I had read a little on GSTAT being limited, but am still trying to find out how to work with it like you suggested, but I'm having trouble finding source or understanding how this is done. Like I said I'm no programmer by any means but am enjoying the fun of learning and making something work.
I have from the last time I posted got the label to change after clicking a button and setting the new work offset but it seams clunky to me, but just trying to see if it Changes while running a program.
3) It is a little annoying but i guess it is what it is, I wounder if there is a way to pass key presses to axis if the focus is on the glade panel to allow you to carry on as normal.
Please Log in or Create an account to join the conversation.
- Willheg
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 2
01 Mar 2021 02:13 #200498
by Willheg
Replied by Willheg on topic getting work offsets to show in panel.
Hi Norbert,
Thanks for the response, I have read this somewhere in the last few days, but still need to reread maybe and do some testing code to see if I can get it to work. some of the examples I have found look good but when I try to implement them or change them I break them.
Maybe i need to try and read up on python programming and the layout etc, but am still trying to find the right resources to do that from.
I have also tried to study some *.py from the linuxcnc source to see if I can pick up anything, but as of yet i'm still looking around.
I'm sure I will get there someday somehow as I am one of those people, I will try my hardest to let nothing beat me if I can.
Thanks for the response, I have read this somewhere in the last few days, but still need to reread maybe and do some testing code to see if I can get it to work. some of the examples I have found look good but when I try to implement them or change them I break them.
Maybe i need to try and read up on python programming and the layout etc, but am still trying to find the right resources to do that from.
I have also tried to study some *.py from the linuxcnc source to see if I can pick up anything, but as of yet i'm still looking around.
I'm sure I will get there someday somehow as I am one of those people, I will try my hardest to let nothing beat me if I can.
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
Less
More
- Posts: 2075
- Thank you received: 406
01 Mar 2021 20:39 #200730
by newbynobi
Replied by newbynobi on topic getting work offsets to show in panel.
@will,
I do use eventbox for the combi DRO widget I use in gmoccapy. That DRO do react on a mouse click and distinguish if you click on the letter to set the axis value or on the numbers, toggling the read out from absolute to relative to dtg.
The complete widget will be to difficult to understand for a beginner, but if you only look at the part of the eventbox it might help.
Linuxcnc-dev/lib/python/gladevcp/combi_dro.py
The path is out of memory :-/
Norbert
I do use eventbox for the combi DRO widget I use in gmoccapy. That DRO do react on a mouse click and distinguish if you click on the letter to set the axis value or on the numbers, toggling the read out from absolute to relative to dtg.
The complete widget will be to difficult to understand for a beginner, but if you only look at the part of the eventbox it might help.
Linuxcnc-dev/lib/python/gladevcp/combi_dro.py
The path is out of memory :-/
Norbert
Please Log in or Create an account to join the conversation.
- Willheg
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 2
01 Mar 2021 21:25 #200737
by Willheg
Replied by Willheg on topic getting work offsets to show in panel.
Thanks Norbert,
I will take a look into that at some point over the next few days and see if I can get my head round it or if I just leave it as it is.
You guys on this forum are so great for replying to everyone's requests even if it has probably all been asked before, but it is great to see such a cool bunch of people trying to help others out to keep things improving.
If only I was able to help others in the same way, but all my stuff is trile and error and probaly not the best I teach other the things I do as they may be bad, and I'm probably only scratching the surface of what can be done, but just trying to make my machine work how I would like for how I work.
Anyway thanks again.
I will take a look into that at some point over the next few days and see if I can get my head round it or if I just leave it as it is.
You guys on this forum are so great for replying to everyone's requests even if it has probably all been asked before, but it is great to see such a cool bunch of people trying to help others out to keep things improving.
If only I was able to help others in the same way, but all my stuff is trile and error and probaly not the best I teach other the things I do as they may be bad, and I'm probably only scratching the surface of what can be done, but just trying to make my machine work how I would like for how I work.
Anyway thanks again.
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Platinum Member
Less
More
- Posts: 2075
- Thank you received: 406
01 Mar 2021 21:47 #200741
by newbynobi
Replied by newbynobi on topic getting work offsets to show in panel.
When I did my first steps, I was asking as much as you and without Chris and Mr. Haberler I would not have done what I did, coding gmoccapy for myself as first step and giving that gui back to the LinuxCNC project and its users.
So feel welcome to ask
So feel welcome to ask
The following user(s) said Thank You: Willheg, tommylight
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7758
- Thank you received: 2043
01 Mar 2021 22:49 #200744
by cmorley
2) this should help other then in 2.7 there are very few messages.
linuxcnc.org/docs/2.8/html/gui/GStat.html
here is the file with the message definitions
github.com/LinuxCNC/linuxcnc/blob/2.7/lib/python/hal_glib.py
3) there is, but it's hacky and a compromise/
github.com/LinuxCNC/linuxcnc/blob/2.7/li...n/gladevcp/xembed.py
Replied by cmorley on topic getting work offsets to show in panel.
Hi cmorley,
to answer
1) i was thinking of doing this so I then could have a transparent background on the button of so the background color changes shades a little instead of going from the transparent state that can be set to the solid grey, and also so i could use different fonts and font color,
2) yeah I had read a little on GSTAT being limited, but am still trying to find out how to work with it like you suggested, but I'm having trouble finding source or understanding how this is done. Like I said I'm no programmer by any means but am enjoying the fun of learning and making something work.
I have from the last time I posted got the label to change after clicking a button and setting the new work offset but it seams clunky to me, but just trying to see if it Changes while running a program.
3) It is a little annoying but i guess it is what it is, I wounder if there is a way to pass key presses to axis if the focus is on the glade panel to allow you to carry on as normal.
2) this should help other then in 2.7 there are very few messages.
linuxcnc.org/docs/2.8/html/gui/GStat.html
here is the file with the message definitions
github.com/LinuxCNC/linuxcnc/blob/2.7/lib/python/hal_glib.py
3) there is, but it's hacky and a compromise/
github.com/LinuxCNC/linuxcnc/blob/2.7/li...n/gladevcp/xembed.py
Please Log in or Create an account to join the conversation.
- Willheg
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 2
02 Mar 2021 09:48 #200768
by Willheg
Replied by Willheg on topic getting work offsets to show in panel.
Thanks cmorley,
shame the 2.7 doesn't have half the new things 2.8 does, at the moment I'm just running from a live CD, but could i update the hal_glib.py to the new one if i was to go down the GSTAT Route???
I tried linking the xembed.py it the axis_mm.ini file like this : GLADEVCP = -u xembed.py -u X.py -H XPins.hal -d X.glade but it did not work, is this the correct way, i looked inside this file and also saw that the arrow keys are in the ignore list so would that mean they can not be used as normal?? or do i copy this into my code??
Thanks Again
shame the 2.7 doesn't have half the new things 2.8 does, at the moment I'm just running from a live CD, but could i update the hal_glib.py to the new one if i was to go down the GSTAT Route???
I tried linking the xembed.py it the axis_mm.ini file like this : GLADEVCP = -u xembed.py -u X.py -H XPins.hal -d X.glade but it did not work, is this the correct way, i looked inside this file and also saw that the arrow keys are in the ignore list so would that mean they can not be used as normal?? or do i copy this into my code??
Thanks Again
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.086 seconds