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

49 lines
1.7 KiB
Python
Raw Normal View History

from worthless.classes.launcher import background, banner, iconbutton, post, qq
2022-01-29 16:32:38 +00:00
Background = background.Background
Banner = banner.Banner
IconButton = iconbutton.IconButton
Post = post.Post
QQ = qq.QQ
2022-01-29 16:32:38 +00:00
class Info:
"""Contains the launcher information
2022-02-15 19:58:48 +00:00
Note that I, myself doesn't use QQ so if you encounter any issues, please open a new issue
or better a PR to fix that problem.
Attributes:
- :class:`worthless.classes.launcher.background.Background` background: The launcher background information.
- :class:`worthless.classes.launcher.banner.Banner` banner: The launcher banner information.
- :class:`worthless.classes.launcher.iconbutton.IconButton` icon: The launcher icon buttons information.
- :class:`worthless.classes.launcher.qq.QQ` post: The launcher QQ posts information.
- :class:`dict` raw: The launcher raw information.
"""
def __init__(self, lc_background: Background, lc_banner: list[Banner], icon: list[IconButton], lc_post: list[Post],
lc_qq: list[QQ], raw: dict):
2022-01-29 16:32:38 +00:00
self.background = lc_background
self.banner = lc_banner
self.icon = icon
self.post = lc_post
self.qq = lc_qq
self.raw = raw
2022-01-29 16:32:38 +00:00
@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))
lc_qq = []
for q in data["qq"]:
lc_qq.append(QQ.from_dict(q))
return Info(bg, lc_banner, lc_icon, lc_post, lc_qq, data)
2022-01-29 16:32:38 +00:00