@@ -1040,9 +1040,10 @@ def connectToDeviceOrExit(timeout=60, verbose=False, ignoresecuredevice=False, s
10401040 progname = os .path .basename (sys .argv [0 ])
10411041 if serialno is None :
10421042 # eat all the extra options the invoking script may have added
1043+ # FIXME: perhaps we should restore the popped arguments
10431044 while len (sys .argv ) > 1 and sys .argv [1 ][0 ] == '-' :
10441045 sys .argv .pop (1 )
1045- serialno = sys .argv [1 ] if len (sys .argv ) > 1 else \
1046+ serialno = sys .argv [1 ] if len (sys .argv ) > 1 else \
10461047 os .environ ['ANDROID_SERIAL' ] if os .environ .has_key ('ANDROID_SERIAL' ) \
10471048 else '.*'
10481049 if verbose :
@@ -1081,7 +1082,7 @@ def connectToDeviceOrExit(timeout=60, verbose=False, ignoresecuredevice=False, s
10811082 return device , serialno
10821083
10831084 @staticmethod
1084- def traverseShowClassIdAndText (view , extraInfo = None ):
1085+ def traverseShowClassIdAndText (view , extraInfo = None , noextrainfo = None ):
10851086 '''
10861087 Shows the View class, id and text if available.
10871088 This function can be used as a transform function to L{ViewClient.traverse()}
@@ -1094,7 +1095,14 @@ def traverseShowClassIdAndText(view, extraInfo=None):
10941095 '''
10951096
10961097 try :
1097- return "%s %s %s%s" % (view .getClass (), view .getId (), view .getText (), " " + extraInfo (view ).__str__ () if extraInfo != None else '' )
1098+ eis = ''
1099+ if extraInfo :
1100+ eis = extraInfo (view ).__str__ ()
1101+ if not eis and noextrainfo :
1102+ eis = noextrainfo
1103+ if eis :
1104+ eis = ' ' + eis
1105+ return "%s %s %s%s" % (view .getClass (), view .getId (), view .getText (), eis )
10981106 except Exception , e :
10991107 return "Exception in view=%s: %s" % (view .__smallStr__ (), e )
11001108
@@ -1122,7 +1130,7 @@ def traverseShowClassIdTextAndContentDescription(view):
11221130 @return: the string containing class, id, and text if available and the content description
11231131 '''
11241132
1125- return ViewClient .traverseShowClassIdAndText (view , View .getContentDescription )
1133+ return ViewClient .traverseShowClassIdAndText (view , View .getContentDescription , 'NAF' )
11261134
11271135 @staticmethod
11281136 def traverseShowClassIdTextAndCenter (view ):
0 commit comments