11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
33'''
4- Copyright (C) 2013-2015 Diego Torres Milano
4+ Copyright (C) 2013-2016 Diego Torres Milano
55Created on Mar 28, 2013
66
77Culebra helps you create AndroidViewClient scripts generating a working template that can be
@@ -20,7 +20,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
2020
2121'''
2222
23- __version__ = '11.5.1 '
23+ __version__ = '11.5.2 '
2424
2525import re
2626import sys
@@ -266,6 +266,7 @@ You have to set PYTHONIOENCODING environment variable. For example:
266266 if options [CulebraOptions .MULTI_DEVICE ]:
267267 warnings .warn ('Multi-device not implemented yet for this case' )
268268 else :
269+ logAction (u'finding view with text=%s' % text )
269270 print u'%s%s = %svc.findViewWithTextOrRaise(%s)' % (indent , var , prefix , text )
270271 elif op == Operation .LONG_TOUCH_VIEW :
271272 root = ', root=%svc.findViewByIdOrRaise(\' %s\' )' % (prefix , arg .getUniqueId ()) if arg else ''
@@ -329,6 +330,7 @@ def printFindViewWithContentDescription(view, useregexp, op=Operation.ASSIGN, ar
329330 if options [CulebraOptions .MULTI_DEVICE ]:
330331 warnings .warn ('Multi-device not implemented yet for this case' )
331332 else :
333+ logAction (u'finding view with content-description=%s' % contentDescription )
332334 print '%s%s = %svc.findViewWithContentDescriptionOrRaise(%s)' % (indent , var , prefix , contentDescription )
333335 elif op == Operation .LONG_TOUCH_VIEW :
334336 if options [CulebraOptions .MULTI_DEVICE ]:
@@ -668,7 +670,9 @@ def traverseAndPrint(view):
668670
669671def printStartActivity (component ):
670672 '''
671- Prints the corresponding startActivity()
673+ Prints the corresponding startActivity().
674+
675+ :param component: the component
672676 '''
673677
674678 if options [CulebraOptions .MULTI_DEVICE ]:
@@ -866,6 +870,9 @@ def printOperation(view, op, *args):
866870 printFindViewById (view , op , args [0 ])
867871
868872def str2bool (v ):
873+ if len (v ) < 1 or len (v ) > 5 :
874+ # len('false')=5
875+ warnings .warn ("str2bool: strange value for conversion '%s' will be considered 'false'" % v )
869876 return v .lower () in ("yes" , "true" , "t" , "1" , "on" )
870877
871878def value2dictionaryKey (v ):
@@ -897,7 +904,7 @@ def printScriptHeader():
897904 print '''%s
898905# -*- coding: utf-8 -*-
899906\' \' \'
900- Copyright (C) 2013-2014 Diego Torres Milano
907+ Copyright (C) 2013-2016 Diego Torres Milano
901908Created on %s by Culebra v%s
902909 __ __ __ __
903910 / \ / \ / \ / \
0 commit comments