<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import linuxcnc
s = linuxcnc.stat()
s.poll()

root_window.tk.call(".pane","configure","-height","300",'-width','700');
root_window.tk.call('.pane.top.tabs','configure','-width','325')
root_window.tk.call('.pane.top.right','configure','-width','300')
root_window.tk.call("wm","geometry",".","+0+36")
### we will change this back to w later  ####
rC = root_window.tk.call



############################################
#######      MOVE THE GCODE   ##############
############################################

# remove bottom pane
rC('.pane','forget','.pane.bottom')

# new auto tab with gcode text
rC('.pane.top.tabs','insert','end','auto','-text',' Auto ')
rC('.pane.top.tabs.fauto','configure','-borderwidth',2)
rC('frame','.pane.top.tabs.fauto.t','-borderwidth',2,'-relief','sunken','-highlightthickness','1')
rC('text','.pane.top.tabs.fauto.t.text','-borderwidth','0','-exportselection','0','-highlightthickness','0','-relief','flat','-takefocus','0','-undo','0')
rC('bind','.pane.top.tabs.fauto.t.text','&lt;Configure&gt;','goto_sensible_line')
rC('scrollbar','.pane.top.tabs.fauto.t.sb','-width',20,'-borderwidth','0','-highlightthickness','0')
rC('.pane.top.tabs.fauto.t.text','configure','-state','normal','-yscrollcommand',['.pane.top.tabs.fauto.t.sb','set'])
rC('.pane.top.tabs.fauto.t.sb','configure','-command',['.pane.top.tabs.fauto.t.text','yview'])
rC('pack','.pane.top.tabs.fauto.t.sb','-fill','y','-side','right')
rC('pack','.pane.top.tabs.fauto.t.text','-expand','1','-fill','both','-side','left')
rC('pack','.pane.top.tabs.fauto.t','-fill','both')

# create a new widget list so we can "move" the gcode text
widget_list_new = []
for widget in widget_list:
    if '.t.text' in widget[2]:
        widget = ('text', Text, '.pane.top.tabs.fauto.t.text')
    widget_list_new.append(widget)
    widget_list_new.append(('buttonFrame', Frame, '.fbuttons'))
widgets = nf.Widgets(root_window,*widget_list_new)

# copied from axis.py (line 3857) to assign the "new" widgets.text to t
t = widgets.text
t.bind('&lt;Button-3&gt;', rClicker)
t.tag_configure("ignored", background="#ffffff", foreground="#808080")
t.tag_configure("lineno", foreground="#808080")
t.tag_configure("executing", background="#804040", foreground="#ffffff")
t.bind("&lt;Button-1&gt;", select_line)
t.bind("&lt;Double-Button-1&gt;", release_select_line)
t.bind("&lt;B1-Motion&gt;", lambda e: "break")
t.bind("&lt;B1-Leave&gt;", lambda e: "break")
t.bind("&lt;Button-4&gt;", scroll_up)
t.bind("&lt;Button-5&gt;", scroll_down)
t.configure(state="disabled")

############################################
#######  end MOVE THE GCODE   ##############
############################################




##########################################################
########       LOAS_LAST FILE   PY3  LCNC 2.9  #############
########   In ini file under [DISPLAY]  ##################
########     LOAD_LASTFILE = 	YES       ##################
##########################################################

loadlast = inifile.find('DISPLAY', 'LOAD_LASTFILE')
if loadlast == "YES" :
    load_lastfile = True
else:
    load_lastfile = False


lastfile = ""
recent = ap.getpref('recentfiles', [], repr)
if len(recent):
    lastfile = recent.pop(0)

code = []
addrecent = True
if args:
    initialfile = args[0]
elif "AXIS_OPEN_FILE" in os.environ:
    initialfile = os.environ["AXIS_OPEN_FILE"]
elif inifile.find("DISPLAY", "OPEN_FILE"):
    initialfile = inifile.find("DISPLAY", "OPEN_FILE")
elif os.path.exists(lastfile) and load_lastfile:
    initialfile = lastfile
    print ("Loading ") 
    print (initialfile)
elif lathe:
    initialfile = os.path.join(BASE, "share", "axis", "images","axis-lathe.ngc")
    addrecent = False
else:
    initialfile = os.path.join(BASE, "share", "axis", "images", "axis.ngc")
    addrecent = False

if os.path.exists(initialfile):
    open_file_guts(initialfile, False, addrecent)

###############################
######    end load last    ###############
#########################################

#########
##################################

###  do you want to exit linuxcnc
rC("wm","protocol",".","WM_DELETE_WINDOW","destroy .")

rC('grid','forget','.pane.top.gcodel')
rC('grid','forget','.pane.top.right')
rC('grid','forget','.pane.top.gcodes')
rC('grid','.pane.top.right','-sticky','nesw','-column','1','-row','1')
rC('grid','.pane.top.gcodes','-sticky','nesw','-column','1','-row','2','-rowspan','2')



########################################################
###############  choose/remove sliders ########################
########################################################

#rC('grid','forget','.pane.top.feedoverride')
#rC('grid','forget','.pane.top.rapidoverride')
#rC('grid','forget','.pane.top.spinoverride')
#rC('grid','forget','.pane.top.jogspeed')
#rC('grid','forget','.pane.top.ajogspeed')
rC('grid','forget','.pane.top.maxvel')




#######   EDIT TAB   ######

def load_editfile():
    print (s.file)
    open_filea = open(s.file,'r')
    rC('.pane.top.tabs.fedit.t.text','delete','1.0','end')
    rC('.pane.top.tabs.fedit.t.text','insert','end',open_filea.read())
    rC('bind','.pane.top.tabs.fedit.t.text','&lt;Key&gt;', '%A' )
    



def save_editfile():
    print (s.file)
    open_filea = open(s.file,'w')
    edit_gcode = rC('.pane.top.tabs.fedit.t.text','get','1.0','end')
    open_filea.write(edit_gcode)
    reload_file()
    return 1


def print_file():
    print ('breaking')
    return "break"

def print_file2():
    print_file



rC('.pane.top.tabs','insert','end','edit','-text',' edit ','-raisecmd','load_editfile','-leavecmd','save_editfile')
#rC('.pane.top.tabs','insert','end','edit','-text',' edit ')
rC('.pane.top.tabs.fedit','configure','-borderwidth',2)
rC('frame','.pane.top.tabs.fedit.t','-borderwidth',2,'-relief','sunken','-highlightthickness','1')
#rC('text','.pane.top.tabs.fedit.t.text','-borderwidth','0','-exportselection','1','-highlightthickness','0','-relief','flat','-takefocus','1','-undo','1')
rC('text','.pane.top.tabs.fedit.t.text','-borderwidth','0','-relief','flat','-takefocus','1','-undo','1')

#rC('bind','.pane.top.tabs.fedit.t.text','&lt;Configure&gt;','goto_sensible_line')
rC('scrollbar','.pane.top.tabs.fedit.t.sb','-width',20,'-borderwidth','0','-highlightthickness','0')
#rC('.pane.top.tabs.fedit.t.text','configure','-yscrollcommand',['.pane.top.tabs.fedit.t.sb','set'])
#rC('.pane.top.tabs.fedit.t.sb','configure','-command',['.pane.top.tabs.fedit.t.text','yview'])
rC('pack','.pane.top.tabs.fedit.t.sb','-fill','y','-side','right')
rC('pack','.pane.top.tabs.fedit.t.text','-expand','1','-fill','both','-side','left')
rC('pack','.pane.top.tabs.fedit.t','-fill','both')



###### test entry  ####

rC('button','.pane.top.tabs.fedit.edit','-text','edit','-command','load_editfile')
rC('button','.pane.top.tabs.fedit.save','-text','save','-command','save_editfile')
rC('pack','.pane.top.tabs.fedit.edit')
rC('pack','.pane.top.tabs.fedit.save')

rC('.pane.top.tabs','itemconfigure','manual','-text',' MANUAL ')
rC('.pane.top.tabs','itemconfigure','mdi','-text',' MDI ')
rC('.pane.top.tabs','itemconfigure','auto','-text',' AUTO ')
rC('.pane.top.tabs','itemconfigure','edit','-text',' EDIT ')
rC('.pane.top.right','itemconfigure','preview','-text',' PREVIEW ')
rC('.pane.top.right','itemconfigure','numbers','-text',' DRO ')


#######   table test
rC('.pane.top.tabs','insert','end','off','-text',' OFF ')
rC('frame','.pane.top.tabs.foff.t','-borderwidth',2,'-relief','sunken','-highlightthickness','1')
rC('.pane.top.tabs.foff','configure','-borderwidth',2)
rC('pack','.pane.top.tabs.foff.t','-fill','both')


offset = '.pane.top.tabs.foff.t'
count = 0
height = 5
width = 5

for i in range(height): #Rows
    for j in range(width): #Columns
        b = rC('Entry',offset +'.entry' + str(count), '-text', (i,j),'-width','5')
        rC('grid', str(b) ,'-row',i,'-column',j)
        count += 1



TclCommands.save_editfile = save_editfile
TclCommands.load_editfile = load_editfile
TclCommands.printfile = print_file

commands = TclCommands(root_window)

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