From: Mark Doffman Date: Wed, 20 Aug 2008 16:40:20 +0000 (+0100) Subject: 2008-08-20 Mark Doffman X-Git-Tag: AT_SPI2_CORE_0_1_3~146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdff7d3c109acd1bc4ff2c92b6a48627fb711103;p=platform%2Fupstream%2Fat-spi2-core.git 2008-08-20 Mark Doffman * pyatspi/ Move some needed interfaces out of other.py and into their own files. Rename stateset.py to match the .idl file name. Move some enumerations into their proper place in accessible.py and component.py --- diff --git a/pyatspi/Makefile.am b/pyatspi/Makefile.am index 859078f..082e038 100644 --- a/pyatspi/Makefile.am +++ b/pyatspi/Makefile.am @@ -1,17 +1,20 @@ pyatspi_PYTHON = \ accessible.py \ + action.py \ base.py \ cache.py \ constants.py \ + desktop.py \ event.py \ factory.py \ interfaces.py \ __init__.py \ Makefile.am \ other.py \ - stateset.py \ + state.py \ registry.py \ relation.py \ + role.py \ test.py \ utils.py diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py index 5b0ee64..2cc1c28 100644 --- a/pyatspi/accessible.py +++ b/pyatspi/accessible.py @@ -13,17 +13,73 @@ #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import interfaces -from base import BaseProxy +from base import BaseProxy, Enum from factory import create_accessible, add_accessible_class from stateset import StateSet, _marshal_state_set from relation import _marshal_relation_set __all__ = [ + "LOCALE_TYPE", + "LOCALE_TYPE_COLLATE", + "LOCALE_TYPE_CTYPE", + "LOCALE_TYPE_MESSAGES", + "LOCALE_TYPE_MONETARY", + "LOCALE_TYPE_NUMERIC", + "LOCALE_TYPE_TIME", + "BoundingBox", "Accessible", ] #------------------------------------------------------------------------------ +class LOCALE_TYPE(Enum): + _enum_lookup = { + 0:'LOCALE_TYPE_MESSAGES', + 1:'LOCALE_TYPE_COLLATE', + 2:'LOCALE_TYPE_CTYPE', + 3:'LOCALE_TYPE_MONETARY', + 4:'LOCALE_TYPE_NUMERIC', + 5:'LOCALE_TYPE_TIME', + } + +LOCALE_TYPE_COLLATE = LOCALE_TYPE(1) +LOCALE_TYPE_CTYPE = LOCALE_TYPE(2) +LOCALE_TYPE_MESSAGES = LOCALE_TYPE(0) +LOCALE_TYPE_MONETARY = LOCALE_TYPE(3) +LOCALE_TYPE_NUMERIC = LOCALE_TYPE(4) +LOCALE_TYPE_TIME = LOCALE_TYPE(5) + +#------------------------------------------------------------------------------ + +class BoundingBox(list): + def __new__(cls, x, y, width, height): + list.__new__(cls, (x, y, width, height)) + def __init__(self, x, y, width, height): + list.__init__(self, (x, y, width, height)) + + def _get_x(self): + return self[0] + def _set_x(self, val): + self[0] = val + x = property(fget=_get_x, fset=_set_x) + def _get_y(self): + return self[1] + def _set_y(self, val): + self[1] = val + y = property(fget=_get_y, fset=_set_y) + def _get_width(self): + return self[2] + def _set_width(self, val): + self[2] = val + width = property(fget=_get_width, fset=_set_width) + def _get_height(self): + return self[3] + def _set_height(self, val): + self[3] = val + height = property(fget=_get_height, fset=_set_height) + +#------------------------------------------------------------------------------ + class Accessible(BaseProxy): """ The base interface which is implemented by all accessible objects. diff --git a/pyatspi/action.py b/pyatspi/action.py new file mode 100644 index 0000000..d1ab641 --- /dev/null +++ b/pyatspi/action.py @@ -0,0 +1,101 @@ +#Copyright (C) 2008 Codethink Ltd + +#This library is free software; you can redistribute it and/or +#modify it under the terms of the GNU Lesser General Public +#License version 2 as published by the Free Software Foundation. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +#You should have received a copy of the GNU Lesser General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +import interfaces +from base import BaseProxy +from factory import create_accessible, add_accessible_class + +__all__ = [ + "Action", + ] + +#------------------------------------------------------------------------------ + +class Action(BaseProxy): + """ + An interface through which a user-actionable user interface component + can be manipulated. Components which react to mouse or keyboard + input from the user, (with the exception of pure text entry fields + with no other function), should implement this interface. Typical + actions include "click", "press", "release" (for instance for + buttons), "menu" (for objects which have context menus invokable + from mouse or keyboard), "open" for icons representing files + folders, and others. + """ + + def doAction(self, *args, **kwargs): + """ + doAction: + @param : index + the 0-based index of the action to perform. + Causes the object to perform the specified action. + @return : a boolean indicating success or failure. + """ + func = self.get_dbus_method("doAction") + return func(*args, **kwargs) + + def getDescription(self, *args, **kwargs): + """ + getDescription: + @param : index + the index of the action for which a description is desired. + Get the description of the specified action. The description + of an action may provide information about the result of action + invocation, unlike the action name. + @return : a string containing the description of the specified + action. + """ + func = self.get_dbus_method("getDescription") + return func(*args, **kwargs) + + def getKeyBinding(self, *args, **kwargs): + """ + getKeyBinding: + @param : index + the 0-based index of the action for which a key binding is requested. + Get the key binding associated with a specific action. + @return : a string containing the key binding for the specified + action, or an empty string ("") if none exists. + """ + func = self.get_dbus_method("getKeyBinding") + return func(*args, **kwargs) + + def getName(self, *args, **kwargs): + """ + getName: + @param : index + the index of the action whose name is requested. + Get the name of the specified action. Action names generally + describe the user action, i.e. "click" or "press", rather then + the result of invoking the action. + @return : a string containing the name of the specified action. + """ + func = self.get_dbus_method("getName") + return func(*args, **kwargs) + + def get_nActions(self): + self._pgetter(self._dbus_interface, "nActions") + def set_nActions(self, value): + self._psetter(self._dbus_interface, "nActions", value) + _nActionsDoc = \ + """ + nActions: a long containing the number of actions this object + supports. + """ + nActions = property(fget=get_nActions, fset=set_nActions, doc=_nActionsDoc) + +# Register the Accessible class with the accessible factory. +add_accessible_class(interfaces.ATSPI_ACTION, Action) + +#END---------------------------------------------------------------------------- diff --git a/pyatspi/component.py b/pyatspi/component.py index adce5d6..4e5556f 100644 --- a/pyatspi/component.py +++ b/pyatspi/component.py @@ -19,10 +19,20 @@ from factory import create_accessible, add_accessible_class from dbus.types import Int16 __all__ = [ - "Component", "CoordType", "XY_SCREEN", "XY_WINDOW", + "ComponentLayer", + "Component", + "LAYER_BACKGROUND", + "LAYER_CANVAS", + "LAYER_INVALID", + "LAYER_LAST_DEFINED", + "LAYER_MDI", + "LAYER_OVERLAY", + "LAYER_POPUP", + "LAYER_WIDGET", + "LAYER_WINDOW", ] #------------------------------------------------------------------------------ @@ -38,6 +48,31 @@ XY_WINDOW = CoordType(1) #------------------------------------------------------------------------------ +class ComponentLayer(Enum): + _enum_lookup = { + 0:'LAYER_INVALID', + 1:'LAYER_BACKGROUND', + 2:'LAYER_CANVAS', + 3:'LAYER_WIDGET', + 4:'LAYER_MDI', + 5:'LAYER_POPUP', + 6:'LAYER_OVERLAY', + 7:'LAYER_WINDOW', + 8:'LAYER_LAST_DEFINED', + } + +LAYER_BACKGROUND = ComponentLayer(1) +LAYER_CANVAS = ComponentLayer(2) +LAYER_INVALID = ComponentLayer(0) +LAYER_LAST_DEFINED = ComponentLayer(8) +LAYER_MDI = ComponentLayer(4) +LAYER_OVERLAY = ComponentLayer(6) +LAYER_POPUP = ComponentLayer(5) +LAYER_WIDGET = ComponentLayer(3) +LAYER_WINDOW = ComponentLayer(7) + +#------------------------------------------------------------------------------ + class Component(BaseProxy): """ The Component interface is implemented by objects which occupy diff --git a/pyatspi/desktop.py b/pyatspi/desktop.py new file mode 100644 index 0000000..e02aa78 --- /dev/null +++ b/pyatspi/desktop.py @@ -0,0 +1,183 @@ +#Copyright (C) 2008 Codethink Ltd + +#This library is free software; you can redistribute it and/or +#modify it under the terms of the GNU Lesser General Public +#License version 2 as published by the Free Software Foundation. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +#You should have received a copy of the GNU Lesser General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +import interfaces +from factory import create_accessible + +__all__ = [ + "Desktop", + ] + +#------------------------------------------------------------------------------ + +class Accessible(BaseProxy): + """ + The base interface which is implemented by all accessible objects. + All objects support interfaces for querying their contained + 'children' and position in the accessible-object hierarchy, + whether or not they actually have children. + """ + + def getApplication(self): + """ + Get the containing Application for this object. + @return the Application instance to which this object belongs. + """ + return None + + def getAttributes(self): + """ + Get a list of properties applied to this object as a whole, as + an AttributeSet consisting of name-value pairs. As such these + attributes may be considered weakly-typed properties or annotations, + as distinct from the strongly-typed interface instance data declared + using the IDL "attribute" keyword. + Not all objects have explicit "name-value pair" AttributeSet + properties. + Attribute names and values may have any UTF-8 string value, however + where possible, in order to facilitate consistent use and exposure + of "attribute" properties by applications and AT clients, attribute + names and values should chosen from a publicly-specified namespace + where appropriate. + Where possible, the names and values in the name-value pairs + should be chosen from well-established attribute namespaces using + standard semantics. For example, attributes of Accessible objects + corresponding to XHTML content elements should correspond to + attribute names and values specified in the w3c XHTML specification, + at http://www.w3.org/TR/xhtml2, where such values are not already + exposed via a more strongly-typed aspect of the AT-SPI API. Metadata + names and values should be chosen from the 'Dublin Core' Metadata + namespace using Dublin Core semantics: http://dublincore.org/dcregistry/ + Similarly, relevant structural metadata should be exposed using + attribute names and values chosen from the CSS2 and WICD specification: + http://www.w3.org/TR/1998/REC-CSS2-19980512 WICD (http://www.w3.org/TR/2005/WD-WICD-20051121/). + + @return : An AttributeSet encapsulating any "attribute values" + currently defined for the object. An attribute set is a list of strings + with each string comprising an name-value pair format 'name:value'. + """ + return [] + + def getChildAtIndex(self, index): + """ + Get the accessible child of this object at index. + @param : index + an in parameter indicating which child is requested (zero-indexed). + @return : the 'nth' Accessible child of this object. + """ + path = self.cached_data.children[index] + return create_accessible(self._cache, + self._app_name, + path, + interfaces.ATSPI_ACCESSIBLE, + connection=self._cache._connection) + + def getIndexInParent(self): + """ + Get the index of this object in its parent's child list. + @return : a long integer indicating this object's index in the + parent's list. + """ + return -1 + + def getLocalizedRoleName(self): + """ + Get a string indicating the type of UI role played by this object, + translated to the current locale. + @return : a UTF-8 string indicating the type of UI role played + by this object. + """ + #TODO Need to localize this somehow. Hmmmmm + return 'unknown' + + def getRelationSet(self): + """ + Get a set defining this object's relationship to other accessible + objects. + @return : a RelationSet defining this object's relationships. + """ + return [] + + def getRole(self): + """ + Get the Role indicating the type of UI role played by this object. + @return : a Role indicating the type of UI role played by this + object. + """ + return self.cached_data.role + + def getRoleName(self): + """ + Get a string indicating the type of UI role played by this object. + @return : a UTF-8 string indicating the type of UI role played + by this object. + """ + return 'unknown' + + def getState(self): + """ + Get the current state of the object as a StateSet. + @return : a StateSet encapsulating the currently true states + of the object. + """ + return [] + + def isEqual(self, accessible): + """ + Determine whether an Accessible refers to the same object as + another. This method should be used rather than brute-force comparison + of object references (i.e. "by-value" comparison), as two object + references may have different apparent values yet refer to the + same object. + @param : obj + an Accessible object reference to compare to + @return : a boolean indicating whether the two object references + point to the same object. + """ + return (self._app_name == accessible._app_name) and \ + (self._acc_path == accessible._acc_path) + + def get_childCount(self): + return len(self.cached_data.children) + _childCountDoc = \ + """ + childCount: the number of children contained by this object. + """ + childCount = property(fget=get_childCount, doc=_childCountDoc) + + def get_description(self): + return '' + _descriptionDoc = \ + """ + a string describing the object in more detail than name. + """ + description = property(fget=get_description, doc=_descriptionDoc) + + def get_name(self): + return 'main' + _nameDoc = \ + """ + a (short) string representing the object's name. + """ + name = property(fget=get_name, doc=_nameDoc) + + def get_parent(self): + return None + _parentDoc = \ + """ + An Accessible object which is this object's containing object. + """ + parent = property(fget=get_parent, doc=_parentDoc) + +#END---------------------------------------------------------------------------- diff --git a/pyatspi/other.py b/pyatspi/other.py index a243d5d..9cbca74 100644 --- a/pyatspi/other.py +++ b/pyatspi/other.py @@ -19,110 +19,6 @@ import constants from factory import add_accessible_class -class Action(_BaseProxy): - """ - An interface through which a user-actionable user interface component - can be manipulated. Components which react to mouse or keyboard - input from the user, (with the exception of pure text entry fields - with no other function), should implement this interface. Typical - actions include "click", "press", "release" (for instance for - buttons), "menu" (for objects which have context menus invokable - from mouse or keyboard), "open" for icons representing files - folders, and others. - """ - - - def doAction(self, *args, **kwargs): - """ - doAction: - @param : index - the 0-based index of the action to perform. - Causes the object to perform the specified action. - @return : a boolean indicating success or failure. - """ - func = self.get_dbus_method("doAction") - return func(*args, **kwargs) - - def getDescription(self, *args, **kwargs): - """ - getDescription: - @param : index - the index of the action for which a description is desired. - Get the description of the specified action. The description - of an action may provide information about the result of action - invocation, unlike the action name. - @return : a string containing the description of the specified - action. - """ - func = self.get_dbus_method("getDescription") - return func(*args, **kwargs) - - def getKeyBinding(self, *args, **kwargs): - """ - getKeyBinding: - @param : index - the 0-based index of the action for which a key binding is requested. - Get the key binding associated with a specific action. - @return : a string containing the key binding for the specified - action, or an empty string ("") if none exists. - """ - func = self.get_dbus_method("getKeyBinding") - return func(*args, **kwargs) - - def getName(self, *args, **kwargs): - """ - getName: - @param : index - the index of the action whose name is requested. - Get the name of the specified action. Action names generally - describe the user action, i.e. "click" or "press", rather then - the result of invoking the action. - @return : a string containing the name of the specified action. - """ - func = self.get_dbus_method("getName") - return func(*args, **kwargs) - - def get_nActions(self): - self._pgetter(self._dbus_interface, "nActions") - def set_nActions(self, value): - self._psetter(self._dbus_interface, "nActions", value) - _nActionsDoc = \ - """ - nActions: a long containing the number of actions this object - supports. - """ - nActions = property(fget=get_nActions, fset=set_nActions, doc=_nActionsDoc) - - -#------------------------------------------------------------------------------ - -class BoundingBox(list): - def __new__(cls, x, y, width, height): - list.__new__(cls, (x, y, width, height)) - def __init__(self, x, y, width, height): - list.__init__(self, (x, y, width, height)) - - def _get_x(self): - return self[0] - def _set_x(self, val): - self[0] = val - x = property(fget=_get_x, fset=_set_x) - def _get_y(self): - return self[1] - def _set_y(self, val): - self[1] = val - y = property(fget=_get_y, fset=_set_y) - def _get_width(self): - return self[2] - def _set_width(self, val): - self[2] = val - width = property(fget=_get_width, fset=_set_width) - def _get_height(self): - return self[3] - def _set_height(self, val): - self[3] = val - height = property(fget=_get_height, fset=_set_height) - class Collection(_BaseProxy): @@ -260,8 +156,6 @@ class CommandListener(_BaseProxy): to the list of available commands is made. The notifyCommands() method of the client is then called by the Selector instance. """ - - def notifyCommands(self, *args, **kwargs): """ Notify the CommandListener instance of changes to the currently @@ -275,18 +169,6 @@ class CommandListener(_BaseProxy): -class ComponentLayer(_Enum): - _enum_lookup = { - 0:'LAYER_INVALID', - 1:'LAYER_BACKGROUND', - 2:'LAYER_CANVAS', - 3:'LAYER_WIDGET', - 4:'LAYER_MDI', - 5:'LAYER_POPUP', - 6:'LAYER_OVERLAY', - 7:'LAYER_WINDOW', - 8:'LAYER_LAST_DEFINED', - } class ContentStream(_BaseProxy): @@ -1640,15 +1522,6 @@ class KeySynthType(_Enum): 4:'KEY_STRING', } -class LOCALE_TYPE(_Enum): - _enum_lookup = { - 0:'LOCALE_TYPE_MESSAGES', - 1:'LOCALE_TYPE_COLLATE', - 2:'LOCALE_TYPE_CTYPE', - 3:'LOCALE_TYPE_MONETARY', - 4:'LOCALE_TYPE_NUMERIC', - 5:'LOCALE_TYPE_TIME', - } class LoginHelper(_BaseProxy): """ @@ -1917,101 +1790,6 @@ class Registry(EventListener): -class Role(_Enum): - _enum_lookup = { - 0:'ROLE_INVALID', - 1:'ROLE_ACCELERATOR_LABEL', - 2:'ROLE_ALERT', - 3:'ROLE_ANIMATION', - 4:'ROLE_ARROW', - 5:'ROLE_CALENDAR', - 6:'ROLE_CANVAS', - 7:'ROLE_CHECK_BOX', - 8:'ROLE_CHECK_MENU_ITEM', - 9:'ROLE_COLOR_CHOOSER', - 10:'ROLE_COLUMN_HEADER', - 11:'ROLE_COMBO_BOX', - 12:'ROLE_DATE_EDITOR', - 13:'ROLE_DESKTOP_ICON', - 14:'ROLE_DESKTOP_FRAME', - 15:'ROLE_DIAL', - 16:'ROLE_DIALOG', - 17:'ROLE_DIRECTORY_PANE', - 18:'ROLE_DRAWING_AREA', - 19:'ROLE_FILE_CHOOSER', - 20:'ROLE_FILLER', - 21:'ROLE_FOCUS_TRAVERSABLE', - 22:'ROLE_FONT_CHOOSER', - 23:'ROLE_FRAME', - 24:'ROLE_GLASS_PANE', - 25:'ROLE_HTML_CONTAINER', - 26:'ROLE_ICON', - 27:'ROLE_IMAGE', - 28:'ROLE_INTERNAL_FRAME', - 29:'ROLE_LABEL', - 30:'ROLE_LAYERED_PANE', - 31:'ROLE_LIST', - 32:'ROLE_LIST_ITEM', - 33:'ROLE_MENU', - 34:'ROLE_MENU_BAR', - 35:'ROLE_MENU_ITEM', - 36:'ROLE_OPTION_PANE', - 37:'ROLE_PAGE_TAB', - 38:'ROLE_PAGE_TAB_LIST', - 39:'ROLE_PANEL', - 40:'ROLE_PASSWORD_TEXT', - 41:'ROLE_POPUP_MENU', - 42:'ROLE_PROGRESS_BAR', - 43:'ROLE_PUSH_BUTTON', - 44:'ROLE_RADIO_BUTTON', - 45:'ROLE_RADIO_MENU_ITEM', - 46:'ROLE_ROOT_PANE', - 47:'ROLE_ROW_HEADER', - 48:'ROLE_SCROLL_BAR', - 49:'ROLE_SCROLL_PANE', - 50:'ROLE_SEPARATOR', - 51:'ROLE_SLIDER', - 52:'ROLE_SPIN_BUTTON', - 53:'ROLE_SPLIT_PANE', - 54:'ROLE_STATUS_BAR', - 55:'ROLE_TABLE', - 56:'ROLE_TABLE_CELL', - 57:'ROLE_TABLE_COLUMN_HEADER', - 58:'ROLE_TABLE_ROW_HEADER', - 59:'ROLE_TEAROFF_MENU_ITEM', - 60:'ROLE_TERMINAL', - 61:'ROLE_TEXT', - 62:'ROLE_TOGGLE_BUTTON', - 63:'ROLE_TOOL_BAR', - 64:'ROLE_TOOL_TIP', - 65:'ROLE_TREE', - 66:'ROLE_TREE_TABLE', - 67:'ROLE_UNKNOWN', - 68:'ROLE_VIEWPORT', - 69:'ROLE_WINDOW', - 70:'ROLE_EXTENDED', - 71:'ROLE_HEADER', - 72:'ROLE_FOOTER', - 73:'ROLE_PARAGRAPH', - 74:'ROLE_RULER', - 75:'ROLE_APPLICATION', - 76:'ROLE_AUTOCOMPLETE', - 77:'ROLE_EDITBAR', - 78:'ROLE_EMBEDDED', - 79:'ROLE_ENTRY', - 80:'ROLE_CHART', - 81:'ROLE_CAPTION', - 82:'ROLE_DOCUMENT_FRAME', - 83:'ROLE_HEADING', - 84:'ROLE_PAGE', - 85:'ROLE_SECTION', - 86:'ROLE_REDUNDANT_OBJECT', - 87:'ROLE_FORM', - 88:'ROLE_LINK', - 89:'ROLE_INPUT_METHOD_WINDOW', - 90:'ROLE_LAST_DEFINED', - } - class Selection(_BaseProxy): """ An interface which indicates that an object exposes a 'selection' @@ -2796,35 +2574,6 @@ KEY_STRING = KeySynthType(4) KEY_SYM = KeySynthType(3) -LAYER_BACKGROUND = ComponentLayer(1) - -LAYER_CANVAS = ComponentLayer(2) - -LAYER_INVALID = ComponentLayer(0) - -LAYER_LAST_DEFINED = ComponentLayer(8) - -LAYER_MDI = ComponentLayer(4) - -LAYER_OVERLAY = ComponentLayer(6) - -LAYER_POPUP = ComponentLayer(5) - -LAYER_WIDGET = ComponentLayer(3) - -LAYER_WINDOW = ComponentLayer(7) - -LOCALE_TYPE_COLLATE = LOCALE_TYPE(1) - -LOCALE_TYPE_CTYPE = LOCALE_TYPE(2) - -LOCALE_TYPE_MESSAGES = LOCALE_TYPE(0) - -LOCALE_TYPE_MONETARY = LOCALE_TYPE(3) - -LOCALE_TYPE_NUMERIC = LOCALE_TYPE(4) - -LOCALE_TYPE_TIME = LOCALE_TYPE(5) MODIFIER_ALT = ModifierType(3) @@ -2842,189 +2591,6 @@ MODIFIER_SHIFT = ModifierType(0) MODIFIER_SHIFTLOCK = ModifierType(1) - -ROLE_ACCELERATOR_LABEL = Role(1) - -ROLE_ALERT = Role(2) - -ROLE_ANIMATION = Role(3) - -ROLE_APPLICATION = Role(75) - -ROLE_ARROW = Role(4) - -ROLE_AUTOCOMPLETE = Role(76) - -ROLE_CALENDAR = Role(5) - -ROLE_CANVAS = Role(6) - -ROLE_CAPTION = Role(81) - -ROLE_CHART = Role(80) - -ROLE_CHECK_BOX = Role(7) - -ROLE_CHECK_MENU_ITEM = Role(8) - -ROLE_COLOR_CHOOSER = Role(9) - -ROLE_COLUMN_HEADER = Role(10) - -ROLE_COMBO_BOX = Role(11) - -ROLE_DATE_EDITOR = Role(12) - -ROLE_DESKTOP_FRAME = Role(14) - -ROLE_DESKTOP_ICON = Role(13) - -ROLE_DIAL = Role(15) - -ROLE_DIALOG = Role(16) - -ROLE_DIRECTORY_PANE = Role(17) - -ROLE_DOCUMENT_FRAME = Role(82) - -ROLE_DRAWING_AREA = Role(18) - -ROLE_EDITBAR = Role(77) - -ROLE_EMBEDDED = Role(78) - -ROLE_ENTRY = Role(79) - -ROLE_EXTENDED = Role(70) - -ROLE_FILE_CHOOSER = Role(19) - -ROLE_FILLER = Role(20) - -ROLE_FOCUS_TRAVERSABLE = Role(21) - -ROLE_FONT_CHOOSER = Role(22) - -ROLE_FOOTER = Role(72) - -ROLE_FORM = Role(87) - -ROLE_FRAME = Role(23) - -ROLE_GLASS_PANE = Role(24) - -ROLE_HEADER = Role(71) - -ROLE_HEADING = Role(83) - -ROLE_HTML_CONTAINER = Role(25) - -ROLE_ICON = Role(26) - -ROLE_IMAGE = Role(27) - -ROLE_INPUT_METHOD_WINDOW = Role(89) - -ROLE_INTERNAL_FRAME = Role(28) - -ROLE_INVALID = Role(0) - -ROLE_LABEL = Role(29) - -ROLE_LAST_DEFINED = Role(90) - -ROLE_LAYERED_PANE = Role(30) - -ROLE_LINK = Role(88) - -ROLE_LIST = Role(31) - -ROLE_LIST_ITEM = Role(32) - -ROLE_MENU = Role(33) - -ROLE_MENU_BAR = Role(34) - -ROLE_MENU_ITEM = Role(35) - -ROLE_OPTION_PANE = Role(36) - -ROLE_PAGE = Role(84) - -ROLE_PAGE_TAB = Role(37) - -ROLE_PAGE_TAB_LIST = Role(38) - -ROLE_PANEL = Role(39) - -ROLE_PARAGRAPH = Role(73) - -ROLE_PASSWORD_TEXT = Role(40) - -ROLE_POPUP_MENU = Role(41) - -ROLE_PROGRESS_BAR = Role(42) - -ROLE_PUSH_BUTTON = Role(43) - -ROLE_RADIO_BUTTON = Role(44) - -ROLE_RADIO_MENU_ITEM = Role(45) - -ROLE_REDUNDANT_OBJECT = Role(86) - -ROLE_ROOT_PANE = Role(46) - -ROLE_ROW_HEADER = Role(47) - -ROLE_RULER = Role(74) - -ROLE_SCROLL_BAR = Role(48) - -ROLE_SCROLL_PANE = Role(49) - -ROLE_SECTION = Role(85) - -ROLE_SEPARATOR = Role(50) - -ROLE_SLIDER = Role(51) - -ROLE_SPIN_BUTTON = Role(52) - -ROLE_SPLIT_PANE = Role(53) - -ROLE_STATUS_BAR = Role(54) - -ROLE_TABLE = Role(55) - -ROLE_TABLE_CELL = Role(56) - -ROLE_TABLE_COLUMN_HEADER = Role(57) - -ROLE_TABLE_ROW_HEADER = Role(58) - -ROLE_TEAROFF_MENU_ITEM = Role(59) - -ROLE_TERMINAL = Role(60) - -ROLE_TEXT = Role(61) - -ROLE_TOGGLE_BUTTON = Role(62) - -ROLE_TOOL_BAR = Role(63) - -ROLE_TOOL_TIP = Role(64) - -ROLE_TREE = Role(65) - -ROLE_TREE_TABLE = Role(66) - -ROLE_UNKNOWN = Role(67) - -ROLE_VIEWPORT = Role(68) - -ROLE_WINDOW = Role(69) - TEXT_BOUNDARY_CHAR = TEXT_BOUNDARY_TYPE(0) TEXT_BOUNDARY_LINE_END = TEXT_BOUNDARY_TYPE(6) diff --git a/pyatspi/role.py b/pyatspi/role.py new file mode 100644 index 0000000..a2cf9ce --- /dev/null +++ b/pyatspi/role.py @@ -0,0 +1,206 @@ +#Copyright (C) 2008 Codethink Ltd + +#This library is free software; you can redistribute it and/or +#modify it under the terms of the GNU Lesser General Public +#License version 2 as published by the Free Software Foundation. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +#You should have received a copy of the GNU Lesser General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from base import Enum as _Enum + +#------------------------------------------------------------------------------ + +class Role(_Enum): + _enum_lookup = { + 0:'ROLE_INVALID', + 1:'ROLE_ACCELERATOR_LABEL', + 2:'ROLE_ALERT', + 3:'ROLE_ANIMATION', + 4:'ROLE_ARROW', + 5:'ROLE_CALENDAR', + 6:'ROLE_CANVAS', + 7:'ROLE_CHECK_BOX', + 8:'ROLE_CHECK_MENU_ITEM', + 9:'ROLE_COLOR_CHOOSER', + 10:'ROLE_COLUMN_HEADER', + 11:'ROLE_COMBO_BOX', + 12:'ROLE_DATE_EDITOR', + 13:'ROLE_DESKTOP_ICON', + 14:'ROLE_DESKTOP_FRAME', + 15:'ROLE_DIAL', + 16:'ROLE_DIALOG', + 17:'ROLE_DIRECTORY_PANE', + 18:'ROLE_DRAWING_AREA', + 19:'ROLE_FILE_CHOOSER', + 20:'ROLE_FILLER', + 21:'ROLE_FOCUS_TRAVERSABLE', + 22:'ROLE_FONT_CHOOSER', + 23:'ROLE_FRAME', + 24:'ROLE_GLASS_PANE', + 25:'ROLE_HTML_CONTAINER', + 26:'ROLE_ICON', + 27:'ROLE_IMAGE', + 28:'ROLE_INTERNAL_FRAME', + 29:'ROLE_LABEL', + 30:'ROLE_LAYERED_PANE', + 31:'ROLE_LIST', + 32:'ROLE_LIST_ITEM', + 33:'ROLE_MENU', + 34:'ROLE_MENU_BAR', + 35:'ROLE_MENU_ITEM', + 36:'ROLE_OPTION_PANE', + 37:'ROLE_PAGE_TAB', + 38:'ROLE_PAGE_TAB_LIST', + 39:'ROLE_PANEL', + 40:'ROLE_PASSWORD_TEXT', + 41:'ROLE_POPUP_MENU', + 42:'ROLE_PROGRESS_BAR', + 43:'ROLE_PUSH_BUTTON', + 44:'ROLE_RADIO_BUTTON', + 45:'ROLE_RADIO_MENU_ITEM', + 46:'ROLE_ROOT_PANE', + 47:'ROLE_ROW_HEADER', + 48:'ROLE_SCROLL_BAR', + 49:'ROLE_SCROLL_PANE', + 50:'ROLE_SEPARATOR', + 51:'ROLE_SLIDER', + 52:'ROLE_SPIN_BUTTON', + 53:'ROLE_SPLIT_PANE', + 54:'ROLE_STATUS_BAR', + 55:'ROLE_TABLE', + 56:'ROLE_TABLE_CELL', + 57:'ROLE_TABLE_COLUMN_HEADER', + 58:'ROLE_TABLE_ROW_HEADER', + 59:'ROLE_TEAROFF_MENU_ITEM', + 60:'ROLE_TERMINAL', + 61:'ROLE_TEXT', + 62:'ROLE_TOGGLE_BUTTON', + 63:'ROLE_TOOL_BAR', + 64:'ROLE_TOOL_TIP', + 65:'ROLE_TREE', + 66:'ROLE_TREE_TABLE', + 67:'ROLE_UNKNOWN', + 68:'ROLE_VIEWPORT', + 69:'ROLE_WINDOW', + 70:'ROLE_EXTENDED', + 71:'ROLE_HEADER', + 72:'ROLE_FOOTER', + 73:'ROLE_PARAGRAPH', + 74:'ROLE_RULER', + 75:'ROLE_APPLICATION', + 76:'ROLE_AUTOCOMPLETE', + 77:'ROLE_EDITBAR', + 78:'ROLE_EMBEDDED', + 79:'ROLE_ENTRY', + 80:'ROLE_CHART', + 81:'ROLE_CAPTION', + 82:'ROLE_DOCUMENT_FRAME', + 83:'ROLE_HEADING', + 84:'ROLE_PAGE', + 85:'ROLE_SECTION', + 86:'ROLE_REDUNDANT_OBJECT', + 87:'ROLE_FORM', + 88:'ROLE_LINK', + 89:'ROLE_INPUT_METHOD_WINDOW', + 90:'ROLE_LAST_DEFINED', + } + +ROLE_ACCELERATOR_LABEL = Role(1) +ROLE_ALERT = Role(2) +ROLE_ANIMATION = Role(3) +ROLE_APPLICATION = Role(75) +ROLE_ARROW = Role(4) +ROLE_AUTOCOMPLETE = Role(76) +ROLE_CALENDAR = Role(5) +ROLE_CANVAS = Role(6) +ROLE_CAPTION = Role(81) +ROLE_CHART = Role(80) +ROLE_CHECK_BOX = Role(7) +ROLE_CHECK_MENU_ITEM = Role(8) +ROLE_COLOR_CHOOSER = Role(9) +ROLE_COLUMN_HEADER = Role(10) +ROLE_COMBO_BOX = Role(11) +ROLE_DATE_EDITOR = Role(12) +ROLE_DESKTOP_FRAME = Role(14) +ROLE_DESKTOP_ICON = Role(13) +ROLE_DIAL = Role(15) +ROLE_DIALOG = Role(16) +ROLE_DIRECTORY_PANE = Role(17) +ROLE_DOCUMENT_FRAME = Role(82) +ROLE_DRAWING_AREA = Role(18) +ROLE_EDITBAR = Role(77) +ROLE_EMBEDDED = Role(78) +ROLE_ENTRY = Role(79) +ROLE_EXTENDED = Role(70) +ROLE_FILE_CHOOSER = Role(19) +ROLE_FILLER = Role(20) +ROLE_FOCUS_TRAVERSABLE = Role(21) +ROLE_FONT_CHOOSER = Role(22) +ROLE_FOOTER = Role(72) +ROLE_FORM = Role(87) +ROLE_FRAME = Role(23) +ROLE_GLASS_PANE = Role(24) +ROLE_HEADER = Role(71) +ROLE_HEADING = Role(83) +ROLE_HTML_CONTAINER = Role(25) +ROLE_ICON = Role(26) +ROLE_IMAGE = Role(27) +ROLE_INPUT_METHOD_WINDOW = Role(89) +ROLE_INTERNAL_FRAME = Role(28) +ROLE_INVALID = Role(0) +ROLE_LABEL = Role(29) +ROLE_LAST_DEFINED = Role(90) +ROLE_LAYERED_PANE = Role(30) +ROLE_LINK = Role(88) +ROLE_LIST = Role(31) +ROLE_LIST_ITEM = Role(32) +ROLE_MENU = Role(33) +ROLE_MENU_BAR = Role(34) +ROLE_MENU_ITEM = Role(35) +ROLE_OPTION_PANE = Role(36) +ROLE_PAGE = Role(84) +ROLE_PAGE_TAB = Role(37) +ROLE_PAGE_TAB_LIST = Role(38) +ROLE_PANEL = Role(39) +ROLE_PARAGRAPH = Role(73) +ROLE_PASSWORD_TEXT = Role(40) +ROLE_POPUP_MENU = Role(41) +ROLE_PROGRESS_BAR = Role(42) +ROLE_PUSH_BUTTON = Role(43) +ROLE_RADIO_BUTTON = Role(44) +ROLE_RADIO_MENU_ITEM = Role(45) +ROLE_REDUNDANT_OBJECT = Role(86) +ROLE_ROOT_PANE = Role(46) +ROLE_ROW_HEADER = Role(47) +ROLE_RULER = Role(74) +ROLE_SCROLL_BAR = Role(48) +ROLE_SCROLL_PANE = Role(49) +ROLE_SECTION = Role(85) +ROLE_SEPARATOR = Role(50) +ROLE_SLIDER = Role(51) +ROLE_SPIN_BUTTON = Role(52) +ROLE_SPLIT_PANE = Role(53) +ROLE_STATUS_BAR = Role(54) +ROLE_TABLE = Role(55) +ROLE_TABLE_CELL = Role(56) +ROLE_TABLE_COLUMN_HEADER = Role(57) +ROLE_TABLE_ROW_HEADER = Role(58) +ROLE_TEAROFF_MENU_ITEM = Role(59) +ROLE_TERMINAL = Role(60) +ROLE_TEXT = Role(61) +ROLE_TOGGLE_BUTTON = Role(62) +ROLE_TOOL_BAR = Role(63) +ROLE_TOOL_TIP = Role(64) +ROLE_TREE = Role(65) +ROLE_TREE_TABLE = Role(66) +ROLE_UNKNOWN = Role(67) +ROLE_VIEWPORT = Role(68) +ROLE_WINDOW = Role(69) + +#END---------------------------------------------------------------------------- diff --git a/pyatspi/stateset.py b/pyatspi/state.py similarity index 100% rename from pyatspi/stateset.py rename to pyatspi/state.py