Пример #1
0
 def content(self):
     # fmt: off
     yield pyui.VStack(alignment=pyui.Alignment.LEADING)(
         pyui.Text("Enter some text below:"),
         pyui.TextField(self.line, placeholder="Single line text"),
         pyui.TextField(self.lines,
                        placeholder="Two line text input").lines(2),
         pyui.TextField(
             self.text,
             placeholder="All the text").lines(None).priority("high"),
         pyui.HStack()(
             pyui.Spacer(),
             pyui.Button("Submit", asset="button.primary"),
         ),
     ).padding(20)
Пример #2
0
 def content(self):
     # fmt: off
     yield pyui.VStack(alignment=pyui.Alignment.LEADING, spacing=5)(
         pyui.Text(self.lang),
         pyui.TextField(self.description,
                        "Description for {}".format(self.lang)),
     )
Пример #3
0
 def content(self):
     # fmt: off
     yield pyui.VStack(alignment=pyui.Alignment.LEADING)(
         pyui.HStack()(
             pyui.Toggle(self.items.all_complete, action=self.items.toggle_all),
             pyui.TextField(self.new_item, "What needs to be done?", action=self.add),
         ),
         pyui.ScrollView()(
             pyui.List(self.selected, builder=lambda item: (
                 pyui.HStack()(
                     pyui.Toggle(item.complete, label=item.text, action=(self.items.toggle, item))
                         .modify(ITEM_COMPLETE if item.complete else ITEM_ACTIVE),
                     pyui.Spacer(),
                     pyui.Button(action=(self.items.delete, item), asset=None)(
                         pyui.Icon("trash-alt")
                     ).font(size=12).padding(0)
                 )
             )),
         ).priority(pyui.Priority.HIGH),
         pyui.HStack(
             pyui.Text(self.remaining_text),
             pyui.Button(action=self.items.clear_complete, asset=None)(
                 pyui.Text("Clear Completed").color(60, 150, 255)
             ).padding(5).disable(not self.items.any_complete),
             pyui.Spacer(),
             # TODO: would be nice to pass SegmentedButton an enum?
             pyui.SegmentedButton(self.selected_filter)(
                 pyui.Text("All"),
                 pyui.Text("Active"),
                 pyui.Text("Completed"),
             ),
         )
     ).padding(20)
Пример #4
0
 def content(self):
     # fmt: off
     yield pyui.HStack()(
         pyui.TextField(self.current_text,
                        placeholder="Search icons",
                        action=self.search),
         pyui.Button("Search", action=self.search,
                     asset="button.primary").priority("high")).padding(10)
Пример #5
0
 def content(self):
     # fmt: off
     yield pyui.VStack()(pyui.TextField(self.text, placeholder="Some text"),
                         pyui.Picker(selection=self.selected)(
                             pyui.Text("Item One"),
                             pyui.Text("Item Two"),
                             pyui.Text("Item Three"),
                         )).padding(20)
Пример #6
0
 def content(self):
     # fmt: off
     fg = pyui.Environment(
         "text").color if self.language.value else sdl2.SDL_Color(
             150, 150, 150)
     yield pyui.VStack(spacing=20)(
         pyui.HStack()(
             pyui.TextField(self.language, "Add a new language"),
             pyui.Button(action=self.new_language)(pyui.Text(
                 "Add {}".format(self.language.value)).color(fg), ).disable(
                     self.language.value == ""),
             pyui.Spacer(),
         ),
         pyui.ForEach(self.languages.value, lambda lang:
                      (DescriptionView(lang=lang))),
     )