orca r3957 - in trunk: . src/orca src/orca/scripts/apps/evolution src/orca/scripts/apps/soffice src/orca/scripts/toolkits/Gecko



Author: richb
Date: Wed Jun  4 16:43:04 2008
New Revision: 3957
URL: http://svn.gnome.org/viewvc/orca?rev=3957&view=rev

Log:
        * src/orca/scripts/apps/evolution/script.py:
          src/orca/scripts/apps/soffice/speech_generator.py:
          src/orca/scripts/apps/soffice/where_am_i.py:
          src/orca/scripts/apps/soffice/braille_generator.py:
          src/orca/scripts/toolkits/Gecko/bookmarks.py:
          src/orca/scripts/toolkits/Gecko/script.py:
          src/orca/dectalk.py:
          src/orca/speechgenerator.py:
          src/orca/orca_prefs.py:
          src/orca/default.py:
          src/orca/liveregions.py:
          src/orca/focus_tracking_presenter.py:
          src/orca/where_am_I.py:
          src/orca/espeechfactory.py:
          src/orca/script.py:
          src/orca/keybindings.py:
          src/orca/speechdispatcherfactory.py:
          src/orca/braillegenerator.py:
          src/orca/gnomespeechfactory.py:
          src/orca/orca_gui_prefs.py:
          Fix for bug #517532 - change dict.has_key() usage to set
          operator in.


Modified:
   trunk/ChangeLog
   trunk/src/orca/braillegenerator.py
   trunk/src/orca/dectalk.py
   trunk/src/orca/default.py
   trunk/src/orca/espeechfactory.py
   trunk/src/orca/focus_tracking_presenter.py
   trunk/src/orca/gnomespeechfactory.py
   trunk/src/orca/keybindings.py
   trunk/src/orca/liveregions.py
   trunk/src/orca/orca_gui_prefs.py
   trunk/src/orca/orca_prefs.py
   trunk/src/orca/script.py
   trunk/src/orca/scripts/apps/evolution/script.py
   trunk/src/orca/scripts/apps/soffice/braille_generator.py
   trunk/src/orca/scripts/apps/soffice/speech_generator.py
   trunk/src/orca/scripts/apps/soffice/where_am_i.py
   trunk/src/orca/scripts/toolkits/Gecko/bookmarks.py
   trunk/src/orca/scripts/toolkits/Gecko/script.py
   trunk/src/orca/speechdispatcherfactory.py
   trunk/src/orca/speechgenerator.py
   trunk/src/orca/where_am_I.py

Modified: trunk/src/orca/braillegenerator.py
==============================================================================
--- trunk/src/orca/braillegenerator.py	(original)
+++ trunk/src/orca/braillegenerator.py	Wed Jun  4 16:43:04 2008
@@ -1377,8 +1377,8 @@
             # the same row).
             #
             speakAll = True
-            if self._script.pointOfReference.has_key("lastRow") and \
-                self._script.pointOfReference.has_key("lastColumn"):
+            if "lastRow" in self._script.pointOfReference and \
+                "lastColumn" in self._script.pointOfReference:
                 pointOfReference = self._script.pointOfReference
                 speakAll = (pointOfReference["lastRow"] != row) or \
                        ((row == 0 or row == table.nRows-1) and \
@@ -1596,7 +1596,7 @@
                     or (obj.getRole() == pyatspi.ROLE_PAGE_TAB_LIST)
 
         role = obj.getRole()
-        if self.brailleGenerators.has_key(role):
+        if role in self.brailleGenerators:
             generator = self.brailleGenerators[role]
         else:
             generator = self._getDefaultBrailleRegions

Modified: trunk/src/orca/dectalk.py
==============================================================================
--- trunk/src/orca/dectalk.py	(original)
+++ trunk/src/orca/dectalk.py	Wed Jun  4 16:43:04 2008
@@ -533,7 +533,7 @@
     for d in ['average-pitch', 'pitch-range',
               'richness', 'stress']:
         if d in acss:
-            if _table.has_key((familyName, d)):
+            if (familyName, d) in _table:
                 voice += _table[(familyName, d)][int(acss[d])]
     if voice:
         dv = " :dv %s" % voice

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Wed Jun  4 16:43:04 2008
@@ -2535,9 +2535,9 @@
                 # If this progress bar is not already known, create initial
                 # values for it.
                 #
-                if not self.lastProgressBarTime.has_key(obj):
+                if obj not in self.lastProgressBarTime:
                     self.lastProgressBarTime[obj] = 0.0
-                if not self.lastProgressBarValue.has_key(obj):
+                if obj not in self.lastProgressBarValue:
                     self.lastProgressBarValue[obj] = None
 
                 lastProgressBarTime = self.lastProgressBarTime[obj]
@@ -3083,7 +3083,7 @@
                 # We might have tucked away some information for this
                 # thing in the onActiveDescendantChanged method.
                 #
-                if self.pointOfReference.has_key("activeDescendantInfo"):
+                if "activeDescendantInfo" in self.pointOfReference:
                     [parent, index] = \
                         self.pointOfReference['activeDescendantInfo']
                     newFocus = parent[index]
@@ -3762,7 +3762,7 @@
 
             return
 
-        if state_change_notifiers.has_key(event.source.getRole()):
+        if event.source.getRole() in state_change_notifiers:
             notifiers = state_change_notifiers[event.source.getRole()]
             found = False
             for state in notifiers:
@@ -3950,7 +3950,7 @@
         # us their value changed even though it hasn't.
         #
         value = event.source.queryValue()
-        if self.pointOfReference.has_key("oldValue") \
+        if "oldValue" in self.pointOfReference \
            and (value.currentValue == self.pointOfReference["oldValue"]):
             return
 
@@ -4153,7 +4153,7 @@
         """
 
         for key in keys:
-            if attributes.has_key(key):
+            if key in attributes:
                 attribute = attributes[key]
                 if attribute:
                     # If it's the 'weight' attribute and greater than 400, just
@@ -4242,7 +4242,7 @@
             #
             attributes = {}
             for key in userAttrList:
-                if allAttributes.has_key(key):
+                if key in allAttributes:
                     textAttr = allAttributes.get(key)
                     userAttr = userAttrDict.get(key)
                     if textAttr != userAttr or len(userAttr) == 0:
@@ -6798,7 +6798,7 @@
         """
 
         for key in settings.userCustomizableSettings:
-            if prefsDict.has_key(key):
+            if key in prefsDict:
                 setattr(settings, key, prefsDict[key])
 
     ########################################################################

Modified: trunk/src/orca/espeechfactory.py
==============================================================================
--- trunk/src/orca/espeechfactory.py	(original)
+++ trunk/src/orca/espeechfactory.py	Wed Jun  4 16:43:04 2008
@@ -118,7 +118,7 @@
             if line[0] == '#' or line.strip() == '':
                 continue
             name = line.strip()
-            if not SpeechServer.__activeServers.has_key(name):
+            if name not in SpeechServer.__activeServers:
                 try:
                     SpeechServer.__activeServers[name] = SpeechServer(name)
                 except:
@@ -133,7 +133,7 @@
         """Gets a given SpeechServer based upon the info.
         See SpeechServer.getInfo() for more info.
         """
-        if SpeechServer.__activeServers.has_key(info[0]):
+        if info[0] in SpeechServer.__activeServers:
             return SpeechServer.__activeServers[info[0]]
         else:
             try:
@@ -288,7 +288,7 @@
 
     def shutdown(self):
         """Shutdown speech engine."""
-        if SpeechServer.__activeServers.has_key(self._engine):
+        if self._engine in SpeechServer.__activeServers:
             self._output.close()
             del SpeechServer.__activeServers[self._engine]
 

Modified: trunk/src/orca/focus_tracking_presenter.py
==============================================================================
--- trunk/src/orca/focus_tracking_presenter.py	(original)
+++ trunk/src/orca/focus_tracking_presenter.py	Wed Jun  4 16:43:04 2008
@@ -102,7 +102,7 @@
         - eventType: the event type.
         """
 
-        if self._listenerCounts.has_key(eventType):
+        if eventType in self._listenerCounts:
             self._listenerCounts[eventType] += 1
         else:
             self.registry.registerEventListener(self._enqueueEvent,
@@ -289,7 +289,7 @@
                 self._defaultScript = default.Script(None)
                 self._registerEventListeners(self._defaultScript)
             script = self._defaultScript
-        elif self._knownScripts.has_key(app):
+        elif app in self._knownScripts:
             script = self._knownScripts[app]
         else:
             script = self._createScript(app)
@@ -404,7 +404,7 @@
                 try:
                     debug.println(debug.LEVEL_FINEST,
                                   "Looking for settings at %s.py..." % name)
-                    if not self._knownAppSettings.has_key(name):
+                    if name not in self._knownAppSettings:
                         self._knownAppSettings[name] = \
                             __import__(name, globals(), locals(), [''])
                     reload(self._knownAppSettings[name])

Modified: trunk/src/orca/gnomespeechfactory.py
==============================================================================
--- trunk/src/orca/gnomespeechfactory.py	(original)
+++ trunk/src/orca/gnomespeechfactory.py	Wed Jun  4 16:43:04 2008
@@ -160,7 +160,7 @@
     def __createServer(iid):
         server = None
 
-        if SpeechServer.__activeServers.has_key(iid):
+        if iid in SpeechServer.__activeServers:
             server = SpeechServer.__activeServers[iid]
         else:
             driver = SpeechServer.__activateDriver(iid)
@@ -191,7 +191,7 @@
             "repo_ids.has('IDL:GNOME/Speech/SynthesisDriver:0.3')")
 
         for server in knownServers:
-            if not SpeechServer.__activeServers.has_key(server.iid):
+            if server.iid not in SpeechServer.__activeServers:
                 try:
                     SpeechServer.__createServer(server.iid)
                 except:
@@ -206,7 +206,7 @@
         See SpeechServer.getInfo() for more info.
         """
 
-        if info and SpeechServer.__activeServers.has_key(info[1]):
+        if info and info[1] in SpeechServer.__activeServers:
             return SpeechServer.__activeServers[info[1]]
 
         server = None
@@ -283,7 +283,7 @@
     def __getRate(self, speaker):
         """Gets the voice-independent ACSS rate value of a voice."""
 
-        if not self.__rateInfo.has_key(speaker):
+        if speaker not in self.__rateInfo:
             return 50.0
 
         [minRate, averageRate, maxRate] = self.__rateInfo[speaker]
@@ -301,7 +301,7 @@
         voice-independent ACSS rate value.
         """
 
-        if not self.__rateInfo.has_key(speaker):
+        if speaker not in self.__rateInfo:
             return
 
         [minRate, averageRate, maxRate] = self.__rateInfo[speaker]
@@ -322,7 +322,7 @@
         Returns the voice-specific pitch setting.
         """
 
-        if not self.__pitchInfo.has_key(speaker):
+        if speaker not in self.__pitchInfo:
             return 5.0
 
         [minPitch, averagePitch, maxPitch] = self.__pitchInfo[speaker]
@@ -340,7 +340,7 @@
         voice-independent ACSS pitch value.
         """
 
-        if not self.__pitchInfo.has_key(speaker):
+        if speaker not in self.__pitchInfo:
             return
 
         [minPitch, averagePitch, maxPitch] = self.__pitchInfo[speaker]
@@ -359,7 +359,7 @@
         voice-independent ACSS rate value.
         """
 
-        if not self.__volumeInfo.has_key(speaker):
+        if speaker not in self.__volumeInfo:
             return
 
         [minVolume, averageVolume, maxVolume] = self.__volumeInfo[speaker]
@@ -375,7 +375,7 @@
         if not acss:
             acss = defaultACSS
 
-        if self.__speakers.has_key(acss.name()):
+        if acss.name() in self.__speakers:
             return self.__speakers[acss.name()]
 
         # Search for matching languages first, as that is the most
@@ -384,10 +384,10 @@
         #
         languages = []
         try:
-            if acss.has_key(ACSS.FAMILY):
+            if ACSS.FAMILY in acss:
                 family = acss[ACSS.FAMILY]
                 languages = [family[speechserver.VoiceFamily.LOCALE]]
-            elif defaultACSS.has_key(ACSS.FAMILY):
+            elif ACSS.FAMILY in defaultACSS:
                 family = defaultACSS[ACSS.FAMILY]
                 languages = [family[speechserver.VoiceFamily.LOCALE]]
         except:
@@ -424,10 +424,10 @@
         # Now search for a matching family name.
         #
         familyName = None
-        if acss.has_key(ACSS.FAMILY):
+        if ACSS.FAMILY in acss:
             family = acss[ACSS.FAMILY]
             familyName = family[speechserver.VoiceFamily.NAME]
-        elif defaultACSS.has_key(ACSS.FAMILY):
+        elif ACSS.FAMILY in defaultACSS:
             family = defaultACSS[ACSS.FAMILY]
             familyName = family[speechserver.VoiceFamily.NAME]
 
@@ -480,13 +480,13 @@
                 self.__volumeInfo[speaker] = \
                     [parameter.min, parameter.current, parameter.max]
 
-        if acss.has_key(ACSS.RATE):
+        if ACSS.RATE in acss:
             self.__setRate(speaker, acss[ACSS.RATE])
 
-        if acss.has_key(ACSS.AVERAGE_PITCH):
+        if ACSS.AVERAGE_PITCH in acss:
             self.__setPitch(speaker, acss[ACSS.AVERAGE_PITCH])
 
-        if acss.has_key(ACSS.GAIN):
+        if ACSS.GAIN in acss:
             self.__setVolume(speaker, acss[ACSS.GAIN])
 
         self.__speakers[acss.name()] = speaker
@@ -722,7 +722,7 @@
         ##
         removeNewLines = True
         if orca_state.lastInputEvent and \
-               orca_state.lastInputEvent.__dict__.has_key("event_string"):
+               "event_string" in orca_state.lastInputEvent.__dict__:
             lastKey = orca_state.lastInputEvent.event_string
             if lastKey == "Left" or lastKey == "Right":
                 removeNewLines = False
@@ -829,10 +829,10 @@
             return -1
 
         speaker = self.__getSpeaker(acss)
-        if acss and not acss.has_key(ACSS.RATE):
+        if acss and ACSS.RATE not in acss:
             voices = settings.voices
             defaultACSS = voices[settings.DEFAULT_VOICE]
-            if defaultACSS.has_key(ACSS.RATE):
+            if ACSS.RATE in defaultACSS:
                 self.__setRate(speaker, defaultACSS[ACSS.RATE])
 
         if not text:
@@ -1056,7 +1056,7 @@
 
     def shutdown(self):
         """Shuts down the speech engine."""
-        if SpeechServer.__activeServers.has_key(self.__iid):
+        if self.__iid in SpeechServer.__activeServers:
             for speaker in self.__speakers.values():
                 speaker.stop()
                 speaker.unref()

Modified: trunk/src/orca/keybindings.py
==============================================================================
--- trunk/src/orca/keybindings.py	(original)
+++ trunk/src/orca/keybindings.py	Wed Jun  4 16:43:04 2008
@@ -51,7 +51,7 @@
     that is mapped to the given keysym.  This allows us, for example,
     to determine that the key bound to KP_Insert is also bound to KP_0."""
 
-    if not _keysymsCache.has_key(keysym):
+    if keysym not in _keysymsCache:
         # The keysym itself is always part of the list.
         #
         _keysymsCache[keysym] = [keysym]
@@ -119,7 +119,7 @@
     if not keysym:
         return 0
 
-    if not _keycodeCache.has_key(keysym):
+    if keysym not in _keycodeCache:
         keymap = gtk.gdk.keymap_get_default()
 
         # Find the numerical value of the keysym

Modified: trunk/src/orca/liveregions.py
==============================================================================
--- trunk/src/orca/liveregions.py	(original)
+++ trunk/src/orca/liveregions.py	Wed Jun  4 16:43:04 2008
@@ -382,7 +382,7 @@
     def matchLiveRegion(self, obj):
         """Predicate used to find a live region"""
         attrs = self._getAttrDictionary(obj)
-        return attrs.has_key('container-live')
+        return 'container-live' in attrs
 
     def _getMessage(self, event):
         """Gets the message associated with a given live event."""
@@ -448,7 +448,7 @@
         labels = self._getLabelsAsUtterances(event.source)
 
         # instantly send out notify messages
-        if attrs.has_key('channel') and attrs['channel'] == 'notify':
+        if 'channel' in attrs and attrs['channel'] == 'notify':
             utts = labels + content
             speech.stop()
             # Note: we would like to use a different ACSS for alerts.  This work
@@ -496,7 +496,7 @@
             # Last ditch effort is to see if our parent is a table row <tr> 
             # element.
             parentattrs = self._getAttrDictionary(obj.parent) 
-            if parentattrs.has_key('tag') and parentattrs['tag'] == 'TR':
+            if 'tag' in parentattrs and parentattrs['tag'] == 'TR':
                 return [self._script.expandEOCs( \
                                   obj.parent.getChildAtIndex(0)).strip()]
 
@@ -508,7 +508,7 @@
         registers LIVE_NONE objects in politeness overrides when monitoring."""
         objectid = self._getObjectId(obj)
         uri = self._script.bookmarks.getURIKey()
-        if self._politenessOverrides.has_key((uri, objectid)):
+        if (uri, objectid) in self._politenessOverrides:
             # look to see if there is a user politeness override
             return self._politenessOverrides[(uri, objectid)]
         else:

Modified: trunk/src/orca/orca_gui_prefs.py
==============================================================================
--- trunk/src/orca/orca_gui_prefs.py	(original)
+++ trunk/src/orca/orca_gui_prefs.py	Wed Jun  4 16:43:04 2008
@@ -480,7 +480,7 @@
         #
         elif voiceType == _("Uppercase"):
             voice = self.uppercaseVoice
-            if not voice.has_key(key):
+            if key not in voice:
                 if not useDefault:
                     return None
                 voice = self.defaultVoice
@@ -490,14 +490,14 @@
         #
         elif voiceType == _("Hyperlink"):
             voice = self.hyperlinkVoice
-            if not voice.has_key(key):
+            if key not in voice:
                 if not useDefault:
                     return None
                 voice = self.defaultVoice
         else:
             voice = self.defaultVoice
 
-        if voice.has_key(key):
+        if key in voice:
             return voice[key]
         else:
             return None
@@ -515,7 +515,7 @@
         familyName = None
         family = self._getKeyValueForVoiceType(voiceType, acss.ACSS.FAMILY)
 
-        if family and family.has_key(speechserver.VoiceFamily.NAME):
+        if family and speechserver.VoiceFamily.NAME in family:
             familyName = family[speechserver.VoiceFamily.NAME]
 
         return familyName

Modified: trunk/src/orca/orca_prefs.py
==============================================================================
--- trunk/src/orca/orca_prefs.py	(original)
+++ trunk/src/orca/orca_prefs.py	Wed Jun  4 16:43:04 2008
@@ -670,7 +670,7 @@
         """
 
         value = None
-        if prefsDict.has_key(key):
+        if key in prefsDict:
             if key == "voices":
                 value = self._getVoicesString(prefsDict[key])
             elif key == "speechServerInfo":

Modified: trunk/src/orca/script.py
==============================================================================
--- trunk/src/orca/script.py	(original)
+++ trunk/src/orca/script.py	Wed Jun  4 16:43:04 2008
@@ -329,9 +329,9 @@
 
         user_bindings = None
         user_bindings_map = settings.keyBindingsMap
-        if user_bindings_map.has_key(self.__module__):
+        if self.__module__ in user_bindings_map:
             user_bindings = user_bindings_map[self.__module__]
-        elif user_bindings_map.has_key("default"):
+        elif "default" in user_bindings_map:
             user_bindings = user_bindings_map["default"]
 
         consumes = False
@@ -373,9 +373,9 @@
         user_bindings = None
 
         user_bindings_map = settings.keyBindingsMap
-        if user_bindings_map.has_key(self.__module__):
+        if self.__module__ in user_bindings_map:
             user_bindings = user_bindings_map[self.__module__]
-        elif user_bindings_map.has_key("default"):
+        elif "default" in user_bindings_map:
             user_bindings = user_bindings_map["default"]
 
         consumed = False
@@ -397,17 +397,17 @@
         """
         user_bindings = None
         user_bindings_map = settings.brailleBindingsMap
-        if user_bindings_map.has_key(self.__module__):
+        if self.__module__ in user_bindings_map:
             user_bindings = user_bindings_map[self.__module__]
-        elif user_bindings_map.has_key("default"):
+        elif "default" in user_bindings_map:
             user_bindings = user_bindings_map["default"]
 
         command = brailleEvent.event
         consumes = False
         if user_bindings:
-            consumes = user_bindings.has_key(command)
+            consumes = command in user_bindings
         if not consumes:
-            consumes = self.brailleBindings.has_key(command)
+            consumes = command in self.brailleBindings
         return consumes
 
     def processBrailleEvent(self, brailleEvent):
@@ -444,16 +444,16 @@
         command = brailleEvent.event
 
         user_bindings_map = settings.brailleBindingsMap
-        if user_bindings_map.has_key(self.name):
+        if self.name in user_bindings_map:
             user_bindings = user_bindings_map[self.name]
-        elif user_bindings_map.has_key("default"):
+        elif "default" in user_bindings_map:
             user_bindings = user_bindings_map["default"]
 
-        if user_bindings and user_bindings.has_key(command):
+        if user_bindings and command in user_bindings:
             handler = user_bindings[command]
             consumed = handler.processInputEvent(self, brailleEvent)
 
-        if (not consumed) and self.brailleBindings.has_key(command):
+        if (not consumed) and command in self.brailleBindings:
             handler = self.brailleBindings[command]
             consumed = handler.processInputEvent(self, brailleEvent)
 

Modified: trunk/src/orca/scripts/apps/evolution/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/evolution/script.py	(original)
+++ trunk/src/orca/scripts/apps/evolution/script.py	Wed Jun  4 16:43:04 2008
@@ -262,7 +262,7 @@
                             # Only speak the screen label if we haven't already
                             # done so.
                             #
-                            if text and not self.setupLabels.has_key(label):
+                            if text and label not in self.setupLabels:
                                 # Translators: this is the name of a setup
                                 # assistant window/screen in Evolution.
                                 #
@@ -291,7 +291,7 @@
             # label, then just ignore it.
             #
             text = self.getDisplayedText(label)
-            if text and not self.setupLabels.has_key(label):
+            if text and label not in self.setupLabels:
                 # Most of the Setup Assistant screens have a useful piece
                 # of text starting with the word "Please". We want to speak
                 # these. For the first screen, the useful piece of text
@@ -1413,7 +1413,7 @@
                     # seen this panel, then handle it.
                     #
                     elif event.source.getRole() == pyatspi.ROLE_PANEL and \
-                        not self.setupPanels.has_key(event.source):
+                        event.source not in self.setupPanels:
                         self.handleSetupAssistantPanel(event.source)
                         self.setupPanels[event.source] = True
                         break

Modified: trunk/src/orca/scripts/apps/soffice/braille_generator.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/braille_generator.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/braille_generator.py	Wed Jun  4 16:43:04 2008
@@ -70,10 +70,10 @@
             parentTable = None
 
         index = self._script.getCellIndex(obj)
-        if self._script.pointOfReference.has_key("lastColumn") and \
+        if "lastColumn" in self._script.pointOfReference and \
               self._script.pointOfReference["lastColumn"] != \
               parentTable.getColumnAtIndex(index):
-            if self._script.dynamicColumnHeaders.has_key(table):
+            if table in self._script.dynamicColumnHeaders:
                 row = self._script.dynamicColumnHeaders[table]
                 header = self._script.getDynamicRowHeaderCell(obj, row)
                 try:
@@ -91,10 +91,10 @@
                     if text:
                         regions.append(braille.Region(" " + text + " "))
 
-        if self._script.pointOfReference.has_key("lastRow") and \
+        if "lastRow" in self._script.pointOfReference and \
               self._script.pointOfReference['lastRow'] != \
               parentTable.getRowAtIndex(index):
-            if self._script.dynamicRowHeaders.has_key(table):
+            if table in self._script.dynamicRowHeaders:
                 column = self._script.dynamicRowHeaders[table]
                 header = self._script.getDynamicColumnHeaderCell(obj, column)
                 try:
@@ -135,8 +135,8 @@
                 # the same row).
                 #
                 speakAll = True
-                if self._script.pointOfReference.has_key("lastRow") and \
-                    self._script.pointOfReference.has_key("lastColumn"):
+                if "lastRow" in self._script.pointOfReference and \
+                    "lastColumn" in self._script.pointOfReference:
                     pointOfReference = self._script.pointOfReference
                     speakAll = \
                         (pointOfReference["lastRow"] != row) or \

Modified: trunk/src/orca/scripts/apps/soffice/speech_generator.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/speech_generator.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/speech_generator.py	Wed Jun  4 16:43:04 2008
@@ -148,10 +148,10 @@
                 parentTable = None
 
             index = self._script.getCellIndex(obj)
-            if self._script.pointOfReference.has_key("lastColumn") and \
+            if "lastColumn" in self._script.pointOfReference and \
                self._script.pointOfReference["lastColumn"] != \
                parentTable.getColumnAtIndex(index):
-                if self._script.dynamicColumnHeaders.has_key(table):
+                if table in self._script.dynamicColumnHeaders:
                     row = self._script.dynamicColumnHeaders[table]
                     header = self._script.getDynamicRowHeaderCell(obj, row)
                     try:
@@ -169,10 +169,10 @@
                         if text:
                             utterances.append(text)
 
-            if self._script.pointOfReference.has_key("lastRow") and \
+            if "lastRow" in self._script.pointOfReference and \
                self._script.pointOfReference["lastRow"] != \
                parentTable.getRowAtIndex(index):
-                if self._script.dynamicRowHeaders.has_key(table):
+                if table in self._script.dynamicRowHeaders:
                     column = self._script.dynamicRowHeaders[table]
                     header = self._script.getDynamicColumnHeaderCell(obj,
                                                                      column)
@@ -205,8 +205,8 @@
                     # the same row).
                     #
                     speakAll = True
-                    if self._script.pointOfReference.has_key("lastRow") and \
-                        self._script.pointOfReference.has_key("lastColumn"):
+                    if "lastRow" in self._script.pointOfReference and \
+                        "lastColumn" in self._script.pointOfReference:
                         pointOfReference = self._script.pointOfReference
                         speakAll = (pointOfReference["lastRow"] != row) or \
                                ((row == 0 or row == parentTable.nRows-1) and \

Modified: trunk/src/orca/scripts/apps/soffice/where_am_i.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/where_am_i.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/where_am_i.py	Wed Jun  4 16:43:04 2008
@@ -75,7 +75,7 @@
 
         # Speak the dynamic column header (if any).
         #
-        if self._script.dynamicColumnHeaders.has_key(table):
+        if table in self._script.dynamicColumnHeaders:
             row = self._script.dynamicColumnHeaders[table]
             header = self._script.getDynamicRowHeaderCell(obj, row)
             try:
@@ -101,7 +101,7 @@
 
         # Speak the dynamic row header (if any).
         #
-        if self._script.dynamicRowHeaders.has_key(table):
+        if table in self._script.dynamicRowHeaders:
             column = self._script.dynamicRowHeaders[table]
             header = self._script.getDynamicColumnHeaderCell(obj, column)
             try:

Modified: trunk/src/orca/scripts/toolkits/Gecko/bookmarks.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/bookmarks.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/bookmarks.py	Wed Jun  4 16:43:04 2008
@@ -185,7 +185,7 @@
             return
         # only 1 bookmark or we are just starting out
         elif len(thispage_hwkeys) == 1 or \
-                         not self._currentbookmarkindex.has_key(current_uri):
+                         current_uri not in self._currentbookmarkindex:
             self.goToBookmark(None, index=(thispage_hwkeys[0], current_uri))
             return
         
@@ -218,7 +218,7 @@
             return
         # only 1 bookmark or we are just starting out
         elif len(thispage_hwkeys) == 1 or \
-                         not self._currentbookmarkindex.has_key(current_uri):
+                         current_uri not in self._currentbookmarkindex:
             self.goToBookmark(None, index=(thispage_hwkeys[0], current_uri))
             return
         

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Wed Jun  4 16:43:04 2008
@@ -1629,9 +1629,9 @@
 
         user_bindings = None
         user_bindings_map = settings.keyBindingsMap
-        if user_bindings_map.has_key(self.__module__):
+        if self.__module__ in user_bindings_map:
             user_bindings = user_bindings_map[self.__module__]
-        elif user_bindings_map.has_key("default"):
+        elif "default" in user_bindings_map:
             user_bindings = user_bindings_map["default"]
 
         consumes = False
@@ -3524,7 +3524,7 @@
             if attrs['xml-roles'] in script_settings.ARIA_LANDMARKS:
                 return True
             # ARIA live region
-            elif attrs.has_key('container-live'):
+            elif 'container-live' in attrs:
                 return True
             # All other ARIA widgets
             else:
@@ -3541,7 +3541,7 @@
         """
         obj = obj or orca_state.locusOfFocus
         attrs = self._getAttrDictionary(obj)
-        return (attrs.has_key('xml-roles') and not attrs.has_key('live'))
+        return ('xml-roles' in attrs and 'live' not in attrs)
 
     def _getAttrDictionary(self, obj):
         return dict([attr.split(':', 1) for attr in obj.getAttributes()])
@@ -3575,14 +3575,14 @@
                 # Now we need to look at the object attributes
                 attrs = self._getAttrDictionary(event.any_data)
                 # Good live region markup
-                if attrs.has_key('container-live'):
+                if 'container-live' in attrs:
                     return True
 
                 # We see this one with the URL bar opening (sometimes)
-                if attrs.has_key('tag') and attrs['tag'] == 'xul:richlistbox':
+                if 'tag' in attrs and attrs['tag'] == 'xul:richlistbox':
                     return False
 
-                if attrs.has_key('xml-roles'):
+                if 'xml-roles' in attrs:
                     # This eliminates all ARIA widgets that are not
                     # considered live
                     if attrs['xml-roles'] != 'alert' \
@@ -3596,7 +3596,7 @@
                 # Some alerts have been seen without the :system postfix.
                 # We will take care of them separately.
                 attrs = self._getAttrDictionary(event.any_data)
-                if attrs.has_key('xml-roles') \
+                if 'xml-roles' in attrs \
                                       and attrs['xml-roles'] == 'alert':
                     return True
                 else:
@@ -3613,18 +3613,18 @@
 
             attrs = self._getAttrDictionary(event.source)
             # Good live region markup
-            if attrs.has_key('container-live'):
+            if 'container-live' in attrs:
                 return True
 
             # This might be too restrictive but we need it to filter
             # out URLs that are displayed when the location list opens.
-            if attrs.has_key('tag') \
+            if 'tag' in attrs \
                     and attrs['tag'] == 'xul:description' \
                     or attrs['tag'] == 'xul:label':
                 return False
 
             # This eliminates all ARIA widgets that are not considered live
-            if attrs.has_key('xml-roles'):
+            if 'xml-roles' in attrs:
                 return False
         else: # object:text-inserted events
             return False

Modified: trunk/src/orca/speechdispatcherfactory.py
==============================================================================
--- trunk/src/orca/speechdispatcherfactory.py	(original)
+++ trunk/src/orca/speechdispatcherfactory.py	Wed Jun  4 16:43:04 2008
@@ -104,7 +104,7 @@
         when it is not possible to create the server.
         
         """
-        if not cls._active_servers.has_key(serverId):
+        if serverId not in cls._active_servers:
             cls(serverId)
         # Don't return the instance, unless it is succesfully added
         # to `_active_Servers'.

Modified: trunk/src/orca/speechgenerator.py
==============================================================================
--- trunk/src/orca/speechgenerator.py	(original)
+++ trunk/src/orca/speechgenerator.py	Wed Jun  4 16:43:04 2008
@@ -1466,8 +1466,8 @@
                 # the same row).
                 #
                 speakAll = True
-                if self._script.pointOfReference.has_key("lastRow") and \
-                    self._script.pointOfReference.has_key("lastColumn"):
+                if "lastRow" in self._script.pointOfReference and \
+                    "lastColumn" in self._script.pointOfReference:
                     pointOfReference = self._script.pointOfReference
                     speakAll = (pointOfReference["lastRow"] != row) or \
                         ((row == 0 or row == parent_table.nRows-1) and \
@@ -1746,7 +1746,7 @@
         Returns a list of utterances to be spoken.
         """
         role = obj.getRole()
-        if self.speechGenerators.has_key(role):
+        if role in self.speechGenerators:
             generator = self.speechGenerators[role]
         else:
             generator = self._getDefaultSpeech

Modified: trunk/src/orca/where_am_I.py
==============================================================================
--- trunk/src/orca/where_am_I.py	(original)
+++ trunk/src/orca/where_am_I.py	Wed Jun  4 16:43:04 2008
@@ -1536,7 +1536,7 @@
                           "charDict: %s" % (charDict))
 
             for key in keys:
-                if charDict.has_key(key):
+                if key in charDict:
                     attribute = charDict[key]
                     if attribute:
                         # If it's the 'weight' attribute and greater than 400,



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