403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/pyatspi/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/pyatspi/utils.pyc
Ñò
1¡ÜJc@sÞdZddkZddkZd„Zd„ZddkZd„Zd„Zd„Zd„Z	d	„Z
ed
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zdeifd„ƒYZdefd„ƒYZdS(sj
Utility functions for AT-SPI for querying interfaces, searching the hierarchy,
converting constants to strings, and so forth.

@author: Peter Parente
@organization: IBM Corporation
@copyright: Copyright (c) 2005, 2007 IBM Corporation
@license: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.

Portions of this code originally licensed and copyright (c) 2005, 2007
IBM Corporation under the BSD license, available at
U{http://www.opensource.org/licenses/bsd-license.php}
iÿÿÿÿNcCs
|iiS(s4
  Gets the ID of an interface class or object in string format for use in
  queryInterface.
  
  @param obj: Class representing an AT-SPI interface or instance
  @type obj: object
  @return: IID for the interface
  @rtype: string
  @raise AttributeError: When the parameter does not provide typecode info
  (t__typecode__trepo_id(tobj((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytgetInterfaceIID scCs
|iiS(s*
  Gets the human readable name of an interface class or object in string
  format.
  
  @param obj: Class representing an AT-SPI interface or instance
  @type obj: class
  @return: Name of the interface
  @rtype: string
  @raise AttributeError: When the parameter does not provide typecode info
  (Rtname(R((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytgetInterfaceName-scCs]tƒ}xMtiD]B}|it|ƒƒ}|djoqn|it|ƒƒqW|S(sÞ
  Gets a list of the names of all interfaces supported by this object. The
  names are the short-hand interface names like "Accessible" and "Component",
  not the full interface identifiers.

  @param obj: Arbitrary object to query for all accessibility related
  interfaces. Must provide a queryInterface method.
  @type obj: object
  @return: Set of supported interface names
  @rtype: set
  @raise AttributeError: If the object provide does not implement
  queryInterface
  N(tsett	constantstALL_INTERFACEStqueryInterfaceRtNonetaddR(Rtnamestictio((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytlistInterfaces>s	

cCs6|iƒd|iƒiddƒ}tt||ƒS(s„
  Maps a string name to an AT-SPI constant. The rules for the mapping are as 
  follows:
    - The prefix is captalized and has an _ appended to it.
    - All spaces in the suffix are mapped to the _ character. 
    - All alpha characters in the suffix are mapped to their uppercase.
    
  The resulting name is used with getattr to look up a constant with that name
  in the L{constants} module. If such a constant does not exist, the string
  suffix is returned instead.

  This method allows strings to be used to refer to roles, relations, etc.
  without direct access to the constants. It also supports the future expansion
  of roles, relations, etc. by allowing arbitrary strings which may or may not
  map to the current standard set of roles, relations, etc., but may still
  match some non-standard role, relation, etc. being reported by an
  application.
  
  @param prefix: Prefix of the constant name such as role, relation, state, 
    text, modifier, key
  @type prefix: string
  @param suffix: Name of the role, relation, etc. to use to lookup the constant
  @type suffix: string
  @return: The matching constant value
  @rtype: object
  t_t (tuppertreplacetgetattrR(tprefixtsuffixR((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyt
stringToConstTs&cCstii|ƒS(s
  Converts a state value to a string based on the name of the state constant in
  the L{constants} module that has the given value.
  
  @param value: An AT-SPI state
  @type value: Accessibility.StateType
  @return: Human readable, untranslated name of the state
  @rtype: string
  (RtSTATE_VALUE_TO_NAMEtget(tvalue((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyt
stateToStringrs
cCstii|ƒS(s(
  Converts a relation value to a string based on the name of the state constant
  in the L{constants} module that has the given value.
  
  @param value: An AT-SPI relation
  @type value: Accessibility.RelationType
  @return: Human readable, untranslated name of the relation
  @rtype: string
  (RtRELATION_VALUE_TO_NAMER(R((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytrelationToString~s
ccs5d}x(|dti>jo|V|d7}q	WdS(so
  Generates all possible keyboard modifiers for use with 
  L{registry.Registry.registerKeystrokeListener}.
  iiN(RtMODIFIER_NUMLOCK(tmask((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytallModifiersŠs
cCsk|ot||ƒSxO|D]G}yt||ƒ}Wntj
o
d}nX|dj	o|SqWdS(sš
  Searches for a descendant node satisfying the given predicate starting at 
  this node. The search is performed in depth-first order by default or
  in breadth first order if breadth_first is True. For example,
  
  my_win = findDescendant(lambda x: x.name == 'My Window')
  
  will search all descendants of x until one is located with the name 'My
  Window' or all nodes are exausted. Calls L{_findDescendantDepth} or
  L{_findDescendantBreadth} to start the recursive search.
  
  @param acc: Root accessible of the search
  @type acc: Accessibility.Accessible
  @param pred: Search predicate returning True if accessible matches the 
      search criteria or False otherwise
  @type pred: callable
  @param breadth_first: Search breadth first (True) or depth first (False)?
  @type breadth_first: boolean
  @return: Accessible matching the criteria or None if not found
  @rtype: Accessibility.Accessible or None
  N(t_findDescendantBreadtht_findDescendantDeptht	ExceptionR
(tacctpredt
breadth_firsttchildtret((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytfindDescendant”s
c	Cs“x:|D]2}y||ƒo|SWqtj
oqXqWxO|D]G}yt||ƒ}Wntj
o
d}nX|dj	o|SqDWdS(s¨    
  Internal function for locating one descendant. Called by L{findDescendant} to
  start the search.
  
  @param acc: Root accessible of the search
  @type acc: Accessibility.Accessible
  @param pred: Search predicate returning True if accessible matches the 
      search criteria or False otherwise
  @type pred: callable
  @return: Matching node or None to keep searching
  @rtype: Accessibility.Accessible or None
  N(R#R!R
(R$R%R'R(((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR!´s

		
c
Cs‚y||ƒo|SWntj
onXxO|D]G}yt||ƒ}Wntj
o
d}nX|dj	o|Sq3WdS(s 
  Internal function for locating one descendant. Called by L{findDescendant} to
  start the search.

  @param acc: Root accessible of the search
  @type acc: Accessibility.Accessible
  @param pred: Search predicate returning True if accessible matches the 
    search criteria or False otherwise
  @type pred: callable
  @return: Matching node or None to keep searching
  @rtype: Accessibility.Accessible or None
  N(R#R"R
(R$R%R'R(((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR"Ís

	
cCsg}t|||ƒ|S(sP
  Searches for all descendant nodes satisfying the given predicate starting at 
  this node. Does an in-order traversal. For example,
  
  pred = lambda x: x.getRole() == pyatspi.ROLE_PUSH_BUTTON
  buttons = pyatspi.findAllDescendants(node, pred)
  
  will locate all push button descendants of node.
  
  @param acc: Root accessible of the search
  @type acc: Accessibility.Accessible
  @param pred: Search predicate returning True if accessible matches the 
      search criteria or False otherwise
  @type pred: callable
  @return: All nodes matching the search criteria
  @rtype: list
  (t_findAllDescendants(R$R%tmatches((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytfindAllDescendantsåscCs]xV|D]N}y"||ƒo|i|ƒnWntj
onXt|||ƒqWdS(s“
  Internal method for collecting all descendants. Reuses the same matches
  list so a new one does not need to be built on each recursive step.
  N(tappendR#R*(R$R%R+R'((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR*ûs
cCsl|djodSxS|idjodSy||iƒo|iSWntj
onX|i}qdS(s™
  Searches for an ancestor satisfying the given predicate. Note that the
  AT-SPI hierarchy is not always doubly linked. Node A may consider node B its
  child, but B is not guaranteed to have node A as its parent (i.e. its parent
  may be set to None). This means some searches may never make it all the way
  up the hierarchy to the desktop level.
  
  @param acc: Starting accessible object
  @type acc: Accessibility.Accessible
  @param pred: Search predicate returning True if accessible matches the 
    search criteria or False otherwise
  @type pred: callable
  @return: Node matching the criteria or None if not found
  @rtype: Accessibility.Accessible
  N(R
tparentR#(R$R%((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytfindAncestors
cCskg}x^|idjo|iƒ|Sy|i|iƒƒWntj
o
t‚nX|i}q	dS(s?
  Gets the path from the application ancestor to the given accessible in
  terms of its child index at each level.
  
  @param acc: Target accessible
  @type acc: Accessibility.Accessible
  @return: Path to the target
  @rtype: list of integer
  @raise LookupError: When the application accessible cannot be reached
  N(R.R
treverseR-tgetIndexInParentR#tLookupError(R$tpath((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytgetPath%s
t
_StateSetImplcBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
RS(	s»
  Implementation of the StateSet interface. Clients should not use this class
  directly, but rather the L{StateSet} proxy class.
  
  @param states: Set of states
  @type states: set
  cCstƒ|_dS(sInitializes the state set.N(Rtstates(tself((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyt__init__CscCs
||ijS(sÔ
    Checks if this StateSet contains the given state.
    
    @param state: State to check
    @type state: Accessibility.StateType
    @return: True if the set contains the given state
    @rtype: boolean
    (R6(R7tstate((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytcontainsGs	cCs|ii|ƒdS(sp
    Adds a state to this set.
    
    @param state: State to add
    @type state: Accessibility.StateType
    N(R6R(R7R9((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyRRscCs|ii|ƒdS(sx
    Removes a state from this set.
    
    @param state: State to remove
    @type state: Accessibility.StateType
    N(R6tremove(R7R9((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR;[scCst|iƒƒ|ijS(s
    Checks if this StateSet contains exactly the same members as the given
    StateSet.
    
    @param state_set: Another set
    @type state_set: Accessibility.StateSet
    @return: Are the sets equivalent in terms of their contents?
    @rtype: boolean
    (Rt	getStatesR6(R7t	state_set((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytequalsdscCstii‚dS(s0
    Computes the symmetric differences of this L{StateSet} and the given
    L{StateSet}.

    @note: This method is not currently implemented because of difficulties
    with reference counting. This method needs to return a new
    Accessibility.StateSet object, but the Python implementation for that
    object needs to be kept alive. The problem is who will keep that
    server implementation alive? As soon as it goes out of scope, it's
    GC'ed. This object cannot keep it alive either as it may go out of
    scope before the new object is ready to be finalized. With a global
    cache of objects, we don't know when to invalidate.
    
    @param state_set: Another set
    @type state_set: Accessibility.StateSet
    @return: Elements in only one of the two sets
    @rtype: Accessibility.StateSet
    N(tORBittCORBAtNO_IMPLEMENT(R7R=((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytcomparerscCst|iƒdjS(sa
    Checks if this L{StateSet} is empty.
    
    @return: Is it empty?
    @rtype: boolean
    i(tlenR6(R7((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pytisEmptyscCs
t|iƒS(sh
    Gets the sequence of all states in this set.
    
    @return: List of states
    @rtype: list
    (tlistR6(R7((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR<˜s(t__name__t
__module__t__doc__R8R:RR;R>RBRDR<(((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR5;s										tStateSetcBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„ZRS(
s»
  Python proxy for the L{_StateSetImpl} class. Use this to safely instantiate
  new StateSet objects in Python.

  @param impl: State set implementation
  @type impl: L{_StateSetImpl}
  cGs)tƒ|_t|iiƒi|ƒdS(s
    Initializes the state set with the given states.

    @param states: States to add immediately
    @type states: list
    N(R5timpltmapt_thisR(R7R6((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR8©scCs|iiƒi|ƒS(sÔ
    Checks if this StateSet contains the given state.
    
    @param state: State to check
    @type state: Accessibility.StateType
    @return: True if the set contains the given state
    @rtype: boolean
    (RJRLR:(R7R9((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR:³s	cGst|iiƒi|ƒdS(st
    Adds states to this set.
    
    @param states: State(s) to add
    @type states: Accessibility.StateType
    N(RKRJRLR(R7R6((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR¾scCst|iiƒi|ƒdS(s|
    Removes states from this set.
    
    @param states: State(s) to remove
    @type states: Accessibility.StateType
    N(RKRJRLR;(R7R9((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR;ÇscCs9t||iƒo|iƒ}n|iiƒi|ƒS(s
    Checks if this StateSet contains exactly the same members as the given
    StateSet.
    
    @param state_set: Another set
    @type state_set: Accessibility.StateSet
    @return: Are the sets equivalent in terms of their contents?
    @rtype: boolean
    (t
isinstancet	__class__trawRJRLR>(R7R=((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR>Ðs
cCsit||iƒo|iƒ}nt|iiƒiƒƒ}t|iƒƒ}|i|ƒ}t|ŒS(sr
    Finds the symmetric difference between this state set andthe one provided,
    and returns it as a new StateSet.

    @note: This does not use L{_StateSetImpl.compare} which cannot be
    implemented at this time
    @param state_set: Set to compare against
    @type state_set: Accessibility.StateSet
    @return: Proxy for the new set
    @rtype: L{StateSet}
    (	RMRNRORRJRLR<tsymmetric_differenceRI(R7R=tatbtdiff((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyRBßscCs|iiƒiƒS(s^
    Checks if this StateSet is empty.
    
    @return: Is it empty?
    @rtype: boolean
    (RJRLRD(R7((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyRDóscCs|iiƒiƒS(sh
    Gets the sequence of all states in this set.
    
    @return: List of states
    @rtype: list
    (RJRLR<(R7((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyR<üscCs
|iiƒS(s‘
    Gets the Accessibility.StateSet object proxied for use in a remote
    call.

    @return: State set
    @rtype: Accessibility.StateSet
    (RJRL(R7((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyROs(RFRGRHR8R:RR;R>RBRDR<RO(((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyRI¡s	
											(RHR?tAccessibility__POARRRRRRRR tFalseR)R!R"R,R*R/R4RIR5tobject(((s1/usr/lib/python2.6/site-packages/pyatspi/utils.pyt<module>s&	
						
 						f

Youez - 2016 - github.com/yon3zu
LinuXploit