[orca] Use the default script's onNameChanged to present the name of the new folder
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Use the default script's onNameChanged to present the name of the new folder
- Date: Sat, 2 Nov 2013 20:18:35 +0000 (UTC)
commit bbf5458cef7f89c128362a887d5ea7e9f76eda2b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Nov 2 16:17:13 2013 -0400
Use the default script's onNameChanged to present the name of the new folder
src/orca/scripts/apps/nautilus/script.py | 135 ------------------------------
1 files changed, 0 insertions(+), 135 deletions(-)
---
diff --git a/src/orca/scripts/apps/nautilus/script.py b/src/orca/scripts/apps/nautilus/script.py
index e32f6fb..ee995be 100644
--- a/src/orca/scripts/apps/nautilus/script.py
+++ b/src/orca/scripts/apps/nautilus/script.py
@@ -29,7 +29,6 @@ import pyatspi
import orca.debug as debug
import orca.messages as messages
import orca.scripts.default as default
-import orca.speech as speech
########################################################################
# #
@@ -48,18 +47,6 @@ class Script(default.Script):
default.Script.__init__(self, app)
- # Set the debug level for all the methods in this script.
- #
- self.debugLevel = debug.LEVEL_FINEST
-
- # Path view panel child that is currently checked.
- #
- self.pathChild = None
-
- # Name of the last folder visited.
- #
- self.oldFolderName = None
-
def isActivatableEvent(self, event):
"""Returns True if the given event is one that should cause this
script to become the active script. This is only a hint to
@@ -94,128 +81,6 @@ class Script(default.Script):
return shouldActivate
- def getItemCount(self, frame):
- """Return a string containing the number of items in the current
- folder.
-
- Arguments:
- - frame: the top-level frame for this Nautilus window.
-
- Return a string containing the number of items in the current
- folder.
- """
-
- itemCount = -1
- itemCountString = " "
- allScrollPanes = self.utilities.descendantsWithRole(
- frame, pyatspi.ROLE_SCROLL_PANE)
- rolesList = [pyatspi.ROLE_SCROLL_PANE,
- pyatspi.ROLE_FILLER,
- pyatspi.ROLE_FILLER,
- pyatspi.ROLE_SPLIT_PANE,
- pyatspi.ROLE_PANEL,
- pyatspi.ROLE_FRAME,
- pyatspi.ROLE_APPLICATION]
-
- # Look for the scroll pane containing the folder items. If this
- # window is showing an icon view, then the child will be a layered
- # pane. If it's showing a list view, then the child will be a table.
- # Create a string of the number of items in the folder.
- #
- for pane in allScrollPanes:
- if self.utilities.hasMatchingHierarchy(pane, rolesList):
- for i in range(0, pane.childCount):
- child = pane.getChildAtIndex(i)
- if child.getRole() == pyatspi.ROLE_LAYERED_PANE:
- itemCount = child.childCount
- elif child.getRole() == pyatspi.ROLE_TABLE:
- try:
- itemCount = child.queryTable().nRows
- except NotImplementedError:
- itemCount = -1
- if itemCount != -1:
- itemCountString = " " + messages.itemCount(itemCount)
- break
-
- return itemCountString
-
- def onNameChanged(self, event):
- """Called whenever a property on an object changes.
-
- Arguments:
- - event: the Event
- """
-
- details = debug.getAccessibleDetails(self.debugLevel, event.source)
- debug.printObjectEvent(self.debugLevel, event, details)
-
- if event.source.getRole() == pyatspi.ROLE_FRAME:
-
- # If we've changed folders, announce the new folder name and
- # the number of items in it (see bug #350674).
- #
- # Unfortunately we get two of what appear to be idential events
- # when the accessible name of the frame changes. We only want to
- # speak/braille the new folder name if its different then last
- # time, so, if the Location bar is showing, look to see if the
- # same toggle button (with the same name) in the "path view" is
- # checked. If it isn't, then this is a new folder, so announce it.
- #
- # If the Location bar isn't showing, then just do a comparison of
- # the new folder name with the old folder name and if they are
- # different, announce it. Note that this doesn't do the right
- # thing when navigating directory hierarchies such as
- # /path/to/same/same/same.
- #
- allTokens = event.source.name.split(" - ")
- newFolderName = allTokens[0]
-
- allPanels = self.utilities.descendantsWithRole(
- event.source, pyatspi.ROLE_PANEL)
- rolesList = [pyatspi.ROLE_PANEL,
- pyatspi.ROLE_FILLER,
- pyatspi.ROLE_PANEL,
- pyatspi.ROLE_TOOL_BAR,
- pyatspi.ROLE_PANEL,
- pyatspi.ROLE_FRAME,
- pyatspi.ROLE_APPLICATION]
- locationBarFound = False
- for panel in allPanels:
- if self.utilities.hasMatchingHierarchy(panel, rolesList):
- locationBarFound = True
- desiredPanel = panel
- break
-
- shouldAnnounce = False
- if locationBarFound:
- for i in range(0, desiredPanel.childCount):
- child = desiredPanel.getChildAtIndex(i)
- if child.getRole() == pyatspi.ROLE_TOGGLE_BUTTON and \
- child.getState().contains(pyatspi.STATE_CHECKED):
- if not self.utilities.isSameObject(
- child, self.pathChild):
- self.pathChild = child
- shouldAnnounce = True
- break
-
- else:
- if self.oldFolderName != newFolderName:
- shouldAnnounce = True
-
- if shouldAnnounce:
- string = newFolderName
- string += self.getItemCount(event.source)
- debug.println(debug.LEVEL_INFO, string)
- speech.speak(string)
- self.displayBrailleMessage(string)
-
- self.oldFolderName = newFolderName
- return
-
- # Pass the event onto the parent class to be handled in the default way.
- #
- default.Script.onNameChanged(self, event)
-
def onSelectionChanged(self, event):
"""Called when an object's selection changes.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]