Coverage Report - orca.rolenames

ModuleCoverage %
orca.rolenames
96%
1
# Orca
2
#
3
# Copyright 2004-2006 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., 59 Temple Place - Suite 330,
19
# Boston, MA 02111-1307, USA.
20
21
"""Provides a methods that converts the role name of an Accessible
22 1
object into localized strings for speech and braille."""
23
24 1
__id__        = "$Id: rolenames.py 1831 2006-12-15 21:48:45Z wwalker $"
25 1
__version__   = "$Revision: 1831 $"
26 1
__date__      = "$Date: 2006-12-15 13:48:45 -0800 (Fri, 15 Dec 2006) $"
27 1
__copyright__ = "Copyright (c) 2005-2006 Sun Microsystems Inc."
28 1
__license__   = "LGPL"
29
30 1
import debug
31 1
import settings
32
33 1
from orca_i18n import _ # for gettext support
34
35
########################################################################
36
#                                                                      #
37
# Rolenames derived from atk/atk/atkobject.c:role_items.               #
38
#                                                                      #
39
########################################################################
40
41 1
ROLE_INVALID             = "invalid"
42 1
ROLE_ACCEL_LABEL         = "accelerator label"
43 1
ROLE_ALERT               = "alert"
44 1
ROLE_ANIMATION           = "animation"
45 1
ROLE_ARROW               = "arrow"
46 1
ROLE_CALENDAR            = "calendar"
47 1
ROLE_CAPTION             = "caption"
48 1
ROLE_CANVAS              = "canvas"
49 1
ROLE_CHECK_BOX           = "check box"
50 1
ROLE_CHECK_MENU_ITEM     = "check menu item"
51 1
ROLE_CHECK_MENU          = "check menu" # invented for items that are submenus
52 1
ROLE_COLOR_CHOOSER       = "color chooser"
53 1
ROLE_COLUMN_HEADER       = "column header"
54 1
ROLE_COMBO_BOX           = "combo box"
55 1
ROLE_DATE_EDITOR         = "dateeditor"
56 1
ROLE_DESKTOP_ICON        = "desktop icon"
57 1
ROLE_DESKTOP_FRAME       = "desktop frame"
58 1
ROLE_DIAL                = "dial"
59 1
ROLE_DIALOG              = "dialog"
60 1
ROLE_DIRECTORY_PANE      = "directory pane"
61 1
ROLE_DOCUMENT_FRAME      = "document frame"
62 1
ROLE_DRAWING_AREA        = "drawing area"
63 1
ROLE_ENTRY               = "entry"
64 1
ROLE_FILE_CHOOSER        = "file chooser"
65 1
ROLE_FILLER              = "filler"
66 1
ROLE_FONT_CHOOSER        = "fontchooser"
67 1
ROLE_FORM                = "form"
68 1
ROLE_FRAME               = "frame"
69 1
ROLE_GLASS_PANE          = "glass pane"
70 1
ROLE_HEADING             = "heading"
71 1
ROLE_HTML_CONTAINER      = "html container"
72 1
ROLE_ICON                = "icon"
73 1
ROLE_IMAGE               = "image"
74 1
ROLE_INTERNAL_FRAME      = "internal frame"
75 1
ROLE_INPUT_METHOD_WINDOW = "input method window"
76 1
ROLE_LABEL               = "label"
77 1
ROLE_LAYERED_PANE        = "layered pane"
78 1
ROLE_LINK                = "link"
79 1
ROLE_LIST                = "list"
80 1
ROLE_LIST_ITEM           = "list item"
81 1
ROLE_MENU                = "menu"
82 1
ROLE_MENU_BAR            = "menu bar"
83 1
ROLE_MENU_ITEM           = "menu item"
84 1
ROLE_OPTION_PANE         = "option pane"
85 1
ROLE_PAGE_TAB            = "page tab"
86 1
ROLE_PAGE_TAB_LIST       = "page tab list"
87 1
ROLE_PANEL               = "panel"
88 1
ROLE_PASSWORD_TEXT       = "password text"
89 1
ROLE_POPUP_MENU          = "popup menu"
90 1
ROLE_PROGRESS_BAR        = "progress bar"
91 1
ROLE_PUSH_BUTTON         = "push button"
92 1
ROLE_RADIO_BUTTON        = "radio button"
93 1
ROLE_RADIO_MENU_ITEM     = "radio menu item"
94 1
ROLE_RADIO_MENU          = "radio menu" # invented for items that are submenus
95 1
ROLE_ROOT_PANE           = "root pane"
96 1
ROLE_ROW_HEADER          = "row header"
97 1
ROLE_SCROLL_BAR          = "scroll bar"
98 1
ROLE_SCROLL_PANE         = "scroll pane"
99 1
ROLE_SECTION             = "section"
100 1
ROLE_SEPARATOR           = "separator"
101 1
ROLE_SLIDER              = "slider"
102 1
ROLE_SPLIT_PANE          = "split pane"
103 1
ROLE_SPIN_BUTTON         = "spin button"
104 1
ROLE_STATUSBAR           = "statusbar"
105 1
ROLE_TABLE               = "table"
106 1
ROLE_TABLE_CELL          = "table cell"
107 1
ROLE_TABLE_COLUMN_HEADER = "table column header"
108 1
ROLE_TABLE_ROW_HEADER    = "table row header"
109 1
ROLE_TEAR_OFF_MENU_ITEM  = "tear off menu item"
110 1
ROLE_TERMINAL            = "terminal"
111 1
ROLE_TEXT                = "text"
112 1
ROLE_TOGGLE_BUTTON       = "toggle button"
113 1
ROLE_TOOL_BAR            = "tool bar"
114 1
ROLE_TOOL_TIP            = "tool tip"
115 1
ROLE_TREE                = "tree"
116 1
ROLE_TREE_TABLE          = "tree table"
117 1
ROLE_UNKNOWN             = "unknown"
118 1
ROLE_VIEWPORT            = "viewport"
119 1
ROLE_WINDOW              = "window"
120 1
ROLE_HEADER              = "header"
121 1
ROLE_FOOTER              = "footer"
122 1
ROLE_PARAGRAPH           = "paragraph"
123 1
ROLE_APPLICATION         = "application"
124 1
ROLE_AUTOCOMPLETE        = "autocomplete"
125 1
ROLE_EDITBAR             = "edit bar"
126 1
ROLE_EMBEDDED            = "embedded component"
127
128 2
class Rolename:
129
    """Provides localized forms of rolenames for speech and Braille.
130
    """
131
132 1
    def __init__(self, rolename, brailleShort, brailleLong, speech):
133
        """Created a new rolename with the given parameters.
134
135
        Arguments:
136
        - rolename:     the internationalized (e.g., machine) name for the role
137
        - brailleShort: the localized short string for Braille display
138
        - brailleLong:  the localized long string for Braille display
139
        - speech:       the localized string to speak for speech
140
        """
141
142 84
        self.rolename = rolename
143 84
        self.brailleShort = brailleShort
144 84
        self.brailleLong = brailleLong
145 84
        self.speech = speech
146
147
# [[[TODO: WDW - the AT-SPI also has getLocalizedRoleName, which might a
148
# more appropriate thing to use, as it covers the situation where an app
149
# has developed a brand new component with a brand new role. Logged as
150
# buzilla bug 319780.]]]
151
#
152 1
rolenames = {}
153
154 1
rolenames[ROLE_INVALID] = Rolename(ROLE_INVALID,
155 1
                                   _("???"),
156 1
                                   _("Invalid"),
157 1
                                   _("invalid"))
158
159 1
rolenames[ROLE_ACCEL_LABEL] = Rolename(ROLE_ACCEL_LABEL,
160 1
                                       _("acc"),
161 1
                                       _("Accelerator"),
162 1
                                       _("accelerator"))
163
164 1
rolenames[ROLE_ALERT] = Rolename(ROLE_ALERT,
165 1
                                 _("alert"),
166 1
                                 _("Alert"),
167 1
                                 _("alert"))
168
169 1
rolenames[ROLE_ANIMATION] = Rolename(ROLE_ANIMATION,
170 1
                                     _("Anim"),
171 1
                                     _("Animation"),
172 1
                                     _("animation"))
173
174 1
rolenames[ROLE_ARROW] = Rolename(ROLE_ARROW,
175 1
                                 _("arrow"),
176 1
                                 _("Arrow"),
177 1
                                 _("arrow"))
178
179 1
rolenames[ROLE_CALENDAR] = Rolename(ROLE_CALENDAR,
180 1
                                    _("cal"),
181 1
                                    _("Calendar"),
182 1
                                    _("calendar"))
183
184 1
rolenames[ROLE_CANVAS] = Rolename(ROLE_CANVAS,
185 1
                                  _("cnv"),
186 1
                                  _("Canvas"),
187 1
                                  _("canvas"))
188
189 1
rolenames[ROLE_CAPTION] = Rolename(ROLE_CAPTION,
190 1
                                   _("cptn"),
191 1
                                   _("Caption"),
192 1
                                   _("caption"))
193
194 1
rolenames[ROLE_CHECK_BOX] = Rolename(ROLE_CHECK_BOX,
195 1
                                     _("chk"),
196 1
                                     _("CheckBox"),
197 1
                                     _("check box"))
198
199 1
rolenames[ROLE_CHECK_MENU_ITEM] = Rolename(ROLE_CHECK_MENU_ITEM,
200 1
                                           _("chk"),
201 1
                                           _("CheckItem"),
202 1
                                           _("check item"))
203
204 1
rolenames[ROLE_CHECK_MENU] = Rolename(ROLE_CHECK_MENU,
205 1
                                      _("ckm"),
206 1
                                      _("CheckMenu"),
207 1
                                      _("check menu"))
208
209 1
rolenames[ROLE_COLOR_CHOOSER] = Rolename(ROLE_COLOR_CHOOSER,
210 1
                                         _("clrchsr"),
211 1
                                         _("ColorChooser"),
212 1
                                         _("color chooser"))
213
214 1
rolenames[ROLE_COLUMN_HEADER] = Rolename(ROLE_COLUMN_HEADER,
215 1
                                         _("colhdr"),
216 1
                                         _("ColumnHeader"),
217 1
                                         _("column header"))
218
219 1
rolenames[ROLE_COMBO_BOX] = Rolename(ROLE_COMBO_BOX,
220 1
                                     _("cbo"),
221 1
                                     _("Combo"),
222 1
                                     _("combo box"))
223
224 1
rolenames[ROLE_DATE_EDITOR] = Rolename(ROLE_DATE_EDITOR,
225 1
                                       _("dat"),
226 1
                                       _("DateEditor"),
227 1
                                       _("date editor"))
228
229 1
rolenames[ROLE_DESKTOP_ICON] = Rolename(ROLE_DESKTOP_ICON,
230 1
                                        _("icon"),
231 1
                                        _("DesktopIcon"),
232 1
                                        _("desktop icon"))
233
234 1
rolenames[ROLE_DESKTOP_FRAME] = Rolename(ROLE_DESKTOP_FRAME,
235 1
                                         _("frame"),
236 1
                                         _("DesktopFrame"),
237 1
                                         _("desktop frame"))
238
239 1
rolenames[ROLE_DIAL] = Rolename(ROLE_DIAL,
240 1
                                _("dial"),
241 1
                                _("Dial"),
242 1
                                _("dial"))
243
244 1
rolenames[ROLE_DIALOG] = Rolename(ROLE_DIALOG,
245 1
                                  _("dlg"),
246 1
                                  _("Dialog"),
247 1
                                  _("dialog"))
248
249 1
rolenames[ROLE_DIRECTORY_PANE] = Rolename(ROLE_DIRECTORY_PANE,
250 1
                                          _("dip"),
251 1
                                          _("DirectoryPane"),
252 1
                                          _("directory pane"))
253
254 1
rolenames[ROLE_DOCUMENT_FRAME] = Rolename(ROLE_DOCUMENT_FRAME,
255 1
                                _("html"),
256 1
                                _("HtmlPane"),
257 1
                                _("html content"))
258
259 1
rolenames[ROLE_DRAWING_AREA] = Rolename(ROLE_DRAWING_AREA,
260 1
                                        _("draw"),
261 1
                                        _("DrawingArea"),
262 1
                                        _("drawing area"))
263
264 1
rolenames[ROLE_FILE_CHOOSER] = Rolename(ROLE_FILE_CHOOSER,
265 1
                                        _("fchsr"),
266 1
                                        _("FileChooser"),
267 1
                                        _("file chooser"))
268
269 1
rolenames[ROLE_FILLER] = Rolename(ROLE_FILLER,
270 1
                                  _("flr"),
271 1
                                  _("Filler"),
272 1
                                  _("filler"))
273
274 1
rolenames[ROLE_FONT_CHOOSER] = Rolename(ROLE_FONT_CHOOSER,
275 1
                                        _("fnt"),
276 1
                                        _("FontChooser"),
277 1
                                        _("font chooser"))
278
279 1
rolenames[ROLE_FORM] = Rolename(ROLE_FORM,
280 1
                                _("form"),
281 1
                                _("Form"),
282 1
                                _("form"))
283
284 1
rolenames[ROLE_FRAME] = Rolename(ROLE_FRAME,
285 1
                                 _("frm"),
286 1
                                 _("Frame"),
287 1
                                 _("frame"))
288
289 1
rolenames[ROLE_GLASS_PANE] = Rolename(ROLE_GLASS_PANE,
290 1
                                      _("gpn"),
291 1
                                      _("GlassPane"),
292 1
                                      _("glass pane"))
293
294 1
rolenames[ROLE_HEADING] = Rolename(ROLE_HEADING,
295 1
                                   _("hdng"),
296 1
                                   _("Heading"),
297 1
                                   _("heading"))
298
299 1
rolenames[ROLE_HTML_CONTAINER] = Rolename(ROLE_HTML_CONTAINER,
300 1
                                          _("html"),
301 1
                                          _("HtmlContainer"),
302 1
                                          _("h t m l container"))
303
304 1
rolenames[ROLE_ICON] = Rolename(ROLE_ICON,
305 1
                                _("icon"),
306 1
                                _("Icon"),
307 1
                                _("icon"))
308
309 1
rolenames[ROLE_IMAGE] = Rolename(ROLE_IMAGE,
310 1
                                 _("img"),
311 1
                                 _("Image"),
312 1
                                 _("image"))
313
314 1
rolenames[ROLE_INTERNAL_FRAME] = Rolename(ROLE_INTERNAL_FRAME,
315 1
                                          _("frame"),
316 1
                                          _("InternalFrame"),
317 1
                                          _("internal frame"))
318
319 1
rolenames[ROLE_LABEL] = Rolename(ROLE_LABEL,
320 1
                                 _("lbl"),
321 1
                                 _("Label"),
322 1
                                 _("label"))
323
324 1
rolenames[ROLE_LAYERED_PANE] = Rolename(ROLE_LAYERED_PANE,
325 1
                                        _("lyrdpn"),
326 1
                                        _("LayeredPane"),
327 1
                                        _("layered pane"))
328
329 1
rolenames[ROLE_LINK] = Rolename(ROLE_LINK,
330 1
                                _("lnk"),
331 1
                                _("Link"),
332 1
                                _("link"))
333
334 1
rolenames[ROLE_LIST] = Rolename(ROLE_LIST,
335 1
                                _("lst"),
336 1
                                _("List"),
337 1
                                _("list"))
338
339 1
rolenames[ROLE_LIST_ITEM] = Rolename(ROLE_LIST_ITEM,
340 1
                                     _("lstitm"),
341 1
                                     _("ListItem"),
342 1
                                     _("list item"))
343
344 1
rolenames[ROLE_MENU] = Rolename(ROLE_MENU,
345 1
                                _("mnu"),
346 1
                                _("Menu"),
347 1
                                _("menu"))
348
349 1
rolenames[ROLE_MENU_BAR] = Rolename(ROLE_MENU_BAR,
350 1
                                    _("mnubr"),
351 1
                                    _("MenuBar"),
352 1
                                    _("menu bar"))
353
354 1
rolenames[ROLE_MENU_ITEM] = Rolename(ROLE_MENU_ITEM,
355 1
                                     _("mnuitm"),
356 1
                                     _("MenuItem"),
357 1
                                     _("menu item"))
358
359 1
rolenames[ROLE_OPTION_PANE] = Rolename(ROLE_OPTION_PANE,
360 1
                                       _("optnpn"),
361 1
                                       _("OptionPane"),
362 1
                                       _("option pane"))
363
364 1
rolenames[ROLE_PAGE_TAB] = Rolename(ROLE_PAGE_TAB,
365 1
                                    _("page"),
366 1
                                    _("Page"),
367 1
                                    _("page"))
368
369 1
rolenames[ROLE_PAGE_TAB_LIST] = Rolename(ROLE_PAGE_TAB_LIST,
370 1
                                         _("tblst"),
371 1
                                         _("TabList"),
372 1
                                         _("tab list"))
373
374 1
rolenames[ROLE_PANEL] = Rolename(ROLE_PANEL,
375 1
                                 _("pnl"),
376 1
                                 _("Panel"),
377 1
                                 _("panel"))
378
379 1
rolenames[ROLE_PASSWORD_TEXT] = Rolename(ROLE_PASSWORD_TEXT,
380 1
                                         _("pwd"),
381 1
                                         _("Password"),
382 1
                                         _("password"))
383
384 1
rolenames[ROLE_POPUP_MENU] = Rolename(ROLE_POPUP_MENU,
385 1
                                      _("popmnu"),
386 1
                                      _("PopupMenu"),
387 1
                                      _("popup menu"))
388
389 1
rolenames[ROLE_PROGRESS_BAR] = Rolename(ROLE_PROGRESS_BAR,
390 1
                                        _("pgbar"),
391 1
                                        _("Progress"),
392 1
                                        _("progress bar"))
393
394 1
rolenames[ROLE_PUSH_BUTTON] = Rolename(ROLE_PUSH_BUTTON,
395 1
                                       _("btn"),
396 1
                                       _("Button"),
397 1
                                       _("button"))
398
399 1
rolenames[ROLE_RADIO_BUTTON] = Rolename(ROLE_RADIO_BUTTON,
400 1
                                        _("radio"),
401 1
                                        _("RadioButton"),
402 1
                                        _("radio button"))
403
404 1
rolenames[ROLE_RADIO_MENU_ITEM] = Rolename(ROLE_RADIO_MENU_ITEM,
405 1
                                           _("rdmnuitm"),
406 1
                                           _("RadioItem"),
407 1
                                           _("radio menu item"))
408
409 1
rolenames[ROLE_RADIO_MENU] = Rolename(ROLE_RADIO_MENU,
410 1
                                      _("rdmnu"),
411 1
                                      _("RadioMenu"),
412 1
                                      _("radio menu"))
413
414 1
rolenames[ROLE_ROOT_PANE] = Rolename(ROLE_ROOT_PANE,
415 1
                                     _("rtpn"),
416 1
                                     _("RootPane"),
417 1
                                     _("root pane"))
418
419 1
rolenames[ROLE_ROW_HEADER] = Rolename(ROLE_ROW_HEADER,
420 1
                                      _("rwhdr"),
421 1
                                      _("RowHeader"),
422 1
                                      _("row header"))
423
424 1
rolenames[ROLE_SCROLL_BAR] = Rolename(ROLE_SCROLL_BAR,
425 1
                                      _("scbr"),
426 1
                                      _("ScrollBar"),
427 1
                                      _("scroll bar"))
428
429 1
rolenames[ROLE_SCROLL_PANE] = Rolename(ROLE_SCROLL_PANE,
430 1
                                       _("scpn"),
431 1
                                       _("ScrollPane"),
432 1
                                       _("scroll pane"))
433
434 1
rolenames[ROLE_SECTION] = Rolename(ROLE_SECTION,
435 1
                                   _("sctn"),
436 1
                                   _("Section"),
437 1
                                   _("section"))
438
439 1
rolenames[ROLE_SEPARATOR] = Rolename(ROLE_SEPARATOR,
440 1
                                     _("seprtr"),
441 1
                                     _("Separator"),
442 1
                                     _("separator"))
443
444 1
rolenames[ROLE_SLIDER] = Rolename(ROLE_SLIDER,
445 1
                                  _("sldr"),
446 1
                                  _("Slider"),
447 1
                                  _("slider"))
448
449 1
rolenames[ROLE_SPLIT_PANE] = Rolename(ROLE_SPLIT_PANE,
450 1
                                      _("spltpn"),
451 1
                                      _("SplitPane"),
452 1
                                      _("split pane"))
453
454 1
rolenames[ROLE_SPIN_BUTTON] = Rolename(ROLE_SPIN_BUTTON,
455 1
                                       _("spin"),
456 1
                                       _("SpinButton"),
457 1
                                       _("spin button"))
458
459 1
rolenames[ROLE_STATUSBAR] = Rolename(ROLE_STATUSBAR,
460 1
                                     _("statbr"),
461 1
                                     _("StatusBar"),
462 1
                                     _("status bar"))
463
464 1
rolenames[ROLE_TABLE] = Rolename(ROLE_TABLE,
465 1
                                 _("tbl"),
466 1
                                 _("Table"),
467 1
                                 _("table"))
468
469 1
rolenames[ROLE_TABLE_CELL] = Rolename(ROLE_TABLE_CELL,
470 1
                                      _("cell"),
471 1
                                      _("Cell"),
472 1
                                      _("cell"))
473
474 1
rolenames[ROLE_TABLE_COLUMN_HEADER] = Rolename(ROLE_TABLE_COLUMN_HEADER,
475 1
                                               _("colhdr"),
476 1
                                               _("ColumnHeader"),
477 1
                                               _("column header"))
478
479 1
rolenames[ROLE_TABLE_ROW_HEADER] = Rolename(ROLE_TABLE_ROW_HEADER,
480 1
                                            _("rwhdr"),
481 1
                                            _("RowHeader"),
482 1
                                            _("row header"))
483
484 1
rolenames[ROLE_TEAR_OFF_MENU_ITEM] = Rolename(ROLE_TEAR_OFF_MENU_ITEM,
485 1
                                              _("tomnuitm"),
486 1
                                              _("TearOffMenuItem"),
487 1
                                              _("tear off menu item"))
488
489 1
rolenames[ROLE_TERMINAL] = Rolename(ROLE_TERMINAL,
490 1
                                    _("term"),
491 1
                                    _("Terminal"),
492 1
                                    _("terminal"))
493
494 1
rolenames[ROLE_TEXT] = Rolename(ROLE_TEXT,
495 1
                                _("txt"),
496 1
                                _("Text"),
497 1
                                _("text"))
498
499 1
rolenames[ROLE_ENTRY] = rolenames[ROLE_TEXT]
500
501 1
rolenames[ROLE_TOGGLE_BUTTON] = Rolename(ROLE_TOGGLE_BUTTON,
502 1
                                         _("tglbtn"),
503 1
                                         _("ToggleButton"),
504 1
                                         _("toggle button"))
505
506 1
rolenames[ROLE_TOOL_BAR] = Rolename(ROLE_TOOL_BAR,
507 1
                                    _("tbar"),
508 1
                                    _("ToolBar"),
509 1
                                    _("tool bar"))
510
511 1
rolenames[ROLE_TOOL_TIP] = Rolename(ROLE_TOOL_TIP,
512 1
                                    _("tip"),
513 1
                                    _("ToolTip"),
514 1
                                    _("tool tip"))
515
516 1
rolenames[ROLE_TREE] = Rolename(ROLE_TREE,
517 1
                                _("tree"),
518 1
                                _("Tree"),
519 1
                                _("tree"))
520
521 1
rolenames[ROLE_TREE_TABLE] = Rolename(ROLE_TREE_TABLE,
522 1
                                      _("trtbl"),
523 1
                                      _("TreeTable"),
524 1
                                      _("tree table"))
525
526 1
rolenames[ROLE_UNKNOWN] = Rolename(ROLE_UNKNOWN,
527 1
                                   _("unk"),
528 1
                                   _("Unknown"),
529 1
                                   _("unknown"))
530
531 1
rolenames[ROLE_VIEWPORT] = Rolename(ROLE_VIEWPORT,
532 1
                                    _("vwprt"),
533 1
                                    _("Viewport"),
534 1
                                    _("viewport"))
535
536 1
rolenames[ROLE_WINDOW] = Rolename(ROLE_WINDOW,
537 1
                                  _("wnd"),
538 1
                                  _("Window"),
539 1
                                  _("window"))
540
541 1
rolenames[ROLE_HEADER] = Rolename(ROLE_HEADER,
542 1
                                  _("hdr"),
543 1
                                  _("Header"),
544 1
                                  _("header"))
545
546 1
rolenames[ROLE_FOOTER] = Rolename(ROLE_FOOTER,
547 1
                                  _("ftr"),
548 1
                                  _("Footer"),
549 1
                                  _("footer"))
550
551 1
rolenames[ROLE_PARAGRAPH] = Rolename(ROLE_PARAGRAPH,
552 1
                                     _("para"),
553 1
                                     _("Paragraph"),
554 1
                                     _("paragraph"))
555
556 1
rolenames[ROLE_APPLICATION] = Rolename(ROLE_APPLICATION,
557 1
                                       _("app"),
558 1
                                       _("Application"),
559 1
                                       _("application"))
560
561 1
rolenames[ROLE_AUTOCOMPLETE] = Rolename(ROLE_AUTOCOMPLETE,
562 1
                                        _("auto"),
563 1
                                        _("AutoComplete"),
564 1
                                        _("autocomplete"))
565
566 1
rolenames[ROLE_EDITBAR] = Rolename(ROLE_EDITBAR,
567 1
                                   _("edtbr"),
568 1
                                   _("EditBar"),
569 1
                                   _("edit bar"))
570
571 1
rolenames[ROLE_EMBEDDED] = Rolename(ROLE_EMBEDDED,
572 1
                                    _("emb"),
573 1
                                    _("EmbeddedComponent"),
574 1
                                    _("embedded component"))
575
576
# Extra stuff from Gnopernicus.
577
#
578
#rolenames[ROLE_EXTENDED] = Rolename(ROLE_EXTENDED,
579
#                                    _("EXT"),
580
#                                    _("EXTENDED"),
581
#                                    _("extended"))
582
#
583
#rolenames[ROLE_HYPER_LINK] = Rolename(ROLE_HYPER_LINK,
584
#                                      _("LNK"),
585
#                                      _("LINK"),
586
#                                      _("link"))
587
#
588
#rolenames[ROLE_LINK] = Rolename(ROLE_LINK,
589
#                                _("LNK"),
590
#                                _("LINK"),
591
#                                _("link"))
592
#
593
#rolenames[ROLE_MULTI_LINE_TEXT] = Rolename(ROLE_MULTI_LINE_TEXT,
594
#                                           _("TXT"),
595
#                                           _("MULTI LINE TEXT"),
596
#                                           _("multi Line Text"))
597
#
598
#rolenames[ROLE_SINGLE_LINE_TEXT] = Rolename(ROLE_SINGLE_LINE_TEXT,
599
#                                            _("TXT"),
600
#                                            _("SINGLE LINE TEXT"),
601
#                                            _("single Line Text"))
602
#
603
#rolenames[ROLE_TABLE_LINE] = Rolename(ROLE_TABLE_LINE,
604
#                                      _("TLI"),
605
#                                      _("TABLE LINE"),
606
#                                      _("table line"))
607
#
608
#rolenames[ROLE_TITLE_BAR] = Rolename(ROLE_TITLE_BAR,
609
#                                     _("TIT"),
610
#                                     _("TITLE BAR"),
611
#                                     _("title bar"))
612
#
613
#rolenames[ROLE_TREE_ITEM] = Rolename(ROLE_TREE_ITEM,
614
#                                     _("TRI"),
615
#                                     _("TREE ITEM"),
616
#                                     _("tree item"))
617
618 1
def getSpeechForRoleName(obj):
619
    """Returns the localized name of the given Accessible object; the name is
620
    suitable to be spoken.  If a localized name cannot be discovered, this
621
    will return the string as defined by the at-spi.
622
623
    Arguments:
624
    - obj: an Accessible object
625
626
    Returns a string containing the localized name of the object suitable
627
    to be spoken.
628
    """
629
630 701
    name = obj.role
631 701
    if rolenames.has_key(name):
632 701
        return rolenames[name].speech
633
    else:
634 0
        debug.println(debug.LEVEL_WARNING, "No rolename for %s" % name)
635 0
        localizedRoleName = obj.localizedRoleName
636 0
        if localizedRoleName and len(localizedRoleName):
637 0
            return localizedRoleName
638
        else:
639 0
            return name
640
641 1
def getShortBrailleForRoleName(obj):
642
    """Returns the localized name of the given Accessible object; the name is
643
    a short string suitable for a Braille display.  If a localized name cannot
644
    be discovered, this will return the string as defined by the at-spi.
645
646
    Arguments:
647
    - obj: an Accessible object
648
649
    Returns a short string containing the localized name of the object
650
    suitable for a Braille display.
651
    """
652
653 0
    name = obj.role
654 0
    if rolenames.has_key(name):
655 0
        return rolenames[name].brailleShort
656
    else:
657 0
        debug.println(debug.LEVEL_WARNING, "No rolename for %s" % name)
658 0
        localizedRoleName = obj.localizedRoleName
659 0
        if localizedRoleName and len(localizedRoleName):
660 0
            return localizedRoleName
661
        else:
662 0
            return name
663
664 1
def getLongBrailleForRoleName(obj):
665
    """Returns the localized name of the given Accessible object; the name is
666
    a long string suitable for a Braille display.  If a localized name cannot
667
    be discovered, this will return the string as defined by the at-spi.
668
669
    Arguments:
670
    - obj: an Accessible object
671
672
    Returns a string containing the localized name of the object suitable for
673
    a Braille display.
674
    """
675
676 4685
    name = obj.role
677 4685
    if rolenames.has_key(name):
678 4661
        return rolenames[name].brailleLong
679
    else:
680 24
        debug.println(debug.LEVEL_WARNING, "No rolename for %s" % name)
681 24
        localizedRoleName = obj.localizedRoleName
682 24
        if localizedRoleName and len(localizedRoleName):
683 24
            return localizedRoleName
684
        else:
685 0
            return name
686
687 1
def getBrailleForRoleName(obj):
688
    """Returns the localized name of the given Accessible object; the name is
689
    a string suitable for a Braille display.  If a localized name cannot
690
    be discovered, this will return the string as defined by the at-spi.
691
692
    Arguments:
693
    - obj: an Accessible object
694
695
    Returns a string containing the localized name of the object suitable for
696
    a Braille display.  The actual string will depend upon the value of
697
    the 'brailleRolenameStyle' setting.
698
    """
699
700 4685
    if settings.brailleRolenameStyle == settings.BRAILLE_ROLENAME_STYLE_SHORT:
701 0
        return getShortBrailleForRoleName(obj)
702
    else:
703 4685
        return getLongBrailleForRoleName(obj)