@@ -165,10 +165,12 @@ def compare(model, row1, row2, user_data=None):
165165 if toolfile :
166166 self .reload (None )
167167 # check the INI file if display-type: LATHE is set
168- self .inifile = linuxcnc .ini (INIPATH )
169- self .lathe_display_type = self .inifile .getbool ("DISPLAY" , "LATHE" , fallback = False )
170- self .set_lathe_display (self .lathe_display_type )
171-
168+ try :
169+ self .inifile = linuxcnc .ini (INIPATH )
170+ self .lathe_display_type = self .inifile .getbool ("DISPLAY" , "LATHE" , fallback = False )
171+ self .set_lathe_display (self .lathe_display_type )
172+ except :
173+ print ("No INI file found" )
172174 # check linuxcnc status every second
173175 GLib .timeout_add (1000 , self .periodic_check )
174176
@@ -767,7 +769,7 @@ def main(filename=None):
767769 window .connect ("destroy" , Gtk .main_quit )
768770 tooledit .set_col_visible ("abcUVW" , False , tab = '1' )
769771 # uncommented the below line for testing.
770- tooledit .set_filename ("../../../configs/sim/sim.tbl" )
772+ # tooledit.set_filename("../../../configs/sim/sim.tbl")
771773 tooledit .set_font ("sans 16" ,tab = '23' )
772774 window .show_all ()
773775 #tooledit.set_lathe_display(True)
@@ -778,7 +780,10 @@ def main(filename=None):
778780 print ("False" )
779781
780782if __name__ == "__main__" :
781- # if there are two arguments then specify the path
783+ if "INI_FILE_NAME" not in os .environ :
784+ print ("LinuxCNC probably not running. Run 'export INI_FILE_NAME=<your_ini_file>' to use tooledit stand alone." )
785+
786+ # if there is one argument given, specify the path of the tooltable file
782787 if len (sys .argv ) > 1 : main (sys .argv [1 ])
783788 else : main ()
784789
0 commit comments