orca r4201 - in branches/phase2: . src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4201 - in branches/phase2: . src/orca
- Date: Sat, 13 Sep 2008 00:32:19 +0000 (UTC)
Author: wwalker
Date: Sat Sep 13 00:32:19 2008
New Revision: 4201
URL: http://svn.gnome.org/viewvc/orca?rev=4201&view=rev
Log:
Pylint'ing away.
Modified:
branches/phase2/pylintrc
branches/phase2/src/orca/__init__.py
branches/phase2/src/orca/braille.py
branches/phase2/src/orca/braille_monitor.py
branches/phase2/src/orca/default.py
branches/phase2/src/orca/input_bindings.py
branches/phase2/src/orca/input_event.py
branches/phase2/src/orca/orca.py
branches/phase2/src/orca/script.py
branches/phase2/src/orca/script_manager.py
branches/phase2/src/orca/settings.py
branches/phase2/src/orca/utils.py
Modified: branches/phase2/pylintrc
==============================================================================
--- branches/phase2/pylintrc (original)
+++ branches/phase2/pylintrc Sat Sep 13 00:32:19 2008
@@ -88,7 +88,7 @@
# R0915: Function or method has too many statements
#
#disable-msg=E0611,C0111,R0201,W0102,W0141,W0333,W0401,W0403,W0603,W0612,W0613,W0702,W0704,W0511,R0801,R0912,R0915,R0914,R0904,R0903,R0401,R0911,R0913,C0302,R0902
-disable-msg=W0403,W0612,W0613,W0702,W0704,R0903
+disable-msg=W0403,W0612,W0613,W0702,W0704,R0201,R0903,R0912,R0913
[REPORTS]
@@ -256,7 +256,7 @@
max-branchs=12
# Maximum number of statements in function / method body
-max-statements=50
+max-statements=60
# Maximum number of parents for a class (see R0901).
max-parents=7
Modified: branches/phase2/src/orca/__init__.py
==============================================================================
--- branches/phase2/src/orca/__init__.py (original)
+++ branches/phase2/src/orca/__init__.py Sat Sep 13 00:32:19 2008
@@ -2,5 +2,3 @@
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
-
-
Modified: branches/phase2/src/orca/braille.py
==============================================================================
--- branches/phase2/src/orca/braille.py (original)
+++ branches/phase2/src/orca/braille.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2005-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -112,7 +110,7 @@
# For the purposes of testing w/o a braille display, we'll set the display
# size to width=32 and height=1.
#
-# [[[TODO: WDW - Only a height of 1 is support at this time.]]]
+# Only a height of 1 is support at this time.
#
_displaySize = [32, 1]
@@ -121,6 +119,10 @@
#
_callback = None
+# Allow globals to be used in this module.
+#
+# pylint: disable-msg=W0603
+#
def writeText(text, attributeMask, cursorCell):
"""Writes the given text with the given attribute mask. Also
puts the cursor at the given 1-based cursorCell (0 means no cursor).
@@ -143,11 +145,12 @@
writeStruct.text = text
writeStruct.cursor = cursorCell
if attributeMask:
- writeStruct.attrOr = attributeMask[startPos:endPos]
+ writeStruct.attrOr = attributeMask
_brlAPI.write(writeStruct)
if enableBrailleMonitor:
if not monitor:
+ import braille_monitor
monitor = braille_monitor.BrailleMonitor(_displaySize[0])
monitor.show_all()
monitor.writeText(text, attributeMask, cursorCell)
@@ -270,18 +273,19 @@
if not _initialized:
return False
- global brlAPIRunning
- global brlAPISourceId
- if brlAPIRunning:
- brlAPIRunning = False
- gobject.source_remove(brlAPISourceId)
- brlAPISourceId = 0
- brlAPI.leaveTtyMode()
+ global _brlAPIRunning
+ global _brlAPISourceId
+ if _brlAPIRunning:
+ _brlAPIRunning = False
+ gobject.source_remove(_brlAPISourceId)
+ _brlAPISourceId = 0
+ _brlAPI.leaveTtyMode()
_initialized = False
return True
def _myCallback(event):
+ """Just for testing when run in standalone mode."""
if event["type"] == brlapi.KEY_TYPE_CMD:
print "This is a command"
else:
Modified: branches/phase2/src/orca/braille_monitor.py
==============================================================================
--- branches/phase2/src/orca/braille_monitor.py (original)
+++ branches/phase2/src/orca/braille_monitor.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2006-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -134,11 +132,6 @@
self.move(x, 0)
- # There are a lot of decision branches happening below, but
- # it's OK for this method. We'll disable the pylint message.
- #
- # pylint: disable-msg=R0912
-
def writeText(self, text, attributeMask, cursorCell):
"""Display the given text and highlight the given
cursor cell. A cursorCell of 0 means no cell has
@@ -157,7 +150,6 @@
text = ""
for i in range(0, len(text)):
-
# Handle special chars so they are not interpreted by pango.
#
if text[i] == "<":
@@ -200,11 +192,12 @@
gtk.SHADOW_OUT)
if __name__ == "__main__":
- # [[[TODO: WDW - this doesn't work.]]]
logging.basicConfig(format="%(name)s %(message)s")
log.setLevel(logging.DEBUG)
monitor = BrailleMonitor()
monitor.realize()
monitor.show_all()
+ mask = " " + DOT_7 + DOT_8 + DOTS_78 + " "
+ monitor.writeText("Just a test: <& ", mask, 5)
gtk.main()
Modified: branches/phase2/src/orca/default.py
==============================================================================
--- branches/phase2/src/orca/default.py (original)
+++ branches/phase2/src/orca/default.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
Modified: branches/phase2/src/orca/input_bindings.py
==============================================================================
--- branches/phase2/src/orca/input_bindings.py (original)
+++ branches/phase2/src/orca/input_bindings.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2005-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -212,11 +210,6 @@
"""A single input event binding, consisting of a command, a keyboard
modifier mask, and the Handler.
"""
-
- # We really do want this many arguments.
- #
- # pylint: disable-msg=R0913
-
def __init__(self,
command,
modifierMask,
@@ -372,7 +365,7 @@
return None
- def consumeInputEvent(self,
+ def _consumeInputEvent(self,
script,
inputEvent,
commandCode,
@@ -403,14 +396,8 @@
########################################################################
class KeyBinding(Binding):
- """A single binding, consisting of a keycode, a modifier mask,
- and the Handler.
+ """A single keyboard binding.
"""
-
- # We really do want this many arguments.
- #
- # pylint: disable-msg=R0913
-
def __init__(self,
command,
modifierMask,
@@ -456,7 +443,7 @@
assumed the event will always be consumed (e.g., we want to
consume key presses as well, but not really process them).
"""
- return Bindings.consumeInputEvent(
+ return Bindings._consumeInputEvent(
self,
script,
keyboardEvent,
@@ -471,10 +458,8 @@
########################################################################
class BrailleBinding(Binding):
- # We really do want this many arguments.
- #
- # pylint: disable-msg=R0913
-
+ """A single braille binding.
+ """
def __init__(self,
command,
modifierMask,
@@ -509,7 +494,7 @@
def consumeInputEvent(self, script, brailleEvent, modifiers):
"""Attempts to consume the given braille event.
"""
- return Bindings.consumeInputEvent(
+ return Bindings._consumeInputEvent(
self,
script,
brailleEvent,
Modified: branches/phase2/src/orca/input_event.py
==============================================================================
--- branches/phase2/src/orca/input_event.py (original)
+++ branches/phase2/src/orca/input_event.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2005-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
Modified: branches/phase2/src/orca/orca.py
==============================================================================
--- branches/phase2/src/orca/orca.py (original)
+++ branches/phase2/src/orca/orca.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -158,7 +156,6 @@
# There are a lot of decision branches and statements happening below,
# but it's OK for this method. We'll disable the pylint messages.
#
-# pylint: disable-msg=R0912
# pylint: disable-msg=R0915
def processArgv(desktopRunning):
Modified: branches/phase2/src/orca/script.py
==============================================================================
--- branches/phase2/src/orca/script.py (original)
+++ branches/phase2/src/orca/script.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -42,11 +40,6 @@
import braille
-# We want several methods here to be abstract methods so subclasses
-# can refer to self.
-#
-# pylint: disable-msg=R0201
-
class Script:
"""The specific focus tracking scripts for applications.
"""
Modified: branches/phase2/src/orca/script_manager.py
==============================================================================
--- branches/phase2/src/orca/script_manager.py (original)
+++ branches/phase2/src/orca/script_manager.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -72,6 +70,7 @@
import gobject
import Queue
+import time
import braille
import default
@@ -79,7 +78,7 @@
import pyatspi
import utils
-class ScriptManager():
+class ScriptManager:
"""Maintain a set of scripts for all running applications, and
also keeps the notion of an activeScript. All object events are
passed to the associated script for that application, regardless if
@@ -121,11 +120,6 @@
#
class _FakeEvent:
"""Silly fake input event."""
-
- # We really do want this many arguments.
- #
- # pylint: disable-msg=R0913
-
def __init__(self, source, eventType,
detail1, detail2, any_data):
"""Creates a fake input input."""
@@ -482,7 +476,7 @@
# either.
#
if event.type.startswith("object:children-changed:remove") \
- and (event.source == self.registry.getDesktop(0)):
+ and (event.source == pyatspi.Registry.getDesktop(0)):
self._reclaimScripts()
# We don't want to touch a defunct object. It's useless and it
@@ -531,13 +525,12 @@
if not reason and setNewActiveScript:
reason = "window:activate event"
- # [[[TODO: WDW - HACK we look for frame that get
- # focus: as a means to detect active scripts
- # because yelp does this. Actually, yelp is a bit
- # odd in that it calls itself 'yelp' then changes
- # its application name and id to the Gecko toolkit
- # in use, and then issues a focus: event on the
- # main window, which is a frame.]]]
+ # We look for frame that get focus: as a means to
+ # detect active scripts because yelp does this.
+ # Actually, yelp is a bit odd in that it calls itself
+ # 'yelp' then changes its application name and id to
+ # the Gecko toolkit in use, and then issues a focus:
+ # event on the main window, which is a frame.
#
setNewActiveScript = setNewActiveScript \
or (eType.startswith("focus") \
@@ -567,9 +560,9 @@
or (eType.startswith("object:state-changed:focused")\
and event.detail1):
setNewActiveScript = \
- orca_state.activeScript \
+ self._activeScript \
and event.host_application \
- and (orca_state.activeScript.app \
+ and (self._activeScript.app \
!= event.host_application)
if not reason and setNewActiveScript:
@@ -591,7 +584,7 @@
retryCount += 1
if retryCount <= commFailureAttemptLimit:
log.warning(" TRYING AGAIN (%d)" % retryCount)
- time.sleep(s.commFailureWaitTime)
+ time.sleep(commFailureWaitTime)
else:
log.warning(" GIVING UP AFTER %d TRIES" % (retryCount - 1))
except:
@@ -653,7 +646,7 @@
pass
if event:
- log.debug("----------> QUEUEING %s" % str(event).replace("\n"," "))
+ log.debug("QUEUEING %s" % str(event).replace("\n"," "))
self._eventQueue.put(event)
if processSynchronously:
self._dequeueEvent()
@@ -668,15 +661,15 @@
try:
event = self._eventQueue.get_nowait()
- log.debug("DEQUEUED %s <----------" % str(event).replace("\n"," "))
- log.debug("\nvvvvv PROCESS %s vvvvv" % str(event).replace("\n"," "))
+ log.debug("DEQUEUED %s\n" % str(event).replace("\n"," "))
+ log.debug("vvvvv PROCESS %s vvvvv" % str(event).replace("\n"," "))
if isinstance(event, input_event.KeyboardEvent):
self._dispatchKeyboardEvent(event)
elif isinstance(event, input_event.BrailleEvent):
self._dispatchBrailleEvent(event)
else:
self._processObjectEvent(event)
- log.debug("\n^^^^^ PROCESS %s ^^^^^" % str(event).replace("\n"," "))
+ log.debug("^^^^^ PROCESS %s ^^^^^\n" % str(event).replace("\n"," "))
except Queue.Empty:
rerun = False
except:
@@ -688,6 +681,9 @@
logging.basicConfig(format="%(name)s %(message)s")
log.setLevel(logging.DEBUG)
- import utils
manager = ScriptManager()
+
+ # Accessing the protected method is just for testing here.
+ #
+ # pylint: disable-msg=W0212
print manager._getScript(utils.getKnownApplications()[0])
Modified: branches/phase2/src/orca/settings.py
==============================================================================
--- branches/phase2/src/orca/settings.py (original)
+++ branches/phase2/src/orca/settings.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
@@ -39,6 +37,7 @@
Arguments:
- delegate: a Settings instance to use if settings cannot be found here.
"""
+ dict.__init__(self)
self.delegate = delegate
def __getitem__(self, key):
Modified: branches/phase2/src/orca/utils.py
==============================================================================
--- branches/phase2/src/orca/utils.py (original)
+++ branches/phase2/src/orca/utils.py Sat Sep 13 00:32:19 2008
@@ -1,5 +1,3 @@
-# Orca
-#
# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]