Coverage Report - orca.rolenames

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