From f78ca973a60881003dbc61c85847639b1c098c77 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Fri, 22 Jan 2010 13:40:48 +0000 Subject: More reliable edit mode detecting method --- diff --git a/src/jarabe/journal/homogenetable.py b/src/jarabe/journal/homogenetable.py index 1a7ebbd..e92b717 100644 --- a/src/jarabe/journal/homogenetable.py +++ b/src/jarabe/journal/homogenetable.py @@ -184,7 +184,16 @@ class VHomogeneTable(gtk.Container): if cell is None: return False else: - return cell.widget.get_focus_child() + # XXX why gtk.Container.get_focus_child() doesn't work some time + window = self.get_toplevel() + if window is None: + return False + focus = window.get_focus() + while focus is not None and focus.parent is not None: + if focus is self: + return True + focus = focus.parent + return False def set_editing(self, value): if value == self.editing: @@ -358,7 +367,7 @@ class VHomogeneTable(gtk.Container): if widget is not None: x, y, __, __ = widget.allocation cursor = self._get_cell_at_pos(x, y) - if cursor not in self.frame_range: + if self.cursor is None or cursor not in self.frame_range: self.cursor = cursor def do_focus(self, type): -- cgit v0.9.1