[orca] Do not attempt to store an AtspiTable in a dictionary



commit 234edd3b54cf2791fc493bd7c1fd8edbb28c2aa3
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jan 23 08:43:00 2013 -0500

    Do not attempt to store an AtspiTable in a dictionary

 src/orca/scripts/apps/soffice/braille_generator.py |    8 ++++----
 src/orca/scripts/apps/soffice/script.py            |   15 +++++++--------
 src/orca/scripts/apps/soffice/speech_generator.py  |   16 ++++++++--------
 3 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/braille_generator.py b/src/orca/scripts/apps/soffice/braille_generator.py
index 30ad96f..bc281ab 100644
--- a/src/orca/scripts/apps/soffice/braille_generator.py
+++ b/src/orca/scripts/apps/soffice/braille_generator.py
@@ -63,8 +63,8 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
             index = self._script.utilities.cellIndex(obj)
             rowIndex = table.getRowAtIndex(index)
             if rowIndex >= 0 \
-               and table in self._script.dynamicRowHeaders:
-                column = self._script.dynamicRowHeaders[table]
+               and hash(obj.parent) in self._script.dynamicRowHeaders:
+                column = self._script.dynamicRowHeaders[hash(obj.parent)]
                 header = self._script.getDynamicColumnHeaderCell(obj, column)
                 try:
                     headerText = header.queryText()
@@ -96,8 +96,8 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
             index = self._script.utilities.cellIndex(obj)
             columnIndex = table.getColumnAtIndex(index)
             if columnIndex >= 0 \
-               and table in self._script.dynamicColumnHeaders:
-                row = self._script.dynamicColumnHeaders[table]
+               and hash(obj.parent) in self._script.dynamicColumnHeaders:
+                row = self._script.dynamicColumnHeaders[hash(obj.parent)]
                 header = self._script.getDynamicRowHeaderCell(obj, row)
                 try:
                     headerText = header.queryText()
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index e4b783d..142c9a1 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -525,15 +525,14 @@ class Script(default.Script):
         isn't in a table.
         """
 
-        table = None
         obj = self.adjustForWriterTable(obj)
         if obj.getRole() == pyatspi.ROLE_TABLE_CELL and obj.parent:
             try:
-                table = obj.parent.queryTable()
+                obj.parent.queryTable()
             except NotImplementedError:
-                pass
+                return None
 
-        return table
+        return obj.parent
 
     def getDynamicColumnHeaderCell(self, obj, column):
         """Given a table cell, return the dynamic column header cell
@@ -955,7 +954,7 @@ class Script(default.Script):
         table = self.getTable(orca_state.locusOfFocus)
         if table:
             row = self.getTableRow(orca_state.locusOfFocus)
-            self.dynamicColumnHeaders[table] = row
+            self.dynamicColumnHeaders[hash(table)] = row
             # Translators: Orca allows you to dynamically define which
             # row of a spreadsheet or table counts as column headers.
             #
@@ -977,7 +976,7 @@ class Script(default.Script):
         if table:
             row = self.getTableRow(orca_state.locusOfFocus)
             try:
-                del self.dynamicColumnHeaders[table]
+                del self.dynamicColumnHeaders[hash(table)]
                 # Translators: Orca allows you to dynamically define which
                 # row of a spreadsheet or table counts as column headers.
                 #
@@ -1029,7 +1028,7 @@ class Script(default.Script):
         table = self.getTable(orca_state.locusOfFocus)
         if table:
             column = self.getTableColumn(orca_state.locusOfFocus)
-            self.dynamicRowHeaders[table] = column
+            self.dynamicRowHeaders[hash(table)] = column
             # Translators: Orca allows you to dynamically define which
             # column of a spreadsheet or table counts as row headers.
             #
@@ -1052,7 +1051,7 @@ class Script(default.Script):
         if table:
             column = self.getTableColumn(orca_state.locusOfFocus)
             try:
-                del self.dynamicRowHeaders[table]
+                del self.dynamicRowHeaders[hash(table)]
                 # Translators: Orca allows you to dynamically define which
                 # column of a spreadsheet or table counts as row headers.
                 #
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py b/src/orca/scripts/apps/soffice/speech_generator.py
index 18c314c..128c11b 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -239,8 +239,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
             index = self._script.utilities.cellIndex(obj)
             rowIndex = table.getRowAtIndex(index)
             if rowIndex >= 0 \
-               and table in self._script.dynamicRowHeaders:
-                column = self._script.dynamicRowHeaders[table]
+               and hash(obj.parent) in self._script.dynamicRowHeaders:
+                column = self._script.dynamicRowHeaders[hash(obj.parent)]
                 header = self._script.getDynamicColumnHeaderCell(obj, column)
                 try:
                     headerText = header.queryText()
@@ -275,8 +275,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if "lastRow" in self._script.pointOfReference and parentTable \
            and self._script.pointOfReference["lastRow"] != \
            parentTable.getRowAtIndex(index):
-            if table in self._script.dynamicRowHeaders:
-                column = self._script.dynamicRowHeaders[table]
+            if hash(parent) in self._script.dynamicRowHeaders:
+                column = self._script.dynamicRowHeaders[hash(parent)]
                 header = self._script.getDynamicColumnHeaderCell(obj, column)
                 try:
                     headerText = header.queryText()
@@ -312,8 +312,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
             index = self._script.utilities.cellIndex(obj)
             columnIndex = table.getColumnAtIndex(index)
             if columnIndex >= 0 \
-               and table in self._script.dynamicColumnHeaders:
-                row = self._script.dynamicColumnHeaders[table]
+               and hash(obj.parent) in self._script.dynamicColumnHeaders:
+                row = self._script.dynamicColumnHeaders[hash(obj.parent)]
                 header = self._script.getDynamicRowHeaderCell(obj, row)
                 try:
                     headerText = header.queryText()
@@ -348,8 +348,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if parentTable and "lastColumn" in self._script.pointOfReference \
            and self._script.pointOfReference["lastColumn"] != \
            parentTable.getColumnAtIndex(index):
-            if table in self._script.dynamicColumnHeaders:
-                row = self._script.dynamicColumnHeaders[table]
+            if hash(parent) in self._script.dynamicColumnHeaders:
+                row = self._script.dynamicColumnHeaders[hash(parent)]
                 header = self._script.getDynamicRowHeaderCell(obj, row)
                 try:
                     headerText = header.queryText()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]