pycvp as an axis Tab

More
4 years 11 months ago #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

Please Log in to join the conversation.

More
4 years 11 months ago #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

Please Log in to join the conversation.

More
4 years 11 months ago #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)   



Warning: Spoiler!


 

Please Log in to join the conversation.

More
4 years 11 months ago #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 to join the conversation.

More
4 years 11 months ago #227116 by cakeslob
Replied by cakeslob on topic pycvp as an axis Tab
Code:
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 to join the conversation.

Time to create page: 0.105 seconds
Powered by Kunena Forum