orca r3864 - in trunk: . src/orca



Author: richb
Date: Tue Apr 29 20:37:56 2008
New Revision: 3864
URL: http://svn.gnome.org/viewvc/orca?rev=3864&view=rev

Log:
        * src/orca/settings.py:
          src/orca/orca-setup.glade:
          src/orca/orca_prefs.py:
          src/orca/default.py:
          src/orca/where_am_I.py:
          src/orca/braille.py:
          src/orca/orca_gui_prefs.py:
          Fixed bug #426010 - Implement Verbalized Links.


Modified:
   trunk/ChangeLog
   trunk/src/orca/braille.py
   trunk/src/orca/default.py
   trunk/src/orca/orca-setup.glade
   trunk/src/orca/orca_gui_prefs.py
   trunk/src/orca/orca_prefs.py
   trunk/src/orca/settings.py
   trunk/src/orca/where_am_I.py

Modified: trunk/src/orca/braille.py
==============================================================================
--- trunk/src/orca/braille.py	(original)
+++ trunk/src/orca/braille.py	Tue Apr 29 20:37:56 2008
@@ -465,6 +465,8 @@
         if orca_state.activeScript:
             [string, self.caretOffset, self.lineOffset] = \
                  orca_state.activeScript.getTextLineAtCaret(self.accessible)
+        else:
+            string = ""
 
         string = string.decode("UTF-8")
 
@@ -562,8 +564,27 @@
 
         attrIndicator = settings.textAttributesBrailleIndicator
         selIndicator = settings.brailleSelectorIndicator
+        linkIndicator = settings.brailleLinkIndicator
         script = orca_state.activeScript
 
+        if linkIndicator != settings.BRAILLE_LINK_NONE:
+            try:
+                hyperText = self.accessible.queryHypertext()
+                nLinks = hyperText.getNLinks()
+            except:
+                nLinks = 0
+
+            n = 0
+            while n < nLinks:
+                link = hyperText.getLink(n)
+                if self.lineOffset <= link.startIndex:
+                    for i in xrange(link.startIndex, link.endIndex):
+                        try:
+                            regionMask[i] |= linkIndicator
+                        except:
+                            pass
+                n += 1
+
         if attrIndicator:
             enabledAttributes = script.attribsToDictionary(
                 settings.enabledBrailledTextAttributes)

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Tue Apr 29 20:37:56 2008
@@ -2110,6 +2110,7 @@
 
             if settings.enableSpeechIndentation:
                 self.speakTextIndentation(obj, line)
+            line = self.adjustForLinks(obj, line)
             line = self.adjustForRepeats(line)
             speech.speak(line, voice)
             self.speakTextSelectionState(obj, startOffset, caretOffset)
@@ -4011,6 +4012,14 @@
 
             self.outputCharAttributes(userAttrList, attributes)
 
+            # If this is a hypertext link, then let the user know:
+            #
+            if self.getLinkIndex(orca_state.locusOfFocus, caretOffset) >= 0:
+                # Translators: this indicates that this piece of
+                # text is a hypertext link.
+                #
+                speech.speak(_("link"))
+
         return True
 
     def reportScriptInfo(self, inputEvent=None):
@@ -5729,6 +5738,45 @@
 
         return line
 
+    def adjustForLinks(self, obj, line):
+        """Adjust line to include the word "link" after any hypertext links.
+
+        Arguments:
+        - obj: the accessible object that this line came from.
+        - line: the string to adjust for links.
+
+        Returns: a new line adjusted for repeat character counts (if enabled).
+        """
+
+        try:
+            hyperText = obj.queryHypertext()
+            nLinks = hyperText.getNLinks()
+        except:
+            nLinks = 0
+
+        n = nLinks
+        while n > 0:
+            link = hyperText.getLink(n-1)
+
+            # If the link was not followed by a whitespace or punctuation
+            # character, then add in a space to make it more presentable.
+            #
+            trailingChar = " "
+            if link.endIndex < len(line) and \
+               (line[link.endIndex] in self.whitespace or \
+                punctuation_settings.getPunctuationInfo(line[link.endIndex])):
+                trailingChar = ""
+
+            # Translators: this indicates that this piece of
+            # text is a hypertext link.
+            #
+            line = line[0:link.endIndex] + " " + _("link") + \
+                   trailingChar + line[link.endIndex:]
+
+            n -= 1
+
+        return line
+
     def adjustForRepeats(self, line):
         """Adjust line to include repeat character counts.
         As some people will want this and others might not,

Modified: trunk/src/orca/orca-setup.glade
==============================================================================
--- trunk/src/orca/orca-setup.glade	(original)
+++ trunk/src/orca/orca-setup.glade	Tue Apr 29 20:37:56 2008
@@ -1785,145 +1785,300 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkFrame" id="brailleSelectionFrame">
+		    <widget class="GtkHBox" id="hbox62">
 		      <property name="visible">True</property>
-		      <property name="label_xalign">0</property>
-		      <property name="label_yalign">0.5</property>
-		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
 
 		      <child>
-			<widget class="GtkAlignment" id="alignment57">
+			<widget class="GtkFrame" id="brailleSelectionFrame">
 			  <property name="visible">True</property>
-			  <property name="xalign">0.5</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xscale">1</property>
-			  <property name="yscale">1</property>
-			  <property name="top_padding">0</property>
-			  <property name="bottom_padding">0</property>
-			  <property name="left_padding">12</property>
-			  <property name="right_padding">0</property>
+			  <property name="label_xalign">0</property>
+			  <property name="label_yalign">0.5</property>
+			  <property name="shadow_type">GTK_SHADOW_NONE</property>
 
 			  <child>
-			    <widget class="GtkVBox" id="vbox28">
-			      <property name="border_width">3</property>
+			    <widget class="GtkAlignment" id="alignment57">
 			      <property name="visible">True</property>
-			      <property name="homogeneous">False</property>
-			      <property name="spacing">0</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xscale">1</property>
+			      <property name="yscale">1</property>
+			      <property name="top_padding">0</property>
+			      <property name="bottom_padding">0</property>
+			      <property name="left_padding">12</property>
+			      <property name="right_padding">0</property>
 
 			      <child>
-				<widget class="GtkRadioButton" id="brailleSelectionNoneButton">
+				<widget class="GtkVBox" id="vbox28">
+				  <property name="border_width">3</property>
 				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">_None</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				  <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:00:47 GMT"/>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
-			      </child>
+				  <property name="homogeneous">False</property>
+				  <property name="spacing">0</property>
 
-			      <child>
-				<widget class="GtkRadioButton" id="brailleSelection7Button">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">Dot _7</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				  <property name="group">brailleSelectionNoneButton</property>
-				  <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:03 GMT"/>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
-			      </child>
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleSelectionNoneButton">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">_None</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:00:47 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
 
-			      <child>
-				<widget class="GtkRadioButton" id="brailleSelection8Button">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">Dot _8</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				  <property name="group">brailleSelectionNoneButton</property>
-				  <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:28 GMT"/>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
-			      </child>
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleSelection7Button">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dot _7</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleSelectionNoneButton</property>
+				      <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:03 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
 
-			      <child>
-				<widget class="GtkRadioButton" id="brailleSelectionBothButton">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">Dots 7 an_d 8</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				  <property name="group">brailleSelectionNoneButton</property>
-				  <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:43 GMT"/>
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleSelection8Button">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dot _8</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleSelectionNoneButton</property>
+				      <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:28 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleSelectionBothButton">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dots 7 an_d 8</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleSelectionNoneButton</property>
+				      <signal name="toggled" handler="brailleSelectionChanged" last_modification_time="Thu, 28 Jun 2007 20:01:43 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
 				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
 			      </child>
 			    </widget>
 			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label28">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">&lt;b&gt;Selection Indicator&lt;/b&gt;</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">True</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="type">label_item</property>
+			    </packing>
+			  </child>
 			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkLabel" id="label28">
+			<widget class="GtkFrame" id="frame14">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;b&gt;Selection Indicator&lt;/b&gt;</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0.5</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
+			  <property name="label_xalign">0</property>
+			  <property name="label_yalign">0.5</property>
+			  <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+			  <child>
+			    <widget class="GtkAlignment" id="alignment88">
+			      <property name="visible">True</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xscale">1</property>
+			      <property name="yscale">1</property>
+			      <property name="top_padding">0</property>
+			      <property name="bottom_padding">0</property>
+			      <property name="left_padding">12</property>
+			      <property name="right_padding">0</property>
+
+			      <child>
+				<widget class="GtkVBox" id="vbox35">
+				  <property name="visible">True</property>
+				  <property name="homogeneous">False</property>
+				  <property name="spacing">0</property>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleLinkNoneButton">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">_None</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <signal name="toggled" handler="brailleLinkChanged" last_modification_time="Mon, 21 Apr 2008 17:04:44 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleLink7Button">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dot _7</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleLinkNoneButton</property>
+				      <signal name="toggled" handler="brailleLinkChanged" last_modification_time="Mon, 21 Apr 2008 17:05:03 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleLink8Button">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dot _8</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleLinkNoneButton</property>
+				      <signal name="toggled" handler="brailleLinkChanged" last_modification_time="Mon, 21 Apr 2008 17:05:17 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+
+				  <child>
+				    <widget class="GtkRadioButton" id="brailleLinkBothButton">
+				      <property name="visible">True</property>
+				      <property name="can_focus">True</property>
+				      <property name="label" translatable="yes">Dots 7 an_d 8</property>
+				      <property name="use_underline">True</property>
+				      <property name="relief">GTK_RELIEF_NORMAL</property>
+				      <property name="focus_on_click">True</property>
+				      <property name="active">False</property>
+				      <property name="inconsistent">False</property>
+				      <property name="draw_indicator">True</property>
+				      <property name="group">brailleLinkNoneButton</property>
+				      <signal name="toggled" handler="brailleLinkChanged" last_modification_time="Mon, 21 Apr 2008 17:05:29 GMT"/>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+				</widget>
+			      </child>
+			    </widget>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label49">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">&lt;b&gt;Hyperlink Indicator&lt;/b&gt;</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">True</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="type">label_item</property>
+			    </packing>
+			  </child>
 			</widget>
 			<packing>
-			  <property name="type">label_item</property>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
 			</packing>
 		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
 		    </packing>
 		  </child>
 		</widget>

Modified: trunk/src/orca/orca_gui_prefs.py
==============================================================================
--- trunk/src/orca/orca_gui_prefs.py	(original)
+++ trunk/src/orca/orca_gui_prefs.py	Tue Apr 29 20:37:56 2008
@@ -1513,6 +1513,16 @@
         else:
             self.get_widget("brailleSelectionNoneButton").set_active(True)
 
+        linkIndicator = prefs["brailleLinkIndicator"]
+        if linkIndicator == settings.BRAILLE_LINK_7:
+            self.get_widget("brailleLink7Button").set_active(True)
+        elif linkIndicator == settings.BRAILLE_LINK_8:
+            self.get_widget("brailleLink8Button").set_active(True)
+        elif linkIndicator == settings.BRAILLE_LINK_BOTH:
+            self.get_widget("brailleLinkBothButton").set_active(True)
+        else:
+            self.get_widget("brailleLinkNoneButton").set_active(True)
+
         # Key Echo pane.
         #
         self.get_widget("keyEchoCheckbutton").set_active( \
@@ -2547,6 +2557,47 @@
                 self.prefsDict["brailleSelectorIndicator"] = \
                     settings.BRAILLE_SEL_NONE
 
+    def brailleLinkChanged(self, widget):
+        """Signal handler for the "toggled" signal for the
+           brailleLinkNoneButton, brailleLink7Button,
+           brailleLink8Button or brailleLinkBothButton
+           GtkRadioButton widgets. The user has toggled the braille
+           link indicator value. If this signal was generated
+           as the result of a radio button getting selected (as
+           opposed to a radio button losing the selection), set the
+           'brailleLinkIndicator' preference to the new value.
+
+        Arguments:
+        - widget: the component that generated the signal.
+        """
+
+        if widget.get_active():
+            # Translators: A single braille cell on a refreshable
+            # braille display consists of 8 dots.  If the user
+            # chooses this setting, the dot in the bottom left
+            # corner will be used to 'underline' text of interest.
+            #
+            if widget.get_label() == _("Dot _7"):
+                self.prefsDict["brailleLinkIndicator"] = \
+                    settings.BRAILLE_LINK_7
+            # Translators: If the user chooses this setting, the
+            # dot in the bottom right corner of the braille cell
+            # will be used to 'underline' text of interest.
+            #
+            elif widget.get_label() == _("Dot _8"):
+                self.prefsDict["brailleLinkIndicator"] = \
+                    settings.BRAILLE_LINK_8
+            # Translators: If the user chooses this setting, the
+            # two dots at the bottom of the braille cell will be
+            # used to 'underline' text of interest.
+            #
+            elif widget.get_label() == _("Dots 7 an_d 8"):
+                self.prefsDict["brailleLinkIndicator"] = \
+                    settings.BRAILLE_LINK_BOTH
+            else:
+                self.prefsDict["brailleLinkIndicator"] = \
+                    settings.BRAILLE_LINK_NONE
+
     def brailleIndicatorChanged(self, widget):
         """Signal handler for the "toggled" signal for the
            textBrailleNoneButton, textBraille7Button, textBraille8Button

Modified: trunk/src/orca/orca_prefs.py
==============================================================================
--- trunk/src/orca/orca_prefs.py	(original)
+++ trunk/src/orca/orca_prefs.py	Tue Apr 29 20:37:56 2008
@@ -278,6 +278,21 @@
         else:
             return "orca.settings.BRAILLE_SEL_NONE"
 
+    def _getBrailleLinkIndicatorString(self, linkIndicator):
+        """Returns a string that represents the braille link indicator
+        value passed in."""
+
+        if linkIndicator == settings.BRAILLE_LINK_NONE:
+            return "orca.settings.BRAILLE_LINK_NONE"
+        elif linkIndicator == settings.BRAILLE_LINK_7:
+            return "orca.settings.BRAILLE_LINK_7"
+        elif linkIndicator == settings.BRAILLE_LINK_8:
+            return "orca.settings.BRAILLE_LINK_8"
+        elif linkIndicator == settings.BRAILLE_LINK_BOTH:
+            return "orca.settings.BRAILLE_LINK_BOTH"
+        else:
+            return "orca.settings.BRAILLE_LINK_NONE"
+
     def _getVerbosityString(self, verbosityLevel):
         """Returns a string that represents the verbosity level passed in."""
 
@@ -668,6 +683,8 @@
                 value = self._getBrailleRolenameStyleString(prefsDict[key])
             elif key == "brailleSelectorIndicator":
                 value = self._getBrailleSelectionIndicatorString(prefsDict[key])
+            elif key == "brailleLinkIndicator":
+                value = self._getBrailleLinkIndicatorString(prefsDict[key])
             elif key == "verbalizePunctuationStyle":
                 value = self._getVerbalizePunctuationStyleString(prefsDict[key])
             elif key == "sayAllStyle":

Modified: trunk/src/orca/settings.py
==============================================================================
--- trunk/src/orca/settings.py	(original)
+++ trunk/src/orca/settings.py	Tue Apr 29 20:37:56 2008
@@ -105,6 +105,7 @@
     "brailleVerbosityLevel",
     "brailleRolenameStyle",
     "brailleSelectorIndicator",
+    "brailleLinkIndicator",
     "enableBrailleMonitor",
     "enableMagnifier",
     "enableMagLiveUpdating",
@@ -229,6 +230,16 @@
 BRAILLE_SEL_BOTH = 0xc0 # 11000000
 brailleSelectorIndicator = BRAILLE_SEL_BOTH
 
+# Braille Link Indicator (see brailleLinkIndicator).
+# The values represent the character to be used in the attrOr
+# field of brlAPI's writeStruct.
+#
+BRAILLE_LINK_NONE = 0x00 # 00000000
+BRAILLE_LINK_7    = 0x40 # 01000000
+BRAILLE_LINK_8    = 0x80 # 10000000
+BRAILLE_LINK_BOTH = 0xc0 # 11000000
+brailleLinkIndicator = BRAILLE_LINK_BOTH
+
 # Speech punctuation levels (see verbalizePunctuationStyle).
 #
 PUNCTUATION_STYLE_NONE = 3

Modified: trunk/src/orca/where_am_I.py
==============================================================================
--- trunk/src/orca/where_am_I.py	(original)
+++ trunk/src/orca/where_am_I.py	Tue Apr 29 20:37:56 2008
@@ -1504,7 +1504,7 @@
         textOffset = startOffset
 
         for i in range(0, len(line)):
-            attribs = self._getAttributesForChar(text, textOffset, line, i)
+            attribs = self._getAttributesForChar(obj, text, textOffset, line, i)
             debug.println(self._debugLevel,
                           "line attribs <%s>" % (attribs))
             if attribs:
@@ -1519,7 +1519,7 @@
 
         return newLine
 
-    def _getAttributesForChar(self, text, textOffset, line, lineIndex):
+    def _getAttributesForChar(self, obj, text, textOffset, line, lineIndex):
 
         keys = [ "style", "weight", "underline" ]
         attribStr = ""
@@ -1556,6 +1556,15 @@
                             attribStr += " "
                             attribStr += (key + " " + attribute)
 
+            # Also check to see if this is a hypertext link.
+            #
+            if self._script.getLinkIndex(obj, textOffset) >= 0:
+                attribStr += " "
+                # Translators: this indicates that this piece of
+                # text is a hypertext link.
+                #
+                attribStr += _("link")
+
             debug.println(self._debugLevel,
                           "char <%s>: %s" % (line[lineIndex], attribStr))
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]