pycvp as an axis Tab
- mBender
- Offline
- Premium Member
Less
More
- Posts: 113
- Thank you received: 11
19 Nov 2021 01:37 - 19 Nov 2021 01:38 #226940
by mBender
pycvp as an axis Tab was created by mBender
Hi,
I am using this command to create an axis tab in my ini file. But it creates a stand alone window. Is it possible to get this as an tab?
EMBED_TAB_NAME = VFD
EMBED_TAB_COMMAND = halcmd loadusr pyvcp vfd.xml
I am using this command to create an axis tab in my ini file. But it creates a stand alone window. Is it possible to get this as an tab?
EMBED_TAB_NAME = VFD
EMBED_TAB_COMMAND = halcmd loadusr pyvcp vfd.xml
Last edit: 19 Nov 2021 01:38 by mBender.
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
Less
More
- Posts: 7778
- Thank you received: 2075
19 Nov 2021 05:30 #226954
by cmorley
Replied by cmorley on topic pycvp as an axis Tab
pyvcp can only be put on the side.
If you want to put a panelin the center tab, you must use gladevcp or qtvcp
If you want to put a panelin the center tab, you must use gladevcp or qtvcp
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
19 Nov 2021 13:01 - 19 Nov 2021 13:07 #226976
by nkp
Replied by nkp on topic pycvp as an axis Tab
ini :
EMBED_TAB_NAME = pyvcp0
EMBED_TAB_COMMAND = first
PYVCP_TAB = /home/nkp/linuxcnc/configs/jog/j.xml
=============================
.axixrc :
def _dynamic_tabs(inifile):
from subprocess import Popen
import vcpparse
tab_names = inifile.findall("DISPLAY", "EMBED_TAB_NAME")
tab_cmd = inifile.findall("DISPLAY", "EMBED_TAB_COMMAND")
if len(tab_names) != len(tab_cmd):
print "Invalid tab configuration"
# Complain somehow
return
# XXX: Set our root window ID in environment so child GladeVcp processes
# may forward keyboard events to it
rxid = root_window.winfo_id()
os.environ = str(rxid)
for i,t,c in zip(range(len(tab_cmd)), tab_names, tab_cmd):
w = _dynamic_tab("user_" + str(i), t)
f = Tkinter.Frame(w, container=0, borderwidth=0, highlightthickness=0)
if inifile.find("DISPLAY", "PYVCP_TAB"):
f.pack(fill="y", expand=0)
fxml = inifile.findall("DISPLAY", "PYVCP_TAB")
for aa in fxml:
print "fxml=" ,aa
for tc in tab_cmd:
print "tab_cmd=" ,tc
vcpparse.filename = aa
vcpparse.create_vcp(f, comp = None, compname=tc)
else:
f.pack(fill="both", expand=1)
xid = f.winfo_id()
cmd = c.replace('{XID}', str(xid)).split()
child = Popen(cmd)
wait = cmd[:2] ==
_dynamic_childs[str(w)] = (child, cmd, wait)
EMBED_TAB_NAME = pyvcp0
EMBED_TAB_COMMAND = first
PYVCP_TAB = /home/nkp/linuxcnc/configs/jog/j.xml
=============================
.axixrc :
def _dynamic_tabs(inifile):
from subprocess import Popen
import vcpparse
tab_names = inifile.findall("DISPLAY", "EMBED_TAB_NAME")
tab_cmd = inifile.findall("DISPLAY", "EMBED_TAB_COMMAND")
if len(tab_names) != len(tab_cmd):
print "Invalid tab configuration"
# Complain somehow
return
# XXX: Set our root window ID in environment so child GladeVcp processes
# may forward keyboard events to it
rxid = root_window.winfo_id()
os.environ = str(rxid)
for i,t,c in zip(range(len(tab_cmd)), tab_names, tab_cmd):
w = _dynamic_tab("user_" + str(i), t)
f = Tkinter.Frame(w, container=0, borderwidth=0, highlightthickness=0)
if inifile.find("DISPLAY", "PYVCP_TAB"):
f.pack(fill="y", expand=0)
fxml = inifile.findall("DISPLAY", "PYVCP_TAB")
for aa in fxml:
print "fxml=" ,aa
for tc in tab_cmd:
print "tab_cmd=" ,tc
vcpparse.filename = aa
vcpparse.create_vcp(f, comp = None, compname=tc)
else:
f.pack(fill="both", expand=1)
xid = f.winfo_id()
cmd = c.replace('{XID}', str(xid)).split()
child = Popen(cmd)
wait = cmd[:2] ==
_dynamic_childs[str(w)] = (child, cmd, wait)
Attachments:
Last edit: 19 Nov 2021 13:07 by nkp.
The following user(s) said Thank You: jo_key, cakeslob, D.L.
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
19 Nov 2021 13:08 #226978
by nkp
Replied by nkp on topic pycvp as an axis Tab
now for one tab, later I will edit for several
Please Log in or Create an account to join the conversation.
- cakeslob
- Offline
- Platinum Member
Less
More
- Posts: 802
- Thank you received: 231
20 Nov 2021 19:21 #227116
by cakeslob
Ok, I couldnt get it to work as is, I had to change stuff, I dont know why it was complaining about the print function, it was def running from python2.7 because I had errors from py2.7 (its an older version of 2.9 before py3) , it also didnt like this "wait = cmd[:2] ==" so I added the rest into it. I assume "EMBED_TAB_COMMAND = first" is in anticipation of multiple instances , but im tryng to test it with pyvcp_demo1 , so I changed it to "EMBED_TAB_COMMAND = pyvcp" and now seems to work with existing pyvcp. I also cannot get it to load with 2.9 python3, with debug = 5 I get no errors, it just closes after it loads the usercommand file/before hal
Replied by cakeslob on topic pycvp as an axis Tab
ini :
EMBED_TAB_NAME = pyvcp0
EMBED_TAB_COMMAND = pyvcp
PYVCP_TAB = /home/nkp/linuxcnc/configs/jog/j.xml
=============================
.axixrc :
def _dynamic_tabs(inifile):
from subprocess import Popen
import vcpparse
tab_names = inifile.findall("DISPLAY", "EMBED_TAB_NAME")
tab_cmd = inifile.findall("DISPLAY", "EMBED_TAB_COMMAND")
if len(tab_names) != len(tab_cmd):
print ("Invalid tab configuration")
# Complain somehow
return
# XXX: Set our root window ID in environment so child GladeVcp processes
# may forward keyboard events to it
rxid = root_window.winfo_id()
os.environ = str(rxid)
for i,t,c in zip(range(len(tab_cmd)), tab_names, tab_cmd):
w = _dynamic_tab("user_" + str(i), t)
f = Tkinter.Frame(w, container=0, borderwidth=0, highlightthickness=0)
if inifile.find("DISPLAY", "PYVCP_TAB"):
f.pack(fill="y", expand=0)
fxml = inifile.findall("DISPLAY", "PYVCP_TAB")
for aa in fxml:
print ("fxml=" ,aa )
for tc in tab_cmd:
print ("tab_cmd=" ,tc )
vcpparse.filename = aa
vcpparse.create_vcp(f, comp = None, compname=tc)
else:
f.pack(fill="both", expand=1)
xid = f.winfo_id()
cmd = c.replace('{XID}', str(xid)).split()
child = Popen(cmd)
wait = cmd[:2] == ['halcmd', 'loadusr']
_dynamic_childs[str(w)] = (child, cmd, wait)
Ok, I couldnt get it to work as is, I had to change stuff, I dont know why it was complaining about the print function, it was def running from python2.7 because I had errors from py2.7 (its an older version of 2.9 before py3) , it also didnt like this "wait = cmd[:2] ==" so I added the rest into it. I assume "EMBED_TAB_COMMAND = first" is in anticipation of multiple instances , but im tryng to test it with pyvcp_demo1 , so I changed it to "EMBED_TAB_COMMAND = pyvcp" and now seems to work with existing pyvcp. I also cannot get it to load with 2.9 python3, with debug = 5 I get no errors, it just closes after it loads the usercommand file/before hal
Please Log in or Create an account to join the conversation.
Time to create page: 0.070 seconds