def __init__(self, spec):
super().__init__()
self.present('full_screen', hide_title_bar=True)
spec.append(('Cancel', None))
menu_content_height = len(spec) * (self.button_height + self.button_gap)
self.menu_height = min(menu_content_height, self.menu_max_height)
self.btns = []
for (i, (action_title, action_func)) in enumerate(spec):
action_wrapper = functools.partial(self.func_wrapper, action_func)
bg_color = '#e9e1e1' if action_func else '#4e4b4b'
tnt_color = 'black' if action_func else 'white'
btn = ui.Button(
title=action_title,
action=action_wrapper,
tint_color=tnt_color,
background_color=bg_color,
corner_radius=5
)
self.add_subview(btn)
self.btns.append(btn)
评论列表
文章目录