|
17 | 17 | @author: diego |
18 | 18 | ''' |
19 | 19 |
|
20 | | -__version__ = '2.3.17' |
| 20 | +__version__ = '2.3.18' |
21 | 21 |
|
22 | 22 | import sys |
23 | 23 | import subprocess |
@@ -957,6 +957,8 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse |
957 | 957 | else: |
958 | 958 | adb = ViewClient.__obtainAdbPath() |
959 | 959 |
|
| 960 | + self.adb = adb |
| 961 | + ''' The adb command ''' |
960 | 962 | self.root = None |
961 | 963 | ''' The root node ''' |
962 | 964 | self.viewsById = {} |
@@ -1033,7 +1035,7 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse |
1033 | 1035 | self.localPort = localport |
1034 | 1036 | self.remotePort = remoteport |
1035 | 1037 | # FIXME: it seems there's no way of obtaining the serialno from the MonkeyDevice |
1036 | | - subprocess.check_call([adb, '-s', self.serialno, 'forward', 'tcp:%d' % self.localPort, |
| 1038 | + subprocess.check_call([self.adb, '-s', self.serialno, 'forward', 'tcp:%d' % self.localPort, |
1037 | 1039 | 'tcp:%d' % self.remotePort]) |
1038 | 1040 |
|
1039 | 1041 | self.windows = None |
@@ -1315,6 +1317,10 @@ def traverseShowClassIdTextPositionAndSize(view): |
1315 | 1317 | TRAVERSE_CITPS = traverseShowClassIdTextPositionAndSize |
1316 | 1318 | ''' An alias for L{traverseShowClassIdTextPositionAndSize(view)} ''' |
1317 | 1319 |
|
| 1320 | + @staticmethod |
| 1321 | + def sleep(secs=1): |
| 1322 | + time.sleep(secs) |
| 1323 | + |
1318 | 1324 | def assertServiceResponse(self, response): |
1319 | 1325 | ''' |
1320 | 1326 | Checks whether the response received from the server is correct or raises and Exception. |
@@ -1955,7 +1961,22 @@ def __getFocusedWindowPosition(self): |
1955 | 1961 | return self.__getFocusedWindowId() |
1956 | 1962 |
|
1957 | 1963 | def getSdkVersion(self): |
| 1964 | + ''' |
| 1965 | + Gets the SDK version. |
| 1966 | + ''' |
| 1967 | + |
1958 | 1968 | return self.build[VERSION_SDK_PROPERTY] |
| 1969 | + |
| 1970 | + def isKeyboardShown(self): |
| 1971 | + ''' |
| 1972 | + Whether the keyboard is displayed. |
| 1973 | + ''' |
| 1974 | + |
| 1975 | + dim = self.device.shell('dumpsys input_method') |
| 1976 | + if dim: |
| 1977 | + # FIXME: API >= 15 ? |
| 1978 | + return "mInputShown=true" in dim |
| 1979 | + return False |
1959 | 1980 |
|
1960 | 1981 |
|
1961 | 1982 | if __name__ == "__main__": |
|
0 commit comments