Switching pages in PathPilot by script

More
09 Apr 2023 04:24 - 09 Apr 2023 04:27 #268643 by Vmax549
Hi all I am back working on buttons for PathPilot, The task I am working on is switching pages say from the MAIN page to the Tool offsets page. Switching upper level pages was fairly easy to figure ou but switch down several layers I have not found an example .

This switches to the main page
ui_misc.set_current_notebook_page_id(UI.notebook,"notebook_main_fixed")

But to get to say the tool offset page or the work offsets page you have to work your way down the parent/child tree structure I think (;-)

notebook
             notebook_offsets_fixed
                                                offsets_notebook
                                                                           tool_offsets_fixed
                                                                            work_0ffsets_fixed

Does anyone know how to code the path to get down to those pages ??? I had thought this would work but doesnt'

ui_misc.set_current_notebook_page_id(UI.notebook.notebook_offsets_fixed.offsets_notebook.,"tool_offsets_fixed")

Any ideas on how to do this or point to an example of this being done.

(;-) TP
Last edit: 09 Apr 2023 04:27 by Vmax549.

Please Log in or Create an account to join the conversation.

More
09 Apr 2023 11:19 - 09 Apr 2023 11:23 #268660 by snowgoer540
Replied by snowgoer540 on topic Switching pages in PathPilot by script
I think you were on the right track, but it takes two moves to get there. First you have to switch to the offsets tab:

ui_misc.set_current_notebook_page_by_id(self.notebook, 'notebook_offsets_fixed')


Then you have to switch to the work tab (within the offsets tab):

ui_misc.set_current_notebook_page_by_id(self.offsets_notebook, 'work_offsets_fixed')


So the two lines together took me to the Work tab in the Offsets tab:

ui_misc.set_current_notebook_page_by_id(self.notebook, 'notebook_offsets_fixed')
ui_misc.set_current_notebook_page_by_id(self.offsets_notebook, 'work_offsets_fixed')


To expand a little on how I got there (because I'm by no means a Glade expert), the function "set_current_notebook_page_by_id" in us_misc.py expects the arguments "notebook, page_id".

Following that I looked for the relationships in tormach_mill_ui.glade and at line 296, I saw that the GtkNotebook "notebook" has the GtkFixed objects "notebook_main_fixed", "notebook_settings_fixed", "notebook_offsets_fixed", etc. below it.

In the "notebook_offsets_fixed" section, there's another ,GtkNotebook below it "offsets_notebook". Below that, we have the GtkFixed objects "took_offsets_fixed" and "work_offsets_fixed".

I should mention that I had a glance at the method "handle_hotkey_focus_mdi_line" in ui_common.py, because I knew they switched tabs and grabbed the MDI whenever you press alt + enter (from any tab). I figured the code should be similar. They do some checks to see if a program is running, etc. I am not sure if you need those in your application or not, but it might not be a bad idea.
Last edit: 09 Apr 2023 11:23 by snowgoer540.

Please Log in or Create an account to join the conversation.

More
09 Apr 2023 12:48 #268667 by Vmax549
Replied by Vmax549 on topic Switching pages in PathPilot by script
OK so the trick to understanding it was to look at the function
set_current_notebook_page_by_id() and see what is defines as useable in the way of pathing. and reference that to the Pathing in the glade file.That makes since now.

Would it be possible to have a folder here that we can drop of snippits of code to use with PP ?? Maybe call it " PathPilot ToolBox" That my save others a lot of time learning to mod PP.

Thank You for you time , (;-) TP

Please Log in or Create an account to join the conversation.

More
09 Apr 2023 13:25 #268669 by snowgoer540
Replied by snowgoer540 on topic Switching pages in PathPilot by script
I could make a sticky topic called something like "Modification Code Snippets", or something similar if you think that would be useful.  

I fear it will likely get muddy though with people eventually asking questions, or adding discussion to a snippet, etc.  

But I'm willing if you that's in line with what you were thinking?

Please Log in or Create an account to join the conversation.

More
09 Apr 2023 13:53 #268671 by Vmax549
Replied by Vmax549 on topic Switching pages in PathPilot by script
On other controller forums we allways called it ToolBox . Mach3 ToolBox mach4 toolbox UCCNC ToolBox ,etc.

But you can call it anything you like. I know I will use it to drop off usefull snippit of code with a brief explaination of how to use it and where.

Examples are a GREAT learning tool .

NOTE: I now have a working set of hotkeys to switch pages. One step closer to a mouseless PathPilot when doing everyday work. Now to learn how to set focus on the switched page so I can move around inside of the page functions. IF the TAB function worked inside of PP it would be very usefull I see where Tormach blocked the Tab function . BUT it is what it is.

And if there was a toolbox I would drop off the code there for everyone else to use.

(;-) TP

Please Log in or Create an account to join the conversation.

More
09 Apr 2023 14:08 #268673 by snowgoer540

Please Log in or Create an account to join the conversation.

More
14 May 2023 14:55 #271344 by gerritv
Replied by gerritv on topic Switching pages in PathPilot by script
@Vmax649, would you be willing to also share : forum.linuxcnc.org/pathpilot/41113-wizards-with-linuxcnc ? I am working on a rack toolchanger addition to PP, and would really really prefer not to use Glade :-)

Please Log in or Create an account to join the conversation.

More
14 May 2023 19:23 #271367 by Vmax549
Replied by Vmax549 on topic Switching pages in PathPilot by script
HIYA Ger I am more than happy to help. Just let me know what you need.

(;-) TP
.

Please Log in or Create an account to join the conversation.

More
15 May 2023 00:08 #271377 by gerritv
Replied by gerritv on topic Switching pages in PathPilot by script
Tku, my request will have to wait a while, I have a bigger challenge (see new thread :-)

Please Log in or Create an account to join the conversation.

More
18 May 2023 01:09 #271586 by gerritv
Replied by gerritv on topic Switching pages in PathPilot by script
@vmax549 ok, hurdle overcome. Is there somewhere where I can chat with you offline?

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum