|
| 1 | +from .abstract_components import Serializable |
| 2 | + |
| 3 | +class MediaSource(Serializable): |
| 4 | + def __init__(self, |
| 5 | + mimeType, |
| 6 | + url): |
| 7 | + self.mimeType = mimeType |
| 8 | + self.url = url |
| 9 | + |
| 10 | + super().__init__(serializable_properties=[], |
| 11 | + simple_properties=['mimeType', 'url']) |
| 12 | + |
| 13 | +class Media(Serializable): |
| 14 | + def __init__(self, |
| 15 | + sources, |
| 16 | + poster=None, |
| 17 | + altText=None, |
| 18 | + height=None, |
| 19 | + separator=None, |
| 20 | + spacing=None, |
| 21 | + id=None): |
| 22 | + self.type = "Media" |
| 23 | + self.sources = sources #Needs to be a list of media sources |
| 24 | + self.poster = poster |
| 25 | + self.altText = altText |
| 26 | + self.height = height |
| 27 | + self.separator = separator |
| 28 | + self.spacing = spacing |
| 29 | + self.id = id |
| 30 | + |
| 31 | + super().__init__(serializable_properties=['sources'], |
| 32 | + simple_properties=[ |
| 33 | + 'type', 'poster', 'altText', 'height', |
| 34 | + 'separator', 'spacing', 'id' |
| 35 | + ]) |
| 36 | +class Image(Serializable): |
| 37 | + def __init__(self, |
| 38 | + url, |
| 39 | + altText=None, |
| 40 | + backgroundColor=None, |
| 41 | + height=None, |
| 42 | + horizontalAlignment=None, |
| 43 | + selectAction=None, |
| 44 | + size=None, |
| 45 | + style=None, |
| 46 | + width=None, |
| 47 | + seperator=None, |
| 48 | + spacing=None, |
| 49 | + id=None): |
| 50 | + |
| 51 | + self.type = "Image" |
| 52 | + self.url = url |
| 53 | + self.altText = altText |
| 54 | + self.backgroundColor = backgroundColor |
| 55 | + self.height = height |
| 56 | + self.horizontalAlignment = horizontalAlignment |
| 57 | + self.selectAction = selectAction |
| 58 | + self.size = size |
| 59 | + self.style = style |
| 60 | + self.width = width |
| 61 | + self.seperator = seperator |
| 62 | + self.spacing = spacing |
| 63 | + self.id = id |
| 64 | + |
| 65 | + super().__init__(serializable_properties=[], |
| 66 | + simple_properties=[ |
| 67 | + 'type', 'url', 'altText', 'backgroundColor', |
| 68 | + 'height', 'horizontalAlignment', 'selectAction', |
| 69 | + 'size', 'style', 'width', 'separator', 'spacing', |
| 70 | + 'id' |
| 71 | + ]) |
| 72 | +class TextBlock(Serializable): |
| 73 | + def __init__(self, |
| 74 | + text, |
| 75 | + color=None, |
| 76 | + horizontalAlignment=None, |
| 77 | + isSubtle=None, |
| 78 | + maxLines=None, |
| 79 | + size=None, |
| 80 | + weight=None, |
| 81 | + wrap=None, |
| 82 | + separator=None, |
| 83 | + spacing=None, |
| 84 | + id=None): |
| 85 | + |
| 86 | + |
| 87 | + #ToDo(mneiding): Type check |
| 88 | + self.type = "TextBlock" |
| 89 | + self.text = text |
| 90 | + self.color = color |
| 91 | + self.horizontalAlignment = horizontalAlignment |
| 92 | + self.isSubtle = isSubtle |
| 93 | + self.maxLines = maxLines |
| 94 | + self.size = size |
| 95 | + self.weight = weight |
| 96 | + self.wrap = wrap |
| 97 | + self.separator = separator |
| 98 | + self.spacing = spacing |
| 99 | + self.id = id |
| 100 | + |
| 101 | + super().__init__(serializable_properties=[], |
| 102 | + simple_properties=[ |
| 103 | + 'type', 'text', 'color', 'horizontalAlignment', |
| 104 | + 'isSubtle', 'maxLines', 'size', 'weight', 'wrap', |
| 105 | + 'spacing', 'id', 'separator' |
| 106 | + ]) |
| 107 | +class Column(Serializable): |
| 108 | + def __init__(self, items=None, |
| 109 | + separator=None, |
| 110 | + spacing=None, |
| 111 | + selectAction=None, |
| 112 | + style=None, |
| 113 | + verticalContentAlignment=None, |
| 114 | + width=None, |
| 115 | + id=None): |
| 116 | + self.type = "Column" |
| 117 | + self.items = items |
| 118 | + self.separator = separator |
| 119 | + self.spacing = spacing |
| 120 | + self.selectAction = selectAction |
| 121 | + self.style = style |
| 122 | + self.verticalContentAlignment = verticalContentAlignment |
| 123 | + self.width = width |
| 124 | + self.id = id |
| 125 | + |
| 126 | + super().__init__(serializable_properties=['items'], |
| 127 | + simple_properties=[ |
| 128 | + 'type', 'separator', 'spacing', 'selectAction', |
| 129 | + 'style', 'verticalContentAlignment', 'width', 'id' |
| 130 | + ]) |
| 131 | + |
| 132 | +class Fact(Serializable): |
| 133 | + def __init__(self, title, value): |
| 134 | + self.title = title |
| 135 | + self.value = value |
| 136 | + |
| 137 | + super().__init__(serializable_properties=[], |
| 138 | + simple_properties=['title', 'value']) |
| 139 | + |
| 140 | +class Choice(Serializable): |
| 141 | + def __init__(self, title, value): |
| 142 | + self.title = title |
| 143 | + self.value = value |
| 144 | + |
| 145 | + super().__init__(serializable_properties=[], |
| 146 | + simple_properties=['title', 'value']) |
0 commit comments