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"))
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')
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"))
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')
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"))
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')
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')
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'))
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"))
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(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')
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')
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'))
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
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
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
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, ])), ])
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
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
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"))
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'))
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"))
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"))
def _build_widget(self): total_items = self._gen_credentials() self.pile = Pile(total_items) return Padding.center_60(Filler(self.pile, valign="top"))