Skip to content

Commit

Permalink
culebra snapshot improvements
Browse files Browse the repository at this point in the history
- Use env vars for snapshot dir and format
  • Loading branch information
dtmilano committed Sep 4, 2023
1 parent 3187905 commit a38b8db
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
build/
dist/
**/*.egg-info/*
tmp/

# idea #
########
Expand Down
3 changes: 2 additions & 1 deletion .idea/AndroidViewClient.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/com/dtmilano/android/culebron.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from com.dtmilano.android.uiautomator.uiautomatorhelper import UiAutomatorHelper
from com.dtmilano.android.viewclient import ViewClient, View, VERSION_SDK_PROPERTY

__version__ = '22.5.1'
__version__ = '22.6.0'

import sys
import threading
Expand Down Expand Up @@ -95,7 +95,7 @@
DEBUG_MOVE = DEBUG and False
DEBUG_TOUCH = DEBUG and False
DEBUG_POINT = DEBUG and False
DEBUG_KEY = DEBUG and False or True
DEBUG_KEY = DEBUG and False or False
DEBUG_ISCCOF = DEBUG and False
DEBUG_FIND_VIEW = DEBUG and False
DEBUG_CONTEXT_MENU = DEBUG and False
Expand Down Expand Up @@ -216,8 +216,8 @@ class Culebron:
isLongTouchingPoint = False
isLongTouchingView = False
onTouchListener = None
snapshotDir = '/tmp'
snapshotFormat = 'PNG'
snapshotDir = os.environ.get("CULEBRA_SNAPSHOT_DIR", "/tmp")
snapshotFormat = os.environ.get("CULEBRA_SNAPSHOT_FORMAT", "PNG")
deviceArt = None
dropShadow = False
screenGlare = False
Expand Down Expand Up @@ -370,7 +370,11 @@ def takeScreenshotAndShowItOnWindow(self):
if self.vc.uiAutomatorHelper:
if TIMING:
t0 = time.time()
self.vc.uiAutomatorHelper.ui_device.wait_for_window_update()
try:
self.vc.uiAutomatorHelper.ui_device.wait_for_window_update()
except RuntimeError as e:
if DEBUG:
print(f"ERROR: {e} waiting for windows update", file=sys.stderr)
if TIMING:
print(f"# takeScreenshotAndShowItOnWindow: waiting for window update: {time.time() - t0:.2f}s")
t0 = time.time()
Expand Down
6 changes: 3 additions & 3 deletions tools/culebra
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013-2022 Diego Torres Milano
Copyright (C) 2013-2023 Diego Torres Milano
Created on Mar 28, 2013
Culebra helps you create AndroidViewClient scripts generating a working template that can be
Expand All @@ -27,7 +27,7 @@ import textwrap
import culebratester_client
from culebratester_client import WindowHierarchy

__version__ = '22.5.1'
__version__ = '22.6.0'

import calendar
import codecs
Expand Down Expand Up @@ -1273,7 +1273,7 @@ def printScriptHeader():
print(f'''{getShebangJar()}
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013-2022 Diego Torres Milano
Copyright (C) 2013-2023 Diego Torres Milano
Created on {date.today()} by Culebra v{__version__}
__ __ __ __
/ \ / \ / \ / \
Expand Down

0 comments on commit a38b8db

Please sign in to comment.