def IDS_images(self): """ Load IDS images settings from config file """ # Loading IDS image conf basegroup = "IDS.images" c = ConfDB() c.beginGroup(basegroup) childGroups = c.childGroups() c.endGroup() for id in childGroups: cgroup = basegroup + '/' + id conf = idsImageConf() conf.id = int(id) conf.image1 = c.get(cgroup + "/image1", unicode('')) conf.image2 = c.get(cgroup + "/image2", unicode('')) conf.name = c.get(cgroup + "/name", unicode('')) conf.memory = int(c.get(cgroup + "/memory", 512)) conf.nic_nb = int(c.get(cgroup + "/nic_nb", 3)) conf.usermod = c.value(cgroup + "/usermod", QtCore.QVariant(False)).toBool() conf.nic = str(c.get(cgroup + "/nic", 'e1000')) conf.options = str(c.get(cgroup + "/options", '')) conf.kvm = c.value(cgroup + "/kvm", QtCore.QVariant(False)).toBool() conf.monitor = c.value(cgroup + "/monitor", QtCore.QVariant(False)).toBool() globals.GApp.idsimages[conf.name] = conf if conf.id >= globals.GApp.idsimages_ids: globals.GApp.idsimages_ids = conf.id + 1
def IDS_images(self): """ Load IDS images settings from config file """ # Loading IDS image conf basegroup = "IDS.images" c = ConfDB() c.beginGroup(basegroup) childGroups = c.childGroups() c.endGroup() for id in childGroups: cgroup = basegroup + '/' + id conf = idsImageConf() conf.id = int(id) conf.image1 = c.get(cgroup + "/image1", unicode('')) conf.image2 = c.get(cgroup + "/image2", unicode('')) conf.name = c.get(cgroup + "/name", unicode('')) conf.memory = int(c.get(cgroup + "/memory", 512)) conf.nic_nb = int(c.get(cgroup + "/nic_nb", 3)) conf.nic = str(c.get(cgroup + "/nic", 'e1000')) conf.options = str(c.get(cgroup + "/options", '')) conf.kqemu = c.value(cgroup + "/kqemu", QtCore.QVariant(False)).toBool() conf.kvm = c.value(cgroup + "/kvm", QtCore.QVariant(False)).toBool() globals.GApp.idsimages[conf.name] = conf if conf.id >= globals.GApp.idsimages_ids: globals.GApp.idsimages_ids = conf.id + 1
def slotSaveIDSImage(self): """ Add/Save IDS Image in the list of IDS images """ name = unicode(self.NameIDSImage.text()) image1 = unicode(self.IDSImage1.text()) image2 = unicode(self.IDSImage2.text()) if not name or not image1 or not image2: QtGui.QMessageBox.critical(globals.preferencesWindow, translate("Page_PreferencesQemu", "IDS"), translate("Page_PreferencesQemu", "Identifier, image 1 and image 2 must be set!")) return if globals.GApp.idsimages.has_key(name): # update an already existing IDS image1 + image2 item_to_update = self.treeWidgetIDSImages.findItems(name, QtCore.Qt.MatchFixedString)[0] item_to_update.setText(1, image1) item_to_update.setText(2, image2) else: # else create a new entry item = QtGui.QTreeWidgetItem(self.treeWidgetIDSImages) # image name column item.setText(0, name) # image1 path column item.setText(1, image1) # image2 path column item.setText(2, image2) # save settings if globals.GApp.idsimages.has_key(name): conf = globals.GApp.idsimages[name] else: conf = idsImageConf() conf.id = globals.GApp.idsimages_ids globals.GApp.idsimages_ids += 1 conf.name = name conf.image1 = image1 conf.image2 = image2 conf.memory = self.IDSMemory.value() conf.nic_nb = self.IDSNICNb.value() conf.nic = str(self.IDSNIC.currentText()) conf.options = str(self.IDSOptions.text()) if self.IDScheckBoxKqemu.checkState() == QtCore.Qt.Checked: conf.kqemu = True else: conf.kqemu = False if self.IDScheckBoxKVM.checkState() == QtCore.Qt.Checked: conf.kvm = True else: conf.kvm = False globals.GApp.idsimages[name] = conf self.treeWidgetIDSImages.resizeColumnToContents(0) QtGui.QMessageBox.information(globals.preferencesWindow, translate("Page_PreferencesQemu", "Save"), translate("Page_PreferencesQemu", "IDS settings have been saved"))