Skip to content

Commit 68c4fce

Browse files
committed
Device art defaults to phone if 'auto' and not found
1 parent 27d3be7 commit 68c4fce

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

src/com/dtmilano/android/viewclient.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@author: Diego Torres Milano
1919
'''
2020

21-
__version__ = '10.3.1'
21+
__version__ = '10.3.2'
2222

2323
import sys
2424
import warnings
@@ -3635,6 +3635,13 @@ def writeImageToFile(self, filename, _format="PNG", deviceart=None, dropshadow=T
36353635
elif hardware == 'mt5861':
36363636
deviceart = 'tv_1080p'
36373637

3638+
SUPPORTED_DEVICES = ['nexus_5', 'nexus_4', 'nexus_7', 'tv_1080p']
3639+
if deviceart not in SUPPORTED_DEVICES:
3640+
warnings.warn("Only %s is supported now, more devices coming soon" % SUPPORTED_DEVICES)
3641+
if deviceart == 'auto':
3642+
# it wasn't detected yet, let's assume generic phone
3643+
deviceart = 'phone'
3644+
36383645
if deviceart == 'nexus_5':
36393646
if orientationName == 'port':
36403647
screenPos = (144, 195)
@@ -3654,13 +3661,15 @@ def writeImageToFile(self, filename, _format="PNG", deviceart=None, dropshadow=T
36543661
screenPos = (85, 59)
36553662
orientationName = ''
36563663
separator = ''
3664+
elif deviceart == 'phone':
3665+
if orientationName == 'port':
3666+
screenPos = (113, 93)
3667+
else:
3668+
screenPos = (141, 36)
36573669

3658-
SUPPORTED_DEVICES = ['nexus_5', 'nexus_4', 'nexus_7', 'tv_1080p']
3659-
if deviceart not in SUPPORTED_DEVICES:
3660-
warnings.warn("Only %s is supported now, more devices coming soon" % SUPPORTED_DEVICES)
3661-
if not os.path.isdir(deviceArtDir + '/' + deviceart):
3662-
warnings.warn("Cannot find device art for " + deviceart + ' at ' + deviceArtDir + '/' + deviceart)
36633670
deviceArtModelDir = deviceArtDir + '/' + deviceart
3671+
if not os.path.isdir(deviceArtModelDir):
3672+
warnings.warn("Cannot find device art for " + deviceart + ' at ' + deviceArtModelDir)
36643673
try:
36653674
from PIL import Image
36663675
if dropshadow:

0 commit comments

Comments
 (0)