def test_menu_items_ascii_margins_and_padding(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(margins=MenuMargins(2, 8, 2, 8), padding=MenuPadding(1, 8, 1, 8)), items=self.small_list) for line in sect.generate(): print(line)
def test_show_top_border_for_items(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(border_style=LightBorderStyle()), items=self.large_list) sect.show_item_top_border('menu_item_4', True) sect.show_item_top_border('menu_item_8', True) sect.show_item_top_border('menu_item_12', True) for line in sect.generate(): print(line)
def __init__(self, max_dimension=None): if max_dimension is None: max_dimension = Dimension(width=80, height=40) self.__max_dimension = max_dimension self.__border_style_factory = MenuBorderStyleFactory() self.__header = MenuHeader(menu_style=MenuStyle(), max_dimension=max_dimension) self.__prologue = MenuTextSection(menu_style=MenuStyle(), max_dimension=max_dimension) self.__items_section = MenuItemsSection(menu_style=MenuStyle(), max_dimension=max_dimension) self.__epilogue = MenuTextSection(menu_style=MenuStyle(), max_dimension=max_dimension) self.__footer = MenuFooter(menu_style=MenuStyle(), max_dimension=max_dimension) self.__prompt = MenuPrompt(menu_style=MenuStyle(), max_dimension=max_dimension) # Indent items deeper than other sections self.__items_section.style.padding.left = 3 # Change default top border of prompt to 0, so it hugs the bottom of the menu self.__prompt.style.padding.top = 0
def test_show_both_borders_for_items_then_disable_borders(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(border_style=LightBorderStyle()), items=self.large_list) sect.show_item_top_border('menu_item_4', True) sect.show_item_bottom_border('menu_item_4', True) sect.show_item_top_border('menu_item_8', True) sect.show_item_bottom_border('menu_item_8', True) sect.show_item_top_border('menu_item_12', True) sect.show_item_bottom_border('menu_item_12', True) print("This should show top and bottom borders on items 4, 8, and 12") for line in sect.generate(): print(line) sect.show_item_top_border('menu_item_4', False) sect.show_item_bottom_border('menu_item_4', False) sect.show_item_top_border('menu_item_8', False) sect.show_item_bottom_border('menu_item_8', False) sect.show_item_top_border('menu_item_12', False) sect.show_item_bottom_border('menu_item_12', False) print("This should not show any borders on any item") for line in sect.generate(): print(line)
def test_menu_items_unicodelight(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(border_style=LightBorderStyle()), items=self.small_list) for line in sect.generate(): print(line)
def test_menu_items_ascii_padding_large_list(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(padding=MenuPadding(1, 4, 1, 4)), items=self.large_list) for line in sect.generate(): print(line)
def test_menu_items_ascii(self): print_screen_edge() sect = MenuItemsSection(MenuStyle(), items=self.small_list) for line in sect.generate(): print(line)
def test_menu_items_ascii_no_items(self): print_screen_edge() sect = MenuItemsSection(MenuStyle()) for line in sect.generate(): print(line)