def __init__(self, anaconda, methodstr): # Create temporary repo to store methodstr needed for # createDialog parent method. temprepo = AnacondaYumRepo("UITmpMethodstrRepo") temprepo.name = "Installation Repo" temprepo.anacondaBaseURLs = [methodstr] RepoEditor.__init__(self, anaconda, temprepo)
def _addRepo(self, *args): if not network.hasActiveNetDev(): net = NetworkConfigurator(self.anaconda.id.network) ret = net.run() net.destroy() if ret == gtk.RESPONSE_CANCEL: return gtk.RESPONSE_CANCEL (dxml, dialog) = gui.getGladeWidget("addrepo.glade", "addRepoDialog") gui.addFrame(dialog) lbl = dxml.get_widget("descLabel") txt = lbl.get_text() lbl.set_text(txt % (productName, )) dialog.show_all() while 1: rc = dialog.run() if rc == gtk.RESPONSE_CANCEL: break reponame = dxml.get_widget("nameEntry").get_text() reponame.strip() if len(reponame) == 0: self.intf.messageWindow( _("Invalid Repository Name"), _("You must provide a non-zero length " "repository name.")) continue repourl = dxml.get_widget("urlEntry").get_text() repourl.strip() if (len(repourl) == 0 or not (repourl.startswith("http://") or repourl.startswith("ftp://"))): self.intf.messageWindow( _("Invalid Repository URL"), _("You must provide an HTTP or FTP " "URL to a repository.")) continue # FIXME: this is yum specific repo = AnacondaYumRepo(uri=repourl, repoid=reponame) repo.name = reponame repo.basecachedir = self.backend.ayum.conf.cachedir repo.enable() try: self.backend.ayum.repos.add(repo) except yum.Errors.DuplicateRepoError, e: self.intf.messageWindow( _("Error"), _("The repository %s has already been added. Please " "choose a different repository name and " "URL.") % reponame, type="ok", custom_icon="error") continue if not self._setupRepo(repo): continue s = self.xml.get_widget("repoList").get_model() s.append([repo.isEnabled(), repo.name, repo]) self.repos[repo.name] = (repo.baseurl[0], None) break
def _addRepo(self, *args): if not network.hasActiveNetDev(): net = NetworkConfigurator(self.anaconda.id.network) ret = net.run() net.destroy() if ret == gtk.RESPONSE_CANCEL: return gtk.RESPONSE_CANCEL (dxml, dialog) = gui.getGladeWidget("addrepo.glade", "addRepoDialog") gui.addFrame(dialog) lbl = dxml.get_widget("descLabel") txt = lbl.get_text() lbl.set_text(txt %(productName,)) dialog.show_all() while 1: rc = dialog.run() if rc == gtk.RESPONSE_CANCEL: break reponame = dxml.get_widget("nameEntry").get_text() reponame.strip() if len(reponame) == 0: self.intf.messageWindow(_("Invalid Repository Name"), _("You must provide a non-zero length " "repository name.")) continue repourl = dxml.get_widget("urlEntry").get_text() repourl.strip() if (len(repourl) == 0 or not (repourl.startswith("http://") or repourl.startswith("ftp://"))): self.intf.messageWindow(_("Invalid Repository URL"), _("You must provide an HTTP or FTP " "URL to a repository.")) continue # FIXME: this is yum specific repo = AnacondaYumRepo(uri=repourl, repoid=reponame) repo.name = reponame repo.basecachedir = self.backend.ayum.conf.cachedir repo.enable() try: self.backend.ayum.repos.add(repo) except yum.Errors.DuplicateRepoError, e: self.intf.messageWindow(_("Error"), _("The repository %s has already been added. Please " "choose a different repository name and " "URL.") % reponame, type="ok", custom_icon="error") continue if not self._setupRepo(repo): continue s = self.xml.get_widget("repoList").get_model() s.append([repo.isEnabled(), repo.name, repo]) self.repos[repo.name] = (repo.baseurl[0], None) break