Skip to content

Commit 5695374

Browse files
committed
gmoccapy: allow use of TAB key in the tooledit widget
1 parent 824434c commit 5695374

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def __init__(self, argv):
212212
self.incr_rbt_list = [] # we use this list to add hal pin to the button later
213213
self.jog_increments = [] # This holds the increment values
214214
self.unlock = False # this value will be set using the hal pin unlock settings
215-
self.toolpage_use_calc = True # enable/disable calculator widget to edit numeric values in the tool editor
215+
self.toolpage_use_calc = False # enable/disable calculator widget to edit numeric values in the tool editor
216216

217217
# needed to display the labels
218218
self.system_list = ("0", "G54", "G55", "G56", "G57", "G58", "G59", "G59.1", "G59.2", "G59.3")
@@ -1961,6 +1961,54 @@ def _init_tooleditor(self):
19611961
if col > 0 and col < 16:
19621962
temp = self.widgets.tooledit1.wTree.get_object("cell_%s" % name)
19631963
temp.connect('editing-started', self.on_tool_col_edit_started, col)
1964+
# disconnect the key_press handler in the widget
1965+
tv = self.widgets.tooledit1.wTree.get_object("treeview1")
1966+
tv.disconnect_by_func(self.widgets.tooledit1.on_tree_navigate_key_press)
1967+
tv.connect("key-release-event", self.on_tree_navigate_key_press, None)
1968+
1969+
def on_tree_navigate_key_press(self, treeview, event, filter):
1970+
keyname = Gdk.keyval_name(event.keyval)
1971+
path, col = treeview.get_cursor()
1972+
columns = [c for c in treeview.get_columns()]
1973+
colnum = columns.index(col)
1974+
focuschild = treeview.get_focus_child()
1975+
if filter == 'wear':
1976+
store_path = self.wear_filter.convert_path_to_child_path(path)
1977+
path = store_path
1978+
elif filter == 'tool':
1979+
store_path = self.tool_filter.convert_path_to_child_path(path)
1980+
path = store_path
1981+
if keyname == 'Tab':
1982+
cont = True
1983+
cont2 = True
1984+
i = 0
1985+
while cont:
1986+
print("column ", colnum)
1987+
i += 1
1988+
if colnum + i < len(columns):
1989+
if columns[colnum + i].props.visible:
1990+
renderer = columns[colnum + i].get_cells()
1991+
if renderer[0].props.editable:
1992+
next_column = columns[colnum + i]
1993+
cont = False
1994+
else:
1995+
i = 1
1996+
while cont2:
1997+
renderer = columns[i].get_cells()
1998+
if renderer[0].props.editable:
1999+
next_column = columns[i]
2000+
cont2 = False
2001+
else:
2002+
i += 1
2003+
cont = False
2004+
GLib.timeout_add(50,
2005+
treeview.set_cursor,
2006+
path, next_column, True)
2007+
else:
2008+
pass
2009+
2010+
def on_use_calculator_toggled(self,widget):
2011+
self.toolpage_use_calc = widget.get_active()
19642012

19652013
def on_tool_col_edit_started(self, widget, filtered_path, new_text, col):
19662014
if not self.toolpage_use_calc:
@@ -3219,7 +3267,7 @@ def on_key_event(self, widget, event, signal):
32193267
if not self.widgets.chk_use_kb_shortcuts.get_active():
32203268
LOG.debug("Settings say: do not use keyboard shortcuts, abort")
32213269
return
3222-
3270+
32233271
# get the keyname
32243272
keyname = Gdk.keyval_name(event.keyval)
32253273

0 commit comments

Comments
 (0)