示例#1
0
    def getProxySettings(self):
        config = PisiIface.read_config("/etc/pisi/pisi.conf")
        httpProxy = httpProxyPort = ftpProxy = ftpProxyPort = httpsProxy = httpsProxyPort = None

        http = config.get("general", "http_proxy")
        if http and http != "None":
            httpProxy, httpProxyPort = http[7:].split(":")
            self.httpProxy.setText(httpProxy)
            self.httpProxyPort.setValue(int(httpProxyPort))

        https = config.get("general", "https_proxy")
        if https and https != "None":
            httpsProxy, httpsProxyPort = https[8:].split(":")
            self.httpsProxy.setText(httpsProxy)
            self.httpsProxyPort.setValue(int(httpsProxyPort))

        ftp = config.get("general", "ftp_proxy")
        if ftp and ftp != "None":
            ftpProxy, ftpProxyPort = ftp[6:].split(":")
            self.ftpProxy.setText(ftpProxy)
            self.ftpProxyPort.setValue(int(ftpProxyPort))

        if httpProxy or ftpProxy or httpsProxy:
            self.useProxyButton.setChecked(True)
            if (httpProxy == httpsProxy == ftpProxy) and (httpProxyPort == httpsProxyPort == ftpProxyPort):
                self.useHttpForAll.setChecked(True)
示例#2
0
    def getBandwidthSetting(self):
        config = PisiIface.read_config("/etc/pisi/pisi.conf")
        bandwidth_limit = config.get("general", "bandwidth_limit")

        if bandwidth_limit:
           bandwidth_limit = int(bandwidth_limit)
        else:
            bandwidth_limit = 0

        if bandwidth_limit != 0:
            self.useBandwidthLimit.setChecked(True)
        self.bandwidthValue.setValue(bandwidth_limit)
示例#3
0
    def getCacheSettings(self):
        config = PisiIface.read_config("/etc/pisi/pisi.conf")

        cache = config.get("general", "package_cache")
        cache_limit = config.get("general", "package_cache_limit")

        if cache_limit:
            cache_limit = int(cache_limit)
        else:
            cache_limit = 0

        # If pisi.conf does not have it yet, default is use package cache
        if not cache or cache == "True":
            enableCache = True
        else:
            enableCache = False

        self.cacheEnabled = enableCache
        self.cacheSize = cache_limit
        self.useCacheCheck.setChecked(enableCache)
        self.useCacheSize.setValue(cache_limit)