quickinfo: show all images for a material
This commit is contained in:
@ -60,19 +60,34 @@ class ProductImage:
|
||||
'T', 'TL', 'PACK', 'F', 'B', 'INT', 'ALT_INT', 'FLR',
|
||||
'FRONT', 'BACK']
|
||||
|
||||
# @staticmethod
|
||||
# def get_image_path(sap, image_format):
|
||||
# for view in ProductImage.VIEW_TYPES:
|
||||
# path = os.path.join(ProductImage.THUMB_DIR,
|
||||
# '{}_{}-{}'.format(sap, view, image_format.value))
|
||||
# if os.path.isfile(path):
|
||||
# return path
|
||||
|
||||
@staticmethod
|
||||
def get_image_path(sap, image_format):
|
||||
def get_all_image_paths(sap, image_format):
|
||||
paths = []
|
||||
for view in ProductImage.VIEW_TYPES:
|
||||
path = os.path.join(ProductImage.THUMB_DIR,
|
||||
'{}_{}-{}'.format(sap, view, image_format.value))
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
paths.append(path)
|
||||
return paths
|
||||
|
||||
# @staticmethod
|
||||
# def get_image_url(sap, image_format):
|
||||
# path = ProductImage.get_image_path(sap, image_format)
|
||||
# if path:
|
||||
# return path.replace(ProductImage.THUMB_DIR, ProductImage.THUMB_URL)
|
||||
|
||||
@staticmethod
|
||||
def get_image_url(sap, image_format):
|
||||
path = ProductImage.get_image_path(sap, image_format)
|
||||
if path:
|
||||
return path.replace(ProductImage.THUMB_DIR, ProductImage.THUMB_URL)
|
||||
def get_all_image_urls(sap, image_format):
|
||||
paths = ProductImage.get_all_image_paths(sap, image_format)
|
||||
return [p.replace(ProductImage.THUMB_DIR, ProductImage.THUMB_URL) for p in paths]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user