[gcompris/gcomprixogoo] added support for delete key shortcut when an item is selected.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] added support for delete key shortcut when an item is selected.
- Date: Mon, 2 Nov 2009 06:17:02 +0000 (UTC)
commit 6f7a04ad55c342c6137a06259f27fee8b21e0cd7
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Mon Nov 2 07:16:15 2009 +0100
added support for delete key shortcut when an item is selected.
src/anim-activity/AnimItem.py | 5 +++++
src/anim-activity/anim.py | 12 ++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/anim-activity/AnimItem.py b/src/anim-activity/AnimItem.py
index b6bf7ea..48e4de9 100644
--- a/src/anim-activity/AnimItem.py
+++ b/src/anim-activity/AnimItem.py
@@ -61,6 +61,11 @@ class AnimItem:
self.old_y = 0
+ # Return the type name of the managed object
+ def type_name(self):
+ return (gobject.type_name(self.item))
+
+
# Sadly matrix are not saved by pickle, don't know why
# excactly. This code transform the matrix as a regular
# python list.
diff --git a/src/anim-activity/anim.py b/src/anim-activity/anim.py
index 6a59b14..791a771 100644
--- a/src/anim-activity/anim.py
+++ b/src/anim-activity/anim.py
@@ -264,12 +264,16 @@ class Gcompris_anim:
(keyval == gtk.keysyms.Num_Lock)):
return False
- if ( (not self.selected) or
- (gobject.type_name(self.selected.get_child(0)) != "GooCanvasText")
- ):
- # No Text object selected
+ if (not self.selected):
return False
+ if (self.selected.type_name() != "GooCanvasText"):
+ # Process shortcuts on non text items
+ if ((keyval == gtk.keysyms.BackSpace) or
+ (keyval == gtk.keysyms.Delete)):
+ self.selected.delete()
+ return True
+
textItem = self.selected.get_child(0)
if (not self.last_commit):
oldtext = textItem.get_property('text').decode('UTF-8')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]