Ejemplo n.º 1
0
 def test_ascii_prompt(self):
     footer = MenuFooter(MenuStyle())
     mp = MenuPrompt(MenuStyle())
     for line in footer.generate():
         print(line)
     for line in mp.generate():
         print(line)
Ejemplo n.º 2
0
 def test_ascii_prompt_no_top_margin(self):
     # Set footer's bottom margin to 0 and prompt's top padding to 0 so prompt is touching bottom of menu.
     footer = MenuFooter(MenuStyle(margins=MenuMargins(0, 2, 0, 2)))
     mp = MenuPrompt(MenuStyle(padding=MenuPadding(0, 1, 1, 1)))
     for line in footer.generate():
         print(line)
     for line in mp.generate():
         print(line)
Ejemplo n.º 3
0
 def test_menu_prologue_unicodelight_long_text_big_margins(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(margins=MenuMargins(1, 8, 1, 8),
                                     border_style=LightBorderStyle()),
                           text=self.long_text)
     for line in pro.generate():
         print(line)
Ejemplo n.º 4
0
 def test_menu_prologue_unicodelight_long_text_default_margins_and_padding(
         self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()),
                           text=self.long_text)
     for line in pro.generate():
         print(line)
Ejemplo n.º 5
0
 def test_menu_prologue_unicodelight_centered(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()),
                           text="My centered prologue.",
                           text_align="center")
     for line in pro.generate():
         print(line)
Ejemplo n.º 6
0
 def test_menu_prologue_ascii_text_with_bottom_border(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(),
                           text="This is my really good prologue.",
                           show_bottom_border=True)
     for line in pro.generate():
         print(line)
Ejemplo n.º 7
0
 def test_menu_prologue_unicodelight_long_text_big_padding(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(padding=MenuPadding(2, 8, 2, 8),
                                     border_style=LightBorderStyle()),
                           text=self.long_text)
     for line in pro.generate():
         print(line)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 def test_menu_header_light_margins_t1_l4_b0_r4(self):
     print_screen_edge()
     header = MenuHeader(MenuStyle(margins=MenuMargins(1, 4, 0, 4),
                                   border_style=LightBorderStyle()),
                         title="My Title")
     for line in header.generate():
         print(line)
Ejemplo n.º 10
0
 def test_menu_prologue_ascii_no_text_with_both_borders(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(),
                           show_top_border=True,
                           show_bottom_border=True)
     for line in pro.generate():
         print(line)
Ejemplo n.º 11
0
 def test_menu_header_light_padding_t3_l4_b3_r4(self):
     print_screen_edge()
     header = MenuHeader(MenuStyle(padding=MenuPadding(3, 4, 3, 4),
                                   border_style=LightBorderStyle()),
                         title="My Title")
     for line in header.generate():
         print(line)
Ejemplo n.º 12
0
 def test_menu_header_ascii_no_subtitle(self):
     print_screen_edge()
     header = MenuHeader(
         MenuStyle(border_style_type=MenuBorderStyleType.ASCII_BORDER),
         title="My Title")
     for line in header.generate():
         print(line)
Ejemplo n.º 13
0
 def test_menu_header_ascii_title_centered(self):
     print_screen_edge()
     header = MenuHeader(
         MenuStyle(border_style_type=MenuBorderStyleType.ASCII_BORDER),
         title="My Centered Title",
         title_align='center')
     for line in header.generate():
         print(line)
Ejemplo n.º 14
0
 def test_menu_header_ascii_with_bottom_border(self):
     print_screen_edge()
     header = MenuHeader(
         MenuStyle(border_style_type=MenuBorderStyleType.ASCII_BORDER),
         title="My Title",
         subtitle="I Should Have a Bottom Border",
         show_bottom_border=True)
     for line in header.generate():
         print(line)
Ejemplo n.º 15
0
 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)
Ejemplo n.º 16
0
 def test_unicode_prompt_no_top_margin(self):
     # Set top padding to 0 so prompt is touching bottom of menu.
     style = MenuStyle(padding=MenuPadding(0, 2, 0, 2),
                       border_style=LightBorderStyle())
     footer = MenuFooter(style)
     mp = MenuPrompt(style, prompt_string=u"\u27EB")
     for line in footer.generate():
         print(line)
     for line in mp.generate():
         print(line)
Ejemplo n.º 17
0
 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
Ejemplo n.º 18
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)
Ejemplo n.º 19
0
 def test_menu_prologue_unicodelight(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()))
     for line in pro.generate():
         print(line)
Ejemplo n.º 20
0
 def test_menu_prologue_unicodelight_with_top_border(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()),
                           show_top_border=True)
     for line in pro.generate():
         print(line)
Ejemplo n.º 21
0
 def test_menu_footer_unicodelight(self):
     footer = MenuFooter(MenuStyle())
     for line in footer.generate():
         print(line)
     print_screen_edge()
Ejemplo n.º 22
0
 def test_menu_items_ascii_no_items(self):
     print_screen_edge()
     sect = MenuItemsSection(MenuStyle())
     for line in sect.generate():
         print(line)
Ejemplo n.º 23
0
 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)
Ejemplo n.º 24
0
 def test_menu_items_ascii(self):
     print_screen_edge()
     sect = MenuItemsSection(MenuStyle(), items=self.small_list)
     for line in sect.generate():
         print(line)
Ejemplo n.º 25
0
 def test_menu_header_light_no_subtitle(self):
     print_screen_edge()
     header = MenuHeader(MenuStyle(border_style=LightBorderStyle()),
                         title="My Title")
     for line in header.generate():
         print(line)
Ejemplo n.º 26
0
 def test_menu_footer_ascii_margins_t8_l8_b4_r8(self):
     footer = MenuFooter(MenuStyle(margins=MenuMargins(8, 8, 4, 8)))
     for line in footer.generate():
         print(line)
     print_screen_edge()
Ejemplo n.º 27
0
 def test_menu_prologue_unicodelight_long_text_set_via_property(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()))
     pro.text = self.long_text
     for line in pro.generate():
         print(line)
Ejemplo n.º 28
0
 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)
Ejemplo n.º 29
0
 def test_menu_prologue_ascii(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle())
     for line in pro.generate():
         print(line)