def _gen_credentials(self): total_items = [ Text("Enter your {} credentials:".format( app.current_cloud.upper())) ] total_items += [HR()] for field in self.schema.fields(): label = field.key if field.label is not None: label = field.label col = Columns([('weight', 0.5, Text(label, align='right')), Color.string_input(field.widget, focus_map='string_input focus')], dividechars=1) total_items.append(col) total_items.append( Columns([('weight', 0.5, Text("")), Color.error_major(field.error)], dividechars=1)) total_items.append(Padding.line_break("")) if len(self.regions) > 0: total_items.append( Columns([ ('weight', 0.5, Text("Select a Cloud Region", align='right')), self.regions_w ], dividechars=1)) return total_items
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 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 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 __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 = [] label_width = max( len(f.label or f.key) for f in app.provider.form.fields()) + 2 for field in app.provider.form.fields(): label = field.label or field.key total_items.extend([ Columns([(label_width, Text(label, align='right')), Color.string_input(field.widget, focus_map='string_input focus')], dividechars=1), Columns([(label_width, Text("")), Color.error_major(field.error)], dividechars=1), Padding.line_break(""), ]) return total_items
def build_widget(self): rows = [] def add_row(label, field): rows.extend([ Columns([('fixed', 23, Text(label)), Color.string_input(field, focus_map='string_input focus')]), Padding.line_break(""), ]) add_row('Email:', self.email), add_row('Password:'******'Two-Factor Auth (2FA):', self.twofa), if self.error: rows.append(Color.error_major(Text(" {}".format(self.error)))) return rows
def build_widget(self): total_items = [] if self.header: total_items.extend([ Text(self.header), HR(), ]) for field in self.schema.fields(): label = field.key if field.label is not None: label = field.label col = Columns([('weight', 0.5, Text(label, align='right')), Color.string_input(field.widget, focus_map='string_input focus')], dividechars=1) total_items.append(col) total_items.append( Columns([('weight', 0.5, Text("")), Color.error_major(field.error)], dividechars=1)) total_items.append(Padding.line_break("")) return total_items