2525from .abstract_components import Serializable
2626from .utils import check_type
2727from .options import BlockElementHeight , Spacing
28+ from .actions import OpenUrl , ShowCard , Submit
2829
2930class MediaSource (Serializable ):
3031 """Defines the source of a Media element."""
@@ -76,7 +77,7 @@ def __init__(self,
7677 check_type (separator , bool , False , True )
7778 check_type (spacing , Spacing , False , True )
7879 check_type (id , str , False , True )
79-
80+
8081 self .type = "Media"
8182 self .sources = sources #Needs to be a list of media sources
8283 self .poster = poster
@@ -92,6 +93,8 @@ def __init__(self,
9293 'separator' , 'spacing' , 'id'
9394 ])
9495class Image (Serializable ):
96+ """Displays a image object"""
97+
9598 def __init__ (self ,
9699 url ,
97100 altText = None ,
@@ -105,6 +108,38 @@ def __init__(self,
105108 seperator = None ,
106109 spacing = None ,
107110 id = None ):
111+ """Create a new image component
112+
113+ Args:
114+ url(str): The URL to the image
115+ altText(str): Alternative text describing the image
116+ backgroundColor(str): Background color for transparent images.
117+ height(str, BlockElementHeight): Height of the image either as a
118+ pixel value(i.e. '50px') or as an instance of BlockElementHeight
119+ horizontalAlignmnet(HorizontalAlignment): Controls how the component
120+ is positioned within its parent.
121+ selectAction(OpenUrl, Submit): Option that is caried out when the
122+ card is selected.
123+ size(ImageSize): Controls the approximate size of the image.
124+ style(ImageStyle): The display style of this image.
125+ width(str): Width of the image as a pixel value (i.e. '50px')
126+ separator(bool): Draw a separating line when set to true
127+ spacing(Spacing): Specify the spacing of this component
128+ id(str): The id of this component
129+
130+ """
131+ check_type (url , str , False , False )
132+ check_type (altText , str , False , True )
133+ check_type (backgroundColor , str , False , True )
134+ check_type (height , (str , BlockElementHeight ), False , True )
135+ check_type (horizontalAlignment , horizontalAlignment , False , True )
136+ check_type (selectAction , (OpenUrl , Submit ), False , True )
137+ check_type (size , ImageSize , False , True )
138+ check_type (style , ImageStyle , False , True )
139+ check_style (width , str , False , True )
140+ check_style (separator , bool , False , True )
141+ check_style (spacing , Spacing , False , True )
142+ check_style (id , str , False , True )
108143
109144 self .type = "Image"
110145 self .url = url
0 commit comments