示例#1
0
 def __init__(self, app, msg, cb):
     self.app = app
     self.msg = msg
     self.cb = cb
     _pile = [
         Padding.center_60(Instruction("LXD Configuration is required")),
         Padding.center_60(HR()),
         Padding.center_60(self.build_info()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
示例#2
0
    def _build_widget(self):
        total_items = [Padding.center_60(HR())]
        for spell in self.spells:
            total_items.append(
                Padding.center_60(
                    Color.body(menu_btn(label=spell['name'],
                                        on_press=self.submit,
                                        user_data=spell),
                               focus_map='menu_button focus')))

        total_items.append(Padding.center_60(HR()))
        total_items.append(Padding.center_20(self._build_buttons()))
        return Filler(Pile(total_items), valign='top')
示例#3
0
 def __init__(self, app, cloud, schema, cb):
     self.app = app
     self.cloud = cloud
     self.input_items = schema
     self.cb = cb
     _pile = [
         Padding.center_60(Instruction(
             "Enter your {} credentials:".format(self.cloud.upper()))),
         Padding.center_60(HR()),
         Padding.center_60(self.build_inputs()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="top"))
示例#4
0
    def _build_widget(self):
        total_items = [
            Padding.center_60(Instruction("Choose a Cloud")),
            Padding.center_60(HR())
        ]
        for item in self.clouds:
            total_items.append(
                Padding.center_60(
                    Color.body(menu_btn(label=item, on_press=self.submit),
                               focus_map='menu_button focus')))

        total_items.append(Padding.center_60(HR()))
        total_items.append(Padding.center_20(self._build_buttons()))
        return Filler(Pile(total_items), valign='top')
示例#5
0
 def __init__(self, app, msg, cb):
     self.app = app
     self.msg = msg
     self.cb = cb
     _pile = [
         Padding.center_60(Instruction(
             "Please configure networking for LXD"
         )),
         Padding.center_60(HR()),
         Padding.center_60(self.build_info()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
示例#6
0
 def _build_widget(self):
     total_items = [
         Padding.center_60(Text(self.title, align="center")),
         Padding.center_60(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))
     ]
     for item in self.radio_items.keys():
         opt = self.radio_items[item]
         col = Columns([opt])
         total_items.append(Padding.center_60(col))
     total_items.append(
         Padding.center_60(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)))
     total_items.append(Padding.center_20(self._build_buttons()))
     return Filler(Pile(total_items), valign='middle')
示例#7
0
 def __init__(self, app, cb):
     self.app = app
     self.input_items = NETWORK
     self.cb = cb
     _pile = [
         # Padding.center_60(Instruction(
         #     "Enter LXD information:")),
         Padding.center_60(
             Instruction("Please configure networking for LXD")),
         Padding.center_60(HR()),
         Padding.center_60(self.build_info()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
 def _build_widget(self):
     total_items = [
         Padding.center_60(Text(self.title, align="center")),
         Padding.center_60(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))
     ]
     for item in self.radio_items.keys():
         opt = self.radio_items[item]
         col = Columns([opt])
         total_items.append(Padding.center_60(col))
     total_items.append(
         Padding.center_60(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)))
     total_items.append(Padding.center_20(self._build_buttons()))
     return Filler(Pile(total_items), valign='middle')
示例#9
0
    def _build_widget(self):
        total_items = [HR()]
        total_items += [spell for spell in self.spells]
        total_items += [HR()]

        self.pile = Pile(total_items)
        return Padding.center_60(Filler(self.pile, valign='top'))
示例#10
0
    def _build_widget(self):
        total_items = [HR()]
        total_items += [spell for spell in self.spells]
        total_items += [HR()]

        self.pile = Pile(total_items)
        return Padding.center_60(Filler(self.pile, valign="top"))
示例#11
0
 def __init__(self, app, cb):
     self.app = app
     self.input_items = NETWORK
     self.cb = cb
     _pile = [
         # Padding.center_60(Instruction(
         #     "Enter LXD information:")),
         Padding.center_60(Instruction(
             "Please configure networking for LXD"
         )),
         Padding.center_60(HR()),
         Padding.center_60(self.build_info()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
示例#12
0
    def _build_widget(self):
        total_items = [
            Padding.center_60(HR())
        ]
        for spell in self.spells:
            total_items.append(Padding.center_60(
                Color.body(
                    menu_btn(label=spell,
                             on_press=self.submit),
                    focus_map='menu_button focus'
                )
            ))

        total_items.append(
            Padding.center_60(HR()))
        total_items.append(Padding.center_20(self._build_buttons()))
        return Filler(Pile(total_items), valign='top')
示例#13
0
    def _build_widget(self):
        total_items = [
            Padding.center_60(Instruction("Choose a Cloud")),
            Padding.center_60(HR())
        ]
        for item in self.clouds:
            total_items.append(Padding.center_60(
                Color.body(
                    menu_btn(label=item,
                             on_press=self.submit),
                    focus_map='menu_button focus'
                )
            ))

        total_items.append(
            Padding.center_60(HR()))
        total_items.append(Padding.center_20(self._build_buttons()))
        return Filler(Pile(total_items), valign='top')
示例#14
0
 def _build_widget(self):
     rows = [
         Columns([('fixed', 23, self.field_labels), self.fields]),
     ]
     if self.error:
         rows.extend([
             Padding.line_break(""),
             Color.error_major(Text(" {}".format(self.error))),
         ])
     return Padding.center_60(Filler(Pile(rows), valign='top'))
示例#15
0
 def _build_footer(self):
     self.spell_description = Text("")
     footer_pile = Pile([
         Padding.center_60(self.spell_description),
         Padding.line_break(""),
         Color.frame_footer(
             Columns([('fixed', 2, Text("")),
                      ('fixed', 13, self._build_buttons())]))
     ])
     return footer_pile
示例#16
0
 def _build_footer(self):
     self.spell_description = Text("")
     footer_pile = Pile(
         [
             Padding.center_60(self.spell_description),
             Padding.line_break(""),
             Color.frame_footer(Columns([("fixed", 2, Text("")), ("fixed", 13, self._build_buttons())])),
         ]
     )
     return footer_pile
示例#17
0
    def validate(self):
        """ Will provide an error text if any fields are blank
        """
        values = [i.value for i in self.input_items.values()
                  if isinstance(i, StringEditor)]

        if None in values:
            self.pile.contents[-1] = (
                Padding.center_60(
                    Color.error_major(
                        Text("Please fill all required fields."))),
                self.pile.options())
            return False
        return True
示例#18
0
 def _build_footer(self):
     return Pile([
         Padding.center_60(
             Text('Enter your Ubuntu SSO (Launchpad) email address and '
                  'password.  If you have Two-Factor Authentication (2FA) '
                  'enabled, enter that as well, otherwise leave that field '
                  'blank.  For more information about 2FA, see: '
                  'https://help.ubuntu.com/community/SSO/FAQs/2FA')),
         Padding.line_break(""),
         Color.frame_footer(Pile([
             Padding.line_break(""),
             self.buttons,
         ])),
     ])
示例#19
0
    def validate(self):
        """ Will provide an error text if any fields are blank
        """
        values = [
            i.value for i in self.input_items.values()
            if isinstance(i, StringEditor)
        ]

        if None in values:
            self.pile.contents[-1] = (Padding.center_60(
                Color.error_major(Text("Please fill all required fields."))),
                                      self.pile.options())
            return False
        return True
示例#20
0
 def _build_footer(self):
     footer_pile = Pile([
         Padding.center_60(
             Text(
                 'The controller is what allows Juju to deploy and manage your '
                 'models/spells.  With JaaS, the controller will be managed '
                 'for you, so that you can focus on your applications and '
                 'solutions. Alternatively, you can host and manage your own '
                 'controller on the cloud to which you deploy.')),
         Padding.line_break(""),
         Color.frame_footer(
             Columns([('fixed', 2, Text("")),
                      ('fixed', 13, self._build_buttons())]))
     ])
     return footer_pile
示例#21
0
 def __init__(self, error):
     body = [
         Padding.center_60(
             Text("Oops, there was a problem with your install:",
                  align="center")),
         Padding.center_95(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)),
         Padding.center_85(Text("Reason:")),
         Padding.center_80(Color.error_major(Text(error))),
         Padding.line_break(""),
         Padding.line_break(""),
         Padding.center_95(
             Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)),
         Padding.center_20(self._build_buttons())
     ]
     super().__init__(Filler(Pile(body), valign="middle"))
示例#22
0
    def _build_widget(self):
        total_items = [HR()]
        prev_cat = None
        for category, spell in self.spells:
            if category == "_unassigned_spells":
                category = "other"
            if category != prev_cat:
                if prev_cat:
                    total_items.append(Text(""))
                total_items.append(Color.label(Text(category)))
                prev_cat = category
            total_items.append(SpellPickerWidget(spell, self.submit))
        total_items += [HR()]

        self.pile = Pile(total_items)
        return Padding.center_60(Filler(self.pile, valign='top'))
示例#23
0
 def _build_widget(self):
     total_items = [
         Text("Enter your {} credentials:".format(self.cloud.upper()))
     ]
     total_items += [HR()]
     for k in self.input_items.keys():
         display = k
         if k.startswith('_'):
             # Don't treat 'private' keys as input
             continue
         if k.startswith('@'):
             # Strip public, not storable attribute
             display = k[1:]
         col = Columns([('weight', 0.5, Text(display, align='right')),
                        Color.string_input(self.input_items[k],
                                           focus_map='string_input focus')],
                       dividechars=1)
         total_items.append(col)
         total_items.append(Padding.line_break(""))
     total_items.append(Text(""))
     self.pile = Pile(total_items)
     return Padding.center_60(Filler(self.pile, valign="top"))
示例#24
0
 def _build_widget(self):
     total_items = [Text(
         "Enter your {} credentials:".format(self.cloud.upper()))]
     total_items += [HR()]
     for k in self.input_items.keys():
         display = k
         if k.startswith('_'):
             # Don't treat 'private' keys as input
             continue
         if k.startswith('@'):
             # Strip public, not storable attribute
             display = k[1:]
         col = Columns(
             [
                 ('weight', 0.5, Text(display, align='right')),
                 Color.string_input(self.input_items[k],
                                    focus_map='string_input focus')
             ], dividechars=1
         )
         total_items.append(col)
         total_items.append(Padding.line_break(""))
     total_items.append(Text(""))
     self.pile = Pile(total_items)
     return Padding.center_60(Filler(self.pile, valign="top"))
示例#25
0
 def _build_widget(self):
     total_items = self._gen_credentials()
     self.pile = Pile(total_items)
     return Padding.center_60(Filler(self.pile, valign="top"))