[pyatspi2] Support negative indices in __getitem__
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2] Support negative indices in __getitem__
- Date: Sat, 4 Dec 2010 10:38:59 +0000 (UTC)
commit 43eb875be6241906c6772c0b5c39765a8d8261e4
Author: Mike Gorse <mgorse novell com>
Date: Sat Dec 4 05:40:30 2010 -0500
Support negative indices in __getitem__
pyatspi/Accessibility.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/pyatspi/Accessibility.py b/pyatspi/Accessibility.py
index ba1296a..83c18dc 100644
--- a/pyatspi/Accessibility.py
+++ b/pyatspi/Accessibility.py
@@ -23,7 +23,10 @@ from state import *
from utils import *
def Accessible_getitem(self, i):
- if i < 0 or i >= self.get_child_count():
+ len=self.get_child_count()
+ if i < 0:
+ i = len + i
+ if i < 0 or i >= len:
raise IndexError
return self.get_child_at_index(i)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]