Switch between AXIS tabs with GladeVCP button?
16 Feb 2019 18:09 - 16 Feb 2019 18:11 #126619
by pferrick
Replied by pferrick on topic Switch between AXIS tabs with GladeVCP button?
Unfortunately that didn't work, and I think I figured out why (but not quite how to get around it!)
The button (called backplot) that triggers .axisrc to raise the preview tab is on the side panel next to axis, so it's being monitored by its own (?) gladevcp process. The code that we're trying to use to emit a 'clicked' signal from that button is associated with an iconfileview object on a different GladeVCP panel...one that is associated with a separate (?) gladevcp process. So this is what you get when you choose a file:
Traceback (most recent call last):
File "./Python/file.py", line 28, in on_file_selected
self.builder.get_object(backplot).emit('clicked')
NameError: global name 'backplot' is not defined
As I understand things, 'builder' (aka the 'widget tree') is a structure that holds references to all the gtk objects on a window. The backplot button object we're trying to impersonate (!) is in a different widget tree, I think.
Is there a simple way to say [that other builder].backplot.emit('clicked') ????
Thanks again, Patrick
The button (called backplot) that triggers .axisrc to raise the preview tab is on the side panel next to axis, so it's being monitored by its own (?) gladevcp process. The code that we're trying to use to emit a 'clicked' signal from that button is associated with an iconfileview object on a different GladeVCP panel...one that is associated with a separate (?) gladevcp process. So this is what you get when you choose a file:
Traceback (most recent call last):
File "./Python/file.py", line 28, in on_file_selected
self.builder.get_object(backplot).emit('clicked')
NameError: global name 'backplot' is not defined
As I understand things, 'builder' (aka the 'widget tree') is a structure that holds references to all the gtk objects on a window. The backplot button object we're trying to impersonate (!) is in a different widget tree, I think.
Is there a simple way to say [that other builder].backplot.emit('clicked') ????
Thanks again, Patrick
Last edit: 16 Feb 2019 18:11 by pferrick.
Please Log in or Create an account to join the conversation.
17 Feb 2019 00:13 - 17 Feb 2019 05:46 #126631
by cmorley
Replied by cmorley on topic Switch between AXIS tabs with GladeVCP button?
Ahh I see now. each panel is a different process and yes has a different widget tree.
The thing to do is make a HAL i/o pin in the load button gladevcp panel.
then the program loading function should set this true when the program is loaded.
then in the .axisrc program make a function to read the pin and if true change the tab and then set the pin false again.
to make HAL pins try this:
in the __init__ function add this:
self.halcomp = halcomp
halcomp.newpin('tab-trigger', hal.HAL_BIT, hal.HAL_IO)
then in the program loading function add this at the bottom
The thing to do is make a HAL i/o pin in the load button gladevcp panel.
then the program loading function should set this true when the program is loaded.
then in the .axisrc program make a function to read the pin and if true change the tab and then set the pin false again.
to make HAL pins try this:
in the __init__ function add this:
self.halcomp = halcomp
halcomp.newpin('tab-trigger', hal.HAL_BIT, hal.HAL_IO)
then in the program loading function add this at the bottom
self.halcomp['tab-trigger'] = true
Last edit: 17 Feb 2019 05:46 by cmorley. Reason: some of the code didn't show properly
The following user(s) said Thank You: pferrick
Please Log in or Create an account to join the conversation.
17 Feb 2019 00:18 - 17 Feb 2019 00:18 #126632
by cmorley
Replied by cmorley on topic Switch between AXIS tabs with GladeVCP button?
then in your axisrc file add something like this (PANENAME must be changed to the right name):
Again I haven't tested this code so there could be typos etc
Chris M
if Popen('halcmd getp PANELNAME.tab-trigger',stdout=PIPE,shell=True).communicate()[0].strip() == 'TRUE':
root_window.tk.call('.pane.top.right','raise','preview')
Popen('halcmd setp PANELNAME.tab-trigger false',stdout=PIPE,shell=True)
Again I haven't tested this code so there could be typos etc
Chris M
Last edit: 17 Feb 2019 00:18 by cmorley.
The following user(s) said Thank You: pferrick
Please Log in or Create an account to join the conversation.
17 Feb 2019 02:51 #126648
by pferrick
Replied by pferrick on topic Switch between AXIS tabs with GladeVCP button?
Chris-
Now we're really getting into it....!!! I was thinking that a HAL pin might be the way to go, but I'm not quite to the point of creating them and using them for, shall we say "non-standard" purposes!!! However, I've come a long way in my understanding of basic HAL, that's for sure...thanks in large part to all the expert advice I've gotten through the forum.
I'll try this out tomorrow and let you know how it goes.
tnx,
Patrick
Now we're really getting into it....!!! I was thinking that a HAL pin might be the way to go, but I'm not quite to the point of creating them and using them for, shall we say "non-standard" purposes!!! However, I've come a long way in my understanding of basic HAL, that's for sure...thanks in large part to all the expert advice I've gotten through the forum.
I'll try this out tomorrow and let you know how it goes.
tnx,
Patrick
Please Log in or Create an account to join the conversation.
17 Feb 2019 19:50 #126686
by pferrick
Replied by pferrick on topic Switch between AXIS tabs with GladeVCP button?
Chris-
Well, it looks like I'm running (back) into the shortcomings of using Popen() to poll for tab switch events. According to Phill this is slow enough to limit the number of tabs that can be successfully managed to four. So adding "Oh, and could you check this HAL pin as well!" to .axisrc puts it over the edge!!!
The fix, in probably both cases, is to run the Master branch which apparently does not have this same limitation. Been meaning to try that out for a while now, so I guess it's time! This is not a show-stopping problem by any means, so I will probably work on a few other odds and ends for a little while before I dive in there.
I'll let you know how it comes out then.
Thanks,
Patrick
Well, it looks like I'm running (back) into the shortcomings of using Popen() to poll for tab switch events. According to Phill this is slow enough to limit the number of tabs that can be successfully managed to four. So adding "Oh, and could you check this HAL pin as well!" to .axisrc puts it over the edge!!!
The fix, in probably both cases, is to run the Master branch which apparently does not have this same limitation. Been meaning to try that out for a while now, so I guess it's time! This is not a show-stopping problem by any means, so I will probably work on a few other odds and ends for a little while before I dive in there.
I'll let you know how it comes out then.
Thanks,
Patrick
Please Log in or Create an account to join the conversation.
17 Feb 2019 23:34 #126697
by cmorley
Replied by cmorley on topic Switch between AXIS tabs with GladeVCP button?
Well you have one more chance that I can think of.
Right now we are using Popen to avoid having to connect signals to pins.
You could connect the HAL pin from the gladevcp tab to a HAL pin in your 'happy' component - then you wouldn't need Popen to check them - but you would need to connect signals between them.
Can you post your latest .axisrc and gladevcp python file and I will see if I can flesh our the code.
Chris
Right now we are using Popen to avoid having to connect signals to pins.
You could connect the HAL pin from the gladevcp tab to a HAL pin in your 'happy' component - then you wouldn't need Popen to check them - but you would need to connect signals between them.
Can you post your latest .axisrc and gladevcp python file and I will see if I can flesh our the code.
Chris
Please Log in or Create an account to join the conversation.
19 Feb 2019 03:53 #126746
by pferrick
Replied by pferrick on topic Switch between AXIS tabs with GladeVCP button?
I think I see where you're coming from on this. I'm guessing that checking / adjusting the state of HAL pins is a pretty low-level task for AXIS in comparison with opening a pipe. I'll attach the .axisrc and the GladeVCP/python files so you can take a look. No hurry at all on generating code to try out, by any means!
Thanks,
Patrick
Thanks,
Patrick
Please Log in or Create an account to join the conversation.
19 Feb 2019 07:10 #126753
by phillc54
Replied by phillc54 on topic Switch between AXIS tabs with GladeVCP button?
If you want to hide the the tab labels this may be of interest.
forum.linuxcnc.org/41-guis/36061-tab-label-invisible#126752
Cheers, Phill.
forum.linuxcnc.org/41-guis/36061-tab-label-invisible#126752
Cheers, Phill.
Please Log in or Create an account to join the conversation.
19 Feb 2019 09:04 #126757
by cmorley
Replied by cmorley on topic Switch between AXIS tabs with GladeVCP button?
try these, sorry had to rename them.
Chris
Chris
Please Log in or Create an account to join the conversation.
26 Feb 2019 09:49 #127148
by cmorley
Replied by cmorley on topic Switch between AXIS tabs with GladeVCP button?
Did we win with this?
Chris
Chris
Please Log in or Create an account to join the conversation.
Time to create page: 0.091 seconds