Skip to content

Commit d6f7f52

Browse files
committed
Fixed dump -f image type handling by extension
- Fixed `culebra` device art string when None
1 parent 6a759e1 commit d6f7f52

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

tools/culebra

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
2020
2121
'''
2222

23-
__version__ = '11.5.11'
23+
__version__ = '11.5.12'
2424

2525
import re
2626
import sys
@@ -657,7 +657,9 @@ def printTakeSnapshot(filename, _format, deviceart, dropshadow, screenglare):
657657
warnings.warn('Multi-device not implemented yet for this case')
658658
else:
659659
logAction(u'taking snapshot @ %s format=%s %s %s %s' % (filename, _format, deviceart, dropshadow, screenglare))
660-
print '%s%svc.writeImageToFile(\'%s\', \'%s\', \'%s\', %s, %s)' % (indent, prefix, filename, _format, deviceart, dropshadow, screenglare)
660+
if deviceart:
661+
deviceart = '\'%s\'' % deviceart
662+
print '%s%svc.writeImageToFile(\'%s\', \'%s\', %s, %s, %s)' % (indent, prefix, filename, _format, deviceart, dropshadow, screenglare)
661663

662664

663665
def traverseAndPrint(view):
@@ -967,11 +969,13 @@ def printLogAction(action, priority='D'):
967969
print u'%s[_d.Log.%s(TAG, "%s", _v) for _d in %sallDevices()]' % (indent, priority.lower(), action, prefix)
968970
else:
969971
print '%s%sdevice.Log.%s(TAG, "%s", _v)' % (indent, prefix, priority.lower(), action)
970-
972+
973+
971974
def logAction(action):
972975
if options[CulebraOptions.LOG_ACTIONS]:
973976
printLogAction(action)
974-
977+
978+
975979
def runCulebron():
976980
Culebron.checkSupportedSdkVersion(device.getSdkVersion())
977981
Culebron.checkDependencies()
@@ -982,7 +986,8 @@ def runCulebron():
982986
culebron.screenGlare = options[CulebraOptions.SCREEN_GLARE]
983987
culebron.takeScreenshotAndShowItOnWindow()
984988
culebron.mainloop()
985-
989+
990+
986991
def printShortcutVariables():
987992
if options[CulebraOptions.UNIT_TEST_CLASS] or options[CulebraOptions.UNIT_TEST_METHOD]:
988993
print '''\

tools/dump

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Created on Feb 3, 2012
66
@author: diego
77
'''
88

9-
__version__ = '11.5.11'
9+
__version__ = '11.5.12'
1010

1111
import sys
1212
import os
@@ -193,7 +193,11 @@ if options[DO_NOT_DUMP_VIEWS]:
193193
vc = ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2)
194194
if options[SAVE_SCREENSHOT]:
195195
vc.device.reconnect = True #(not options[DO_NOT_DUMP_VIEWS])
196-
vc.writeImageToFile(options[SAVE_SCREENSHOT], deviceart=options[DEVICE_ART], dropshadow=options[DROP_SHADOW], screenglare=options[SCREEN_GLARE])
196+
ext = os.path.splitext(options[SAVE_SCREENSHOT])[1][1:].upper()
197+
_format = ext
198+
if ext == 'JPG':
199+
_format = 'JPEG'
200+
vc.writeImageToFile(options[SAVE_SCREENSHOT], _format=_format, deviceart=options[DEVICE_ART], dropshadow=options[DROP_SHADOW], screenglare=options[SCREEN_GLARE])
197201
if not options[DO_NOT_DUMP_VIEWS] or options[SAVE_VIEW_SCREENSHOTS]:
198202
vc.dump(window=options[WINDOW])
199203
ViewClient.imageDirectory = options[SAVE_VIEW_SCREENSHOTS]

0 commit comments

Comments
 (0)