Fixed right-click with no selection issue

svn: r15666
This commit is contained in:
Doug Blank 2010-07-30 05:13:32 +00:00
parent 77e5629012
commit 6175654510

View File

@ -94,7 +94,7 @@ class SimpleTable(object):
selection = treeview.get_selection() selection = treeview.get_selection()
store, paths = selection.get_selected_rows() store, paths = selection.get_selected_rows()
tpath = paths[0] if len(paths) > 0 else None tpath = paths[0] if len(paths) > 0 else None
node = store.get_iter(tpath) node = store.get_iter(tpath) if tpath else None
if node: if node:
treeview.grab_focus() treeview.grab_focus()
index = store.get_value(node, 0) index = store.get_value(node, 0)
@ -116,7 +116,7 @@ class SimpleTable(object):
selection = treeview.get_selection() selection = treeview.get_selection()
store, paths = selection.get_selected_rows() store, paths = selection.get_selected_rows()
tpath = paths[0] if len(paths) > 0 else None tpath = paths[0] if len(paths) > 0 else None
node = store.get_iter(tpath) node = store.get_iter(tpath) if tpath else None
if path: if path:
treeview.grab_focus() treeview.grab_focus()
treeview.set_cursor(path, col, 0) treeview.set_cursor(path, col, 0)
@ -178,7 +178,7 @@ class SimpleTable(object):
selection = obj.get_selection() selection = obj.get_selection()
store, paths = selection.get_selected_rows() store, paths = selection.get_selected_rows()
tpath = paths[0] if len(paths) > 0 else None tpath = paths[0] if len(paths) > 0 else None
node = store.get_iter(tpath) node = store.get_iter(tpath) if tpath else None
if not node: if not node:
return return
index = store.get_value(node, 0) # index index = store.get_value(node, 0) # index