Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2010-01-22 13:40:48 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2010-01-22 13:40:48 (GMT)
commitf78ca973a60881003dbc61c85847639b1c098c77 (patch)
treea59f73571500c28eaa51ea1a2a3d868d86463a2d
parent748620f5e56a6da75fa99a0d9aed2cfd0b58976d (diff)
More reliable edit mode detecting method
-rw-r--r--src/jarabe/journal/homogenetable.py13
1 files changed, 11 insertions, 2 deletions
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):