[orca] Select the row associated with the locusOfFocus in the "list of" dialogs



commit cf222c4dd9fbb005eeadfbee5eef3e4b31836988
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 7 16:37:05 2013 -0500

    Select the row associated with the locusOfFocus in the "list of" dialogs

 src/orca/orca_gui_navlist.py      |   12 +++++++-----
 src/orca/structural_navigation.py |   16 ++++++++++++++--
 2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/orca_gui_navlist.py b/src/orca/orca_gui_navlist.py
index f19ee01..0d68b17 100644
--- a/src/orca/orca_gui_navlist.py
+++ b/src/orca/orca_gui_navlist.py
@@ -35,15 +35,15 @@ from .orca_i18n import _
 
 class OrcaNavListGUI:
 
-    def __init__(self, title, columnHeaders, rows):
+    def __init__(self, title, columnHeaders, rows, selectedRow):
         self._tree = None
         self._activateButton = None
-        self._gui = self._createNavListDialog(columnHeaders, rows)
+        self._gui = self._createNavListDialog(columnHeaders, rows, selectedRow)
         self._gui.set_title(title)
         self._gui.set_modal(True)
         self.showGUI()
 
-    def _createNavListDialog(self, columnHeaders, rows):
+    def _createNavListDialog(self, columnHeaders, rows, selectedRow):
         dialog = Gtk.Dialog()
         dialog.set_default_size(500, 400)
 
@@ -80,6 +80,8 @@ class OrcaNavListGUI:
                 model.set_value(rowIter, i, cell)
 
         self._tree.set_model(model)
+        selection = self._tree.get_selection()
+        selection.select_path(selectedRow)
 
         btn = dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
         btn.connect('clicked', self._onCancelClicked)
@@ -168,6 +170,6 @@ class OrcaNavListGUI:
 
         return model.get_value(model.get_iter(paths[0]), 0)
 
-def showUI(title='', columnHeaders=[], rows=[()]):
-    gui = OrcaNavListGUI(title, columnHeaders, rows)
+def showUI(title='', columnHeaders=[], rows=[()], selectedRow=0):
+    gui = OrcaNavListGUI(title, columnHeaders, rows, selectedRow)
     gui.showGUI()
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 23d7fe5..11062d1 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -375,8 +375,14 @@ class StructuralNavigationObject:
             script.presentMessage(title)
             return
 
+        currentObject = self.structuralNavigation.getCurrentObject()
+        try:
+            index = objects.index(currentObject)
+        except:
+            index = 0
+
         rows = [[obj] + rowData(obj) for obj in objects]
-        orca_gui_navlist.showUI(title, columnHeaders, rows)
+        orca_gui_navlist.showUI(title, columnHeaders, rows, index)
 
     def goPreviousAtLevelFactory(self, level):
         """Generates a goPrevious method for the specified level. Right
@@ -443,8 +449,14 @@ class StructuralNavigationObject:
                 script.presentMessage(title)
                 return
 
+            currentObject = self.structuralNavigation.getCurrentObject()
+            try:
+                index = objects.index(currentObject)
+            except:
+                index = 0
+
             rows = [[obj] + rowData(obj) for obj in objects]
-            orca_gui_navlist.showUI(title, columnHeaders, rows)
+            orca_gui_navlist.showUI(title, columnHeaders, rows, index)
 
         return showListAtLevel
 


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