def __init__(self, anaconda, repoObj): self.anaconda = anaconda self.backend = self.anaconda.backend self.intf = self.anaconda.intf self.repo = repoObj (self.dxml, self.dialog) = gui.getGladeWidget("addrepo.glade", "addRepoDialog") self.dxml.signal_autoconnect(self) self.notebook = self.dxml.get_widget("typeNotebook") self.nameEntry = self.dxml.get_widget("nameEntry") self.typeComboBox = self.dxml.get_widget("typeComboBox") self.baseurlEntry = self.dxml.get_widget("baseurlEntry") self.mirrorlistCheckbox = self.dxml.get_widget("mirrorlistCheckbox") self.proxyCheckbox = self.dxml.get_widget("proxyCheckbox") self.proxyEntry = self.dxml.get_widget("proxyEntry") self.proxyTable = self.dxml.get_widget("proxyTable") self.usernameEntry = self.dxml.get_widget("usernameEntry") self.passwordEntry = self.dxml.get_widget("passwordEntry") self.nfsServerEntry = self.dxml.get_widget("nfsServerEntry") self.nfsPathEntry = self.dxml.get_widget("nfsPathEntry") self.nfsOptionsEntry = self.dxml.get_widget("nfsOptionsEntry") self.partitionComboBox = self.dxml.get_widget("partitionComboBox") self.directoryChooser = self.dxml.get_widget("directoryChooserButton") self.dialog.set_title(_("Edit Repository")) # Remove these until they are actually implemented self.typeComboBox.remove_text(3)
def getScreen(self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.hostname = network.getDefaultHostname(anaconda) # load the UI (self.xml, self.align) = gui.getGladeWidget("network.glade", "network_align") self.icon = self.xml.get_widget("icon") self.hostnameEntry = self.xml.get_widget("hostnameEntry") self.hostnameEntry.set_text(self.hostname) # pressing Enter in confirm == clicking Next self.hostnameEntry.connect("activate", lambda w: self.ics.setGrabNext(1)) # load the icon gui.readImageFromFile("network.png", image=self.icon) self.firewallCb = self.xml.get_widget("firewall_check") self.firewallCb.set_active(self.anaconda.network.useFirewall) from sabayon import Entropy from sabayon.const import FIREWALL_PACKAGE if not Entropy().is_installed(FIREWALL_PACKAGE): self.firewallCb.set_visible(False) return self.align
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.tasks = anaconda.id.instClass.tasks self.repos = anaconda.backend.ayum.repos (self.xml, vbox) = gui.getGladeWidget("tasksel.glade", "taskBox") lbl = self.xml.get_widget("mainLabel") if anaconda.id.instClass.description: lbl.set_text(_(anaconda.id.instClass.description)) else: txt = lbl.get_text() lbl.set_text(txt %(productName,)) custom = not self.dispatch.stepInSkipList("group-selection") if custom: self.xml.get_widget("customRadio").set_active(True) else: self.xml.get_widget("customRadio").set_active(False) self.ts = self._createTaskStore() self.rs = self._createRepoStore() if len(self.ts.get_model()) == 0: self.xml.get_widget("cbVBox").hide() self.xml.get_widget("mainLabel").hide() self.xml.get_widget("addRepoButton").connect("clicked", self._addRepo) self.xml.get_widget("editRepoButton").connect("clicked", self._editRepo, self.rs) return vbox
def getScreen(self, anaconda): self.anaconda = anaconda self.data = anaconda.id self.backend = anaconda.backend self.dispatch = anaconda.dispatch (self.xml, vbox) = gui.getGladeWidget("abiquo_distributed.glade", "settingsBox") # Clean selections if we go back for g in [ 'abiquo-server', 'abiquo-ui', 'abiquo-standalone-api', 'abiquo-remote-services', 'abiquo-public-cloud', 'abiquo-v2v' ]: if g in self.anaconda.id.abiquo.selectedGroups: self.anaconda.id.abiquo.selectedGroups.remove(g) self.anaconda.backend.deselectGroup(g) if g in self.data.abiquo.selectedGroups: self.data.abiquo.selectedGroups.remove(g) self.anaconda.backend.deselectGroup(g) for btn in [ 'AbiquoServerRadio', 'AbiquoRSRadio', 'AbiquoV2VRadio', 'AbiquoGUIRadio', 'AbiquoAPIRadio', 'AbiquoPublicRadio' ]: self.xml.get_widget(btn).set_active(False) self.xml.get_widget(btn).set_sensitive(True) self.xml.get_widget(btn).connect('toggled', self._selectionChanged) return vbox
def getScreen(self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.hostname = network.getDefaultHostname(anaconda) # load the UI (self.xml, self.align) = gui.getGladeWidget("network.glade", "network_align") self.icon = self.xml.get_widget("icon") self.hostnameEntry = self.xml.get_widget("hostnameEntry") self.hostnameEntry.set_text(self.hostname) self.netconfButton = self.xml.get_widget("netconfButton") self.netconfButton.connect("clicked", self._netconfButton_clicked) if len(self.anaconda.id.network.netdevices) == 0: self.netconfButton.set_sensitive(False) # pressing Enter in confirm == clicking Next self.hostnameEntry.connect("activate", lambda w: self.ics.setGrabNext(1)) # load the icon gui.readImageFromFile("network.png", image=self.icon) return self.align
def getScreen (self, anaconda): self.anaconda = anaconda self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend (self.xml, box) = gui.getGladeWidget("abiquo_install_type.glade", "hbox1") return box
def addZfcpDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("zfcp-config.glade", "zfcpDialog") gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) for w in ["devnumEntry", "wwpnEntry", "fcplunEntry"]: sg.add_widget(dxml.get_widget(w)) while True: rc = dialog.run() if rc != gtk.RESPONSE_APPLY: break devnum = dxml.get_widget("devnumEntry").get_text().strip() wwpn = dxml.get_widget("wwpnEntry").get_text().strip() fcplun = dxml.get_widget("fcplunEntry").get_text().strip() try: anaconda.storage.zfcp.addFCP(devnum, wwpn, fcplun) except ValueError as e: anaconda.intf.messageWindow(_("Error"), str(e)) continue break dialog.destroy() return rc
def getScreen(self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_dhcp_relay.glade", "settingsBox") service_if_combo = self.xml.get_widget('service_if') management_if_combo = self.xml.get_widget('management_if') netinfo = network.Network() management_if_store = gtk.ListStore(gobject.TYPE_STRING) service_if_store = gtk.ListStore(gobject.TYPE_STRING) # Avaliable devices for dev in anaconda.id.network.netdevices: service_if_store.append([dev]) management_if_store.append([dev]) service_if_combo.set_model(service_if_store) cell = gtk.CellRendererText() service_if_combo.pack_start(cell, True) service_if_combo.add_attribute(cell, 'text', 0) management_if_combo.set_model(management_if_store) cell = gtk.CellRendererText() management_if_combo.pack_start(cell, True) management_if_combo.add_attribute(cell, 'text', 0) return vbox
def addDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog") gui.addFrame(dialog) dialog.show_all() if not iutil.isS390(): dxml.get_widget("zfcpRadio").hide() dxml.get_widget("zfcpRadio").set_group(None) if not storage.iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) dxml.get_widget("iscsiBindCheck").set_sensitive(False) else: dxml.get_widget("iscsiBindCheck").set_active(bool(storage.iscsi.iscsi().ifaces)) dxml.get_widget("iscsiBindCheck").set_sensitive(storage.iscsi.iscsi().mode == "none") if not storage.fcoe.has_fcoe(): dxml.get_widget("fcoeRadio").set_sensitive(False) dxml.get_widget("fcoeRadio").set_active(False) def update_active_ifaces(): active_ifaces = network.getActiveNetDevs() dxml.get_widget("ifaceLabel").set_text(", ".join(active_ifaces)) def netconfButton_clicked(*args): from network_gui import setupNetwork setupNetwork(anaconda.intf) update_active_ifaces() dxml.get_widget("netconfButton").connect("clicked", netconfButton_clicked) update_active_ifaces() #figure out what advanced devices we have available and set sensible default group = dxml.get_widget("iscsiRadio").get_group() for button in group: if button is not None and button.get_property("sensitive"): button.set_active(True) button.grab_focus() break rc = dialog.run() dialog.hide() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False if dxml.get_widget("iscsiRadio").get_active() and storage.iscsi.has_iscsi(): bind = dxml.get_widget("iscsiBindCheck").get_active() rc = addIscsiDrive(anaconda, bind) elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe(): rc = addFcoeDrive(anaconda) elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active(): rc = addZfcpDrive(anaconda) dialog.destroy() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False else: return True
def getScreen (self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_dhcp_relay.glade", "settingsBox") service_if_combo = self.xml.get_widget('service_if') management_if_combo = self.xml.get_widget('management_if') netinfo = network.Network() management_if_store = gtk.ListStore(gobject.TYPE_STRING) service_if_store = gtk.ListStore(gobject.TYPE_STRING) # Avaliable devices for dev in anaconda.id.network.netdevices: service_if_store.append([dev]) management_if_store.append([dev]) service_if_combo.set_model(service_if_store) cell = gtk.CellRendererText() service_if_combo.pack_start(cell, True) service_if_combo.add_attribute(cell, 'text',0) management_if_combo.set_model(management_if_store) cell = gtk.CellRendererText() management_if_combo.pack_start(cell, True) management_if_combo.add_attribute(cell, 'text',0) return vbox
def getScreen(self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.hostname = network.getDefaultHostname(anaconda) # load the UI (self.xml, self.align) = gui.getGladeWidget("network.glade", "network_align") self.icon = self.xml.get_widget("icon") self.hostnameEntry = self.xml.get_widget("hostnameEntry") self.hostnameEntry.set_text(self.hostname) self.netconfButton = self.xml.get_widget("netconfButton") self.netconfButton.connect("clicked", self._setupNetwork) if len(self.anaconda.id.network.netdevices) == 0: self.netconfButton.set_sensitive(False) # pressing Enter in confirm == clicking Next self.hostnameEntry.connect("activate", lambda w: self.ics.setGrabNext(1)) # load the icon gui.readImageFromFile("network.png", image=self.icon) return self.align
def addZfcpDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("zfcp-config.glade", "zfcpDialog") gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) for w in ["devnumEntry", "wwpnEntry", "fcplunEntry"]: sg.add_widget(dxml.get_widget(w)) while True: dialog.present() rc = dialog.run() if rc != gtk.RESPONSE_APPLY: break devnum = dxml.get_widget("devnumEntry").get_text().strip() wwpn = dxml.get_widget("wwpnEntry").get_text().strip() fcplun = dxml.get_widget("fcplunEntry").get_text().strip() try: anaconda.id.storage.zfcp.addFCP(devnum, wwpn, fcplun) except ValueError as e: anaconda.intf.messageWindow(_("Error"), str(e)) continue break dialog.destroy() return rc
def _options_clicked(self, button): (xml, dialog) = gui.getGladeWidget("device-options.glade", "options_dialog") friendly_cb = xml.get_widget("mpath_friendly_names") friendly_cb.set_active(self.anaconda.id.storage.mpathFriendlyNames) if dialog.run() == gtk.RESPONSE_OK: self.anaconda.id.storage.mpathFriendlyNames = friendly_cb.get_active() dialog.destroy()
def __init__(self): super(iSCSILoginDialog, self).__init__() (xml, self.dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "login_dialog") # take credentials from the discovery dialog (self.credentials_xml, credentials_table) = gui.getGladeWidget("iscsi-dialogs.glade", "table_credentials") (credentials, rev_credentials) = self._credentials_widgets(self.credentials_xml) # and put them into the login dialog alignment alignment = xml.get_widget("login_credentials_alignment") alignment.add(credentials_table) # setup the combobox self.combobox = self._combo_box([ pih.CRED_NONE, pih.CRED_ONE, pih.CRED_BOTH, pih.CRED_REUSE ], credentials, rev_credentials) vbox = xml.get_widget("d_login_vbox") vbox.pack_start(self.combobox, expand=False)
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.tasks = anaconda.id.instClass.tasks self.repos = anaconda.backend.ayum.repos (self.xml, vbox) = gui.getGladeWidget("tasksel.glade", "taskBox") lbl = self.xml.get_widget("mainLabel") ''' if anaconda.id.instClass.description: lbl.set_text(_(anaconda.id.instClass.description)) else: txt = lbl.get_text() lbl.set_text(txt %(productName,)) ''' checkKvm=self.xml.get_widget("checkbutton1") checkCdms=self.xml.get_widget("checkbutton2") checkKvm.connect("toggled", self.kvm_callback) checkCdms.connect("toggled", self.cdms_callback) self.labelCdms = self.xml.get_widget("labelCdms") self.entryCdms = self.xml.get_widget("entryCdms") self.labelServerIp = self.xml.get_widget("labelServerIp") self.entryServerIp = self.xml.get_widget("entryServerIp") self.labelServerPasswd = self.xml.get_widget("labelServerPasswd") self.entryServerPasswd = self.xml.get_widget("entryServerPasswd") self.labelCdms.set_sensitive(False) self.entryCdms.set_sensitive(False) self.labelServerIp.set_sensitive(False) self.entryServerIp.set_sensitive(False) self.labelServerPasswd.set_sensitive(False) self.entryServerPasswd.set_sensitive(False) self.entryLocalIp = self.xml.get_widget("entryLocalIp") self.entryLocalNetmask = self.xml.get_widget("entryLocalNetmask") self.entryLocalGateway = self.xml.get_widget("entryLocalGateway") ''' self.combobox = self.xml.get_widget("combobox1") self.find_interface() for i in STATS: self.combobox.append_text(i) ''' self.combobox = gtk.combo_box_new_text() self.combobox.set_size_request(100, 25) self.find_interface() for i in STATS: self.combobox.append_text(i) self.combobox.set_active(0) vbox.put(self.combobox, 195, 270) return vbox
def _options_clicked(self, button): (xml, dialog) = gui.getGladeWidget("device-options.glade", "options_dialog") friendly_cb = xml.get_widget("mpath_friendly_names") friendly_cb.set_active(self.anaconda.id.storage.mpathFriendlyNames) if dialog.run() == gtk.RESPONSE_OK: self.anaconda.id.storage.mpathFriendlyNames = friendly_cb.get_active( ) dialog.destroy()
def getScreen(self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.abiquo_groups = [ 'abiquo-monolithic', 'abiquo-server', 'abiquo-remote-services', 'abiquo-v2v', 'abiquo-ui', 'abiquo-standalone-api', 'abiquo-public-cloud', 'abiquo-lvm-storage-server', 'abiquo-kvm', 'abiquo-dhcp-relay', 'abiquo-nfs-repository', 'abiquo-remote-repository' ] self.tasks = anaconda.id.instClass.tasks (self.xml, vbox) = gui.getGladeWidget("tasksel.glade", "mainWidget") (self.diag1_xml, diag) = gui.getGladeWidget("tasksel.glade", "dialog1") lbl = self.xml.get_widget("mainLabel") self.installer_tasks = [ "Abiquo Platform", "Cloud Node", "Storage Servers", "Additional Components" ] self.tasks_descriptions = { "Abiquo Platform": DESC_ABI_PLATFORM, "Cloud Node": "<b>Cloud Node</b>\nInstall Abiquo KVM (OpenSource hypervisor tested and supported by Abiquo).", "Storage Servers": "<b>Storage Servers</b>\nInstall required servers to manage external storage.", "Additional Components": "<b>Additional Components</b>\nNFS Repository, etc.", } self._createTaskStore() self.abiquo_platform_tasks = AbiquoPlatformTasks(anaconda) self.abiquo_hypervisor_tasks = AbiquoHypervisorTasks(anaconda) self.abiquo_storage_tasks = AbiquoStorageTasks(anaconda) self.abiquo_additional_tasks = AbiquoAdditionalTasks(anaconda) w = self.xml.get_widget("subtaskSW") w.add(self.abiquo_platform_tasks) self.abiquo_platform_tasks.show() return vbox
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo.glade", "settingsBox") self.xml.get_widget('abiquo_server_ip').set_text(self.data.abiquo.abiquo_server_ip) return vbox
def __init__(self): super(iSCSILoginDialog, self).__init__() (xml, self.dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "login_dialog") # take credentials from the discovery dialog (self.credentials_xml, credentials_table) = gui.getGladeWidget("iscsi-dialogs.glade", "table_credentials") (credentials, rev_credentials) = self._credentials_widgets(self.credentials_xml) # and put them into the login dialog alignment alignment = xml.get_widget("login_credentials_alignment") alignment.add(credentials_table) # setup the combobox self.combobox = self._combo_box( [pih.CRED_NONE, pih.CRED_ONE, pih.CRED_BOTH, pih.CRED_REUSE], credentials, rev_credentials) vbox = xml.get_widget("d_login_vbox") vbox.pack_start(self.combobox, expand=False)
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.abiquo_groups = ['cloud-in-a-box', 'abiquo-monolithic', 'abiquo-server', 'abiquo-remote-services', 'abiquo-v2v', 'abiquo-lvm-storage-server', 'opschef-server','opschef-client', 'abiquo-kvm', 'abiquo-xen', 'abiquo-virtualbox', 'abiquo-dhcp-relay', 'abiquo-nfs-repository', 'abiquo-remote-repository' ] self.tasks = anaconda.id.instClass.tasks self.repos = anaconda.id.instClass.repos (self.xml, vbox) = gui.getGladeWidget("tasksel.glade", "mainWidget") (self.diag1_xml, diag) = gui.getGladeWidget("tasksel.glade", "dialog1") lbl = self.xml.get_widget("mainLabel") #self.installer_tasks = ["Abiquo Platform", "Cloud Nodes", "Storage Servers", "Opscode Chef", "Additional Components"] self.installer_tasks = ["Abiquo Platform", "Cloud Nodes", "Storage Servers", "Additional Components"] self.tasks_descriptions = { "Cloud Nodes": "<b>Cloud Nodes</b>\nInstall Abiquo KVM, Xen or VirtualBox Cloud Nodes (OpenSource hypervisors tested and supported by Abiquo).", "Opscode Chef": "<b>Chef</b>\nInstall Chef Server/Client components", "Abiquo Platform": DESC_ABI_PLATFORM, "Storage Servers": "<b>Storage Servers</b>\nInstall required servers to manage external storage.", "Additional Components": "<b>Additional Components</b>\nNFS Repository, etc.", } self._createTaskStore() self.abiquo_platform_tasks = AbiquoPlatformTasks(anaconda) self.abiquo_hypervisor_tasks = AbiquoHypervisorTasks(anaconda) #self.opscode_tasks = OpscodeTasks(anaconda) self.abiquo_storage_tasks = AbiquoStorageTasks(anaconda) self.abiquo_additional_tasks = AbiquoAdditionalTasks(anaconda) w = self.xml.get_widget("subtaskSW") w.add(self.abiquo_platform_tasks) self.abiquo_platform_tasks.show() return vbox
def getScreen(self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo.glade", "settingsBox") self.xml.get_widget('abiquo_server_ip').set_text( self.data.abiquo.abiquo_server_ip) return vbox
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_nfs_config.glade", "settingsBox") self.helpButton = self.xml.get_widget("helpButton") self.helpButton.connect("clicked", self.helpButtonClicked) self.xml.get_widget('abiquo_nfs_repository').set_text(self.data.abiquo_rs.abiquo_nfs_repository) return vbox
def getScreen(self, anaconda): self.anaconda = anaconda self.intf = anaconda.intf (self.xml, self.align) = gui.getGladeWidget("user.glade", "account_align") self.icon = self.xml.get_widget("icon") self.capslock = self.xml.get_widget("capslock") self.pwlabel = self.xml.get_widget("pwlabel") self.pw = self.xml.get_widget("pw") self.username = self.xml.get_widget("username") self.fullname = self.xml.get_widget("fullname") self.confirmlabel = self.xml.get_widget("confirmlabel") self.confirm = self.xml.get_widget("confirm") self.usernamelabel = self.xml.get_widget("usernamelabel") self.fullnamelabel = self.xml.get_widget("fullnamelabel") # load the icon gui.readImageFromFile("root-password.png", image=self.icon) # connect hotkeys self.pwlabel.set_text_with_mnemonic(_("_Password:"******"_Confirm:")) self.confirmlabel.set_mnemonic_widget(self.confirm) self.usernamelabel.set_text_with_mnemonic(_("_Username:"******"_Full name:")) self.fullnamelabel.set_mnemonic_widget(self.fullname) # watch for Caps Lock so we can warn the user self.intf.icw.window.connect( "key-release-event", lambda w, e: self.handleCapsLockRelease(w, e, self.capslock)) # we might have a root password already live_user_data = self.anaconda.users.otherUsers.get(LIVE_USER, {}) self.pw.set_text(live_user_data.get('password', '')) self.confirm.set_text(live_user_data.get('password', '')) self.username.set_text(live_user_data.get('username', '')) self.fullname.set_text(live_user_data.get('fullname', '')) # pressing Enter in confirm == clicking Next vbox = self.xml.get_widget("account_box") self.confirm.connect("activate", lambda widget, vbox=vbox: self.ics.setGrabNext(1)) # set initial caps lock label text self.setCapsLockLabel() return self.align
def getScreen(self, anaconda): self.intf = anaconda.intf self.anaconda = anaconda self.hostname = network.getDefaultHostname(anaconda) # load the UI (self.xml, self.align) = gui.getGladeWidget("network_euca.glade", "network_align") self.icon = self.xml.get_widget("icon") self.hostnameEntry = self.xml.get_widget("hostnameEntry") self.hostnameEntry.set_text(self.hostname) self.netconfButton = self.xml.get_widget("netconfButton") self.netconfButton.connect("clicked", self._netconfButton_clicked) if len(self.anaconda.id.network.netdevices) == 0: self.netconfButton.set_sensitive(False) # pressing Enter in confirm == clicking Next self.hostnameEntry.connect("activate", lambda w: self.ics.setGrabNext(1)) self.netifCombo = self.xml.get_widget("netifcombo") cell = gtk.CellRendererText() self.ipaddr = self.xml.get_widget("ipaddr") self.netmask = self.xml.get_widget("netmask") self.defaultgw = self.xml.get_widget("defaultgw") self.netifCombo.set_model(gtk.ListStore(gobject.TYPE_STRING)) self.netifCombo.pack_start(cell) self.netifCombo.add_attribute(cell, 'text', 0) for dev in anaconda.id.network.netdevices.keys(): self.netifCombo.append_text(dev) self.netifCombo.set_active(0) self.netifCombo.connect("changed", self._netifCombo_changed) self.dhcpCombo = self.xml.get_widget("dhcpcombo") self.dhcpCombo.connect("changed", self._dhcpCombo_changed) self.dnsserver = self.xml.get_widget("dnsserver") # load current network settings self._netifCombo_changed() # Only reset to Static mode when we are going forward. # A little hacky, but good enough for now. if anaconda.dir == DISPATCH_FORWARD: self.dhcpCombo.set_active(0) self._dhcpCombo_changed() # load the icon gui.readImageFromFile("network.png", image=self.icon) return self.align
def getScreen(self, anaconda): self.anaconda = anaconda self.intf = anaconda.intf (self.xml, self.align) = gui.getGladeWidget("user.glade", "account_align") self.icon = self.xml.get_widget("icon") self.capslock = self.xml.get_widget("capslock") self.pwlabel = self.xml.get_widget("pwlabel") self.pw = self.xml.get_widget("pw") self.username = self.xml.get_widget("username") self.fullname = self.xml.get_widget("fullname") self.confirmlabel = self.xml.get_widget("confirmlabel") self.confirm = self.xml.get_widget("confirm") self.usernamelabel = self.xml.get_widget("usernamelabel") self.fullnamelabel = self.xml.get_widget("fullnamelabel") # load the icon gui.readImageFromFile("root-password.png", image=self.icon) # connect hotkeys self.pwlabel.set_text_with_mnemonic(_("_Password:"******"_Confirm:")) self.confirmlabel.set_mnemonic_widget(self.confirm) self.usernamelabel.set_text_with_mnemonic(_("_Username:"******"_Full name:")) self.fullnamelabel.set_mnemonic_widget(self.fullname) # watch for Caps Lock so we can warn the user self.intf.icw.window.connect("key-release-event", lambda w, e: self.handleCapsLockRelease(w, e, self.capslock)) # we might have a root password already live_user_data = self.anaconda.users.otherUsers.get(LIVE_USER, {}) self.pw.set_text(live_user_data.get('password', '')) self.confirm.set_text(live_user_data.get('password', '')) self.username.set_text(live_user_data.get('username', '')) self.fullname.set_text(live_user_data.get('fullname', '')) # pressing Enter in confirm == clicking Next vbox = self.xml.get_widget("account_box") self.confirm.connect("activate", lambda widget, vbox=vbox: self.ics.setGrabNext(1)) # set initial caps lock label text self.setCapsLockLabel() return self.align
def __init__(self, network): (xml, w) = gui.getGladeWidget("netconfig.glade", "NetworkConfigWindow") self.window = w self.network = network self.xml = xml self.rc = gtk.RESPONSE_CANCEL self._setSizeGroup() self._connectSignals() self._populateNetdevs() self.xml.get_widget("ipv4Checkbutton").set_active(True) self.xml.get_widget("ipv6Checkbutton").set_active(False)
def _options_clicked(self, button): (xml, dialog) = gui.getGladeWidget("device-options.glade", "options_dialog") friendly_cb = xml.get_widget("mpath_friendly_names") friendly_cb.set_active(self.anaconda.id.storage.mpathFriendlyNames) # liuweifeng xdialog = xml.get_widget("options_dialog") xdialog.set_property("title","设备选项") # ckb = xml.get_widget("mpath_friendly_names") # ckb.set_property("label","如果启用了名字格式为/dev/mapper/mpath<letter>"\ # + "而不是/dev/mapper/<wwid>的多路径设备,那么需要注意用户"\ # + "友好的名称由多路径工具(multipath tools)分配,并不能保证在多次"\ # + "安装中保持一致。") if dialog.run() == gtk.RESPONSE_OK: self.anaconda.id.storage.mpathFriendlyNames = friendly_cb.get_active() dialog.destroy()
def __init__(self, initiator, initiator_set): super(iSCSIDiscoveryDialog, self).__init__() (self.xml, self.dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "discovery_dialog") self.initiator = self.xml.get_widget("initiator") self.initiator.set_text(initiator) if initiator_set: self.initiator.set_sensitive(False) (credentials, rev_credentials) = self._credentials_widgets(self.xml) self.combobox = self._combo_box([ pih.CRED_NONE, pih.CRED_ONE, pih.CRED_BOTH, ], credentials, rev_credentials) vbox = self.xml.get_widget("d_discovery_vbox") vbox.pack_start(self.combobox, expand=False)
def display_nodes_dialog(self, found_nodes, ifaces): def _login_button_disabler(device_selector, login_button, checked, item): login_button.set_sensitive(len(device_selector.getSelected()) > 0) (xml, dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "nodes_dialog") store = gtk.TreeStore( gobject.TYPE_PYOBJECT, # teh object gobject.TYPE_BOOLEAN, # visible gobject.TYPE_BOOLEAN, # active (checked) gobject.TYPE_BOOLEAN, # immutable gobject.TYPE_STRING, # node name gobject.TYPE_STRING # node interface ) map(lambda node : store.append(None, ( node, # the object True, # visible True, # active False, # not immutable node.name, # node's name ifaces.get(node.iface, node.iface))), # node's interface found_nodes) # create and setup the device selector model = store.filter_new() view = gtk.TreeView(model) ds = DeviceSelector.DeviceSelector( store, model, view) callback = functools.partial(_login_button_disabler, ds, xml.get_widget("button_login")) ds.createSelectionCol(toggledCB=callback) ds.addColumn(_("Node Name"), self.NODE_NAME_COL) ds.addColumn(_("Interface"), self.NODE_INTERFACE_COL) # attach the treeview to the dialog sw = xml.get_widget("nodes_scrolled_window") sw.add(view) sw.show_all() # run the dialog rc = self._run_dialog(dialog) # filter out selected nodes: selected_nodes = map(lambda raw : raw[0], ds.getSelected()) dialog.destroy() return (rc, selected_nodes)
def addDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog") gui.addFrame(dialog) dialog.show_all() if not iutil.isS390(): dxml.get_widget("zfcpRadio").hide() dxml.get_widget("zfcpRadio").set_group(None) if not storage.iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) if not storage.fcoe.has_fcoe(): dxml.get_widget("fcoeRadio").set_sensitive(False) dxml.get_widget("fcoeRadio").set_active(False) #figure out what advanced devices we have available and set sensible default group = dxml.get_widget("iscsiRadio").get_group() for button in group: if button is not None and button.get_property("sensitive"): button.set_active(True) button.grab_focus() break rc = dialog.run() dialog.hide() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False if dxml.get_widget( "iscsiRadio").get_active() and storage.iscsi.has_iscsi(): rc = addIscsiDrive(anaconda) elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe(): rc = addFcoeDrive(anaconda) elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget( "zfcpRadio").get_active(): rc = addZfcpDrive(anaconda) dialog.destroy() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False else: return True
def getScreen(self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_rs.glade", "settingsBox") self.helpButton = self.xml.get_widget("helpButton") self.helpButton.connect("clicked", self.helpButtonClicked) self.xml.get_widget("abiquo_nfs_repository").set_text(self.data.abiquo_rs.abiquo_nfs_repository) self.xml.get_widget("datacenterId").set_text(self.data.abiquo_rs.abiquo_datacenter_id) server_ip = self.data.abiquo_rs.abiquo_rabbitmq_host if server_ip == "127.0.0.1": server_ip = "<server-ip>" self.xml.get_widget("abiquo_server_ip").set_text(server_ip) return vbox
def getScreen(self, anaconda): self.rootPassword = anaconda.id.rootPassword self.intf = anaconda.intf (self.xml, self.align) = gui.getGladeWidget("account.glade", "account_align") self.icon = self.xml.get_widget("icon") self.capslock = self.xml.get_widget("capslock") self.pwlabel = self.xml.get_widget("pwlabel") self.pw = self.xml.get_widget("pw") self.confirmlabel = self.xml.get_widget("confirmlabel") self.confirm = self.xml.get_widget("confirm") # load the icon gui.readImageFromFile("root-password.png", image=self.icon) # connect hotkeys self.pwlabel.set_text_with_mnemonic(_("Root _Password:"******"_Confirm:")) self.confirmlabel.set_mnemonic_widget(self.confirm) # watch for Caps Lock so we can warn the user self.intf.icw.window.connect("key-release-event", lambda w, e: self.handleCapsLockRelease(w, e, self.capslock)) # we might have a root password already if not self.rootPassword['isCrypted']: self.pw.set_text(self.rootPassword['password']) self.confirm.set_text(self.rootPassword['password']) else: self.pw.set_text("xxxxxxxx") self.confirm.set_text("xxxxxxxx") # pressing Enter in confirm == clicking Next vbox = self.xml.get_widget("account_box") self.confirm.connect("activate", lambda widget, vbox=vbox: self.ics.setGrabNext(1)) # set initial caps lock label text self.setCapsLockLabel() return self.align
def addDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog") gui.addFrame(dialog) dialog.show_all() if not iutil.isS390(): dxml.get_widget("zfcpRadio").hide() dxml.get_widget("zfcpRadio").set_group(None) if not storage.iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) if not storage.fcoe.has_fcoe(): dxml.get_widget("fcoeRadio").set_sensitive(False) dxml.get_widget("fcoeRadio").set_active(False) #figure out what advanced devices we have available and set sensible default group = dxml.get_widget("iscsiRadio").get_group() for button in group: if button is not None and button.get_property("sensitive"): button.set_active(True) break rc = dialog.run() dialog.hide() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False if dxml.get_widget("iscsiRadio").get_active() and storage.iscsi.has_iscsi(): rc = addIscsiDrive(anaconda) elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe(): rc = addFcoeDrive(anaconda) elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active(): rc = addZfcpDrive(anaconda) dialog.destroy() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return False else: return True
def getScreen(self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_rs.glade", "settingsBox") self.helpButton = self.xml.get_widget("helpButton") self.helpButton.connect("clicked", self.helpButtonClicked) self.xml.get_widget('abiquo_nfs_repository').set_text( self.data.abiquo_rs.abiquo_nfs_repository) self.xml.get_widget('datacenterId').set_text( self.data.abiquo_rs.abiquo_datacenter_id) server_ip = self.data.abiquo_rs.abiquo_rabbitmq_host if server_ip == '127.0.0.1': server_ip = '<server-ip>' self.xml.get_widget('abiquo_server_ip').set_text(server_ip) return vbox
def getScreen (self, anaconda): self.anaconda = anaconda self.data = anaconda.id self.backend = anaconda.backend self.dispatch = anaconda.dispatch (self.xml, vbox) = gui.getGladeWidget("abiquo_distributed.glade", "settingsBox") for g in self.data.abiquo.selectedGroups: if g == 'abiquo-server': self.xml.get_widget('abiquoServerRadio').set_active(True) elif g == 'abiquo-v2v': self.xml.get_widget('abiquoV2VRadio').set_active(True) elif g == 'abiquo-remote-services': self.xml.get_widget('abiquoRSRadio').set_active(True) else: pass for btn in ['abiquoServerRadio', 'abiquoRSRadio', 'abiquoV2VRadio']: self.xml.get_widget(btn).connect( 'toggled', self._selectionChanged) return vbox
def display_success_dialog(self, success_nodes, fail_nodes, fail_reason): (xml, dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "success_dialog") w_success = xml.get_widget("label_success") w_success_win = xml.get_widget("scroll_window_success") w_success_val = xml.get_widget("text_success") w_fail = xml.get_widget("label_fail") w_fail_win = xml.get_widget("scroll_window_fail") w_fail_val = xml.get_widget("text_fail") w_reason = xml.get_widget("label_reason") w_reason_val = xml.get_widget("label_reason_val") w_retry = xml.get_widget("button_retry") w_separator = xml.get_widget("separator") if success_nodes: markup = "\n".join(map(lambda n: n.name, success_nodes)) buf = gtk.TextBuffer() buf.set_text(markup) w_success.show() w_success_val.set_buffer(buf) w_success_win.show() if fail_nodes: markup = "\n".join(map(lambda n: n.name, fail_nodes)) buf = gtk.TextBuffer() buf.set_text(markup) w_fail.show() w_fail_val.set_buffer(buf) w_fail_win.show() w_retry.show() if fail_reason: w_reason.show() w_reason_val.set_markup(fail_reason) w_reason_val.show() if success_nodes and fail_nodes: # only if there's anything to be separated display the separator w_separator.show() rc = self._run_dialog(dialog) dialog.destroy() return rc
def getScreen(self, anaconda): self.rootPassword = anaconda.id.rootPassword self.intf = anaconda.intf (self.xml, self.align) = gui.getGladeWidget("account.glade", "account_align") self.icon = self.xml.get_widget("icon") self.capslock = self.xml.get_widget("capslock") self.pwlabel = self.xml.get_widget("pwlabel") self.pw = self.xml.get_widget("pw") self.confirmlabel = self.xml.get_widget("confirmlabel") self.confirm = self.xml.get_widget("confirm") # load the icon gui.readImageFromFile("root-password.png", image=self.icon) # connect hotkeys self.pwlabel.set_text_with_mnemonic(_("Root _Password:"******"_Confirm:")) self.confirmlabel.set_mnemonic_widget(self.confirm) # watch for Caps Lock so we can warn the user self.intf.icw.window.connect("key-release-event", lambda w, e: self.handleCapsLockRelease(w, e, self.capslock)) # we might have a root password already if not self.rootPassword['isCrypted']: self.pw.set_text(self.rootPassword['password']) self.confirm.set_text(self.rootPassword['password']) # pressing Enter in confirm == clicking Next vbox = self.xml.get_widget("account_box") self.confirm.connect("activate", lambda widget, vbox=vbox: self.ics.setGrabNext(1)) # set initial caps lock label text self.setCapsLockLabel() return self.align
def display_success_dialog(self, success_nodes, fail_nodes, fail_reason, ifaces): (xml, dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "success_dialog") w_success = xml.get_widget("label_success") w_success_win = xml.get_widget("scroll_window_success") w_success_val = xml.get_widget("text_success") w_fail = xml.get_widget("label_fail") w_fail_win = xml.get_widget("scroll_window_fail") w_fail_val = xml.get_widget("text_fail") w_reason = xml.get_widget("label_reason") w_reason_val = xml.get_widget("label_reason_val") w_retry = xml.get_widget("button_retry") w_separator = xml.get_widget("separator") if success_nodes: markup = "\n".join(map(lambda n: "%s via %s" % (n.name, ifaces.get(n.iface, n.iface)), success_nodes)) buf = gtk.TextBuffer() buf.set_text(markup) w_success.show() w_success_val.set_buffer(buf) w_success_win.show() if fail_nodes: markup = "\n".join(map(lambda n: "%s via %s" % (n.name, ifaces.get(n.iface, n.iface)), fail_nodes)) buf = gtk.TextBuffer() buf.set_text(markup) w_fail.show() w_fail_val.set_buffer(buf) w_fail_win.show() w_retry.show() if fail_reason: w_reason.show() w_reason_val.set_markup(fail_reason) w_reason_val.show() if success_nodes and fail_nodes: # only if there's anything to be separated display the separator w_separator.show() rc = self._run_dialog(dialog) dialog.destroy() return rc
def getScreen (self, anaconda): self.anaconda = anaconda self.data = anaconda.id self.backend = anaconda.backend self.dispatch = anaconda.dispatch (self.xml, vbox) = gui.getGladeWidget("abiquo_distributed.glade", "settingsBox") # Clean selections if we go back for g in ['abiquo-server','abiquo-ui','abiquo-standalone-api','abiquo-remote-services','abiquo-public-cloud','abiquo-v2v']: if g in self.anaconda.id.abiquo.selectedGroups: self.anaconda.id.abiquo.selectedGroups.remove(g) self.anaconda.backend.deselectGroup(g) if g in self.data.abiquo.selectedGroups: self.data.abiquo.selectedGroups.remove(g) self.anaconda.backend.deselectGroup(g) for btn in ['AbiquoServerRadio', 'AbiquoRSRadio', 'AbiquoV2VRadio', 'AbiquoGUIRadio', 'AbiquoAPIRadio','AbiquoPublicRadio']: self.xml.get_widget(btn).set_active(False) self.xml.get_widget(btn).set_sensitive(True) self.xml.get_widget(btn).connect( 'toggled', self._selectionChanged) return vbox
def addDrive(self, button): (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog") gui.addFrame(dialog) dialog.show_all() if rhpl.getArch() not in ("s390", "s390x"): dxml.get_widget("zfcpRadio").hide() dxml.get_widget("zfcpRadio").set_group(None) import iscsi if not iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) #figure out what advanced devices we have available and set sensible default group = dxml.get_widget("iscsiRadio").get_group() for button in group: if button is not None and button.get_property("sensitive"): button.set_active(True) break rc = dialog.run() dialog.hide() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: return if dxml.get_widget("iscsiRadio").get_active(): rc = self.addIscsiDrive() elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget( "zfcpRadio").get_active(): rc = self.addZfcpDrive() dialog.destroy() if rc not in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: w = self.intf.waitWindow(_("Rescanning disks"), _("Rescanning disks")) partitioning.partitionObjectsInitialize(self.anaconda) createAllowedDrivesStore(self.diskset.disks, self.partitions.autoClearPartDrives, self.drivelist, self.anaconda.updateSrc) w.pop()
def addDrive(self, button): (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog") gui.addFrame(dialog) dialog.show_all() if rhpl.getArch() not in ("s390", "s390x"): dxml.get_widget("zfcpRadio").hide() dxml.get_widget("zfcpRadio").set_group(None) import iscsi if not iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) #figure out what advanced devices we have available and set sensible default group = dxml.get_widget("iscsiRadio").get_group() for button in group: if button is not None and button.get_property("sensitive"): button.set_active(True) break rc = dialog.run() dialog.hide() if rc == gtk.RESPONSE_CANCEL: return if dxml.get_widget("iscsiRadio").get_active(): rc = self.addIscsiDrive() elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active(): rc = self.addZfcpDrive() dialog.destroy() if rc != gtk.RESPONSE_CANCEL: w = self.intf.waitWindow(_("Rescanning disks"), _("Rescanning disks")) partitioning.partitionObjectsInitialize(self.anaconda) createAllowedDrivesStore(self.diskset.disks, self.partitions.autoClearPartDrives, self.drivelist, self.anaconda.updateSrc) w.pop()
def display_nodes_dialog(self, found_nodes): (xml, dialog) = gui.getGladeWidget("iscsi-dialogs.glade", "nodes_dialog") store = gtk.TreeStore( gobject.TYPE_PYOBJECT, # teh object gobject.TYPE_BOOLEAN, # visible gobject.TYPE_BOOLEAN, # active (checked) gobject.TYPE_BOOLEAN, # immutable gobject.TYPE_STRING # node name ) map( lambda node: store.append( None, ( node, # the object True, # visible True, # active False, # not immutable node.name)), # node's name found_nodes) # create and setup the device selector model = store.filter_new() view = gtk.TreeView(model) ds = DeviceSelector.DeviceSelector(store, model, view) ds.createSelectionCol() ds.addColumn(_("Node Name"), self.NODE_NAME_COL) # attach the treeview to the dialog sw = xml.get_widget("nodes_scrolled_window") sw.add(view) sw.show_all() # run the dialog rc = self._run_dialog(dialog) # filter out selected nodes: selected_nodes = map(lambda raw: raw[0], ds.getSelected()) dialog.destroy() return (rc, selected_nodes)
def addZfcpDrive(self): (dxml, dialog) = gui.getGladeWidget("zfcp-config.glade", "zfcpDialog") gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) map(lambda x: sg.add_widget(dxml.get_widget(x)), ("devnumEntry", "wwpnEntry", "fcplunEntry")) while 1: rc = dialog.run() if rc != gtk.RESPONSE_APPLY: break devnum = dxml.get_widget("devnumEntry").get_text().strip() wwpn = dxml.get_widget("wwpnEntry").get_text().strip() fcplun = dxml.get_widget("fcplunEntry").get_text().strip() try: self.anaconda.id.zfcp.addFCP(devnum, wwpn, fcplun) except ValueError, e: self.intf.messageWindow(_("Error"), "%s" % e) continue break
def getScreen(self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_v2v.glade", "settingsBox") self.helpButton = self.xml.get_widget("helpButton") self.helpButton.connect("clicked", self.helpButtonClicked) self.xml.get_widget("abiquo_nfs_repository").set_text(self.data.abiquo_rs.abiquo_nfs_repository) self.xml.get_widget("datacenterId").set_text(self.data.abiquo_v2v.abiquo_datacenter_id) server_ip = self.data.abiquo_v2v.abiquo_rabbitmq_host if server_ip == "127.0.0.1": server_ip = "<server-ip>" self.xml.get_widget("abiquo_server_ip").set_text(server_ip) # We don't need to enter NFS info if nfs-repository selected if "abiquo-nfs-repository" in self.anaconda.id.abiquo.selectedGroups: box = self.xml.get_widget("serverSettingsBox") hbox = self.xml.get_widget("hbox1") box.remove(hbox) return vbox
def getScreen (self, anaconda): self.intf = anaconda.intf self.dispatch = anaconda.dispatch self.backend = anaconda.backend self.anaconda = anaconda self.data = anaconda.id (self.xml, vbox) = gui.getGladeWidget("abiquo_v2v.glade", "settingsBox") self.helpButton = self.xml.get_widget("helpButton") self.helpButton.connect("clicked", self.helpButtonClicked) self.xml.get_widget('abiquo_nfs_repository').set_text(self.data.abiquo_rs.abiquo_nfs_repository) self.xml.get_widget('datacenterId').set_text(self.data.abiquo_v2v.abiquo_datacenter_id) server_ip = self.data.abiquo_v2v.abiquo_rabbitmq_host if server_ip == '127.0.0.1': server_ip = '<server-ip>' self.xml.get_widget('abiquo_server_ip').set_text(server_ip) # We don't need to enter NFS info if nfs-repository selected if 'abiquo-nfs-repository' in self.anaconda.id.abiquo.selectedGroups: box = self.xml.get_widget("serverSettingsBox") hbox = self.xml.get_widget("hbox1") box.remove(hbox) return vbox
def whichToShrink(storage, intf): def getActive(combo): act = combo.get_active_iter() return combo.get_model().get_value(act, 1) def comboCB(combo, shrinkSB): # partition to resize changed, let's update our spinbutton newSize = shrinkSB.get_value_as_int() part = getActive(combo) (reqlower, requpper) = getResizeMinMax(part) adj = shrinkSB.get_adjustment() adj.lower = max(1, reqlower) adj.upper = requpper adj.set_value(reqlower) (dxml, dialog) = gui.getGladeWidget("autopart.glade", "shrinkDialog") store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) combo = dxml.get_widget("shrinkPartCombo") combo.set_model(store) crt = gtk.CellRendererText() combo.pack_start(crt, True) combo.set_attributes(crt, text=0) combo.connect("changed", comboCB, dxml.get_widget("shrinkSB")) biggest = -1 for part in storage.partitions: if not part.exists: continue entry = None if part.resizable and part.format.resizable: entry = ( "%s (%s, %d MB)" % (part.name, part.format.name, math.floor(part.format.size)), part) if entry: i = store.append(None) store[i] = entry combo.set_active_iter(i) if biggest == -1: biggest = i else: current = store.get_value(biggest, 1) if part.format.targetSize > current.format.targetSize: biggest = i if biggest > -1: combo.set_active_iter(biggest) if len(store) == 0: dialog.destroy() intf.messageWindow(_("Error"), _("No partitions are available to resize. Only " "physical partitions with specific filesystems " "can be resized."), type="warning", custom_icon="error") return (gtk.RESPONSE_CANCEL, []) gui.addFrame(dialog) dialog.show_all() runResize = True while runResize: rc = dialog.run() if rc != gtk.RESPONSE_OK: dialog.destroy() return (rc, []) request = getActive(combo) sb = dxml.get_widget("shrinkSB") sb.update() newSize = sb.get_value_as_int() actions = [] try: actions.append(ActionResizeFormat(request, newSize)) except ValueError as e: intf.messageWindow(_("Resize FileSystem Error"), _("%(device)s: %(msg)s") % { 'device': request.format.device, 'msg': e.message }, type="warning", custom_icon="error") continue try: actions.append(ActionResizeDevice(request, newSize)) except ValueError as e: intf.messageWindow(_("Resize Device Error"), _("%(name)s: %(msg)s") % { 'name': request.name, 'msg': e.message }, type="warning", custom_icon="error") continue runResize = False dialog.destroy() return (rc, actions)
def whichToShrink(storage, intf): def getActive(combo): act = combo.get_active_iter() return combo.get_model().get_value(act, 1) def comboCB(combo, shrinkSB): # partition to resize changed, let's update our spinbutton newSize = shrinkSB.get_value_as_int() part = getActive(combo) (reqlower, requpper) = getResizeMinMax(part) adj = shrinkSB.get_adjustment() adj.lower = max(1,reqlower) adj.upper = requpper adj.set_value(reqlower) (dxml, dialog) = gui.getGladeWidget("autopart.glade", "shrinkDialog") store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) combo = dxml.get_widget("shrinkPartCombo") combo.set_model(store) crt = gtk.CellRendererText() combo.pack_start(crt, True) combo.set_attributes(crt, text = 0) combo.connect("changed", comboCB, dxml.get_widget("shrinkSB")) biggest = -1 for part in storage.partitions: if not part.exists: continue entry = None if part.resizable and part.format.resizable: entry = ("%s (%s, %d MB)" % (part.name, part.format.name, math.floor(part.format.size)), part) if entry: i = store.append(None) store[i] = entry combo.set_active_iter(i) if biggest == -1: biggest = i else: current = store.get_value(biggest, 1) if part.format.targetSize > current.format.targetSize: biggest = i if biggest > -1: combo.set_active_iter(biggest) if len(store) == 0: dialog.destroy() intf.messageWindow(_("Error"), _("No partitions are available to resize. Only " "physical partitions with specific filesystems " "can be resized."), type="warning", custom_icon="error") return (gtk.RESPONSE_CANCEL, []) gui.addFrame(dialog) dialog.show_all() runResize = True while runResize: rc = dialog.run() if rc != gtk.RESPONSE_OK: dialog.destroy() return (rc, []) request = getActive(combo) sb = dxml.get_widget("shrinkSB") sb.update() newSize = sb.get_value_as_int() actions = [] try: actions.append(ActionResizeFormat(request, newSize)) except ValueError as e: intf.messageWindow(_("Resize FileSystem Error"), _("%(device)s: %(msg)s") % {'device': request.format.device, 'msg': e.message}, type="warning", custom_icon="error") continue try: actions.append(ActionResizeDevice(request, newSize)) except ValueError as e: intf.messageWindow(_("Resize Device Error"), _("%(name)s: %(msg)s") % {'name': request.name, 'msg': e.message}, type="warning", custom_icon="error") continue runResize = False dialog.destroy() return (rc, actions)
def addFcoeDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("fcoe-config.glade", "fcoeDialog") combo = dxml.get_widget("fcoeNicCombo") dcb_cb = dxml.get_widget("dcbCheckbutton") # Populate the combo cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text=0) cell.set_property("wrap-width", 525) combo.set_size_request(480, -1) store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(store) netdevs = anaconda.id.network.netdevices keys = netdevs.keys() keys.sort() selected_interface = None for dev in keys: i = store.append(None) desc = netdevs[dev].description if desc: desc = "%s - %s" % (dev, desc) else: desc = "%s" % (dev, ) mac = netdevs[dev].get("HWADDR") if mac: desc = "%s - %s" % (desc, mac) if selected_interface is None: selected_interface = i store[i] = (desc, dev) if selected_interface: combo.set_active_iter(selected_interface) else: combo.set_active(0) # Show the dialog gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) sg.add_widget(dxml.get_widget("fcoeNicCombo")) while True: # make sure the dialog pops into foreground in case this is the second # time through the loop: dialog.present() rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break iter = combo.get_active_iter() if iter is None: anaconda.intf.messageWindow(_("Error"), _("You must select a NIC to use."), type="warning", custom_icon="error") continue try: anaconda.id.storage.fcoe.addSan(store.get_value(iter, 1), dcb=dcb_cb.get_active(), intf=anaconda.intf) except IOError as e: anaconda.intf.messageWindow(_("Error"), str(e)) rc = gtk.RESPONSE_CANCEL break dialog.destroy() return rc
def _deviceChange(self, b, anaconda, *args): def __driveChange(combo, dxml, choices): if not choices.has_key("mbr"): return iter = combo.get_active_iter() if not iter: return first = combo.get_model()[iter][1] desc = choices["mbr"][1] dxml.get_widget("mbrRadio").set_label("%s - /dev/%s" % (_(desc), first)) dxml.get_widget("mbrRadio").set_data("bootDevice", first) def __genStore(combo, disks, active): model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(model) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text=0) for disk in disks: i = model.append(None) model[i] = ("%s %8.0f MB %s" % (disk.name, disk.size, disk.description), "%s" % (disk.name, )) if disk.name == active: combo.set_active_iter(i) return model (dxml, dialog) = gui.getGladeWidget("blwhere.glade", "blwhereDialog") gui.addFrame(dialog) dialog.set_transient_for(self.parent) dialog.show() choices = anaconda.platform.bootloaderChoices(self.bl) for t in ("mbr", "boot"): if not choices.has_key(t): continue (device, desc) = choices[t] w = dxml.get_widget("%sRadio" % (t, )) w.set_label("%s - /dev/%s" % (_(desc), device)) w.show() if self.bldev == device: w.set_active(True) else: w.set_active(False) w.set_data("bootDevice", device) for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" % (i, )) lbl = dxml.get_widget("bd%dLabel" % (i, )) combo.show() lbl.show() partitioned = anaconda.storage.partitioned disks = anaconda.storage.disks bl_disks = [d for d in disks if d in partitioned] m = __genStore(combo, bl_disks, self.driveorder[i - 1]) dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices) __driveChange(dxml.get_widget("bd1Combo"), dxml, choices) while 1: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break # set the boot device based on what they chose if dxml.get_widget("bootRadio").get_active(): self.bldev = dxml.get_widget("bootRadio").get_data( "bootDevice") elif dxml.get_widget("mbrRadio").get_active(): self.bldev = dxml.get_widget("mbrRadio").get_data("bootDevice") else: raise RuntimeError, "No radio button selected!" # and adjust the boot order neworder = [] for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" % (i, )) iter = combo.get_active_iter() if not iter: continue act = combo.get_model()[iter][1] if act not in neworder: neworder.append(act) for d in self.driveorder: if d not in neworder: neworder.append(d) self.driveorder = neworder break dialog.destroy() self.grubCB.set_label( _("_Install boot loader on /dev/%s.") % (self.bldev, )) return rc
def getScreen(self, anaconda): (self.xml, self.vbox) = gui.getGladeWidget("filter.glade", "vbox") self.buttonBox = self.xml.get_widget("buttonBox") self.notebook = self.xml.get_widget("notebook") self.addAdvanced = self.xml.get_widget("addAdvancedButton") self.buttonBox.connect("realize", self._show_buttons) self.notebook.connect("switch-page", self._page_switched) self.addAdvanced.connect("clicked", self._add_advanced_clicked) self.pages = [] self.anaconda = anaconda # One common store that all the views on all the notebook tabs share. # Yes, this means a whole lot of columns that are going to be empty or # unused much of the time. Oh well. # Object, # visible, active (checked), immutable, # device, model, capacity, vendor, interconnect, serial number, wwid # paths, port, target, lun self.store = gtk.TreeStore( gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN, gobject.TYPE_BOOLEAN, gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.store.set_sort_column_id(MODEL_COL, gtk.SORT_ASCENDING) udev_trigger(subsystem="block", action="change") # So that drives onlined by these show up in the filter UI storage.iscsi.iscsi().startup(anaconda.intf) storage.fcoe.fcoe().startup(anaconda.intf) storage.zfcp.ZFCP().startup() # Note we do NOT call dasd.startup() here, that does not online drives, # but only checks if they need formatting. disks = filter(udev_device_is_disk, udev_get_block_devices()) (singlepaths, mpaths, partitions) = identifyMultipaths(disks) # The device list could be really long, so we really only want to # iterate over it the bare minimum of times. Dividing this list up # now means fewer elements to iterate over later. (raids, nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), singlepaths) if anaconda.simpleFilter: # In the typical use case, the user likely only has one drive and # there's no point showing either the filtering UI or the # cleardisks UI. Unfortunately, that means we need to duplicate # some of the getNext method. if len(singlepaths) == 1: anaconda.storage.exclusiveDisks = [ udev_device_get_name(singlepaths[0]) ] return None self.pages = [self._makeBasic()] self.notebook.set_show_border(False) self.notebook.set_show_tabs(False) else: self.pages = [ self._makeBasic(), self._makeRAID(), self._makeMPath(), self._makeOther(), self._makeSearch() ] self.populate(nonraids, mpaths, raids) # If the "Add Advanced" button is ever clicked, we need to have a list # of what devices previously existed so we know what's new. Then we # can just add the new devices to the UI. This is going to be slow, # but the user has to click a button to get to the slow part. self._cachedDevices = NameCache(singlepaths) self._cachedMPaths = NameCache(mpaths) self._cachedRaidDevices = NameCache(raids) # Switch to the first notebook page that displays any devices. i = 0 for pg in self.pages: if pg.getNVisible(): self.notebook.set_current_page(i) break i += 1 return self.vbox
def getScreen(self, anaconda): # We skip the filter UI in basic storage mode if anaconda.id.simpleFilter: anaconda.id.storage.exclusiveDisks = [] return None (self.xml, self.vbox) = gui.getGladeWidget("filter.glade", "vbox") self.buttonBox = self.xml.get_widget("buttonBox") self.notebook = self.xml.get_widget("notebook") self.addAdvanced = self.xml.get_widget("addAdvancedButton") self.options = self.xml.get_widget("optionsButton") self.notebook.connect("switch-page", self._page_switched) self.addAdvanced.connect("clicked", self._add_advanced_clicked) self.options.connect("clicked", self._options_clicked) self.pages = [] self.anaconda = anaconda # One common store that all the views on all the notebook tabs share. # Yes, this means a whole lot of columns that are going to be empty or # unused much of the time. Oh well. # Object, # visible, active (checked), immutable, # device, model, capacity, vendor, interconnect, serial number, wwid # paths, port, target, lun self.store = gtk.TreeStore( gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN, gobject.TYPE_BOOLEAN, gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_LONG, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.store.set_sort_column_id(MODEL_COL, gtk.SORT_ASCENDING) anaconda.id.storage.devicetree.teardownAll() # So that drives onlined by these show up in the filter UI storage.iscsi.iscsi().startup(anaconda.intf) storage.fcoe.fcoe().startup(anaconda.intf) storage.zfcp.ZFCP().startup(anaconda.intf) storage.dasd.DASD().startup(anaconda.intf, anaconda.id.storage.exclusiveDisks, anaconda.id.storage.zeroMbr) disks = filter(lambda d: udev_device_is_disk(d) and \ not udev_device_is_dm(d) and \ not udev_device_is_md(d) and \ not udev_device_get_md_container(d), udev_get_block_devices()) writeMultipathConf(friendly_names=True) if os.path.exists("/etc/multipath.conf"): # identifyMultipaths() uses 'multipath -d' and 'multipath -ll' to find # mpath devices. In case there are devices already set up they won't # show up (or show up with a wrong name). Flush those first. log.info("filter_gui: flushing all multipath devices.") flush_mpaths() (singlepaths, mpaths, partitions) = identifyMultipaths(disks) else: mpaths = [] singlepaths = disks # The device list could be really long, so we really only want to # iterate over it the bare minimum of times. Dividing this list up # now means fewer elements to iterate over later. singlepaths = filter(lambda info: self._device_size_is_nonzero(info), singlepaths) (raids, nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), singlepaths) self.pages = [ self._makeBasic(), self._makeRAID(), self._makeMPath(), self._makeOther(), self._makeSearch() ] self.populate(nonraids, mpaths, raids) # If the "Add Advanced" button is ever clicked, we need to have a list # of what devices previously existed so we know what's new. Then we # can just add the new devices to the UI. This is going to be slow, # but the user has to click a button to get to the slow part. self._cachedDevices = NameCache(singlepaths) self._cachedRaidDevices = NameCache(raids) # Multipath is a little more complicated. Since mpaths is a list of # lists, we can't directly store that into the cache. Instead we want # to flatten it into a single list of all components of all multipaths # and store that. lst = list(itertools.chain(*mpaths)) self._cachedMPaths = NameCache(lst) # Switch to the first notebook page that displays any devices. i = 0 for pg in self.pages: if pg.getNVisible(): self.notebook.set_current_page(i) break i += 1 return self.vbox
def getScreen(self, anaconda): self.anaconda = anaconda self.storage = anaconda.id.storage self.intf = anaconda.intf self.dispatch = anaconda.dispatch if self.anaconda.dir == DISPATCH_FORWARD: # Save system's partition type setting and restore user's self.anaconda.clearPartTypeSystem = self.storage.clearPartType if self.anaconda.clearPartTypeSelection is not None: self.storage.clearPartType = self.anaconda.clearPartTypeSelection (self.xml, vbox) = gui.getGladeWidget("autopart.glade", "parttypeTable") self.encryptButton = self.xml.get_widget("encryptButton") self.reviewButton = self.xml.get_widget("reviewButton") self.table = self.xml.get_widget("parttypeTable") self.prevrev = None self.reviewButton.set_active( not self.dispatch.stepInSkipList("partition")) self.encryptButton.set_active(self.storage.encryptedAutoPart) self.buttonGroup = pixmapRadioButtonGroup() self.buttonGroup.addEntry( "all", _("Use All Space"), pixmap=gui.readImageFromFile("partscheme-all.png"), descr=_("Removes all partitions on the selected " "device(s). This includes partitions " "created by other operating systems.\n\n" "<b>Tip:</b> This option will remove " "data from the selected device(s). Make " "sure you have backups.")) self.buttonGroup.addEntry( "replace", _("Replace Existing Linux System(s)"), pixmap=gui.readImageFromFile("partscheme-replace.png"), descr=_("Removes only Linux partitions (created from " "a previous Linux installation). This does " "not remove other partitions you may have " "on your storage device(s) (such as VFAT or " "FAT32).\n\n" "<b>Tip:</b> This option will remove " "data from the selected device(s). Make " "sure you have backups.")) self.buttonGroup.addEntry( "shrink", _("Shrink Current System"), pixmap=gui.readImageFromFile("partscheme-shrink.png"), descr=_("Shrinks existing partitions to create free " "space for the default layout.")) self.buttonGroup.addEntry( "freespace", _("Use Free Space"), pixmap=gui.readImageFromFile("partscheme-freespace.png"), descr=_("Retains your current data and partitions and " "uses only the unpartitioned space on the " "selected device(s), assuming you have enough " "free space available.")) self.buttonGroup.addEntry( "custom", _("Create Custom Layout"), pixmap=gui.readImageFromFile("partscheme-custom.png"), descr=_("Manually create your own custom layout on " "the selected device(s) using our partitioning " "tool.")) self.buttonGroup.setToggleCallback(self.typeChanged) widget = self.buttonGroup.render() self.table.attach(widget, 0, 1, 1, 2) # if not set in ks, use UI default if self.storage.clearPartChoice: self.buttonGroup.setCurrent(self.storage.clearPartChoice) else: if self.storage.clearPartType is None or self.storage.clearPartType == CLEARPART_TYPE_LINUX: self.buttonGroup.setCurrent("replace") elif self.storage.clearPartType == CLEARPART_TYPE_NONE: self.buttonGroup.setCurrent("freespace") elif self.storage.clearPartType == CLEARPART_TYPE_ALL: self.buttonGroup.setCurrent("all") if self.buttonGroup.getCurrent() == "custom": # make sure reviewButton is active and not sensitive if self.prevrev == None: self.prevrev = self.reviewButton.get_active() self.reviewButton.set_active(True) self.reviewButton.set_sensitive(False) self.encryptButton.set_sensitive(False) return vbox