[orca] Add support to navlist for specifying a caret offset
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add support to navlist for specifying a caret offset
- Date: Tue, 28 Jul 2015 02:09:59 +0000 (UTC)
commit bc79e9b0c7270d9f099510c4657d4c32b315baad
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jul 27 22:08:44 2015 -0400
Add support to navlist for specifying a caret offset
src/orca/orca_gui_navlist.py | 25 ++++++++++++++++---------
src/orca/structural_navigation.py | 4 ++--
2 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/orca_gui_navlist.py b/src/orca/orca_gui_navlist.py
index 460bf04..4b31b8e 100644
--- a/src/orca/orca_gui_navlist.py
+++ b/src/orca/orca_gui_navlist.py
@@ -60,7 +60,7 @@ class OrcaNavListGUI:
self._tree.set_vexpand(True)
scrolledWindow.add(self._tree)
- cols = [GObject.TYPE_OBJECT]
+ cols = [GObject.TYPE_OBJECT, GObject.TYPE_INT]
cols.extend(len(columnHeaders) * [GObject.TYPE_STRING])
model = Gtk.ListStore(*cols)
@@ -69,10 +69,15 @@ class OrcaNavListGUI:
column.set_visible(False)
self._tree.append_column(column)
+ cell = Gtk.CellRendererText()
+ column = Gtk.TreeViewColumn("offset", cell, text=1)
+ column.set_visible(False)
+ self._tree.append_column(column)
+
for i, header in enumerate(columnHeaders):
cell = Gtk.CellRendererText()
- column = Gtk.TreeViewColumn(header, cell, text=i+1)
- column.set_sort_column_id(i+1)
+ column = Gtk.TreeViewColumn(header, cell, text=i+2)
+ column.set_sort_column_id(i+2)
self._tree.append_column(column)
for row in rows:
@@ -108,7 +113,7 @@ class OrcaNavListGUI:
self._gui.present_with_time(ts)
def _onCursorChanged(self, widget):
- obj = self._getSelectedAccessible()
+ obj, offset = self._getSelectedAccessibleAndOffset()
try:
action = obj.queryAction()
except:
@@ -129,12 +134,12 @@ class OrcaNavListGUI:
self._gui.destroy()
def _onJumpToClicked(self, widget):
- obj = self._getSelectedAccessible()
+ obj, offset = self._getSelectedAccessibleAndOffset()
self._gui.destroy()
- self._script.utilities.setCaretPosition(obj, 0)
+ self._script.utilities.setCaretPosition(obj, offset)
def _onActivateClicked(self, widget):
- obj = self._getSelectedAccessible()
+ obj, offset = self._getSelectedAccessibleAndOffset()
self._gui.destroy()
try:
action = obj.queryAction()
@@ -144,7 +149,7 @@ class OrcaNavListGUI:
else:
action.doAction(0)
- def _getSelectedAccessible(self):
+ def _getSelectedAccessibleAndOffset(self):
if not self._tree:
return None
@@ -156,7 +161,9 @@ class OrcaNavListGUI:
if not paths:
return None
- return model.get_value(model.get_iter(paths[0]), 0)
+ obj = model.get_value(model.get_iter(paths[0]), 0)
+ offset = model.get_value(model.get_iter(paths[0]), 1)
+ return obj, max(0, offset)
def showUI(title='', columnHeaders=[], rows=[()], selectedRow=0):
gui = OrcaNavListGUI(title, columnHeaders, rows, selectedRow)
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index df27df8..be7ac4e 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -383,7 +383,7 @@ class StructuralNavigationObject:
except:
index = 0
- rows = [[obj] + rowData(obj) for obj in objects]
+ rows = [[obj, -1] + rowData(obj) for obj in objects]
orca_gui_navlist.showUI(title, columnHeaders, rows, index)
def goPreviousAtLevelFactory(self, level):
@@ -452,7 +452,7 @@ class StructuralNavigationObject:
except:
index = 0
- rows = [[obj] + rowData(obj) for obj in objects]
+ rows = [[obj, -1] + rowData(obj) for obj in objects]
orca_gui_navlist.showUI(title, columnHeaders, rows, index)
return showListAtLevel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]