home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / gnome-orca / orca / rolenames.py < prev    next >
Encoding:
Python Source  |  2009-04-13  |  38.5 KB  |  1,302 lines

  1. # Orca
  2. #
  3. # Copyright 2004-2008 Sun Microsystems Inc.
  4. # Copyright 2001, 2002 BAUM Retec, A.G.
  5. #
  6. # This library is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # This library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with this library; if not, write to the
  18. # Free Software Foundation, Inc., Franklin Street, Fifth Floor,
  19. # Boston MA  02110-1301 USA.
  20.  
  21. """Provides methods that convert the role name of an Accessible
  22. object into localized strings for speech and braille."""
  23.  
  24. __id__        = "$Id: rolenames.py 4484 2009-01-31 15:40:03Z wwalker $"
  25. __version__   = "$Revision: 4484 $"
  26. __date__      = "$Date: 2009-01-31 10:40:03 -0500 (Sat, 31 Jan 2009) $"
  27. __copyright__ = "Copyright (c) 2004-2008 Sun Microsystems Inc."
  28. __license__   = "LGPL"
  29.  
  30. import debug
  31. import settings
  32.  
  33. import pyatspi
  34.  
  35. from orca_i18n import _  # for gettext support
  36. from orca_i18n import C_ # to provide qualified translatable strings
  37.  
  38. ########################################################################
  39. #                                                                      #
  40. # Rolenames derived from atk/atk/atkobject.c:role_items.               #
  41. #                                                                      #
  42. ########################################################################
  43.  
  44. #[[[TODO: eitani - These are here for backward compatability, they should 
  45. #disappear]]]
  46.  
  47. ROLE_INVALID             = "invalid"
  48. ROLE_ACCEL_LABEL         = "accelerator label"
  49. ROLE_ALERT               = "alert"
  50. ROLE_ANIMATION           = "animation"
  51. ROLE_ARROW               = "arrow"
  52. ROLE_CALENDAR            = "calendar"
  53. ROLE_CAPTION             = "caption"
  54. ROLE_CANVAS              = "canvas"
  55. ROLE_CHECK_BOX           = "check box"
  56. ROLE_CHECK_MENU_ITEM     = "check menu item"
  57. ROLE_COLOR_CHOOSER       = "color chooser"
  58. ROLE_COLUMN_HEADER       = "column header"
  59. ROLE_COMBO_BOX           = "combo box"
  60. ROLE_DATE_EDITOR         = "dateeditor"
  61. ROLE_DESKTOP_ICON        = "desktop icon"
  62. ROLE_DESKTOP_FRAME       = "desktop frame"
  63. ROLE_DIAL                = "dial"
  64. ROLE_DIALOG              = "dialog"
  65. ROLE_DIRECTORY_PANE      = "directory pane"
  66. ROLE_DOCUMENT_FRAME      = "document frame"
  67. ROLE_DRAWING_AREA        = "drawing area"
  68. ROLE_ENTRY               = "entry"
  69. ROLE_FILE_CHOOSER        = "file chooser"
  70. ROLE_FILLER              = "filler"
  71. ROLE_FONT_CHOOSER        = "fontchooser"
  72. ROLE_FORM                = "form"
  73. ROLE_FRAME               = "frame"
  74. ROLE_GLASS_PANE          = "glass pane"
  75. ROLE_HEADING             = "heading"
  76. ROLE_HTML_CONTAINER      = "html container"
  77. ROLE_ICON                = "icon"
  78. ROLE_IMAGE               = "image"
  79. ROLE_INTERNAL_FRAME      = "internal frame"
  80. ROLE_INPUT_METHOD_WINDOW = "input method window"
  81. ROLE_LABEL               = "label"
  82. ROLE_LAYERED_PANE        = "layered pane"
  83. ROLE_LINK                = "link"
  84. ROLE_LIST                = "list"
  85. ROLE_LIST_ITEM           = "list item"
  86. ROLE_MENU                = "menu"
  87. ROLE_MENU_BAR            = "menu bar"
  88. ROLE_MENU_ITEM           = "menu item"
  89. ROLE_OPTION_PANE         = "option pane"
  90. ROLE_PAGE_TAB            = "page tab"
  91. ROLE_PAGE_TAB_LIST       = "page tab list"
  92. ROLE_PANEL               = "panel"
  93. ROLE_PASSWORD_TEXT       = "password text"
  94. ROLE_POPUP_MENU          = "popup menu"
  95. ROLE_PROGRESS_BAR        = "progress bar"
  96. ROLE_PUSH_BUTTON         = "push button"
  97. ROLE_RADIO_BUTTON        = "radio button"
  98. ROLE_RADIO_MENU_ITEM     = "radio menu item"
  99. ROLE_ROOT_PANE           = "root pane"
  100. ROLE_ROW_HEADER          = "row header"
  101. ROLE_SCROLL_BAR          = "scroll bar"
  102. ROLE_SCROLL_PANE         = "scroll pane"
  103. ROLE_SECTION             = "section"
  104. ROLE_SEPARATOR           = "separator"
  105. ROLE_SLIDER              = "slider"
  106. ROLE_SPLIT_PANE          = "split pane"
  107. ROLE_SPIN_BOX            = "spinbox"
  108. ROLE_SPIN_BUTTON         = "spin button"
  109. ROLE_STATUSBAR           = "statusbar"
  110. ROLE_TABLE               = "table"
  111. ROLE_TABLE_CELL          = "table cell"
  112. ROLE_TABLE_COLUMN_HEADER = "table column header"
  113. ROLE_TABLE_ROW_HEADER    = "table row header"
  114. ROLE_TEAR_OFF_MENU_ITEM  = "tear off menu item"
  115. ROLE_TERMINAL            = "terminal"
  116. ROLE_TEXT                = "text"
  117. ROLE_TOGGLE_BUTTON       = "toggle button"
  118. ROLE_TOOL_BAR            = "tool bar"
  119. ROLE_TOOL_TIP            = "tool tip"
  120. ROLE_TREE                = "tree"
  121. ROLE_TREE_TABLE          = "tree table"
  122. ROLE_UNKNOWN             = "unknown"
  123. ROLE_VIEWPORT            = "viewport"
  124. ROLE_WINDOW              = "window"
  125. ROLE_HEADER              = "header"
  126. ROLE_FOOTER              = "footer"
  127. ROLE_PARAGRAPH           = "paragraph"
  128. ROLE_APPLICATION         = "application"
  129. ROLE_AUTOCOMPLETE        = "autocomplete"
  130. ROLE_EDITBAR             = "edit bar"
  131. ROLE_EMBEDDED            = "embedded component"
  132.  
  133. class Rolename:
  134.     """Provides localized forms of rolenames for speech and Braille.
  135.     """
  136.  
  137.     def __init__(self, rolename, brailleShort, brailleLong, speech):
  138.         """Created a new rolename with the given parameters.
  139.  
  140.         Arguments:
  141.         - rolename:     the internationalized (e.g., machine) name for the role
  142.         - brailleShort: the localized short string for Braille display
  143.         - brailleLong:  the localized long string for Braille display
  144.         - speech:       the localized string to speak for speech
  145.         """
  146.  
  147.         self.rolename = rolename
  148.         self.brailleShort = brailleShort
  149.         self.brailleLong = brailleLong
  150.         self.speech = speech
  151.  
  152. # [[[TODO: WDW - the AT-SPI also has getLocalizedRoleName, which might a
  153. # more appropriate thing to use, as it covers the situation where an app
  154. # has developed a brand new component with a brand new role. Logged as
  155. # buzilla bug 319780.]]]
  156. #
  157. rolenames = {}
  158.  
  159. rolenames[ROLE_INVALID] = Rolename(\
  160.     ROLE_INVALID,
  161.     # Translators: short braille for the rolename of an invalid GUI object.
  162.     # We strive to keep it under three characters to preserve real estate.
  163.     #
  164.     _("???"),
  165.     # Translators: long braille for the rolename of an invalid object.
  166.     # We typically make these 'camel' case.
  167.     #
  168.     _("Invalid"),
  169.     # Translators: spoken words for the rolename of an invalid object.
  170.     #
  171.     _("invalid"))
  172.  
  173. rolenames[ROLE_ACCEL_LABEL] = Rolename(
  174.     ROLE_ACCEL_LABEL,
  175.     # Translators: short braille for an accelerator (what you see in a menu).
  176.     # We strive to keep it under three characters to preserve real estate.
  177.     #
  178.     _("acc"),
  179.     # Translators: long braille for an accelerator (what you see in a menu).
  180.     # We typically make these 'camel' case.
  181.     #
  182.     _("Accelerator"),
  183.     # Translators: spoken words for an accelerator (what you see in a menu).
  184.     #
  185.     _("accelerator"))
  186.  
  187. rolenames[ROLE_ALERT] = Rolename(
  188.     ROLE_ALERT,
  189.     # Translators: short braille for the rolename of an alert dialog.
  190.     # NOTE for all the short braille words: they we strive to keep them
  191.     # around three characters to preserve real estate on the braille
  192.     # display.  The letters are chosen to make them unique across all
  193.     # other rolenames, and they typically act like an abbreviation.
  194.     #
  195.     _("alrt"),
  196.     # Translators: long braille for the rolename of an alert dialog.
  197.     # NOTE for all the long braille words: we typically make them
  198.     # 'camel' case -- multiple words are bunched together with no
  199.     # spaces between them and the first letter of each word is
  200.     # capitalized.
  201.     #
  202.     _("Alert"),
  203.     # Translators: spoken words for the rolename of an alert dialog.
  204.     # NOTE for all the spoken words: these are the words one would use
  205.     # when speaking.
  206.     #
  207.     _("alert"))
  208.  
  209. rolenames[ROLE_ANIMATION] = Rolename(
  210.     ROLE_ANIMATION,
  211.     # Translators: short braille for the rolename of an animation widget.
  212.     #
  213.     _("anim"),
  214.     # Translators: long braille for the rolename of an animation widget.
  215.     #
  216.     _("Animation"),
  217.     # Translators: spoken words for the rolename of an animation widget.
  218.     #
  219.     _("animation"))
  220.  
  221. rolenames[ROLE_ARROW] = Rolename(
  222.     ROLE_ARROW,
  223.     # Translators: short braille for the rolename of an arrow widget.
  224.     #
  225.     _("arw"),
  226.     # Translators: long braille for the rolename of an animation widget.
  227.     #
  228.     _("Arrow"),
  229.     # Translators: spoken words for the rolename of an animation widget.
  230.     #
  231.     _("arrow"))
  232.  
  233. rolenames[ROLE_CALENDAR] = Rolename(
  234.     ROLE_CALENDAR,
  235.     # Translators: short braille for the rolename of a calendar widget.
  236.     #
  237.     _("cal"),
  238.     # Translators: long braille for the rolename of a calendar widget.
  239.     #
  240.     _("Calendar"),
  241.     # Translators: spoken words for the rolename of a calendar widget.
  242.     #
  243.     _("calendar"))
  244.  
  245. rolenames[ROLE_CANVAS] = Rolename(
  246.     ROLE_CANVAS,
  247.     # Translators: short braille for the rolename of a canvas widget.
  248.     #
  249.     _("cnv"),
  250.     # Translators: long braille for the rolename of a canvas widget.
  251.     #
  252.     _("Canvas"),
  253.     # Translators: spoken words for the rolename of a canvas widget.
  254.     #
  255.     _("canvas"))
  256.  
  257. rolenames[ROLE_CAPTION] = Rolename(
  258.     ROLE_CAPTION,
  259.     # Translators: short braille for the rolename of a caption (e.g.,
  260.     # table caption).
  261.     #
  262.     _("cptn"),
  263.     # Translators: long braille for the rolename of a caption (e.g.,
  264.     # table caption).
  265.     #
  266.     _("Caption"),
  267.     # Translators: spoken words for the rolename of a caption (e.g.,
  268.     # table caption).
  269.     #
  270.     _("caption"))
  271.  
  272. rolenames[ROLE_CHECK_BOX] = Rolename(
  273.     ROLE_CHECK_BOX,
  274.     # Translators: short braille for the rolename of a checkbox.
  275.     #
  276.     _("chk"),
  277.     # Translators: long braille for the rolename of a checkbox.
  278.     #
  279.     _("CheckBox"),
  280.     # Translators: spoken words for the rolename of a checkbox.
  281.     #
  282.     _("check box"))
  283.  
  284. rolenames[ROLE_CHECK_MENU_ITEM] = Rolename(
  285.     ROLE_CHECK_MENU_ITEM,
  286.     # Translators: short braille for the rolename of a check menu item.
  287.     #
  288.     _("chk"),
  289.     # Translators: long braille for the rolename of a check menu item.
  290.     #
  291.     _("CheckItem"),
  292.     # Translators: spoken words for the rolename of a check menu item.
  293.     #
  294.     _("check item"))
  295.  
  296. rolenames[ROLE_COLOR_CHOOSER] = Rolename(
  297.     ROLE_COLOR_CHOOSER,
  298.     # Translators: short braille for the rolename of a color chooser.
  299.     #
  300.     _("clrchsr"),
  301.     # Translators: long braille for the rolename of a color chooser.
  302.     #
  303.     _("ColorChooser"),
  304.     # Translators: spoken words for the rolename of a color chooser.
  305.     #
  306.     _("color chooser"))
  307.  
  308. rolenames[ROLE_COLUMN_HEADER] = Rolename(
  309.     ROLE_COLUMN_HEADER,
  310.     # Translators: short braille for the rolename of a column header.
  311.     #
  312.     _("colhdr"),
  313.     # Translators: long braille for the rolename of a column header.
  314.     #
  315.     _("ColumnHeader"),
  316.     # Translators: spoken words for the rolename of a column header.
  317.     #
  318.     _("column header"))
  319.  
  320. rolenames[ROLE_COMBO_BOX] = Rolename(
  321.     ROLE_COMBO_BOX,
  322.     # Translators: short braille for the rolename of a combo box.
  323.     #
  324.     _("cbo"),
  325.     # Translators: long braille for the rolename of a combo box.
  326.     #
  327.     _("Combo"),
  328.     # Translators: spoken words for the rolename of a combo box.
  329.     #
  330.     _("combo box"))
  331.  
  332. rolenames[ROLE_DATE_EDITOR] = Rolename(
  333.     ROLE_DATE_EDITOR,
  334.     # Translators: short braille for the rolename of a date editor.
  335.     #
  336.     _("dat"),
  337.     # Translators: long braille for the rolename of a date editor.
  338.     #
  339.     _("DateEditor"),
  340.     # Translators: spoken words for the rolename of a date editor.
  341.     #
  342.     _("date editor"))
  343.  
  344. rolenames[ROLE_DESKTOP_ICON] = Rolename(
  345.     ROLE_DESKTOP_ICON,
  346.     # Translators: short braille for the rolename of a desktop icon.
  347.     #
  348.     _("icn"),
  349.     # Translators: long braille for the rolename of a desktop icon.
  350.     #
  351.     _("DesktopIcon"),
  352.     # Translators: spoken words for the rolename of a desktop icon.
  353.     #
  354.     _("desktop icon"))
  355.  
  356. rolenames[ROLE_DESKTOP_FRAME] = Rolename(
  357.     ROLE_DESKTOP_FRAME,
  358.     # Translators: short braille for the rolename of a desktop frame.
  359.     #
  360.     _("frm"),
  361.     # Translators: long braille for the rolename of a desktop frame.
  362.     #
  363.     _("DesktopFrame"),
  364.     # Translators: spoken words for the rolename of a desktop frame.
  365.     #
  366.     _("desktop frame"))
  367.  
  368. rolenames[ROLE_DIAL] = Rolename(
  369.     ROLE_DIAL,
  370.     # Translators: short braille for the rolename of a dial.
  371.     # You should attempt to treat it as an abbreviation of
  372.     # the translated word for "dial".  It is OK to use an
  373.     # unabbreviated word as long as it is relatively short.
  374.     #
  375.     C_("shortbraille", "dial"),
  376.     # Translators: long braille for the rolename of a dial.
  377.     #
  378.     _("Dial"),
  379.     # Translators: spoken words for the rolename of a dial.
  380.     #
  381.     _("dial"))
  382.  
  383. rolenames[ROLE_DIALOG] = Rolename(
  384.     ROLE_DIALOG,
  385.     # Translators: short braille for the rolename of a dialog.
  386.     #
  387.     _("dlg"),
  388.     # Translators: long braille for the rolename of a dialog.
  389.     #
  390.     _("Dialog"),
  391.     # Translators: spoken words for the rolename of a dialog.
  392.     #
  393.     _("dialog"))
  394.  
  395. rolenames[ROLE_DIRECTORY_PANE] = Rolename(
  396.     ROLE_DIRECTORY_PANE,
  397.     # Translators: short braille for the rolename of a directory pane.
  398.     #
  399.     _("dip"),
  400.     # Translators: long braille for the rolename of a directory pane.
  401.     #
  402.     _("DirectoryPane"),
  403.     # Translators: spoken words for the rolename of a directory pane.
  404.     #
  405.     _("directory pane"))
  406.  
  407. rolenames[ROLE_DOCUMENT_FRAME] = Rolename(
  408.     ROLE_DOCUMENT_FRAME,
  409.     # Translators: short braille for the rolename of an HTML document frame.
  410.     #
  411.     _("html"),
  412.     # Translators: long braille for the rolename of an HTML document frame.
  413.     #
  414.     _("HtmlPane"),
  415.     # Translators: spoken words for the rolename of an HTML document frame.
  416.     #
  417.     _("html content"))
  418.  
  419. rolenames[ROLE_DRAWING_AREA] = Rolename(
  420.     ROLE_DRAWING_AREA,
  421.     # Translators: short braille for the rolename of a drawing area.
  422.     #
  423.     _("draw"),
  424.     # Translators: long braille for the rolename of a drawing area.
  425.     #
  426.     _("DrawingArea"),
  427.     # Translators: spoken words for the rolename of a drawing area.
  428.     #
  429.     _("drawing area"))
  430.  
  431. rolenames[ROLE_FILE_CHOOSER] = Rolename(
  432.     ROLE_FILE_CHOOSER,
  433.     # Translators: short braille for the rolename of a file chooser.
  434.     #
  435.     _("fchsr"),
  436.     # Translators: long braille for the rolename of a file chooser.
  437.     #
  438.     _("FileChooser"),
  439.     # Translators: spoken words for the rolename of a file chooser.
  440.     #
  441.     _("file chooser"))
  442.  
  443. rolenames[ROLE_FILLER] = Rolename(
  444.     ROLE_FILLER,
  445.     # Translators: short braille for the rolename of a filler.
  446.     #
  447.     _("flr"),
  448.     # Translators: long braille for the rolename of a filler.
  449.     #
  450.     _("Filler"),
  451.     # Translators: spoken words for the rolename of a filler.
  452.     #
  453.     _("filler"))
  454.  
  455. rolenames[ROLE_FONT_CHOOSER] = Rolename(
  456.     ROLE_FONT_CHOOSER,
  457.     # Translators: short braille for the rolename of a font chooser.
  458.     #
  459.     _("fnt"),
  460.     # Translators: long braille for the rolename of a font chooser.
  461.     #
  462.     _("FontChooser"),
  463.     # Translators: spoken words for the rolename of a font chooser.
  464.     #
  465.     _("font chooser"))
  466.  
  467. rolenames[ROLE_FORM] = Rolename(
  468.     ROLE_FORM,
  469.     # Translators: short braille for the rolename of a form.
  470.     # You should attempt to treat it as an abbreviation of
  471.     # the translated word for "form".  It is OK to use an
  472.     # unabbreviated word as long as it is relatively short.
  473.     #
  474.     C_("shortbraille", "form"),
  475.     # Translators: long braille for the rolename of a form.
  476.     #
  477.     _("Form"),
  478.     # Translators: spoken words for the rolename of a form.
  479.     #
  480.     _("form"))
  481.  
  482. rolenames[ROLE_FRAME] = Rolename(
  483.     ROLE_FRAME,
  484.     # Translators: short braille for the rolename of a frame.
  485.     #
  486.     _("frm"),
  487.     # Translators: long braille for the rolename of a frame.
  488.     #
  489.     _("Frame"),
  490.     # Translators: spoken words for the rolename of a frame.
  491.     #
  492.     _("frame"))
  493.  
  494. rolenames[ROLE_GLASS_PANE] = Rolename(
  495.     ROLE_GLASS_PANE,
  496.     # Translators: short braille for the rolename of a glass pane.
  497.     #
  498.     _("gpn"),
  499.     # Translators: long braille for the rolename of a glass pane.
  500.     #
  501.     _("GlassPane"),
  502.     # Translators: spoken words for the rolename of a glass pane.
  503.     #
  504.     _("glass pane"))
  505.  
  506. rolenames[ROLE_HEADING] = Rolename(
  507.     ROLE_HEADING,
  508.     # Translators: short braille for the rolename of a heading.
  509.     #
  510.     _("hdng"),
  511.     # Translators: long braille for the rolename of a heading.
  512.     #
  513.     _("Heading"),
  514.     # Translators: spoken words for the rolename of a heading.
  515.     #
  516.     _("heading"))
  517.  
  518. rolenames[ROLE_HTML_CONTAINER] = Rolename(
  519.     ROLE_HTML_CONTAINER,
  520.     # Translators: short braille for the rolename of an html container.
  521.     #
  522.     _("html"),
  523.     # Translators: long braille for the rolename of an html container.
  524.     #
  525.     _("HtmlContainer"),
  526.     # Translators: spoken words for the rolename of an html container.
  527.     #
  528.     _("h t m l container"))
  529.  
  530. rolenames[ROLE_ICON] = Rolename(
  531.     ROLE_ICON,
  532.     # Translators: short braille for the rolename of a icon.
  533.     #
  534.     _("icn"),
  535.     # Translators: long braille for the rolename of a icon.
  536.     #
  537.     _("Icon"),
  538.     # Translators: spoken words for the rolename of a icon.
  539.     #
  540.     _("icon"))
  541.  
  542. rolenames[ROLE_IMAGE] = Rolename(
  543.     ROLE_IMAGE,
  544.     # Translators: short braille for the rolename of a image.
  545.     #
  546.     _("img"),
  547.     # Translators: long braille for the rolename of a image.
  548.     #
  549.     _("Image"),
  550.     # Translators: spoken words for the rolename of a image.
  551.     #
  552.     _("image"))
  553.  
  554. rolenames[ROLE_INTERNAL_FRAME] = Rolename(
  555.     ROLE_INTERNAL_FRAME,
  556.     # Translators: short braille for the rolename of an internal frame.
  557.     #
  558.     _("ifrm"),
  559.     # Translators: long braille for the rolename of an internal frame.
  560.     #
  561.     _("InternalFrame"),
  562.     # Translators: spoken words for the rolename of an internal frame.
  563.     #
  564.     _("internal frame"))
  565.  
  566. rolenames[ROLE_LABEL] = Rolename(
  567.     ROLE_LABEL,
  568.     # Translators: short braille for the rolename of a label.
  569.     #
  570.     _("lbl"),
  571.     # Translators: long braille for the rolename of a label.
  572.     #
  573.     _("Label"),
  574.     # Translators: spoken words for the rolename of a label.
  575.     #
  576.     _("label"))
  577.  
  578. rolenames[ROLE_LAYERED_PANE] = Rolename(
  579.     ROLE_LAYERED_PANE,
  580.     # Translators: short braille for the rolename of a layered pane.
  581.     #
  582.     _("lyrdpn"),
  583.     # Translators: long braille for the rolename of a layered pane.
  584.     #
  585.     _("LayeredPane"),
  586.     # Translators: spoken words for the rolename of a layered pane.
  587.     #
  588.     _("layered pane"))
  589.  
  590. rolenames[ROLE_LINK] = Rolename(
  591.     ROLE_LINK,
  592.     # Translators: short braille for the rolename of a link.
  593.     #
  594.     _("lnk"),
  595.     # Translators: long braille for the rolename of a link.
  596.     #
  597.     _("Link"),
  598.     # Translators: spoken words for the rolename of a link.
  599.     #
  600.     _("link"))
  601.  
  602. rolenames[ROLE_LIST] = Rolename(
  603.     ROLE_LIST,
  604.     # Translators: short braille for the rolename of a list.
  605.     #
  606.     _("lst"),
  607.     # Translators: long braille for the rolename of a list.
  608.     #
  609.     _("List"),
  610.     # Translators: spoken words for the rolename of a list.
  611.     #
  612.     _("list"))
  613.  
  614. rolenames[ROLE_LIST_ITEM] = Rolename(
  615.     ROLE_LIST_ITEM,
  616.     # Translators: short braille for the rolename of a list item.
  617.     #
  618.     _("lstitm"),
  619.     # Translators: long braille for the rolename of a list item.
  620.     #
  621.     _("ListItem"),
  622.     # Translators: spoken words for the rolename of a list item.
  623.     #
  624.     _("list item"))
  625.  
  626. rolenames[ROLE_MENU] = Rolename(
  627.     ROLE_MENU,
  628.     # Translators: short braille for the rolename of a menu.
  629.     #
  630.     _("mnu"),
  631.     # Translators: long braille for the rolename of a menu.
  632.     #
  633.     _("Menu"),
  634.     # Translators: spoken words for the rolename of a menu.
  635.     #
  636.     _("menu"))
  637.  
  638. rolenames[ROLE_MENU_BAR] = Rolename(
  639.     ROLE_MENU_BAR,
  640.     # Translators: short braille for the rolename of a menu bar.
  641.     #
  642.     _("mnubr"),
  643.     # Translators: long braille for the rolename of a menu bar.
  644.     #
  645.     _("MenuBar"),
  646.     # Translators: spoken words for the rolename of a menu bar.
  647.     #
  648.     _("menu bar"))
  649.  
  650. rolenames[ROLE_MENU_ITEM] = Rolename(
  651.     ROLE_MENU_ITEM,
  652.     # Translators: short braille for the rolename of a menu item.
  653.     #
  654.     _("mnuitm"),
  655.     # Translators: long braille for the rolename of a menu item.
  656.     #
  657.     _("MenuItem"),
  658.     # Translators: spoken words for the rolename of a menu item.
  659.     #
  660.     _("menu item"))
  661.  
  662. rolenames[ROLE_OPTION_PANE] = Rolename(
  663.     ROLE_OPTION_PANE,
  664.     # Translators: short braille for the rolename of an option pane.
  665.     #
  666.     _("optnpn"),
  667.     # Translators: long braille for the rolename of an option pane.
  668.     #
  669.     _("OptionPane"),
  670.     # Translators: spoken words for the rolename of an option pane.
  671.     #
  672.     _("option pane"))
  673.  
  674. rolenames[ROLE_PAGE_TAB] = Rolename(
  675.     ROLE_PAGE_TAB,
  676.     # Translators: short braille for the rolename of a page tab.
  677.     #
  678.     _("pgt"),
  679.     # Translators: long braille for the rolename of a page tab.
  680.     #
  681.     _("Page"),
  682.     # Translators: spoken words for the rolename of a page tab.
  683.     #
  684.     _("page"))
  685.  
  686. rolenames[ROLE_PAGE_TAB_LIST] = Rolename(
  687.     ROLE_PAGE_TAB_LIST,
  688.     # Translators: short braille for the rolename of a page tab list.
  689.     #
  690.     _("tblst"),
  691.     # Translators: long braille for the rolename of a page tab list.
  692.     #
  693.     _("TabList"),
  694.     # Translators: spoken words for the rolename of a page tab list.
  695.     #
  696.     _("tab list"))
  697.  
  698. rolenames[ROLE_PANEL] = Rolename(
  699.     ROLE_PANEL,
  700.     # Translators: short braille for the rolename of a panel.
  701.     #
  702.     _("pnl"),
  703.     # Translators: long braille for the rolename of a panel.
  704.     #
  705.     _("Panel"),
  706.     # Translators: spoken words for the rolename of a panel.
  707.     #
  708.     _("panel"))
  709.  
  710. rolenames[ROLE_PASSWORD_TEXT] = Rolename(
  711.     ROLE_PASSWORD_TEXT,
  712.     # Translators: short braille for the rolename of a password field.
  713.     #
  714.     _("pwd"),
  715.     # Translators: long braille for the rolename of a password field.
  716.     #
  717.     _("Password"),
  718.     # Translators: spoken words for the rolename of a password field.
  719.     #
  720.     _("password"))
  721.  
  722. rolenames[ROLE_POPUP_MENU] = Rolename(
  723.     ROLE_POPUP_MENU,
  724.     # Translators: short braille for the rolename of a popup menu.
  725.     #
  726.     _("popmnu"),
  727.     # Translators: long braille for the rolename of a popup menu.
  728.     #
  729.     _("PopupMenu"),
  730.     # Translators: spoken words for the rolename of a popup menu.
  731.     #
  732.     _("popup menu"))
  733.  
  734. rolenames[ROLE_PROGRESS_BAR] = Rolename(
  735.     ROLE_PROGRESS_BAR,
  736.     # Translators: short braille for the rolename of a progress bar.
  737.     #
  738.     _("pgbar"),
  739.     # Translators: long braille for the rolename of a progress bar.
  740.     #
  741.     _("Progress"),
  742.     # Translators: spoken words for the rolename of a progress bar.
  743.     #
  744.     _("progress bar"))
  745.  
  746. rolenames[ROLE_PUSH_BUTTON] = Rolename(
  747.     ROLE_PUSH_BUTTON,
  748.     # Translators: short braille for the rolename of a push button.
  749.     #
  750.     _("btn"),
  751.     # Translators: long braille for the rolename of a push button.
  752.     #
  753.     _("Button"),
  754.     # Translators: spoken words for the rolename of a push button.
  755.     #
  756.     _("button"))
  757.  
  758. rolenames[ROLE_RADIO_BUTTON] = Rolename(
  759.     ROLE_RADIO_BUTTON,
  760.     # Translators: short braille for the rolename of a radio button.
  761.     #
  762.     _("radio"),
  763.     # Translators: long braille for the rolename of a radio button.
  764.     #
  765.     _("RadioButton"),
  766.     # Translators: spoken words for the rolename of a radio button.
  767.     #
  768.     _("radio button"))
  769.  
  770. rolenames[ROLE_RADIO_MENU_ITEM] = Rolename(
  771.     ROLE_RADIO_MENU_ITEM,
  772.     # Translators: short braille for the rolename of a radio menu item.
  773.     #
  774.     _("rdmnuitm"),
  775.     # Translators: long braille for the rolename of a radio menu item.
  776.     #
  777.     _("RadioItem"),
  778.     # Translators: spoken words for the rolename of a radio menu item.
  779.     #
  780.     _("radio menu item"))
  781.  
  782. rolenames[ROLE_ROOT_PANE] = Rolename(
  783.     ROLE_ROOT_PANE,
  784.     # Translators: short braille for the rolename of a root pane.
  785.     #
  786.     _("rtpn"),
  787.     # Translators: long braille for the rolename of a root pane.
  788.     #
  789.     _("RootPane"),
  790.     # Translators: spoken words for the rolename of a root pane.
  791.     #
  792.     _("root pane"))
  793.  
  794. rolenames[ROLE_ROW_HEADER] = Rolename(
  795.     ROLE_ROW_HEADER,
  796.     # Translators: short braille for the rolename of a row header.
  797.     #
  798.     _("rwhdr"),
  799.     # Translators: long braille for the rolename of a row header.
  800.     #
  801.     _("RowHeader"),
  802.     # Translators: spoken words for the rolename of a row header.
  803.     #
  804.     _("row header"))
  805.  
  806. rolenames[ROLE_SCROLL_BAR] = Rolename(
  807.     ROLE_SCROLL_BAR,
  808.     # Translators: short braille for the rolename of a scroll bar.
  809.     #
  810.     _("scbr"),
  811.     # Translators: long braille for the rolename of a scroll bar.
  812.     #
  813.     _("ScrollBar"),
  814.     # Translators: spoken words for the rolename of a scroll bar.
  815.     #
  816.     _("scroll bar"))
  817.  
  818. rolenames[ROLE_SCROLL_PANE] = Rolename(
  819.     ROLE_SCROLL_PANE,
  820.     # Translators: short braille for the rolename of a scroll pane.
  821.     #
  822.     _("scpn"),
  823.     # Translators: long braille for the rolename of a scroll pane.
  824.     #
  825.     _("ScrollPane"),
  826.     # Translators: spoken words for the rolename of a scroll pane.
  827.     #
  828.     _("scroll pane"))
  829.  
  830. rolenames[ROLE_SECTION] = Rolename(
  831.     ROLE_SECTION,
  832.     # Translators: short braille for the rolename of a section (e.g., in html).
  833.     #
  834.     _("sctn"),
  835.     # Translators: long braille for the rolename of a section (e.g., in html).
  836.     #
  837.     _("Section"),
  838.     # Translators: spoken words for the rolename of a section (e.g., in html).
  839.     #
  840.     _("section"))
  841.  
  842. rolenames[ROLE_SEPARATOR] = Rolename(
  843.     ROLE_SEPARATOR,
  844.     # Translators: short braille for the rolename of a separator.
  845.     #
  846.     _("seprtr"),
  847.     # Translators: long braille for the rolename of a separator.
  848.     #
  849.     _("Separator"),
  850.     # Translators: spoken words for the rolename of a separator.
  851.     #
  852.     _("separator"))
  853.  
  854. rolenames[ROLE_SLIDER] = Rolename(
  855.     ROLE_SLIDER,
  856.     # Translators: short braille for the rolename of a slider.
  857.     #
  858.     _("sldr"),
  859.     # Translators: long braille for the rolename of a slider.
  860.     #
  861.     _("Slider"),
  862.     # Translators: spoken words for the rolename of a slider.
  863.     #
  864.     _("slider"))
  865.  
  866. rolenames[ROLE_SPLIT_PANE] = Rolename(
  867.     ROLE_SPLIT_PANE,
  868.     # Translators: short braille for the rolename of a split pane.
  869.     #
  870.     _("spltpn"),
  871.     # Translators: long braille for the rolename of a split pane.
  872.     #
  873.     _("SplitPane"),
  874.     # Translators: spoken words for the rolename of a split pane.
  875.     #
  876.     _("split pane"))
  877.  
  878. rolenames[ROLE_SPIN_BUTTON] = Rolename(
  879.     ROLE_SPIN_BUTTON,
  880.     # Translators: short braille for the rolename of a spin button.
  881.     #
  882.     _("spin"),
  883.     # Translators: long braille for the rolename of a spin button.
  884.     #
  885.     _("SpinButton"),
  886.     # Translators: spoken words for the rolename of a spin button.
  887.     #
  888.     _("spin button"))
  889.  
  890. rolenames[ROLE_STATUSBAR] = Rolename(
  891.     ROLE_STATUSBAR,
  892.     # Translators: short braille for the rolename of a statusbar.
  893.     #
  894.     _("statbr"),
  895.     # Translators: long braille for the rolename of a statusbar.
  896.     #
  897.     _("StatusBar"),
  898.     # Translators: spoken words for the rolename of a statusbar.
  899.     #
  900.     _("status bar"))
  901.  
  902. rolenames[ROLE_TABLE] = Rolename(
  903.     ROLE_TABLE,
  904.     # Translators: short braille for the rolename of a table.
  905.     #
  906.     _("tbl"),
  907.     # Translators: long braille for the rolename of a table.
  908.     #
  909.     _("Table"),
  910.     # Translators: spoken words for the rolename of a table.
  911.     #
  912.     _("table"))
  913.  
  914. rolenames[ROLE_TABLE_CELL] = Rolename(
  915.     ROLE_TABLE_CELL,
  916.     # Translators: short braille for the rolename of a table cell.
  917.     #
  918.     _("cll"),
  919.     # Translators: long braille for the rolename of a table cell.
  920.     #
  921.     _("Cell"),
  922.     # Translators: spoken words for the rolename of a table cell.
  923.     #
  924.     _("cell"))
  925.  
  926. rolenames[ROLE_TABLE_COLUMN_HEADER] = Rolename(
  927.     ROLE_TABLE_COLUMN_HEADER,
  928.     # Translators: short braille for the rolename of a table column header.
  929.     #
  930.     _("colhdr"),
  931.     # Translators: long braille for the rolename of a table column header.
  932.     #
  933.     _("ColumnHeader"),
  934.     # Translators: spoken words for the rolename of a table column header.
  935.     #
  936.     _("column header"))
  937.  
  938. rolenames[ROLE_TABLE_ROW_HEADER] = Rolename(
  939.     ROLE_TABLE_ROW_HEADER,
  940.     # Translators: short braille for the rolename of a table row header.
  941.     #
  942.     _("rwhdr"),
  943.     # Translators: long braille for the rolename of a table row header.
  944.     #
  945.     _("RowHeader"),
  946.     # Translators: spoken words for the rolename of a table row header.
  947.     #
  948.     _("row header"))
  949.  
  950. rolenames[ROLE_TEAR_OFF_MENU_ITEM] = Rolename(
  951.     ROLE_TEAR_OFF_MENU_ITEM,
  952.     # Translators: short braille for the rolename of a tear off menu item.
  953.     #
  954.     _("tomnuitm"),
  955.     # Translators: long braille for the rolename of a tear off menu item.
  956.     #
  957.     _("TearOffMenuItem"),
  958.     # Translators: spoken words for the rolename of a tear off menu item.
  959.     #
  960.     _("tear off menu item"))
  961.  
  962. rolenames[ROLE_TERMINAL] = Rolename(
  963.     ROLE_TERMINAL,
  964.     # Translators: short braille for the rolename of a terminal.
  965.     #
  966.     _("term"),
  967.     # Translators: long braille for the rolename of a terminal.
  968.     #
  969.     _("Terminal"),
  970.     # Translators: spoken words for the rolename of a terminal.
  971.     #
  972.     _("terminal"))
  973.  
  974. rolenames[ROLE_TEXT] = Rolename(
  975.     ROLE_TEXT,
  976.     # Translators: short braille for the rolename of a text entry field.
  977.     #
  978.     _("txt"),
  979.     # Translators: long braille for the rolename of a text entry field.
  980.     #
  981.     _("Text"),
  982.     # Translators: spoken words for the rolename of a text entry field.
  983.     #
  984.     _("text"))
  985.  
  986. rolenames[ROLE_ENTRY] = rolenames[ROLE_TEXT]
  987.  
  988. rolenames[ROLE_TOGGLE_BUTTON] = Rolename(
  989.     ROLE_TOGGLE_BUTTON,
  990.     # Translators: short braille for the rolename of a toggle button.
  991.     #
  992.     _("tglbtn"),
  993.     # Translators: long braille for the rolename of a toggle button.
  994.     #
  995.     _("ToggleButton"),
  996.     # Translators: spoken words for the rolename of a toggle button.
  997.     #
  998.     _("toggle button"))
  999.  
  1000. rolenames[ROLE_TOOL_BAR] = Rolename(
  1001.     ROLE_TOOL_BAR,
  1002.     # Translators: short braille for the rolename of a toolbar.
  1003.     #
  1004.     _("tbar"),
  1005.     # Translators: long braille for the rolename of a toolbar.
  1006.     #
  1007.     _("ToolBar"),
  1008.     # Translators: spoken words for the rolename of a toolbar.
  1009.     #
  1010.     _("tool bar"))
  1011.  
  1012. rolenames[ROLE_TOOL_TIP] = Rolename(
  1013.     ROLE_TOOL_TIP,
  1014.     # Translators: short braille for the rolename of a tooltip.
  1015.     #
  1016.     _("tip"),
  1017.     # Translators: long braille for the rolename of a tooltip.
  1018.     #
  1019.     _("ToolTip"),
  1020.     # Translators: spoken words for the rolename of a tooltip.
  1021.     #
  1022.     _("tool tip"))
  1023.  
  1024. rolenames[ROLE_TREE] = Rolename(
  1025.     ROLE_TREE,
  1026.     # Translators: short braille for the rolename of a tree.
  1027.     #
  1028.     _("tre"),
  1029.     # Translators: long braille for the rolename of a tree.
  1030.     #
  1031.     _("Tree"),
  1032.     # Translators: spoken words for the rolename of a tree.
  1033.     #
  1034.     _("tree"))
  1035.  
  1036. rolenames[ROLE_TREE_TABLE] = Rolename(
  1037.     ROLE_TREE_TABLE,
  1038.     # Translators: short braille for the rolename of a tree table.
  1039.     #
  1040.     _("trtbl"),
  1041.     # Translators: long braille for the rolename of a tree table.
  1042.     #
  1043.     _("TreeTable"),
  1044.     # Translators: spoken words for the rolename of a tree table.
  1045.     #
  1046.     _("tree table"))
  1047.  
  1048. rolenames[ROLE_UNKNOWN] = Rolename(
  1049.     ROLE_UNKNOWN,
  1050.     # Translators: short braille for when the rolename of an object is unknown.
  1051.     #
  1052.     _("unk"),
  1053.     # Translators: long braille for when the rolename of an object is unknown.
  1054.     #
  1055.     _("Unknown"),
  1056.     # Translators: spoken words for when the rolename of an object is unknown.
  1057.     #
  1058.     _("unknown"))
  1059.  
  1060. rolenames[ROLE_VIEWPORT] = Rolename(
  1061.     ROLE_VIEWPORT,
  1062.     # Translators: short braille for the rolename of a viewport.
  1063.     #
  1064.     _("vwprt"),
  1065.     # Translators: long braille for the rolename of a viewport.
  1066.     #
  1067.     _("Viewport"),
  1068.     # Translators: spoken words for the rolename of a viewport.
  1069.     #
  1070.     _("viewport"))
  1071.  
  1072. rolenames[ROLE_WINDOW] = Rolename(
  1073.     ROLE_WINDOW,
  1074.     # Translators: short braille for the rolename of a window.
  1075.     #
  1076.     _("wnd"),
  1077.     # Translators: long braille for the rolename of a window.
  1078.     #
  1079.     _("Window"),
  1080.     # Translators: spoken words for the rolename of a window.
  1081.     #
  1082.     _("window"))
  1083.  
  1084. rolenames[ROLE_HEADER] = Rolename(
  1085.     ROLE_HEADER,
  1086.     # Translators: short braille for the rolename of a header.
  1087.     #
  1088.     _("hdr"),
  1089.     # Translators: long braille for the rolename of a header.
  1090.     #
  1091.     _("Header"),
  1092.     # Translators: spoken words for the rolename of a header.
  1093.     #
  1094.     _("header"))
  1095.  
  1096. rolenames[ROLE_FOOTER] = Rolename(
  1097.     ROLE_FOOTER,
  1098.     # Translators: short braille for the rolename of a footer.
  1099.     #
  1100.     _("ftr"),
  1101.     # Translators: long braille for the rolename of a footer.
  1102.     #
  1103.     _("Footer"),
  1104.     # Translators: spoken words for the rolename of a footer.
  1105.     #
  1106.     _("footer"))
  1107.  
  1108. rolenames[ROLE_PARAGRAPH] = Rolename(
  1109.     ROLE_PARAGRAPH,
  1110.     # Translators: short braille for the rolename of a paragraph.
  1111.     #
  1112.     _("para"),
  1113.     # Translators: long braille for the rolename of a paragraph.
  1114.     #
  1115.     _("Paragraph"),
  1116.     # Translators: spoken words for the rolename of a paragraph.
  1117.     #
  1118.     _("paragraph"))
  1119.  
  1120. rolenames[ROLE_APPLICATION] = Rolename(
  1121.     ROLE_APPLICATION,
  1122.     # Translators: short braille for the rolename of a application.
  1123.     #
  1124.     _("app"),
  1125.     # Translators: long braille for the rolename of a application.
  1126.     #
  1127.     _("Application"),
  1128.     # Translators: spoken words for the rolename of a application.
  1129.     #
  1130.     _("application"))
  1131.  
  1132. rolenames[ROLE_AUTOCOMPLETE] = Rolename(
  1133.     ROLE_AUTOCOMPLETE,
  1134.     # Translators: short braille for the rolename of a autocomplete.
  1135.     #
  1136.     _("auto"),
  1137.     # Translators: long braille for the rolename of a autocomplete.
  1138.     #
  1139.     _("AutoComplete"),
  1140.     # Translators: spoken words for the rolename of a autocomplete.
  1141.     #
  1142.     _("autocomplete"))
  1143.  
  1144. rolenames[ROLE_EDITBAR] = Rolename(
  1145.     ROLE_EDITBAR,
  1146.     # Translators: short braille for the rolename of an editbar.
  1147.     #
  1148.     _("edtbr"),
  1149.     # Translators: long braille for the rolename of an editbar.
  1150.     #
  1151.     _("EditBar"),
  1152.     # Translators: spoken words for the rolename of an editbar.
  1153.     #
  1154.     _("edit bar"))
  1155.  
  1156. rolenames[ROLE_EMBEDDED] = Rolename(
  1157.     ROLE_EMBEDDED,
  1158.     # Translators: short braille for the rolename of an embedded component.
  1159.     #
  1160.     _("emb"),
  1161.     # Translators: long braille for the rolename of an embedded component.
  1162.     #
  1163.     _("EmbeddedComponent"),
  1164.     # Translators: spoken words for the rolename of an embedded component.
  1165.     #
  1166.     _("embedded component"))
  1167.  
  1168.  
  1169. # [[[TODO: eitani - This is for backward compatability, we now put in pyatspi 
  1170. # keys into the dictionary]]]
  1171.  
  1172. _legacy_rolename_keys = rolenames.keys()
  1173.  
  1174. for sym in dir(pyatspi):
  1175.     if sym.startswith('ROLE_'):
  1176.         possible_key = sym.replace('ROLE_','').replace('_','').lower()
  1177.         for key in _legacy_rolename_keys:
  1178.             if key.replace(' ','') == possible_key:
  1179.                 pyatspi_role = getattr(pyatspi, sym)
  1180.                 rolenames[pyatspi_role] = rolenames[key]
  1181.  
  1182. def _adjustRole(obj, role):
  1183.     """Adjust the role to what the role really is.
  1184.     """
  1185.  
  1186.     # Return fake "menu" role names.
  1187.     #
  1188.     if (role == pyatspi.ROLE_MENU_ITEM) \
  1189.           and (obj.childCount > 0):
  1190.         role = ROLE_MENU
  1191.  
  1192.     # If this is an ARIA button with the "haspopup:true" attribute, then
  1193.     # it's really a menu.
  1194.     #
  1195.     if role in [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_MENU_ITEM]:
  1196.         attributes = obj.getAttributes()
  1197.         for attribute in attributes:
  1198.             if attribute.startswith("haspopup:true"):
  1199.                 role = ROLE_MENU
  1200.                 break
  1201.  
  1202.     return role
  1203.  
  1204. def getSpeechForRoleName(obj, role=None):
  1205.     """Returns the localized name of the given Accessible object; the name is
  1206.     suitable to be spoken.  If a localized name cannot be discovered, this
  1207.     will return the string as defined by the at-spi.
  1208.  
  1209.     Arguments:
  1210.     - obj: an Accessible object
  1211.  
  1212.     Returns a string containing the localized name of the object suitable
  1213.     to be spoken.
  1214.     """
  1215.  
  1216.     role = _adjustRole(obj, role or obj.getRole())
  1217.  
  1218.     # If the enum is not in the dictionary, check by name.
  1219.     role_entry = \
  1220.         rolenames.get(role) or rolenames.get(obj.getRoleName())
  1221.     if role_entry:
  1222.         return role_entry.speech
  1223.     else:
  1224.         debug.println(debug.LEVEL_WARNING, "No rolename for %s" % repr(role))
  1225.         localizedRoleName = obj.getLocalizedRoleName()
  1226.         if localizedRoleName and len(localizedRoleName):
  1227.             return localizedRoleName
  1228.         else:
  1229.             return repr(role)
  1230.  
  1231. def getShortBrailleForRoleName(obj, role=None):
  1232.     """Returns the localized name of the given Accessible object; the name is
  1233.     a short string suitable for a Braille display.  If a localized name cannot
  1234.     be discovered, this will return the string as defined by the at-spi.
  1235.  
  1236.     Arguments:
  1237.     - obj: an Accessible object
  1238.  
  1239.     Returns a short string containing the localized name of the object
  1240.     suitable for a Braille display.
  1241.     """
  1242.  
  1243.     role = _adjustRole(obj, role or obj.getRole())
  1244.  
  1245.     # If the enum is not in the dictionary, check by name.
  1246.     role_entry = \
  1247.         rolenames.get(role) or rolenames.get(obj.getRoleName())
  1248.     if role_entry:
  1249.         return role_entry.brailleShort
  1250.     else:
  1251.         debug.println(debug.LEVEL_WARNING, "No rolename for %s" % repr(role))
  1252.         localizedRoleName = obj.getLocalizedRoleName()
  1253.         if localizedRoleName and len(localizedRoleName):
  1254.             return localizedRoleName
  1255.         else:
  1256.             return repr(role)
  1257.  
  1258. def getLongBrailleForRoleName(obj, role=None):
  1259.     """Returns the localized name of the given Accessible object; the name is
  1260.     a long string suitable for a Braille display.  If a localized name cannot
  1261.     be discovered, this will return the string as defined by the at-spi.
  1262.  
  1263.     Arguments:
  1264.     - obj: an Accessible object
  1265.  
  1266.     Returns a string containing the localized name of the object suitable for
  1267.     a Braille display.
  1268.     """
  1269.  
  1270.     role = _adjustRole(obj, role or obj.getRole())
  1271.  
  1272.     # If the enum is not in the dictionary, check by name.
  1273.     role_entry = \
  1274.         rolenames.get(role) or rolenames.get(obj.getRoleName())
  1275.     if role_entry:
  1276.         return role_entry.brailleLong
  1277.     else:
  1278.         debug.println(debug.LEVEL_WARNING, "No rolename for %s" % repr(role))
  1279.         localizedRoleName = obj.getLocalizedRoleName()
  1280.         if localizedRoleName and len(localizedRoleName):
  1281.             return localizedRoleName
  1282.         else:
  1283.             return repr(role)
  1284.  
  1285. def getBrailleForRoleName(obj, role=None):
  1286.     """Returns the localized name of the given Accessible object; the name is
  1287.     a string suitable for a Braille display.  If a localized name cannot
  1288.     be discovered, this will return the string as defined by the at-spi.
  1289.  
  1290.     Arguments:
  1291.     - obj: an Accessible object
  1292.  
  1293.     Returns a string containing the localized name of the object suitable for
  1294.     a Braille display.  The actual string will depend upon the value of
  1295.     the 'brailleRolenameStyle' setting.
  1296.     """
  1297.  
  1298.     if settings.brailleRolenameStyle == settings.BRAILLE_ROLENAME_STYLE_SHORT:
  1299.         return getShortBrailleForRoleName(obj, role)
  1300.     else:
  1301.         return getLongBrailleForRoleName(obj, role)
  1302.