from factory import accessible_factory
from state import StateSet, _marshal_state_set
from relation import _marshal_relation_set
-from role import Role
+from role import Role, ROLE_NAMES
__all__ = [
"LOCALE_TYPE",
whether or not they actually have children.
"""
+ _relation_set = None
+
def __nonzero__(self):
return True
objects.
@return : a RelationSet defining this object's relationships.
"""
- func = self.get_dbus_method("getRelationSet", dbus_interface=ATSPI_ACCESSIBLE)
- relation_set = func()
- return _marshal_relation_set(self._cache, self._app_name, relation_set)
+ if self._relation_set:
+ return self._relation_set
+ else:
+ func = self.get_dbus_method("getRelationSet", dbus_interface=ATSPI_ACCESSIBLE)
+ relation_set = func()
+ self._relation_set = _marshal_relation_set(self._cache, self._app_name, relation_set)
+ return self._relation_set
def getRole(self):
"""
@return : a UTF-8 string indicating the type of UI role played
by this object.
"""
+ """
func = self.get_dbus_method("getRoleName", dbus_interface=ATSPI_ACCESSIBLE)
return func()
+ """
+ return ROLE_NAMES[self.cached_data.role]
def getState(self):
"""
"""
parent = property(fget=get_parent, doc=_parentDoc)
+ def flushCache(self):
+ self._relation_set = None
+
# Register the accessible class with the factory.
accessible_factory.register_accessible_class(ATSPI_ACCESSIBLE, Accessible)
ROLE_VIEWPORT = Role(68)
ROLE_WINDOW = Role(69)
+ROLE_NAMES = {
+ ROLE_INVALID:'invalid',
+ ROLE_ACCELERATOR_LABEL:'accelerator label',
+ ROLE_ALERT:'alert',
+ ROLE_ANIMATION:'animation',
+ ROLE_ARROW:'arrow',
+ ROLE_CALENDAR:'calendar',
+ ROLE_CANVAS:'canvas',
+ ROLE_CHECK_BOX:'check box',
+ ROLE_CHECK_MENU_ITEM:'check menu item',
+ ROLE_COLOR_CHOOSER:'color chooser',
+ ROLE_COLUMN_HEADER:'column header',
+ ROLE_COMBO_BOX:'combo box',
+ ROLE_DATE_EDITOR:'dateeditor',
+ ROLE_DESKTOP_ICON:'desktop icon',
+ ROLE_DESKTOP_FRAME:'desktop frame',
+ ROLE_DIAL:'dial',
+ ROLE_DIALOG:'dialog',
+ ROLE_DIRECTORY_PANE:'directory pane',
+ ROLE_DRAWING_AREA:'drawing area',
+ ROLE_FILE_CHOOSER:'file chooser',
+ ROLE_FILLER:'filler',
+ ROLE_FONT_CHOOSER:'font chooser',
+ ROLE_FRAME:'frame',
+ ROLE_GLASS_PANE:'glass pane',
+ ROLE_HTML_CONTAINER:'html container',
+ ROLE_ICON:'icon',
+ ROLE_IMAGE:'image',
+ ROLE_INTERNAL_FRAME:'internal frame',
+ ROLE_LABEL:'label',
+ ROLE_LAYERED_PANE:'layered pane',
+ ROLE_LIST:'list',
+ ROLE_LIST_ITEM:'list item',
+ ROLE_MENU:'menu',
+ ROLE_MENU_BAR:'menu bar',
+ ROLE_MENU_ITEM:'menu item',
+ ROLE_OPTION_PANE:'option pane',
+ ROLE_PAGE_TAB:'page tab',
+ ROLE_PAGE_TAB_LIST:'page tab list',
+ ROLE_PANEL:'panel',
+ ROLE_PASSWORD_TEXT:'password text',
+ ROLE_POPUP_MENU:'popup menu',
+ ROLE_PROGRESS_BAR:'progress bar',
+ ROLE_PUSH_BUTTON:'push button',
+ ROLE_RADIO_BUTTON:'radio button',
+ ROLE_RADIO_MENU_ITEM:'radio menu item',
+ ROLE_ROOT_PANE:'root pane',
+ ROLE_ROW_HEADER:'row header',
+ ROLE_SCROLL_BAR:'scroll bar',
+ ROLE_SCROLL_PANE:'scroll pane',
+ ROLE_SEPARATOR:'separator',
+ ROLE_SLIDER:'slider',
+ ROLE_SPLIT_PANE:'split pane',
+ ROLE_SPIN_BUTTON:'spin button',
+ ROLE_STATUS_BAR:'status bar',
+ ROLE_TABLE:'table',
+ ROLE_TABLE_CELL:'table cell',
+ ROLE_TABLE_COLUMN_HEADER:'table column header',
+ ROLE_TABLE_ROW_HEADER:'table row header',
+ ROLE_TEAROFF_MENU_ITEM:'tear off menu item',
+ ROLE_TERMINAL:'terminal',
+ ROLE_TEXT:'text',
+ ROLE_TOGGLE_BUTTON:'toggle button',
+ ROLE_TOOL_BAR:'tool bar',
+ ROLE_TOOL_TIP:'tool tip',
+ ROLE_TREE:'tree',
+ ROLE_TREE_TABLE:'tree table',
+ ROLE_UNKNOWN:'unknown',
+ ROLE_VIEWPORT:'viewport',
+ ROLE_WINDOW:'window',
+ ROLE_HEADER:'header',
+ ROLE_FOOTER:'footer',
+ ROLE_PARAGRAPH:'paragraph',
+ ROLE_RULER:'ruler',
+ ROLE_APPLICATION:'application',
+ ROLE_AUTOCOMPLETE:'autocomplete',
+ ROLE_EDITBAR:'edit bar',
+ ROLE_EMBEDDED:'embedded component',
+ ROLE_ENTRY:'entry',
+ ROLE_CHART:'chart',
+ ROLE_CAPTION:'caption',
+ ROLE_DOCUMENT_FRAME:'document frame',
+ ROLE_HEADING:'heading',
+ ROLE_PAGE:'page',
+ ROLE_SECTION:'section',
+ ROLE_REDUNDANT_OBJECT:'redundant object',
+ ROLE_FORM:'form',
+ ROLE_LINK:'link',
+ ROLE_INPUT_METHOD_WINDOW:'input method window',
+}
+
#END----------------------------------------------------------------------------