Skip to content

Commit a38b8db

Browse files
committed
culebra snapshot improvements
- Use env vars for snapshot dir and format
1 parent 3187905 commit a38b8db

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
build/
1818
dist/
1919
**/*.egg-info/*
20+
tmp/
2021

2122
# idea #
2223
########

.idea/AndroidViewClient.iml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/culebra__GUh.xml renamed to .idea/runConfigurations/culebra__Guh__o_tmp_c_py.xml

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

src/com/dtmilano/android/culebron.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from com.dtmilano.android.uiautomator.uiautomatorhelper import UiAutomatorHelper
3939
from com.dtmilano.android.viewclient import ViewClient, View, VERSION_SDK_PROPERTY
4040

41-
__version__ = '22.5.1'
41+
__version__ = '22.6.0'
4242

4343
import sys
4444
import threading
@@ -95,7 +95,7 @@
9595
DEBUG_MOVE = DEBUG and False
9696
DEBUG_TOUCH = DEBUG and False
9797
DEBUG_POINT = DEBUG and False
98-
DEBUG_KEY = DEBUG and False or True
98+
DEBUG_KEY = DEBUG and False or False
9999
DEBUG_ISCCOF = DEBUG and False
100100
DEBUG_FIND_VIEW = DEBUG and False
101101
DEBUG_CONTEXT_MENU = DEBUG and False
@@ -216,8 +216,8 @@ class Culebron:
216216
isLongTouchingPoint = False
217217
isLongTouchingView = False
218218
onTouchListener = None
219-
snapshotDir = '/tmp'
220-
snapshotFormat = 'PNG'
219+
snapshotDir = os.environ.get("CULEBRA_SNAPSHOT_DIR", "/tmp")
220+
snapshotFormat = os.environ.get("CULEBRA_SNAPSHOT_FORMAT", "PNG")
221221
deviceArt = None
222222
dropShadow = False
223223
screenGlare = False
@@ -370,7 +370,11 @@ def takeScreenshotAndShowItOnWindow(self):
370370
if self.vc.uiAutomatorHelper:
371371
if TIMING:
372372
t0 = time.time()
373-
self.vc.uiAutomatorHelper.ui_device.wait_for_window_update()
373+
try:
374+
self.vc.uiAutomatorHelper.ui_device.wait_for_window_update()
375+
except RuntimeError as e:
376+
if DEBUG:
377+
print(f"ERROR: {e} waiting for windows update", file=sys.stderr)
374378
if TIMING:
375379
print(f"# takeScreenshotAndShowItOnWindow: waiting for window update: {time.time() - t0:.2f}s")
376380
t0 = time.time()

tools/culebra

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
"""
4-
Copyright (C) 2013-2022 Diego Torres Milano
4+
Copyright (C) 2013-2023 Diego Torres Milano
55
Created on Mar 28, 2013
66
77
Culebra helps you create AndroidViewClient scripts generating a working template that can be
@@ -27,7 +27,7 @@ import textwrap
2727
import culebratester_client
2828
from culebratester_client import WindowHierarchy
2929

30-
__version__ = '22.5.1'
30+
__version__ = '22.6.0'
3131

3232
import calendar
3333
import codecs
@@ -1273,7 +1273,7 @@ def printScriptHeader():
12731273
print(f'''{getShebangJar()}
12741274
# -*- coding: utf-8 -*-
12751275
"""
1276-
Copyright (C) 2013-2022 Diego Torres Milano
1276+
Copyright (C) 2013-2023 Diego Torres Milano
12771277
Created on {date.today()} by Culebra v{__version__}
12781278
__ __ __ __
12791279
/ \ / \ / \ / \

0 commit comments

Comments
 (0)