Commit 2dd4768b authored by Eitan Isaacson's avatar Eitan Isaacson

* src/lib/accerciser/accessible_treeview.py:

    * plugins/interface_view.py: Added accessible name changed
    listeners to update the view accordingly (bug #582434).
parent 6857e636
2009-05-24 Eitan Isaacson <eitan@ascender.com>
* src/lib/accerciser/accessible_treeview.py:
* plugins/interface_view.py: Added accessible name changed
listeners to update the view accordingly (bug #582434).
2009-05-15 Eitan Isaacson <eitan@ascender.com> 2009-05-15 Eitan Isaacson <eitan@ascender.com>
* plugins/interface_view.py: Fixed editable text bug (bug #574223). * plugins/interface_view.py: Fixed editable text bug (bug #574223).
......
...@@ -88,6 +88,27 @@ class InterfaceViewer(ViewportPlugin): ...@@ -88,6 +88,27 @@ class InterfaceViewer(ViewportPlugin):
section = _InterfaceSection(ui_xml, self.node, iface_name) section = _InterfaceSection(ui_xml, self.node, iface_name)
section.disable() section.disable()
pyatspi.Registry.registerEventListener(
self.onAccNameChanged, 'object:property-change:accessible-name')
def onAccNameChanged(self, event):
'''
Listener for accessible name changes, if it is ours, change the name.
@param event: 'object:property-change:accessible-name' event.
@type acc: Accessibility.Event
'''
if event.source != self.node.acc:
return
role = self.node.acc.getRoleName()
name = self.node.acc.name
if name:
role_name = '%s: %s' % (role, name)
else:
role_name = role
self.label_role.set_markup('<b>%s</b>' % markup_escape_text(role_name))
def onAccChanged(self, acc): def onAccChanged(self, acc):
''' '''
Method that is invoked when the main accessible selection s changed. Method that is invoked when the main accessible selection s changed.
......
...@@ -422,9 +422,14 @@ class AccessibleTreeView(gtk.TreeView, Tools): ...@@ -422,9 +422,14 @@ class AccessibleTreeView(gtk.TreeView, Tools):
selection.connect('changed', self._onSelectionChanged) selection.connect('changed', self._onSelectionChanged)
selection.set_select_function(self._selectFunc) selection.set_select_function(self._selectFunc)
self.connect('row-expanded', self._onExpanded) self.connect('row-expanded', self._onExpanded)
pyatspi.Registry.registerEventListener(self._accEventChildChanged, pyatspi.Registry.registerEventListener(self._accEventChildChanged,
'object:children-changed') 'object:children-changed')
pyatspi.Registry.registerEventListener(
self._accEventNameChanged,
'object:property-change:accessible-name')
self.action_group = gtk.ActionGroup('TreeActions') self.action_group = gtk.ActionGroup('TreeActions')
self.action_group.add_actions([ self.action_group.add_actions([
('RefreshAll', gtk.STOCK_REFRESH, _('_Refresh Registry'), ('RefreshAll', gtk.STOCK_REFRESH, _('_Refresh Registry'),
...@@ -527,6 +532,26 @@ class AccessibleTreeView(gtk.TreeView, Tools): ...@@ -527,6 +532,26 @@ class AccessibleTreeView(gtk.TreeView, Tools):
# populate this level # populate this level
self.model.popLevel(iter) self.model.popLevel(iter)
def _accEventNameChanged(self, event):
'''
Event handler for "object:property-change:accessible-name".
Updates the treeview accordingly.
@param event: The event which triggered this handler.
@type event: L{pyatspi.event.Event}
'''
if self.isMyApp(event.source) or event.source == self.desktop:
# Bad karma
return
if self.model.isInModel(event.source):
try:
path = self.model.getAccPath(event.source)
iter = self.model.get_iter(path)
except:
pass
else:
self.model[iter][COL_NAME] = event.source.name
def _accEventChildChanged(self, event): def _accEventChildChanged(self, event):
''' '''
Event handler for "object:children-changed". Updates the treeview accordingly. Event handler for "object:children-changed". Updates the treeview accordingly.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment