def on_change(self, changes): self.logger.debug("Boot device changes: %s" % changes) devices = self.storage_discovery.all_devices_for_ui_table() if devices: if changes.contains_any(["boot.device"]): device = changes["boot.device"] if device == "other": self.widgets["label.details"].text("") else: changes["boot.device.current"] = device self._model.update(changes) self.widgets["label.details"].set_device(device) else: # Disable the continue button buttons = plugins.UIElements(self.widgets["boot"].buttons) buttons["button.next"].enabled(False) if changes.contains_any(["boot.device.custom"]): if self.storage_discovery.devices.live_disk_name() == \ self.storage_discovery.devices.translate_device_name( changes["boot.device.custom"]): raise exceptions.InvalidData("Can't be the same as " "the live device") else: self._model.update(changes)
def __init__(self, title, description, plugin): self.keys = [ "rhn.proxyhost", "rhn.proxyport", "rhn.proxyuser", "rhn.proxypassword" ] def clear_invalid(dialog, changes): [plugin.stash_change(prefix) for prefix in self.keys] title = _("RHSM Proxy Information") entries = [ ui.Entry("rhn.proxyhost", "Server:"), ui.Entry("rhn.proxyport", "Port:"), ui.Entry("rhn.proxyuser", "Username:"******"rhn.proxypassword", "Password:"******"label[0]", description), ui.Divider("divider[0]") ] children.extend(entries) super(ProxyDialog, self).__init__("proxy.dialog", title, children) self.buttons = [ ui.CloseButton("proxy.save", _("Save"), enabled=True), ui.CloseButton("proxy.close", _("Cancel")) ] b = plugins.UIElements(self.buttons) b["proxy.close"].on_activate.clear() b["proxy.close"].on_activate.connect(ui.CloseAction()) b["proxy.close"].on_activate.connect(clear_invalid)
def __init__(self, path_prefix, title, description, plugin): def clear_invalid(dialog, changes): plugin.stash_change(path_prefix) title = _("Custom Block Device") device_entry = ui.Entry(path_prefix, _("Device path:")) children = [ui.Label("label[0]", description), ui.Divider("divider[0]"), device_entry] super(CustomDeviceDialog, self).__init__("%s.dialog" % path_prefix, title, children) self.buttons = [ui.SaveButton("dialog.device.custom.save", _("Save"), enabled=False), ui.CloseButton("dialog.device.custom.close", _("Cancel"))] b = plugins.UIElements(self.buttons) b["dialog.device.custom.close"].on_activate.clear() b["dialog.device.custom.close"].on_activate.connect(ui.CloseAction()) b["dialog.device.custom.close"].on_activate.connect(clear_invalid)
def __init__(self, title, plugin): self.keys = ["maintenance.level"] self.plugin = plugin def clear_invalid(dialog, changes): [plugin.stash_change(prefix) for prefix in self.keys] entries = [ui.Options("maintenance.level", "Maintenance Level", self.states, selected=self.__vm_status())] children = [ui.Divider("divider.options"), ui.Label("label[0]", "Please select the maintenance " "level"), ui.Divider("divider[0]")] children.extend(entries) super(MaintenanceDialog, self).__init__( "maintenance.dialog", title, children) self.buttons = [ui.SaveButton("maintenance.confirm", "Set"), ui.CloseButton("maintenance.close", "Cancel")] b = plugins.UIElements(self.buttons) b["maintenance.close"].on_activate.clear() b["maintenance.close"].on_activate.connect(ui.CloseAction()) b["maintenance.close"].on_activate.connect(clear_invalid)
def __init__(self, title, plugin): self.keys = ["hosted_engine.diskpath", "hosted_engine.pxe"] def clear_invalid(dialog, changes): [plugin.stash_change(prefix) for prefix in self.keys] entries = [ui.Entry("hosted_engine.diskpath", "Engine ISO/OVA URL for download:"), ui.Checkbox("hosted_engine.pxe", "PXE Boot Engine VM"), ui.Divider("divider[1]"), ui.SaveButton("deploy.additional", "Add this host to an existing group")] children = [ui.Label("label[0]", "Please provide details for " "deployment of hosted engine"), ui.Divider("divider[0]")] children.extend(entries) super(DeployDialog, self).__init__("deploy.dialog", title, children) self.buttons = [ui.SaveButton("deploy.confirm", "Deploy"), ui.CloseButton("deploy.close", "Cancel")] b = plugins.UIElements(self.buttons) b["deploy.close"].on_activate.clear() b["deploy.close"].on_activate.connect(ui.CloseAction()) b["deploy.close"].on_activate.connect(clear_invalid)