<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">W = root_window.tk.call


### ADD NEW TAB TO LEFT SIDE  #######

W('.pane.top.tabs','insert','end', 'user', '-text','user')



###########  add buttons to tab  #########
#W('labelframe','.pane.top.tabs.fuser')

#W('grid','.pane.top.tabs.fuser','-column','0','-row','1','-sticky','nw')
W('grid','columnconfigure','.pane.top.tabs.fuser','0','-weight','1')

W('button','.pane.top.tabs.fuser.scrl','-text','^','-command','select_next')
W('grid','.pane.top.tabs.fuser.scrl','-column','1','-row','1','-sticky','ne')

#W('grid','.pane.top.tabs.fuser','-column','0','-row','1','-sticky','nw')
#W('grid','columnconfigure','.pane.top.tabs.user.frame','0','-weight','1')
W('label','.pane.top.tabs.fuser.ucs','-text','G5x')
W('grid','.pane.top.tabs.fuser.ucs','-column','0','-row','1','-sticky','nw')
#W('grid','columnconfigure','.pane.top.tabs.user','0','-weight','1')


###  hide tab  #####







###################   add button to preview ##################
W('grid','columnconfigure','.pane.top.right.fpreview','0','-weight','1')

W('button','.pane.top.right.fpreview.scrl','-text','^','-command','select_next')
W('pack','.pane.top.right.fpreview.scrl','-side','left','-anchor','nw')









# change the font

font = 'mono 12'
fname,fsize = font.split()
root_window.tk.call('font','configure','TkDefaultFont','-family',fname,'-size',fsize)

# redo the text in tabs so they resize for the new default font

root_window.tk.call('.pane.top.tabs','itemconfigure','manual','-text',' Manual - F3 ')
root_window.tk.call('.pane.top.tabs','itemconfigure','mdi','-text',' MDI - F5 ')
root_window.tk.call('.pane.top.right','itemconfigure','preview','-text',' Preview ')
root_window.tk.call('.pane.top.right','itemconfigure','numbers','-text',' DRO ')

###############  choose/remove sliders ########################
#root_window.tk.call('grid','forget','.pane.top.feedoverride')
root_window.tk.call('grid','forget','.pane.top.rapidoverride')
#root_window.tk.call('grid','forget','.pane.top.spinoverride')
root_window.tk.call('grid','forget','.pane.top.jogspeed')
#root_window.tk.call('grid','forget','.pane.top.ajogspeed')
root_window.tk.call('grid','forget','.pane.top.maxvel')
############ remove active gcodes lable and codes ##########
root_window.tk.call('grid','forget','.pane.top.gcodel')
#root_window.tk.call('grid','forget','.pane.top.gcodes')

root_window.tk.call('pack','forget','.pane.bottom')

#root_window.tk.call('destroy','.pane.bottom.t')
#root_window.tk.call('grid','forget','.pane.top.tabs')
#root_window.tk.call('grid','forget','.pane.top')
root_window.tk.call('grid','forget','.pane.bottom')

## -remove bottom frame -##
root_window.tk.call('pack','forget','.pane.bottom.t.text')
root_window.tk.call('pack','forget','.pane.bottom.t.sb')
#root_window.tk.call('grid','.pane.bottom','-column','0','-row','1','-sticky','nesw')

###  pack something under gcode  #######
###root_window.tk.call('grid','.pane.bottom.common','-column','1','-row','2','-sticky','nw')

###add common frame beside t.test
root_window.tk.call('labelframe','.pane.bottom.common')
root_window.tk.call('grid','.pane.bottom.common','-column','0','-row','1','-sticky','nw')
root_window.tk.call('grid','columnconfigure','.pane.bottom.common','0','-weight','1')

##### add userframe corrdinate display as baseline working test ######
W = root_window.tk.call
W('label','.pane.bottom.common.ucs','-text','G5x')
W('grid','.pane.bottom.common.ucs','-column','0','-row','0','-sticky','w')
 
#### add feedrate lable and grid into bottom.common ####################
W('label','.pane.bottom.common.feedrate-upm','-anchor','se','-width','5','-fg','blue')
W('label','.pane.bottom.common.feedrate-upmlab','-text','FEED','-anchor','w','-width','4')
W('grid','.pane.bottom.common.feedrate-upm','-row','1','-column','1','-rowspan','1','-sticky','se')
W('grid','.pane.bottom.common.feedrate-upmlab','-row','1','-column','0','-sticky','w')
##spindle-speed
W('label','.pane.bottom.common.spindle-speed','-anchor','se','-width','5','-fg','blue')
W('label','.pane.bottom.common.spindle-speedlab','-text','S','-anchor','w','-width','4')
W('grid','.pane.bottom.common.spindle-speed','-row','2','-column','1','-rowspan','1','-sticky','se')
W('grid','.pane.bottom.common.spindle-speedlab','-row','2','-column','0','-sticky','w')
## tool number
W('label','.pane.bottom.common.tool-number','-anchor','se','-width','5','-fg','blue')
W('label','.pane.bottom.common.tool-numberlab','-text','T','-anchor','w','-width','4')
W('grid','.pane.bottom.common.tool-number','-row','3','-column','1','-rowspan','1','-sticky','se')
W('grid','.pane.bottom.common.tool-numberlab','-row','3','-column','0','-sticky','w')







#######  add search_bar  #########


## add search entry widget ###
#search_text = StringVar()
#W('entry','.pane.bottom.common.srch_bar','-textvariable','search_text','-width','15')
W('entry','.pane.bottom.common.srch_bar','-width','12')

#####  search function  #########
#search = 'Entry','.pane.bottom.common.srch_bar'


#W('button','.pane.bottom.common.srch_btn','-text','search')
W('button','.pane.bottom.common.scrl_up','-text','^','-command','select_next')
W('button','.pane.bottom.common.scrl_dwn','-text','V','-command','select_prev')

W('button','.pane.bottom.common.srch_btn','-text','search','-command','search_next')

W('grid','.pane.bottom.common.srch_bar','-column','3','-row','2','-sticky','ne')
W('grid','.pane.bottom.common.scrl_up','-column','3','-row','0','-sticky','ne')
W('grid','.pane.bottom.common.srch_btn','-column','2','-row','3','-sticky','ne')
W('grid','.pane.bottom.common.scrl_dwn','-column','3','-row','3','-sticky','ne')



#####  search function  #########
se = '.pane.bottom.common.srch_bar'

def search_next():
      se.set()



def search_gcode(event):  
      
   
    
    # remove tag 'found' from index 1 to END  
    #t.tag_remove('found', '1.0', END)  
      
    
    s =  W('.pane.bottom.common.srch_bar','get')
    #s = "g3"

          
    if (s):         
        line = o.get_highlight_line()
        idx = ("%d.0" % (line+1))
    
            # searches for desried string from index highlighted line  
        idx = t.search(s, idx, nocase = 1,
                            forwards = 1,
                            stopindex = END)
                
              
            # last index sum of current index and  
            # length of text  
        lastidx = '% s+% dc' % (idx, len(s))               
  
  
  
            # overwrite 'Found' at idx  
        t.tag_add('found', idx, lastidx)  
        idx = lastidx 
        t.see(idx)
         
  
        # mark located string as red 
          
    t.tag_config('found', background ='yellow') 
    
      
    idxh = int(idx.split('.')[0])
    o.set_highlight_line(idxh)
    o.tkRedraw()
    '.pane.bottom.common.srch_bar.set(" ")'



#def search_next(*event):
    # command = search_text.get()
    #commands.search_gcode(command)





W('.pane.bottom.common.srch_btn','configure','-command','search_next')







#### end search stuff #########

####### update feedrate
def user_live_update():
    root_window.tk.call('.pane.bottom.common.feedrate-upm','configure','-text','%3.0f' % (comp['feedrate-upm']))
    root_window.tk.call('.pane.bottom.common.spindle-speed','configure','-text','%3.0f' % (comp['spindle-speed']))
    root_window.tk.call('.pane.bottom.common.tool-number','configure','-text','%3.0f' % (comp['tool-number']))

    ###coordinate
    W('.pane.bottom.common.ucs','configure','-text','U:' + all_systems[o.last_g5x_index].split()[1])


def user_hal_pins():
    # create new hal pins
    #mycomp = hal.component('feed')
    comp.newpin('feedrate-upm', hal.HAL_FLOAT, hal.HAL_IN)
    comp.newpin('spindle-speed', hal.HAL_FLOAT, hal.HAL_IN)
    comp.newpin('tool-number', hal.HAL_U32, hal.HAL_IN)
    comp.ready()
    # create new signals and connect pins
    
    hal.new_sig('feedrate-upm',hal.HAL_FLOAT)
    #hal.new_sig('spindle-speed',hal.HAL_FLOAT)
    hal.new_sig('tool-number',hal.HAL_U32)

    hal.connect('motion.feed-upm','feedrate-upm')
    hal.connect('axisui.feedrate-upm','feedrate-upm')
    #hal.connect('spindle.0.speed-out','spindle-speed')
    hal.connect('axisui.spindle-speed','spindle-vel-cmd-rpm')
    hal.connect('halui.tool.number','tool-number')
    hal.connect('axisui.tool-number','tool-number')
##### end feed test




####  repack bottom ####
root_window.tk.call('pack','.pane.bottom.t.sb','-fill','y','-side','left')
root_window.tk.call('pack','.pane.bottom.t.text','-fill','both','-expand','1','-side','top')
root_window.tk.call('pack','.pane.bottom.t.text','-fill','both','-expand','1','-side','left')
########## resize bottom pane #######
root_window.tk.call('.pane','paneconfigure','.pane.bottom',"-stretch","always","-height","350",'-width','500');

#### end new common frame test #####

def toggle_show_tabs(*event):
        # need to toggle variable manually for keyboard shortcut
        if len(event) &gt; 0:
            vars.show_pyvcppanel.set(not vars.show_pyvcppanel.get())

        if vars.show_pyvcppanel.get():
            root_window.tk.call('grid','.pane.top.tabs')
            root_window.tk.call('grid','.pane.top.feedoverride')
            #root_window.tk.call('grid','.pane.top.rapidoverride')
            root_window.tk.call('grid','.pane.top.spinoverride')
            #root_window.tk.call('grid','.pane.top.jogspeed')
            #root_window.tk.call('grid','.pane.top.ajogspeed')
            #root_window.tk.call('grid','.pane.top.maxvel')
            ############ remove active gcodes lable and codes ##########
            #root_window.tk.call('grid','.pane.top.gcodel')
            root_window.tk.call('grid','.pane.top.gcodes')
            #root_window.tk.call('grid','.pane.top.right')

        else:
            root_window.tk.call('grid','remove','.pane.top.tabs')
            root_window.tk.call('grid','remove','.pane.top.feedoverride')
            root_window.tk.call('grid','remove','.pane.top.rapidoverride')
            root_window.tk.call('grid','remove','.pane.top.spinoverride')
            root_window.tk.call('grid','remove','.pane.top.jogspeed')
            root_window.tk.call('grid','remove','.pane.top.ajogspeed')
            root_window.tk.call('grid','remove','.pane.top.maxvel')
            ############ remove active gcodes lable and codes ##########
            root_window.tk.call('grid','remove','.pane.top.gcodel')
            root_window.tk.call('grid','remove','.pane.top.gcodes')
        o.tkRedraw()



def toggle_show_bottom(*event):
        # need to toggle variable manually for keyboard shortcut
        if len(event) &gt; 0:
            vars.show_pyvcppanel.set(not vars.show_pyvcppanel.get())

        if vars.show_pyvcppanel.get():
            root_window.tk.call('grid','.pane.top','-row','1')
            root_window.tk.call('.pane','paneconfigure','.pane.top',"-stretch","never","-minsize","350");

            root_window.tk.call('grid','.pane.bottom','-row','2')
            root_window.tk.call('.pane','paneconfigure','.pane.bottom',"-stretch","always",'-width','500');

            
        else:
            root_window.tk.call('grid','remove','.pane.top')
            root_window.tk.call('.pane','paneconfigure','.pane.top',"-stretch","always","-minsize","150");
            root_window.tk.call('.pane','paneconfigure','.pane.bottom',"-stretch","never",'-width','500','-height','500');

        o.tkRedraw()




######### resize top pane ########
###### smaller manual frame /11 lines of gcode ########
root_window.tk.call('.pane','paneconfigure','.pane.top',"-stretch","never","-minsize","350");
#root_window.tk.call('.pane','paneconfigure','.pane.top',"-stretch","never","-height","350","-minsize","250");

##### bigger manual frame /7 lines of gcode #####
#root_window.tk.call('.pane','paneconfigure','.pane.top',"-stretch","never","-minsize","300");

########### window resize #########
#root_window.tk.call(".pane","configure","-height","350");

########### display z plane in preview  ###########
commands.set_view_z()

########### window resize ##################
#root_window.tk.call("wm","geometry",".","700x440")
#root_window.tk.call("wm","geometry",".","800x480")
#root_window.attributes("-fullscreen",1)





# disable the do you want to close dialog
root_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .")

# change dro screen
root_window.tk.call('.pane.top.right.fnumbers.text','configure','-foreground','limegreen','-background','black')


#modal text
root_window.tk.call('.pane.top.gcodes','configure'
,'-foreground','limegreen'
,"-font","mono 11 bold"
,'-background','black')


#gcode preview text
root_window.tk.call(pane_bottom+".t.text","configure"
,"-foreground","Limegreen"
,"-font","mono 11 "
,"-background","black")

#estop button
root_window.tk.call(".toolbar.machine_estop","configure"
,"-image",""
,"-text","ESTOP"
,"-activebackground","red"
,"-background","red"
,"-helptext","Toggle Emergency Stop [F1]"
,"-borderwidth","5"
,"-font","fixedsys 12 bold"
,"-height","2"
,"-width","6"
,"-highlightthickness", 1
,"-highlightcolor","black"
,"-highlightbackground","black"
,"-takefocus",0
,"-padx",5
,"-pady",5
);

#powerbutton
root_window.tk.call(".toolbar.machine_power","configure"
,"-image",""
,"-text","POWER"
,"-activebackground","green"
,"-background","green"
,"-helptext","Toggle Machine power [F2]"
,"-borderwidth","5"
,"-font","fixedsys 12 bold"
,"-height","2"
,"-width","6"
,"-highlightthickness", 1
,"-highlightcolor","black"
,"-highlightbackground","black"
,"-takefocus",0
,"-padx",5
,"-pady",5
);

root_window.bind('&lt;Key-1&gt;', select_next)
root_window.bind('&lt;Key-2&gt;', select_prev)
root_window.bind('&lt;Key-3&gt;', rClicker)
root_window.bind('&lt;Key-4&gt;', search_gcode)
root_window.bind('&lt;Key-5&gt;', toggle_show_bottom)
root_window.bind('&lt;Key-6&gt;', toggle_show_tabs)


TclCommands.search_gcode = search_gcode
TclCommands.toggle_show_bottom = toggle_show_bottom
TclCommands.toggle_show_tabs = toggle_show_tabs

TclCommands.search_next = search_next
commands = TclCommands(root_window)
#search_command = StringVar()


</pre></body></html>