Пример #1
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
Пример #2
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)
Пример #3
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)
Пример #4
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)
Пример #5
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)
Пример #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)
Пример #7
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)
Пример #8
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)
Пример #9
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)
Пример #10
0
 def test_menu_prologue_unicodelight(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle(border_style=LightBorderStyle()))
     for line in pro.generate():
         print(line)
Пример #11
0
 def test_menu_prologue_ascii(self):
     print_screen_edge()
     pro = MenuTextSection(MenuStyle())
     for line in pro.generate():
         print(line)