def _container(self): total_items = [ Columns([("weight", 0.2, Text("Partition number", align="right")), ("weight", 0.3, Color.string_input(self.partnum, focus_map="string_input focus"))], dividechars=4), Columns([ ("weight", 0.2, Text("Size (max {})".format(self.size_str), align="right")), ("weight", 0.3, Color.string_input(self.size, focus_map="string_input focus")), ], dividechars=4), Columns([("weight", 0.2, Text("Format", align="right")), ("weight", 0.3, Color.string_input(self._format_edit(), focus_map="string_input focus"))], dividechars=4), Columns([("weight", 0.2, Text("Mount", align="right")), ("weight", 0.3, Color.string_input(self.mountpoint, focus_map="string_input focs"))], dividechars=4) ] return Pile(total_items)
def _build_model_inputs(self): items = [ Columns( [ ("weight", 0.2, Text("Ceph MON", align="right")), ("weight", 0.3, Color.string_input(self.ceph_mon)) ], dividechars=4 ), Columns( [ ("weight", 0.2, Text("Username", align="right")), ("weight", 0.3, Color.string_input(self.username)) ], dividechars=4 ), Columns( [ ("weight", 0.2, Text("Key", align="right")), ("weight", 0.3, Color.string_input(self.ceph_key)) ], dividechars=4 ) ] return Pile(items)
def _container(self): total_items = [ Columns([("weight", 0.2, Text("Format", align="right")), ("weight", 0.3, Color.string_input(self._format_edit(), focus_map="string_input focus"))], dividechars=4), Columns([("weight", 0.2, Text("Mount", align="right")), ("weight", 0.3, Color.string_input(self.mountpoint, focus_map="string_input focs"))], dividechars=4) ] return Pile(total_items)
def _build_raid_configuration(self): log.debug('raid: _build_raid_config') items = [ Text("RAID CONFIGURATION"), Columns([("weight", 0.2, Text("RAID Level", align="right")), ("weight", 0.3, Color.string_input(self.raid_level))], dividechars=4), Columns([("weight", 0.2, Text("Hot spares", align="right")), ("weight", 0.3, Color.string_input(self.hot_spares))], dividechars=4), Columns([("weight", 0.2, Text("Chunk size", align="right")), ("weight", 0.3, Color.string_input(self.chunk_size))], dividechars=4) ] return Pile(items)
def _build_table(self): widget = self.widget if self.field.takes_default_style: widget = Color.string_input(widget) self.caption_text = Text(self.field.caption) self.under_text = Text(self.help) if self.field.caption_first: self.caption_text.align = 'right' first_row = [self.caption_text, _Validator(self, widget)] else: first_row = [ _Validator( self, UrwidPadding(widget, align='right', width=widget_width(widget))), self.caption_text, ] self._rows = [ Toggleable(TableRow(row)) for row in [ first_row, [Text(""), self.under_text], ] ] self._table = TablePile(self._rows, spacing=2, colspecs=form_colspecs)
def __init__(self, parent, setting): self.parent = parent self.setting = setting self.selector = Selector(toggle_options) self.selector.value = 'alt_shift_toggle' if self.parent.model.setting.toggle: try: self.selector.value = self.parent.model.setting.toggle except AttributeError: pass widgets = [ Text(_(toggle_text)), Text(""), Padding.center_79( Columns([ ('pack', Text(_("Shortcut: "))), Color.string_input(self.selector), ])), Text(""), button_pile([ ok_btn(label=_("OK"), on_press=self.ok), cancel_btn(label=_("Cancel"), on_press=self.cancel), ]), ] super().__init__(_("Select layout toggle"), widgets, stretchy_index=0, focus_index=4)
def show_edit_default_route(self, btn): log.debug("Re-rendering specify default route") self.default_gateway_w = StringEditor( caption="Default gateway will be ") self.gateway_options.contents[-1] = (Padding.center_50( Color.string_input(self.default_gateway_w)), self.gateway_options.options())
def _build_model_inputs(self): sl = Padding.center_79( Columns([ ("weight", 0.2, Text("Email address:", align="right")), ("weight", 0.3, Color.string_input(self.email)), ], dividechars=4)) return sl
def _build_model_inputs(self): items = [ Columns([("weight", 0.2, Text("iSCSI Server Host", align="right")), ("weight", 0.3, Color.string_input(self.iscsi_host))], dividechars=4), Columns( [("weight", 0.2, Text("Connect anonymously", align="right")), ("weight", 0.3, Color.string_input(Pile(self.connect_anon.group)))], dividechars=4), Columns( [("weight", 0.2, Text("Connect as user", align="right")), ("weight", 0.3, Color.string_input(self.connect_username))], dividechars=4), Columns( [("weight", 0.2, Text("Password", align="right")), ("weight", 0.3, Color.string_input(self.connect_password))], dividechars=4), Columns( [("weight", 0.2, Text("Require server auth", align="right")), ("weight", 0.3, Color.string_input(Pile(self.server_auth.group)))], dividechars=4), Columns( [("weight", 0.2, Text("Server identity", align="right")), ("weight", 0.3, Color.string_input(self.server_username))], dividechars=4), Columns( [("weight", 0.2, Text("Server password", align="right")), ("weight", 0.3, Color.string_input(self.server_password))], dividechars=4) ] return Pile(items)
def _build_lvm_configuration(self): log.debug('lvm: _build_lvm_config') items = [ Text("LVM VOLUMEGROUP CONFIGURATION"), Columns([("weight", 0.2, Text("VolumeGroup Name", align="right")), ("weight", 0.3, Color.string_input(self.volgroup))], dividechars=4), ] return Pile(items)
def _build_bondmode_configuration(self): log.debug('bond: _build_bondmode_configuration') items = [ Text("BOND CONFIGURATION"), Columns([("weight", 0.2, Text("Bonding Mode", align="right")), ("weight", 0.3, Color.string_input(self.bond_mode))], dividechars=4), ] log.debug('bond_mode: items: {}'.format(items)) return Pile(items)
def _showhide_other(self, show): if show and not self._other_showing: self._w.contents.append( (Columns([(1, Text("/")), Color.string_input(self._other)]), self._w.options('pack'))) self._other_showing = True elif not show and self._other_showing: del self._w.contents[-1] self._other_showing = False
def _build_model_inputs(self): sl = [ Columns( [ ("weight", 0.2, Text("Email address:", align="right")), ("weight", 0.3, Color.string_input(self.email)), ], dividechars=4 ), ] return Pile(sl)
def _cols(self): text = Text(self.caption, align="right") if self._enabled: input = Color.string_input(_Validator(self, self.widget)) else: input = self.widget cols = [(self._longest_caption, text), input] cols = Columns(cols, dividechars=2) if self._enabled: return cols else: return WidgetDisable(Color.info_minor(cols))
def _build_iface_inputs(self): col1 = [ Columns([("weight", 0.2, Text("Subnet")), ("weight", 0.3, Color.string_input(self.subnet_input, focus_map="string_input focus")), ("weight", 0.5, Text("CIDR e.g. 192.168.9.0/24"))], dividechars=2), Columns([("weight", 0.2, Text("Address")), ("weight", 0.3, Color.string_input(self.address_input, focus_map="string_input focus")), ("weight", 0.5, Text(""))], dividechars=2), Columns([("weight", 0.2, Text("Gateway")), ("weight", 0.3, Color.string_input(self.gateway_input, focus_map="string_input focus")), ("weight", 0.5, Text(""))], dividechars=2) ] return Pile(col1)
def _build_disk_selection(self, section): log.debug('bcache: _build_disk_selection, section:' + section) items = [Text(section + " DISK SELECTION")] avail_devs = self._get_available_devs(section) if len(avail_devs) == 0: return items.append( [Color.info_minor(Text("No available disks."))]) selector = Selector(avail_devs) self.selected_disks[section] = selector items.append(Color.string_input(selector)) return Pile(items)
def _build_iface_inputs(self): col = [ Padding.center_79( Color.info_minor( Text( "Only open or WPA2/PSK networks are supported at this time." ))), Padding.line_break(""), Columns([ ("weight", 0.2, Text("Network name:")), ("weight", 0.3, Color.string_input(self.essid_input, focus_map="string_input focus")), ], dividechars=2), Columns([ ("weight", 0.2, Text("Password:"******"weight", 0.3, Color.string_input(self.psk_input, focus_map="string_input focus")), ], dividechars=2), ] return Pile(col)
def _build_table(self): widget = self.widget if self.field.takes_default_style: widget = Color.string_input(widget) self.caption_text = Text(self.field.caption, align="right") self.under_text = Text(self.help) self._rows = [ Toggleable(TableRow(row)) for row in [ [self.caption_text, _Validator(self, widget)], [Text(""), self.under_text], ] ] self._table = TablePile(self._rows, spacing=2, colspecs=form_colspecs)
def _cols(self): text = Text(self.caption, align="right") if self._enabled: input = Color.string_input(_Validator(self, self.widget)) else: input = self.widget if self.help is not None: help = Help(self.parent_view, self.help) else: help = Text("") cols = [ (self._longest_caption, text), input, (3, help), ] cols = Columns(cols, dividechars=2) if self._enabled: return cols else: return WidgetDisable(Color.info_minor(cols))
def _build_table(self): widget = self.widget if self.field.takes_default_style: widget = Color.string_input(widget) if self.help is not NO_HELP: self.under_text = Text(self.help) else: self.under_text = Text("") if self.field.caption is NO_CAPTION: first_row = [(2, _Validator(self, widget))] second_row = [(2, self.under_text)] else: self.caption_text = Text(_(self.field.caption)) if self.field.caption_first: self.caption_text.align = 'right' first_row = [self.caption_text, _Validator(self, widget)] else: first_row = [ _Validator( self, UrwidPadding(widget, align='right', width=widget_width(widget))), self.caption_text, ] second_row = [Text(""), self.under_text] rows = [first_row] if self.help is not NO_HELP: rows.append(second_row) self._rows = [Toggleable(TableRow(row)) for row in rows] self._table = TablePile(self._rows, spacing=2, colspecs=form_colspecs)
def _build_model_inputs(self): sl = [ Columns([("weight", 0.2, Text("Your name:", align="right")), ("weight", 0.3, Color.string_input(self.realname, focus_map="string_input focus"))], dividechars=4), Columns( [("weight", 0.2, Text("Your server's name:", align="right")), ("weight", 0.3, Color.string_input(self.hostname, focus_map="string_input focus"))], dividechars=4), Columns([ ("weight", 0.2, Text("", align="right")), ("weight", 0.3, Color.info_minor( Text( "The name it uses when it talks to " "other computers", align="left"))), ], dividechars=4), Columns([("weight", 0.2, Text("Pick a username:"******"right")), ("weight", 0.3, Color.string_input(self.username, focus_map="string_input focus"))], dividechars=4), Columns( [("weight", 0.2, Text("Choose a password:"******"right")), ("weight", 0.3, Color.string_input(self.password, focus_map="string_input focus"))], dividechars=4), Columns([ ("weight", 0.2, Text("Confirm your password:"******"right")), ("weight", 0.3, Color.string_input(self.confirm_password, focus_map="string_input focus")) ], dividechars=4), Columns( [("weight", 0.2, Text("Import SSH identity:", align="right")), ("weight", 0.3, Color.string_input(self.ssh_import_id, focus_map="string_input focus"))], dividechars=4), Columns([ ("weight", 0.2, Text("", align="right")), ("weight", 0.3, Color.info_minor( Text( "Input your SSH user id from " "Ubuntu SSO (sso:email), " "Launchpad (lp:username) or " "Github (gh:username).", align="left"))), ], dividechars=4), ] return Pile(sl)