@@ -1942,7 +1942,6 @@ def set_up_user_tab_widgets(self, tab_locations):
19421942
19431943 # and we load the tooltable data
19441944 def _init_tooleditor (self ):
1945-
19461945 # get the path to the tool table
19471946 tooltable = self .get_ini_info .get_toolfile ()
19481947 if not tooltable :
@@ -1952,20 +1951,56 @@ def _init_tooleditor(self):
19521951 sys .exit ()
19531952 toolfile = os .path .join (CONFIGPATH , tooltable )
19541953 self .widgets .tooledit1 .set_filename (toolfile )
1955-
19561954 # first we hide all the axis columns the unhide the ones we want
19571955 self .widgets .tooledit1 .set_visible ("abcxyzuvwijq" , False )
19581956 for axis in self .axis_list :
19591957 self .widgets .tooledit1 .set_visible ("{0}" .format (axis ), True )
1960-
19611958 # if it's a lathe config we show lathe related columns
19621959 if self .lathe_mode :
19631960 self .widgets .tooledit1 .set_visible ("ijq" , True )
19641961 if not self .get_ini_info .get_lathe_wear_offsets ():
19651962 # hide the wear offset tabs
19661963 self .widgets .tooledit1 .set_lathe_display (False )
1967-
19681964 self .widgets .tooledit1 .hide_buttonbox (True )
1965+ column_cell_ids = ["toggle" , "tool#1" , "pos1" , "x1" , "y1" , "z1" , "a1" , "b1" , "c1" , "u1" , "v1" , "w1" ,
1966+ "d1" , "front1" , "back1" , "orient1" , "cell_comments1" ]
1967+ for col , name in enumerate (column_cell_ids ):
1968+ if col > 0 and col < 16 :
1969+ temp = self .widgets .tooledit1 .wTree .get_object ("cell_%s" % name )
1970+ temp .connect ('editing-started' , self .on_tool_col_edit_started , col )
1971+
1972+ def on_tool_col_edit_started (self , widget , filtered_path , new_text , col ):
1973+ captations = ["toggle" , "Tool#" , "Pocket" ,
1974+ "X-offset" , "Y-offset" , "Z-offset" ,
1975+ "A-offset" , "B-offset" , "C-offset" ,
1976+ "U-offset" , "V-offset" , "W-offset" ,
1977+ "Diameter" , "Front angle" , "Back angle" , "Orientation" , ";1" ]
1978+ toolpage = self .widgets .tooledit1
1979+ toolview = toolpage .view1
1980+ model , row = toolview .get_selection ().get_selected ()
1981+ value = self .dialogs .entry_dialog (self ,
1982+ data = model [row ][col ],
1983+ header = _ ("Enter value" ),
1984+ label = _ ("Tool %s, %s:" % (model [row ][1 ], captations [col ])),
1985+ integer = False )
1986+ if value == "ERROR" :
1987+ LOG .debug ("conversion error" )
1988+ self .dialogs .warning_dialog (self , _ ("Conversion error !" ),
1989+ ("Please enter only numerical values\n Values have not been applied" ))
1990+ elif value == "CANCEL" :
1991+ pass
1992+ else :
1993+ store = toolpage .wTree .get_object ("liststore1" )
1994+ if col in [1 ,2 ,15 ]:
1995+ store [row ][col ] = value
1996+ else :
1997+ store [row ][col ] = locale .format_string ("%11.4f" , value )
1998+ # this is needed to get offsetview out of editing mode
1999+ GLib .timeout_add (50 ,
2000+ toolview .set_cursor ,
2001+ toolpage .model .get_path (row ),
2002+ toolview .get_columns ()[0 ],
2003+ True )
19692004
19702005 def _init_themes (self ):
19712006 # If there are themes then add them to combo box
0 commit comments