Switch between AXIS tabs with GladeVCP button?

More
7 years 8 months ago #126619 by pferrick
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. [I did try replacing backplot with gladevcp.backplot, but that didn't help.]

Is there a simple way to say [that other builder].backplot.emit('clicked') ????

Thanks again, Patrick

Please Log in to join the conversation.

More
7 years 8 months ago #126631 by cmorley
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
Code:
self.halcomp['tab-trigger'] = true

Please Log in to join the conversation.

More
7 years 8 months ago #126632 by cmorley
then in your axisrc file add something like this (PANENAME must be changed to the right name):
Code:
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

Please Log in to join the conversation.

More
7 years 8 months ago #126648 by pferrick
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

Please Log in to join the conversation.

More
7 years 8 months ago #126686 by pferrick
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

Please Log in to join the conversation.

More
7 years 8 months ago #126697 by cmorley
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

Please Log in to join the conversation.

More
7 years 8 months ago #126746 by pferrick
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

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
7 years 8 months ago #126753 by phillc54
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.

Please Log in to join the conversation.

More
7 years 8 months ago #126757 by cmorley
try these, sorry had to rename them.

Chris

Please Log in to join the conversation.

More
7 years 8 months ago #127148 by cmorley
Did we win with this?

Chris

Please Log in to join the conversation.

Time to create page: 0.228 seconds
Powered by Kunena Forum