Пример #1
0
 def add_source(self, caption, url):
     install_source = InstallSource()
     install_source.url = url
     install_source.caption = caption
     self.sources.append(install_source)
     self.on_source_added(install_source)
     self.set_current_item(len(self.sources) - 1)
Пример #2
0
	def add_source(self, caption, url):
		install_source = InstallSource()
		install_source.url = url
		install_source.caption = caption
		self.sources.append(install_source)
		self.on_source_added(install_source)
		self.set_current_item(len(self.sources) - 1)
Пример #3
0
	def __init__(self, privatePath="./", sr=None):
		self.statusReporter = sr
		self.privatePath = privatePath
		self.transport = None
		self.passive = False
		self.term = False
		if self.privatePath:
			self.privatePath = removeTrailingSlash(self.privatePath)

		confPath = privatePath + "/InstallMgr.conf"
		FileMgr.createParent(confPath)
		
		installConf = Sword.SWConfig(confPath)

		#SectionMap::iterator sourcesSection;
		#ConfigEntMap::iterator sourceBegin;
		#ConfigEntMap::iterator sourceEnd;

		self.sources = {}
		
		self.setFTPPassive(
			installConf.get("General", "PassiveFTP") == "false"
		)

		sourcesSection = installConf.getSections().find(Sword.SWBuf("Sources"))
		if sourcesSection != installConf.getSections().end():
			ftp_source = Sword.SWBuf("FTPSource")
			ss = sourcesSection.value()[1]
			
			sourceBegin = ss.lower_bound(ftp_source)
			sourceEnd = ss.upper_bound(ftp_source)

			while sourceBegin != sourceEnd:
				install_source = InstallSource("FTP", 
					sourceBegin.value()[1].c_str())

				self.sources[install_source.caption] = install_source
				parent = privatePath + "/" + install_source.source + "/file"
				FileMgr.createParent(parent)
				install_source.localShadow = privatePath + "/" + install_source.source
				sourceBegin += 1

		self.defaultMods = set()
		sourcesSection = installConf.getSections().find(Sword.SWBuf("General"))
		general = sourcesSection.value()[1]
		
		if sourcesSection != installConf.getSections().end():
			default_mod = Sword.SWBuf("DefaultMod")
			sourceBegin = general.lower_bound(default_mod)
			sourceEnd = general.upper_bound(default_mod)

			while sourceBegin != sourceEnd:
				self.defaultMods.add(sourceBegin.value()[1].c_str())
				sourceBegin += 1
Пример #4
0
    def __init__(self, privatePath="./", sr=None):
        self.statusReporter = sr
        self.privatePath = privatePath
        self.transport = None
        self.passive = False
        self.term = False
        if self.privatePath:
            self.privatePath = removeTrailingSlash(self.privatePath)

        confPath = privatePath + "/InstallMgr.conf"
        FileMgr.createParent(confPath)

        installConf = Sword.SWConfig(confPath)

        #SectionMap::iterator sourcesSection;
        #ConfigEntMap::iterator sourceBegin;
        #ConfigEntMap::iterator sourceEnd;

        self.sources = {}

        self.setFTPPassive(installConf.get("General", "PassiveFTP") == "false")

        sourcesSection = installConf.getSections().find(Sword.SWBuf("Sources"))
        if sourcesSection != installConf.getSections().end():
            ftp_source = Sword.SWBuf("FTPSource")
            ss = sourcesSection.value()[1]

            sourceBegin = ss.lower_bound(ftp_source)
            sourceEnd = ss.upper_bound(ftp_source)

            while sourceBegin != sourceEnd:
                install_source = InstallSource("FTP",
                                               sourceBegin.value()[1].c_str())

                self.sources[install_source.caption] = install_source
                parent = privatePath + "/" + install_source.source + "/file"
                FileMgr.createParent(parent)
                install_source.localShadow = privatePath + "/" + install_source.source
                sourceBegin += 1

        self.defaultMods = set()
        sourcesSection = installConf.getSections().find(Sword.SWBuf("General"))
        general = sourcesSection.value()[1]

        if sourcesSection != installConf.getSections().end():
            default_mod = Sword.SWBuf("DefaultMod")
            sourceBegin = general.lower_bound(default_mod)
            sourceEnd = general.upper_bound(default_mod)

            while sourceBegin != sourceEnd:
                self.defaultMods.add(sourceBegin.value()[1].c_str())
                sourceBegin += 1