worthless-launcher/worthless/classes/launcher/info.py

29 lines
899 B
Python

from worthless.classes.launcher import background, banner, iconbutton, post
Background = background.Background
Banner = banner.Banner
IconButton = iconbutton.IconButton
Post = post.Post
class Info:
def __init__(self, lc_background: Background, lc_banner: list[Banner], icon: list[IconButton], lc_post: list[Post]):
self.background = lc_background
self.banner = lc_banner
self.icon = icon
self.post = lc_post
@staticmethod
def from_dict(data):
bg = Background.from_dict(data["adv"])
lc_banner = []
for b in data["banner"]:
lc_banner.append(Banner.from_dict(b))
lc_icon = []
for i in data["icon"]:
lc_icon.append(IconButton.from_dict(i))
lc_post = []
for p in data["post"]:
lc_post.append(Post.from_dict(p))
return Info(bg, lc_banner, lc_icon, lc_post)