def ui_content(self): page_title = _("Please select the disk to use for booting %s") % \ self.application.product.PRODUCT_SHORT other_device = self._model.get("boot.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table() ws = [ui.Header("header[0]", page_title)] tbl_head = self.storage_discovery.tbl_tpl.format(bus=_("Location"), name=_("Device Name"), size=_("Size (GB)")) if devices: ws += [ui.Table("boot.device", "", tbl_head, devices), ui.Divider("divider[0]"), ui.Button("button.other_device", "Other device: %s" % other_device), DeviceDetails("label.details", self, _("(No device)")) ] else: ws += [ui.Label("boot.no_device", _("No Valid Boot Devices Detected"))] page = ui.Page("boot", ws) page.buttons = [ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue"))] self.widgets.add(page) return page
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ mbond = defaults.NicBonding().retrieve() bond_status = ", ".join(mbond["slaves"] or []) bond_lbl = "Remove %s (%s)" % (mbond["name"], bond_status) \ if bond_status else "Create Bond" ws = [ ui.Header("header[0]", "System Identification"), ui.Entry("hostname", "Hostname:"), ui.Divider("divider[0]"), ui.Entry("dns[0]", "DNS Server 1:"), ui.Entry("dns[1]", "DNS Server 2:"), ui.Divider("divider[1]"), ui.Entry("ntp[0]", "NTP Server 1:"), ui.Entry("ntp[1]", "NTP Server 2:"), ui.Divider("divider[2]"), NicTable("nics", height=3), ui.Row("row[0]", [ ui.Button("button.ping", "Ping"), ui.Button("button.toggle_bond", bond_lbl) ]) ] page = ui.Page("page", ws) # Save it "locally" as a dict, for better accessability self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Button("button.install", "Install %s" % str(self.application.product)), ] self.widgets.add(ws) page = ui.Page("welcome", ws) page.buttons = [ui.Button("button.quit", "Quit")] return page
def ui_content(self): kbd = utils.Keyboard() ws = [ ui.Header("header[0]", "Keyboard Layout Selection"), ui.Table("keyboard.layout", "Available Keyboard Layouts", "", kbd.available_layouts()), ] self.widgets.add(ws) page = ui.Page("keyboard", ws) page.buttons = [ ui.Button("button.quit", "Quit"), ui.Button("button.next", "Continue") ] return page
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ # Function to expand all "keywords" to the same length aligned = lambda l: l.ljust(14) # Network related widgets, appearing in one row network_widgets = [ ui.KeywordLabel("networking", aligned("Networking: ")), ui.KeywordLabel("networking.bridge", "Bridge: "), ] action_widgets = [ ui.Button("action.logoff", "Log Off"), ui.Button("action.restart", "Restart"), ui.Button("action.poweroff", "Poweroff") ] widgets = [ ui.Header("header[0]", "System Information"), #ui.KeywordLabel("status", aligned("Status: ")), ui.Divider("divider[0]"), ui.Row("row[0]", network_widgets), ui.Divider("divider[1]"), ui.KeywordLabel("logs", aligned("Logs: ")), ui.Divider("divider[2]"), #ui.KeywordLabel("libvirt.num_guests", # aligned("Running VMs: ")), ui.Divider("divider[3]"), ui.Label("support.hint", "Press F8 for support menu"), ui.Divider("divider[4]"), ui.Row( "row[1]", [ ui.Button("action.hostkey", "View Host Key"), #ui.Button("action.cpu_details", # "View CPU Details"), ]), ui.Row("row[2]", action_widgets), ] self.widgets.add(widgets) page = ui.Page("page", widgets) page.buttons = [] return page
def ui_content(self): page_title = \ _("Please select the disk(s) to use for installation of %s") \ % self.application.product.PRODUCT_SHORT other_device = self._model.get("installation.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table() ws = [ui.Header("header[0]", page_title)] tbl_head = self.storage_discovery.tbl_tpl.format(bus="Location", name="Device Name", size="Size (GB)") if devices: ws += [ ui.Table("installation.device.current", "", tbl_head, devices, height=3, multi=True), ui.Button("button.other_device", "Other Device: %s" % other_device), ui.Divider("divider[0]"), DeviceDetails("installation.device.details", self, _("(No device)")) ] else: ws += [ ui.Label("installation.no_device", _("No Valid Install Devices Detected")) ] page = ui.Page("installation", ws) page.buttons = [ ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue")) ] self.widgets.add(page) # We are directly connecting to the table's on_change event # The tables on_change event is fired (in the multi-case) # when the highlighted entry is changed. table = self.widgets["installation.device.current"] table.on_change.connect(self.__update_details) return page
def ui_content(self): page_title = "Please select the disk to use for booting %s" % \ self.application.product.PRODUCT_SHORT other_device = self._model.get("boot.device.custom", "") devices = self.storage_discovery.all_devices_for_ui_table(other_device) ws = [ui.Header("header[0]", page_title)] if devices: ws += [ ui.Table( "boot.device", "", " %6s %11s %5s" % ("Location", "Device Name", "Size"), devices), DeviceDetails("label.details", self, "(No device)") ] else: ws += [ ui.Label("boot.no_device", "No Valid Boot Devices Detected") ] page = ui.Page("boot", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Continue") ] self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", "Require a password for local console access?"), ui.Label( "label[0]", "Please enter the current admin " + "password. You may also change the admin password " + "if required. If the new password fields are left" + "blank the password will remain the same."), ui.Label("label[1]", "Password for local console access"), ui.Divider("divider[0]"), ui.PasswordEntry("upgrade.current_password", "Current Password:"******"divider[1]"), ui.PasswordEntry("upgrade.password", "Password:"******"upgrade.password_confirmation", "Confirm Password:"******"divider[2]"), ui.Label("current_password.info", ""), ui.Label("password.info", self.__no_new_password_msg) ] self.widgets.add(ws) page = ui.Page("password", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Update") ] return page
def ui_content(self): ws = [ ui.Header("header[0]", _("Require a password for the admin user?")), ui.Label( "label[0]", _("Please enter the current admin ") + _("password. You may also change the admin password ") + _("if required. If the new password fields are left ") + _("blank the password will remain the same.")), ui.Label("label[1]", _("Password for the admin user")), ui.Divider("divider[0]"), ui.PasswordEntry("upgrade.current_password", _("Current Password:"******"divider[1]"), ui.ConfirmedEntry("upgrade.password", _("Password:"******"current_password.info", ""), ui.Label("password.info", self.__no_new_password_msg) ] page = ui.Page("password", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Update") ] self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", "Storage Volumes"), ui.Label( "label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Divider("divider[0]"), ui.Entry("storage.efi_size", "UEFI/Bios:", enabled=False), ui.Divider("divider[1]"), ui.Entry("storage.root_size", "Root & RootBackup:", enabled=False), ui.Label("label[1]", "(2 partitions at 512MB each)"), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", "Swap:"), ui.Entry("storage.config_size", "Config:"), ui.Entry("storage.logging_size", "Logging:"), ui.Entry("storage.data_size", "Data:"), ] self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Next") ] return page
def ui_content(self): page_title = "Please select the disk to use for booting %s" % \ self.application.product.PRODUCT_SHORT ws = [ui.Header("header[0]", page_title), ui.Table("boot.device", "", " %6s %11s %5s" % ("Location", "Device Name", "Size"), self._device_list()), DeviceDetails("label.details", "(No device)") ] self.widgets.add(ws) page = ui.Page("boot", ws) page.buttons = [ui.Button("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.Button("button.next", "Continue")] return page
def ui_content(self): ws = [ ui.Header("header[0]", "Require a password for local console access?"), ui.Divider("divider[0]"), ui.PasswordEntry("root.password", "Password:"******"root.password_confirmation", "Confirm Password:"******"password", ws) page.buttons = [ ui.Button("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.Button("button.next", "Install") ] return page
def __init__(self, path="lock.dialog", title="This screen is locked."): super(LockDialog, self).__init__(path, title, []) self.children = [ ui.Header("lock.label[0]", "Enter the admin password to unlock"), ui.KeywordLabel("username", "Username: "******"password", "Password:"******"action.unlock", "Unlock")] self.escape_key = None
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ mbond = defaults.NicBonding().retrieve() bond_status = ", ".join(mbond["slaves"] or []) bond_lbl = _("Remove %s (%s)") % (mbond["name"], bond_status) \ if bond_status else _("Create Bond") ws = [ui.Header("header[0]", _("System Identification")), ui.Entry("hostname", _("Hostname:")), ui.Divider("divider[0]"), ui.Entry("dns[0]", _("DNS Server 1:")), ui.Entry("dns[1]", _("DNS Server 2:")), ui.Divider("divider[1]"), ui.Entry("ntp[0]", _("NTP Server 1:")), ui.Entry("ntp[1]", _("NTP Server 2:")), ui.Divider("divider[2]"), NicTable("nics", height=3), ui.Row("row[0]", [ui.Button("button.ping", _("Ping")), ui.Button("button.toggle_bond", bond_lbl) ]) ] page = ui.Page("page", ws) # Save it "locally" as a dict, for better accessability self.widgets.add(page) # # NIC Deatils Dialog and Bond creation is disabled # when Node is managed # if has_managed_ifnames(): self._nic_details_group.enabled(False) self.widgets["button.toggle_bond"].enabled(False) nictbl = self.widgets["nics"] nictbl.on_activate.clear() nictbl.label(nictbl.label() + " (read-only/managed)") return page
def ui_content(self): # Update the status on a page refresh self._model["hosted_engine.status"] = self.__get_vm_status() network_up = NodeNetwork().is_configured() ws = [ui.Header("header[0]", "Hosted Engine Setup")] if network_up: ws.extend([ui.KeywordLabel("hosted_engine.enabled", ("Hosted Engine: "))]) else: ws.extend([ui.Notice("network.notice", "Networking is not " + "configured please configure it before " + "setting up hosted engine")]) if self._configured(): ws.extend([ui.Divider("divider[0]"), ui.KeywordLabel("hosted_engine.vm", ("Engine VM: ")), ui.KeywordLabel("hosted_engine.status", ("Engine Status: ")), ui.Button("button.status", "Hosted Engine VM status"), ui.Button("button.maintenance", "Set Hosted Engine maintenance")]) if network_up: ws.extend([ui.Divider("divider.button"), ui.Button("button.dialog", "Deploy Hosted Engine")]) if self._show_progressbar: if "progress" in self._model: ws.append(ui.ProgressBar("download.progress", int(self._model["progress"]))) else: ws.append(ui.ProgressBar("download.progress", 0)) ws.append(ui.KeywordLabel("download.status", "")) page = ui.Page("page", ws) page.buttons = [] self.widgets.add(page) return page
def ___installation_options(self): block_upgrade = False has_hostvg = False if self.application.args.dry: return [ui.Button("button.install", _("Install (dry)")), ui.Button("button.upgrade", _("Upgrade (dry)")), ui.Button("button.downgrade", _("Downgrade (dry)")), ui.Button("button.reinstall", _("Reinstall (dry)"))] media = utils.system.InstallationMedia() if not is_reinstall(): # Only check installed, if reinstall, rhbz 1167240 installed = utils.system.InstalledMedia() is_installed = installed.available() if is_installed and \ (media.version_major != installed.version_major): block_upgrade = True if utils.system.has_hostvg(): has_hostvg = True if os.path.exists("/dev/disk/by-label/ROOT"): block_upgrade = True if block_upgrade: return [ui.Label("lbl.blockupgrade", "Major version upgrades " + "are unsupported, uninstall existing version " + "first")] if has_hostvg: try: installed = utils.system.InstalledMedia() if media > installed: return [ui.Button("button.upgrade", _("Upgrade %s to %s") % (installed, media))] elif media < installed: return [ui.Button("button.downgrade", _("Downgrade %s to %s") % (installed, media))] return [ui.Button("button.reinstall", _("Reinstall %s") % installed)] except: self.logger.error("Unable to get version numbers for " + "upgrade, invalid installation or media") return [ui.Label( "lbl.failinstall", _("Invalid installation, please reboot from ") + _("media and choose Reinstall"))] return [ui.Button("button.install", _("Install Hypervisor %s") % media)]
def ___installation_options(self): if self.application.args.dry: return [ ui.Button("button.install", _("Install (dry)")), ui.Button("button.upgrade", _("Upgrade (dry)")), ui.Button("button.downgrade", _("Downgrade (dry)")), ui.Button("button.reinstall", _("Reinstall (dry)")) ] media = utils.system.InstallationMedia() has_hostvg = utils.system.has_hostvg() has_root = os.path.exists("/dev/disk/by-label/ROOT") if has_hostvg and has_root: return [ ui.Label( _("Major version upgrades are unsupported, ") + _("uninstall existing version first")) ] if has_hostvg: try: installed = utils.system.InstalledMedia() if media > installed: return [ ui.Button("button.upgrade", _("Upgrade %s to %s") % (installed, media)) ] elif media < installed: return [ ui.Button("button.downgrade", _("Downgrade %s to %s") % (installed, media)) ] return [ ui.Button("button.reinstall", _("Reinstall %s") % installed) ] except: self.logger.error("Unable to get version numbers for " + "upgrade, invalid installation or media") return [ ui.Label( "lbl.failinstall", _("Invalid installation, please reboot from ") + _("media and choose Reinstall")) ] return [ ui.Button("button.install", _("Install Hypervisor %s") % media) ]
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ buttons = [ui.Button("ping.do_ping", "Apply"), ui.Button("ping.cancel", "Cancel") ] ws = [ui.Header("ping.header", "Engine Setup"), ui.Divider("divider[1]"), ui.Row("row[0]", buttons), ui.Divider("divider[2]"), #ui.ProgressBar("ping.progress"), #ui.Divider("divider[3]"), ui.Label("ping.result", "Result:"), ] page = ui.Page("page", ws) page.buttons = [] self.widgets.add(page) return page
def _build_lock_dialog(self): widgets = [ ui.Header("lock.label[0]", "Enter the admin password to unlock"), ui.KeywordLabel("username", "Username: "******"password", "Password:"******"lock.dialog", "This screen is locked.", widgets) page.buttons = [ui.Button("action.unlock", "Unlock")] page.escape_key = None return page
def quit(instance): def ui_quit(dialog, changes): instance.ui.quit() txt = "Are you sure you want to quit?" dialog = ui.ConfirmationDialog("dialog.exit", "Exit", txt, [ ui.Button("dialog.exit.yes", "Yes"), ui.CloseButton("dialog.exit.close", "No") ]) dialog.buttons[0].on_activate.clear() dialog.buttons[0].on_activate.connect(ui.CloseAction()) dialog.buttons[0].on_activate.connect(ui_quit) instance.show(dialog)
def ui_content(self): kbd = system.Keyboard() c = kbd.get_current() self.logger.debug("Current layout: %s" % c) ws = [ui.Header("header[0]", "Keyboard Layout Selection"), ui.Table("keyboard.layout", "", "Available Keyboard Layouts", kbd.available_layouts(), c), ui.Label("label[0]", "(Hit Enter to select a layout)") ] self.widgets.add(ws) page = ui.Page("keyboard", ws) page.buttons = [ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Continue")] return page
def quit(instance): def ui_quit(dialog, changes): utils.system.reboot() instance.ui.quit() txt = "Are you sure you want to quit? The system will be rebooted." dialog = ui.ConfirmationDialog("dialog.exit", "Exit", txt, [ ui.Button("dialog.exit.yes", "Reboot"), ui.CloseButton("dialog.exit.close", "Cancel") ]) dialog.buttons[0].on_activate.clear() dialog.buttons[0].on_activate.connect(ui.CloseAction()) dialog.buttons[0].on_activate.connect(ui_quit) instance.show(dialog)
def ui_content(self): ws = [ui.Header("header[0]", _("Storage Volumes")), ui.KeywordLabel("storage.drive_size", "Drive size: ")] if not self.__enough_free_space(): ws.extend([ui.Notice("space.notice", "Not enough space! Needs at least " "%sMB for installation, %sMB " "available" % (str(self._min_drive_size), self._drive_size))]) if not self._fill: ws.extend([ui.KeywordLabel("storage.free_space", "Remaining Space: ")]) ws.extend([ui.Label("label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Checkbox("storage.fill_data", "Fill disk with Data " + "partition", True), ui.Entry("storage.efi_size", _("UEFI/Bios:"), enabled=False), ui.Entry("storage.root_size", _("Root & RootBackup:"), enabled=False), ui.Label("label[1]", _("(2 partitions at %sMB each)") % self.model().get("storage.root_size")), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", _("Swap MB:")), ui.Entry("storage.config_size", _("Config MB:")), ui.Entry("storage.logging_size", _("Logging MB:")), ui.Entry("storage.data_size", _("Data MB:"), enabled=not self._fill), ]) if not self._fill: ws.extend([ui.Label("label[2]", "(-1 fills all free space)")]) self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back"))] if self.__enough_free_space(): can_continue = self.model() and self.__calculate_free_space() >= 0 page.buttons.extend([ui.SaveButton("button.next", _("Continue"), enabled=can_continue)]) return page
def ui_content(self): ws = [ui.Header("header[0]", "Require a password for the admin user?"), ui.Divider("divider[0]"), ui.PasswordEntry("admin.password", "Password:"******"admin.password_confirmation", "Confirm Password:"******"divider[1]"), ui.Label("password.info", "") ] self.widgets.add(ws) page = ui.Page("password", ws) page.buttons = [ui.QuitButton("button.quit", "Quit"), ui.Button("button.back", "Back"), ui.SaveButton("button.next", "Install")] return page
def ui_content(self): method = "Installing" product = self.application.product.PRODUCT_SHORT ws = [ui.Header("header[0]", "%s %s" % (method, product)), ui.Divider("divider[0]"), ui.ProgressBar("progressbar", 0), ui.Divider("divider[1]"), ui.Label("log", ""), ui.Divider("divider[2]"), ui.Button("action.reboot", "Reboot") ] self.widgets.add(ws) page = ui.Page("progress", ws) page.buttons = [] self._worker.start() return page
def ui_content(self): cfg = rhn_model.RHN().retrieve() if self.application.args.dry: net_is_configured = True else: net_is_configured = NodeNetwork().is_configured() if not net_is_configured: ws = ([ ui.Divider("notice.divider"), ui.Notice( "network.notice", "Networking is not configured, please " + "configure it before configuring RHSM"), ui.Divider("notice.divider") ]) else: rhn_msg = ("RHSM Registration is required only if you wish " + "to use Red Hat Enterprise Linux with virtual " + "guests subscriptions for your guests.") if cfg["rhntype"] and self._get_status(cfg) is not None: rhn_msg = self._get_status(cfg) ws = [ ui.Header("header[0]", rhn_msg), ui.Entry("rhn.username", "Login:"******"rhn.password", "Password:"******"rhn.profilename", "Profile Name (optional):"), ui.Divider("divider[0]"), ui.Options("rhn.type", "Type", self._rhn_types), ui.Entry("rhn.url", "URL:"), ui.Entry("rhn.ca", "CA URL:"), ui.Entry("rhn.org", "Organization:"), ui.Entry("rhn.environment", "Environment:"), ui.Entry("rhn.activation_key", "Activation Key:"), ui.Button("button.proxy", "HTTP Proxy Configuration"), ] page = ui.Page("page", ws) self.widgets.add(ws) return page
def ui_content(self): ws = [ ui.Header("header[0]", _("Storage Volumes")), ui.KeywordLabel("storage.drive_size", "Drive size: ") ] if not self._fill: ws.extend( [ui.KeywordLabel("storage.free_space", "Remaining Space: ")]) ws.extend([ ui.Label( "label[0]", "Please enter the sizes for the " + "following partitions in MB"), ui.Checkbox("storage.fill_data", "Fill disk with Data " + "partition", True), ui.Entry("storage.efi_size", _("UEFI/Bios:"), enabled=False), ui.Entry("storage.root_size", _("Root & RootBackup:"), enabled=False), ui.Label( "label[1]", _("(2 partitions at %sMB each)") % self.model().get("storage.efi_size")), ui.Divider("divider[2]"), ui.Entry("storage.swap_size", _("Swap:")), ui.Entry("storage.config_size", _("Config:")), ui.Entry("storage.logging_size", _("Logging:")), ui.Entry("storage.data_size", _("Data:"), enabled=not self._fill), ]) if not self._fill: ws.extend([ui.Label("label[2]", "(-1 fills all free space)")]) self.widgets.add(ws) page = ui.Page("storage", ws) page.buttons = [ ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Continue")) ] return page
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ ws = [ ui.Header("ping.header", "Ping a remote host"), ui.Entry("ping.address", "Address:"), ui.Entry("ping.count", "Count:"), ui.Divider("divider[1]"), ui.Button("ping.do_ping", "Ping"), ui.Divider("divider[2]"), ui.ProgressBar("ping.progress"), ui.Divider("divider[3]"), ui.Label("ping.result", "Result:"), ] page = ui.Page("page", ws) page.buttons = [] self.widgets.add(page) return page
def ui_content(self): ws = [ ui.Header("header[0]", _("Enter a password for the admin user")), ui.Divider("divider[0]"), ui.ConfirmedEntry("admin.password", _("Password:"******"password", ws) page.buttons = [ ui.QuitButton("button.quit", _("Quit")), ui.Button("button.back", _("Back")), ui.SaveButton("button.next", _("Install"), enabled=False) ] self.widgets.add(page) return page
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ ws = [ ui.Header("header[0]", "System Identification"), ui.Entry("hostname", "Hostname:"), ui.Divider("divider[0]"), ui.Entry("dns[0]", "DNS Server 1:"), ui.Entry("dns[1]", "DNS Server 2:"), ui.Divider("divider[1]"), ui.Entry("ntp[0]", "NTP Server 1:"), ui.Entry("ntp[1]", "NTP Server 2:"), ui.Divider("divider[2]"), ui.Table("nics", "Available System NICs", "Device Status Model MAC Address", self._get_nics()), ui.Button("button.ping", "Ping") ] page = ui.Page("page", ws) # Save it "locally" as a dict, for better accessability self.widgets.add(page) return page