Skip to content

Commit 98a9ab7

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into py2to3
# Conflicts: # src/com/dtmilano/android/controlpanel.py
2 parents 150562a + ef6e9c6 commit 98a9ab7

21 files changed

Lines changed: 281 additions & 84 deletions

.idea/runConfigurations/Unittests_for_tests_com_dtmilano_android_adb_dumpsystests2_DumpsysTests.xml

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/dump__h.xml renamed to .idea/runConfigurations/culebra__Guc___concertina_config_1___scale_0_5.xml

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ as a pure python tool that automates or simplifies test script creation.
66
It is a test framework for Android applications that:
77
<ul><ul>
88
<li>Automates driving Android applications</li>
9-
<li><b>Generates</b> re-usable scripts</li>
9+
<li>Generates re-usable scripts</li>
1010
<li>Provides view-based <i>device independent</i> UI interaction</li>
1111
<li>Uses 'logical' screen comparison (UI Automator Hierarchy based) over image comparison (Avoiding extraneous
1212
detail issues, such as time or data changes)</li>
@@ -16,14 +16,17 @@ It is a test framework for Android applications that:
1616
<li>Is written in python</li>
1717
</ul></ul>
1818

19+
**🛎** |A new Kotlin backend is under development to provide more functionality and improve performance.<br>Take a look at [CulebraTester2](https://github.com/dtmilano/CulebraTester2-public) |
20+
---|----------------------------------------------------------------|
21+
1922
[![Latest Version](https://img.shields.io/pypi/v/androidviewclient.svg)](https://pypi.python.org/pypi/androidviewclient/)
2023

2124

22-
:rage: **NOTE**: Pypi statistics are broken see [here](https://github.com/aclark4life/vanity/issues/22). The new statistics can be obtained from [BigQuery](https://bigquery.cloud.google.com/queries/culebra-tester).
25+
**NOTE**: Pypi statistics are broken see [here](https://github.com/aclark4life/vanity/issues/22). The new statistics can be obtained from [BigQuery](https://bigquery.cloud.google.com/queries/culebra-tester).
2326

24-
As of June 2018 we have reached:
27+
As of June 2019 we have reached:
2528

26-
<img src="https://github.com/dtmilano/AndroidViewClient/wiki/images/culebra-400k.png" width="80%" align="center">
29+
<img src="https://github.com/dtmilano/AndroidViewClient/wiki/images/culebra-600k.png" width="80%" align="center">
2730

2831
Thanks to all who made it possible.
2932

publish

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
set -e
44
eval $(grep version setup.py | sed 's/,$//')
55
tag="v$version"
6-
git tag "$tag"
6+
git tag "$tag" || printf 'WARNING: tag "%s" already exists\n' "$tag"
77
git push --tags
88
python2.7 setup.py clean build --executable='/usr/bin/env python2.7' bdist_egg bdist_wheel --universal
9-
twine upload dist/androidviewclient-${version}-*
9+
# let's use pyenv's twine, installed by pip
10+
twine=~/.pyenv/shims/twine
11+
set -x
12+
version_info=( $($twine --version 2>&1) )
13+
if [[ "${version_info[2]}" < "1.11" ]]
14+
then
15+
printf '%s: ERROR: twine version > 1.11 required\n' "$(basename $0)"
16+
exit 1
17+
fi
18+
$twine upload dist/androidviewclient-${version}-*

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(name='androidviewclient',
6-
version='15.5.1',
6+
version='15.8.1',
77
description='''AndroidViewClient is a 100% pure python library and tools
88
that simplifies test script creation providing higher level
99
operations and the ability of obtaining the tree of Views present at

src/com/dtmilano/android/adb/adbclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from com.dtmilano.android.adb.dumpsys import Dumpsys
2525

26-
__version__ = '15.5.1'
26+
__version__ = '15.8.1'
2727

2828
import sys
2929
import warnings

src/com/dtmilano/android/adb/dumpsys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import sys
2323
from _warnings import warn
2424

25-
__version__ = '15.5.1'
25+
__version__ = '15.8.1'
2626

2727
DEBUG = False
2828

src/com/dtmilano/android/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@author: Diego Torres Milano
1919
'''
2020

21-
__version__ = '15.5.1'
21+
__version__ = '15.8.1'
2222

2323
import ast
2424
import os

src/com/dtmilano/android/concertina.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import random
2323

2424
__author__ = 'diego'
25-
__version__ = '15.5.1'
25+
__version__ = '15.8.1'
2626

2727
DEBUG = True
2828

src/com/dtmilano/android/controlpanel.py

Lines changed: 80 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
@author: Diego Torres Milano
1919
@author: Ahmed Kasem
2020
'''
21+
import platform
2122

22-
__version__ = '15.5.1'
23+
__version__ = '15.8.1'
2324

2425
import tkinter
2526
import tkinter.ttk
27+
import subprocess
2628

2729
from com.dtmilano.android.culebron import Operation, Color
2830

@@ -36,7 +38,12 @@ class Layout:
3638
BUTTON_WIDTH=13
3739
BUTTONS_NUMBER=9
3840

41+
3942
class ControlPanel(tkinter.Toplevel):
43+
osName = platform.system()
44+
''' The OS name. We sometimes need specific behavior. '''
45+
isDarwin = (osName == 'Darwin')
46+
''' Is it Mac OSX? '''
4047

4148
def __init__(self, culebron, printOperation, **kwargs):
4249
self.culebron = culebron
@@ -53,57 +60,92 @@ def __init__(self, culebron, printOperation, **kwargs):
5360
self.childWindow.resizable(width=tkinter.FALSE, height=tkinter.FALSE)
5461
self.childWindow.printOperation = printOperation
5562
self.childWindow.grid()
56-
self.childWindow.column = self.childWindow.row = 0
63+
self.childWindow.column = 0
64+
self.childWindow.row = 0
65+
if self.isDarwin:
66+
out = subprocess.check_output(["defaults", "read", "-g", "AppleInterfaceStyle"])
67+
self.isDarkMode = ('Dark' in out)
68+
else:
69+
self.isDarkMode = False
70+
if self.isDarkMode:
71+
self.fg = Color.DARK_GRAY
72+
self.bg = Color.LIGHT_GRAY
73+
self.highlightbackground = Color.LIGHT_GRAY
74+
else:
75+
self.fg = Color.DARK_GRAY
76+
self.bg = Color.LIGHT_GRAY
77+
self.highlightbackground = Color.DARK_GRAY
5778
self.createKeycodeTab()
5879
self.createKeyboardTab()
80+
self.childWindow.update()
81+
if self.isDarwin:
82+
if platform.mac_ver()[0].startswith("10.14"):
83+
self.childWindow.after(0, self.fix)
84+
85+
def fix(self):
86+
"""
87+
Fix a problem with Tkinter Buttons in Mojave.
88+
See https://stackoverflow.com/questions/52529403/button-text-of-tkinter-not-works-in-mojave
89+
"""
90+
a = self.childWindow.winfo_geometry().split('+')[0]
91+
b = a.split('x')
92+
w = int(b[0])
93+
h = int(b[1])
94+
self.childWindow.geometry('%dx%d' % (w + 1, h + 1))
5995

6096
def createKeycodeTab(self):
6197
''' KEYCODE '''
62-
self.keycodeList = [
63-
'KEYCODE_HOME', 'KEYCODE_DPAD_UP', 'KEYCODE_BACK', 'KEYCODE_SEARCH', 'KEYCODE_CHANNEL_UP', 'KEYCODE_TV',
64-
'KEYCODE_MUSIC', 'KEYCODE_EXPLORER', 'KEYCODE_CAMERA', 'KEYCODE_POWER', 'KEYCODE_DPAD_LEFT','KEYCODE_DPAD_DOWN',
65-
'KEYCODE_DPAD_RIGHT', 'KEYCODE_PAGE_UP', 'KEYCODE_CHANNEL_DOWN', 'KEYCODE_VOLUME_UP', 'KEYCODE_MEDIA_PLAY',
66-
'KEYCODE_CONTACTS', 'KEYCODE_ZOOM_IN', 'SNAPSHOPT', 'KEYCODE_MENU', 'KEYCODE_DPAD_CENTER', 'KEYCODE_ENTER',
67-
'KEYCODE_PAGE_DOWN', 'KEYCODE_BRIGHTNESS_DOWN', 'KEYCODE_VOLUME_DOWN', 'KEYCODE_MEDIA_PAUSE', 'KEYCODE_BOOKMARK',
68-
'KEYCODE_ZOOM_OUT', 'REFRESH', 'KEYCODE_APP_SWITCH', 'KEYCODE_GOOGLE_NOW', 'KEYCODE_CALL', 'KEYCODE_ESCAPE',
69-
'KEYCODE_BRIGHTNESS_UP', 'KEYCODE_VOLUME_MUTE', 'KEYCODE_MEDIA_STOP', 'KEYCODE_CALCULATOR', 'KEYCODE_SETTINGS', 'QUIT'
70-
]
71-
for keycode in self.keycodeList:
72-
self.keycode = ControlPanelButton(self.keycodeTab, self.culebron, self.printOperation, value=keycode, text=keycode[8:],
73-
width=Layout.BUTTON_WIDTH, bg=Color.DARK_GRAY, fg=Color.LIGHT_GRAY,
74-
highlightbackground=Color.DARK_GRAY)
98+
_keycodeList = [
99+
'KEYCODE_HOME', 'KEYCODE_DPAD_UP', 'KEYCODE_BACK', 'KEYCODE_SEARCH', 'KEYCODE_CHANNEL_UP', 'KEYCODE_TV',
100+
'KEYCODE_MUSIC', 'KEYCODE_EXPLORER', 'KEYCODE_CAMERA', 'KEYCODE_POWER', 'KEYCODE_DPAD_LEFT',
101+
'KEYCODE_DPAD_DOWN',
102+
'KEYCODE_DPAD_RIGHT', 'KEYCODE_PAGE_UP', 'KEYCODE_CHANNEL_DOWN', 'KEYCODE_VOLUME_UP', 'KEYCODE_MEDIA_PLAY',
103+
'KEYCODE_CONTACTS', 'KEYCODE_ZOOM_IN', 'SNAPSHOPT', 'KEYCODE_MENU', 'KEYCODE_DPAD_CENTER', 'KEYCODE_ENTER',
104+
'KEYCODE_PAGE_DOWN', 'KEYCODE_BRIGHTNESS_DOWN', 'KEYCODE_VOLUME_DOWN', 'KEYCODE_MEDIA_PAUSE',
105+
'KEYCODE_BOOKMARK',
106+
'KEYCODE_ZOOM_OUT', 'REFRESH', 'KEYCODE_APP_SWITCH', 'KEYCODE_GOOGLE_NOW', 'KEYCODE_CALL', 'KEYCODE_ESCAPE',
107+
'KEYCODE_BRIGHTNESS_UP', 'KEYCODE_VOLUME_MUTE', 'KEYCODE_MEDIA_STOP', 'KEYCODE_CALCULATOR',
108+
'KEYCODE_SETTINGS', 'QUIT'
109+
]
110+
for keycode in _keycodeList:
111+
_cpb = ControlPanelButton(self.keycodeTab, self.culebron, self.printOperation, value=keycode,
112+
text=keycode[8:],
113+
width=Layout.BUTTON_WIDTH,
114+
bg=self.bg, fg=self.fg,
115+
highlightbackground=self.highlightbackground)
75116

76117
if keycode == 'REFRESH':
77-
self.keycode.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=self.keycode.refreshScreen)
78-
self.keycode.grid(column=self.childWindow.column, row=self.childWindow.row)
118+
_cpb.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=_cpb.refreshScreen)
79119
elif keycode == 'SNAPSHOPT':
80-
self.keycode.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=self.keycode.takeSnapshot)
81-
self.keycode.grid(column=self.childWindow.column, row=self.childWindow.row)
120+
_cpb.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=_cpb.takeSnapshot)
82121
elif keycode == 'QUIT':
83-
self.keycode.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=self.childWindow.destroy)
84-
self.keycode.grid(column=self.childWindow.column, row=self.childWindow.row)
122+
_cpb.configure(fg=Color.BLUE, bg=Color.DARK_GRAY, text=keycode, command=self.childWindow.destroy)
85123
else:
86-
self.keycode.configure(command=self.keycode.command)
87-
self.keycode.grid(column=self.childWindow.column, row=self.childWindow.row)
124+
_cpb.configure(command=_cpb.command)
125+
_cpb.grid(column=self.childWindow.column, row=self.childWindow.row)
88126
self.tabLayout()
89127

90128
def createKeyboardTab(self):
91129
''' KEYBOARD '''
92-
self.keyboardList = [
93-
'KEYCODE_1', 'KEYCODE_2', 'KEYCODE_3', 'KEYCODE_4', 'KEYCODE_5', 'KEYCODE_6', 'KEYCODE_7', 'KEYCODE_8', 'KEYCODE_9', 'KEYCODE_0',
94-
'KEYCODE_Q', 'KEYCODE_W', 'KEYCODE_E', 'KEYCODE_R', 'KEYCODE_T', 'KEYCODE_Y', 'KEYCODE_U', 'KEYCODE_I', 'KEYCODE_O', 'KEYCODE_P',
95-
'KEYCODE_A', 'KEYCODE_S', 'KEYCODE_D', 'KEYCODE_F', 'KEYCODE_G', 'KEYCODE_H', 'KEYCODE_J', 'KEYCODE_K', 'KEYCODE_L',
96-
'KEYCODE_DEL', 'KEYCODE_Z', 'KEYCODE_X', 'KEYCODE_C', 'KEYCODE_V', 'KEYCODE_B', 'KEYCODE_N', 'KEYCODE_M',
97-
'KEYCODE_.', 'KEYCODE_SPACE', 'KEYCODE_GO'
98-
]
99-
100-
for keyboard in self.keyboardList:
101-
self.keyboard = ControlPanelButton(self.keyboardTab, self.culebron, self.printOperation, value=keyboard, text=keyboard[8:],
102-
width=Layout.BUTTON_WIDTH, bg=Color.DARK_GRAY, fg=Color.LIGHT_GRAY,
103-
highlightbackground=Color.DARK_GRAY)
104-
105-
self.keyboard.configure(command=self.keyboard.command)
106-
self.keyboard.grid(column=self.childWindow.column, row=self.childWindow.row)
130+
_keyboardList = [
131+
'KEYCODE_1', 'KEYCODE_2', 'KEYCODE_3', 'KEYCODE_4', 'KEYCODE_5', 'KEYCODE_6', 'KEYCODE_7', 'KEYCODE_8',
132+
'KEYCODE_9', 'KEYCODE_0',
133+
'KEYCODE_Q', 'KEYCODE_W', 'KEYCODE_E', 'KEYCODE_R', 'KEYCODE_T', 'KEYCODE_Y', 'KEYCODE_U', 'KEYCODE_I',
134+
'KEYCODE_O', 'KEYCODE_P',
135+
'KEYCODE_A', 'KEYCODE_S', 'KEYCODE_D', 'KEYCODE_F', 'KEYCODE_G', 'KEYCODE_H', 'KEYCODE_J', 'KEYCODE_K',
136+
'KEYCODE_L',
137+
'KEYCODE_DEL', 'KEYCODE_Z', 'KEYCODE_X', 'KEYCODE_C', 'KEYCODE_V', 'KEYCODE_B', 'KEYCODE_N', 'KEYCODE_M',
138+
'KEYCODE_.', 'KEYCODE_SPACE', 'KEYCODE_GO'
139+
]
140+
141+
for keyboard in _keyboardList:
142+
_cpb = ControlPanelButton(self.keyboardTab, self.culebron, self.printOperation, value=keyboard,
143+
text=keyboard[8:],
144+
width=Layout.BUTTON_WIDTH, bg=self.bg, fg=self.fg,
145+
highlightbackground=self.highlightbackground)
146+
147+
_cpb.configure(command=_cpb.command)
148+
_cpb.grid(column=self.childWindow.column, row=self.childWindow.row)
107149
self.tabLayout()
108150

109151
def tabLayout(self):

0 commit comments

Comments
 (0)