@@ -123,7 +123,7 @@ def excepthook(exc_type, exc_obj, exc_tb):
123123ALERT_ICON = "dialog_warning"
124124INFO_ICON = "dialog_information"
125125
126-
126+ AXISLIST = [ 'offset' , 'X' , 'Y' , 'Z' , 'A' , 'B' , 'C' , 'U' , 'V' , 'W' , 'name' ]
127127
128128class gmoccapy (object ):
129129 def __init__ (self , argv ):
@@ -2244,6 +2244,65 @@ def _init_offsetpage(self):
22442244 name = self .prefs .getpref (system_name , name , str )
22452245 names .append ([system , name ])
22462246 self .widgets .offsetpage1 .set_names (names )
2247+ for col , name in enumerate (AXISLIST ):
2248+ if col > 9 :break
2249+ temp = self .widgets .offsetpage1 .wTree .get_object ("cell_%s" % name )
2250+ temp .connect ('editing-started' , self .col_edit_started , col )
2251+
2252+
2253+ def col_edit_started (self , widget , filtered_path , new_text , col ):
2254+ model , treeiter = self .widgets .offsetpage1 .view2 .get_selection ().get_selected ()
2255+ path = self .widgets .offsetpage1 .modelfilter .get_path (treeiter )
2256+ (store_path ,) = self .widgets .offsetpage1 .modelfilter .convert_path_to_child_path (path )
2257+ row = store_path
2258+ if self .touch_button_dic ["edit_offsets" ].get_active ():
2259+ offset = self .dialogs .entry_dialog (
2260+ self ,
2261+ header = _ ("Enter value for offset" ),
2262+ label = _ ("Set %s %s-offset to:" % (self .widgets .offsetpage1 .store [row ][0 ], AXISLIST [col ])),
2263+ integer = False )
2264+ if offset == "ERROR" :
2265+ LOG .debug ("conversion error" )
2266+ self .dialogs .warning_dialog (self , _ ("Conversion error !" ),
2267+ ("Please enter only numerical values\n Values have not been applied" ))
2268+ self .touch_button_dic ["edit_offsets" ].set_active (False )
2269+ return
2270+ elif offset == "CANCEL" :
2271+ self .touch_button_dic ["edit_offsets" ].set_active (False )
2272+ return
2273+ print (AXISLIST [col ])
2274+ self .widgets .offsetpage1 .store [row ][col ] = str (offset )
2275+ axisnum = col - 1
2276+ try :
2277+ if self .stat .task_mode != linuxcnc .MODE_MDI :
2278+ self .command .mode (linuxcnc .MODE_MDI )
2279+ self .command .wait_complete ()
2280+ if row == 0 :
2281+ self .command .mdi ("G43.1 %s %10.4f" % (AXISLIST [col ], offset ))
2282+ elif row == 1 :
2283+ self .command .mdi ("#%s = %10.4f" % (str (5161 + axisnum ), offset ))
2284+ elif row == 2 :
2285+ self .command .mdi ("#%s = %10.4f" % (str (5181 + axisnum ), offset ))
2286+ elif row == 3 :
2287+ self .command .mdi ("G92 %s %10.4f" % (AXISLIST [col ], offset ))
2288+ else :
2289+ print ("TRY5" )
2290+ pnum = row - 3
2291+ if not pnum == None :
2292+ if col == 10 :
2293+ self .command .mdi ("G10 L2 P%d R %10.4f" % (pnum , offset ))
2294+ else :
2295+ self .command .mdi ("G10 L2 P%d %s %10.4f" % (pnum , AXISLIST [col ], offset ))
2296+ print (("G10 L2 P%d %s %10.4f" % (pnum , AXISLIST [col ], offset )))
2297+ self .command .mode (linuxcnc .MODE_MANUAL )
2298+ self .command .wait_complete ()
2299+ self .command .mode (linuxcnc .MODE_MDI )
2300+ self .command .wait_complete ()
2301+ except Exception as error :
2302+ print (_ ("offsetpage widget error: MDI call error" ))
2303+ print (error )
2304+ self .widgets .offsetpage1 .reload_offsets ()
2305+ self .touch_button_dic ["edit_offsets" ].set_active (False )
22472306
22482307 # Icon file selection stuff
22492308 def _init_IconFileSelection (self ):
0 commit comments