Switch between AXIS tabs with GladeVCP button?
Now that I've got a halfway-decent looking GladeVCP side panel alongside AXIS, I'm wondering how I might go about switching between AXIS tabs by pressing buttons on my panel. On my screen the AXIS tabs themselves are quite small and not very touch-friendly, which is why I'm hoping to select them another way.
I'm pretty sure that some sort of a bridge between Tk and GTK is involved, but since I am a rank beginner at both I have no clear idea of what it might look like.
Thanks very much.
regards,
Patrick
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
linuxcnc.org/docs/2.7/html/gui/axis.html#_axisrc
And here is the Tcl notebook info, you might get the right command to put in the .axisrc file.
core.tcl.tk/bwidget/doc/bwidget/BWman/NoteBook.html
JT
Please Log in or Create an account to join the conversation.
Axis was not designed for a touch screen, Touchy was designed for a touch screen.
As was Gmoccapy, and many folk seem to prefer that to Touchy.
(I like the mandatory physical buttons of Touchy, though the lack of graphical preview is a pity)
Please Log in or Create an account to join the conversation.
BUT it would require someone to dig into AXIS to figure out how to tease out details to change the tabs. Then probably using HAL pins it would be possible.
We call that kinda 'hacky'
AXIS is a good screen but it is difficult to modify - which is a strength and a weakness.
Chris M
Please Log in or Create an account to join the conversation.
Anyway, like I said I have a good thing going with my AXIS mods: an array of large, decorated GladeVCP buttons down the right side which handle all sorts of homing, probing (well, almost), MDI, and 7i76-output (via HAL) chores. Super cool. So I figure it's worth an investment of time to try and get them to switch AXIS tabs...that would really round out the whole touchscreen thing nicely.
As an interim "learn some more python / GTK / Tk" experience, I'm now trying to pop up a message dialog in AXIS in response to a GladeVCP button press event. Kind of a Linuxcnc "Hello, world" if you will. Here's what I've tried (that so far hasn't worked):
1. Put a button called hal_btn_probe on my GladeVCP panel (which is pkf_panel.glade)
2. Attached a handler called: on_hal_btn_probe_clicked() to this button.
3. In a file called pkf.py I have this:
def on_hal_btn_probe_clicked(self, widget):
dialog = gtk_message_dialog_new (main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Well, that worked!",
dialog.run()
I also tried this instead, and many variants of it:
def on_hal_btn_probe_clicked(self, widget):
messagebox.showinfo("FYI","Well, that worked!")
4. In this same python file I included the following (there are others that were already there):
import pygtk
import gladevcp
import gladevcp.makepins
from tkinter import *
from tkinter import messagebox
5. Added the panel to AXIS by putting this line in my ini file:
GLADEVCP = -u pkf.py pkf_panel.glade
==========================================================++++++++++++++++++++++++++++++++++++=
Based on everything I've read in the last few days, I was really expecting this to pop up a messagebox, but so far...nada. I'm thinking that if I can get this working I'll have a fighting chance of getting at the Notebook tabs. We shall see!
If anyone has any words of wisdom on this, I'd be very grateful. Heck, I'm already extremely grateful for all the help I've gotten so far...the collective genius of the folks that hang around this forum never ceases to amaze me!
tnx,
patrick
Please Log in or Create an account to join the conversation.
Thanks for the input, guys. I have played around with gmoccapy quite a bit and while it's an outstanding effort, I find it to be more difficult to customize than I originally thought. [Of course, customizing _any_ of the available programs is a non-trivial undertaking, no matter how you slice it!]
Have you looked at Gscreen? That was specifically designed to be customised.
Please Log in or Create an account to join the conversation.
Have you looked at Gscreen? That was specifically designed to be customised.
Yes, I have read over the Gscreen page. It looks pretty good. However, it also looks like approximately the same learning curve as what I'm already going through with AXIS...and as I mentioned, I'm sooooooo close to finished with that! (Plus I've been using AXIS for you-would-not-believe how long (not to mention EMC...!), and I'd like to stick with it if I can. I'll keep ya posted....
Patrick
Please Log in or Create an account to join the conversation.
pferrick wrote:
I'm wondering how I might go about switching between AXIS tabs by pressing buttons on my panel.
It can be done using .axisrc. The following example will switch thru the tabs sequentially...
Add a HAL button to your GladVCP panel named 'tab-toggle'
Add the following to your .axisrc file:
mycomp = hal.component('tab_switch')
mycomp.newpin('toggle', hal.HAL_BIT, hal.HAL_IN)
mycomp.ready()
# for the manual/mdi tabs
notebook = '.pane.top.tabs'
tabs = ['manual', 'mdi']
# for the preview/dro tabs
#notebook = '.pane.top.right'
#tabs = ['preview', 'numbers']
tab = 0
tabbing = 0
def user_live_update():
global tab
global tabbing
if hal.get_value('tab_switch.toggle') and not tabbing:
tabbing = 1
if tab < len(tabs) - 1:
tab += 1
else:
tab = 0
root_window.tk.call(notebook,'raise',tabs[tab])
elif not hal.get_value('tab_switch.toggle'):
tabbing = 0
Add the following to the init section of your python file: (or you could connect the two hal pins in your postgui hal file)
hal.new_sig('tab-toggle',hal.HAL_BIT)
hal.connect('tab_switch.toggle','tab-toggle')
hal.connect('gladevcp.tab-toggle','tab-toggle')
You would need to ensure that the hal module is imported into your python file.
Cheers, Phill
Please Log in or Create an account to join the conversation.
You are an AXIS .axisrc expert.
We should collect your code snippets and add it to the official docs.
they are very useful - and probably was a bit of research to figer them out.
Nice job!
Chris M
Please Log in or Create an account to join the conversation.