def loadConfig(self,appConfig=None):
     ''' Read webGobbler configuration from registry or .INI file.
         If the registry is not available, the .ini file will be read.
         If the .ini file is not available, the default configuration will be used.
     '''
     self.setStatus("Loading configuration.")
     if appConfig != None:
         raise NotImplementedError
     self.config = webgobbler.applicationConfig()  # Get a new applicationConfig object.
     self.configSource = None
     # First, we try to read configuration from registry.
     try:
         self.config.loadFromRegistryCurrentUser()
         self.configSource = "registry"
     except ImportError:
         pass
     except WindowsError:
         pass
     
     if self.configSource == None:
         # We are probably not under Windows, or the registry could not be read.
         # We try to read the .ini file in user's home directory:
         try:
             self.config.loadFromFileInUserHomedir()
             self.configSource = "inifile"
         except:
             self.configSource = 'default'
Exemple #2
0
    def loadConfig(self, appConfig=None):
        ''' Read webGobbler configuration from registry or .INI file.
            If the registry is not available, the .ini file will be read.
            If the .ini file is not available, the default configuration will be used.
        '''
        self.setStatus("Loading configuration.")
        if appConfig != None:
            raise NotImplementedError
        self.config = webgobbler.applicationConfig(
        )  # Get a new applicationConfig object.
        self.configSource = None
        # First, we try to read configuration from registry.
        try:
            self.config.loadFromRegistryCurrentUser()
            self.configSource = "registry"
        except ImportError:
            pass
        except WindowsError:
            pass

        if self.configSource == None:
            # We are probably not under Windows, or the registry could not be read.
            # We try to read the .ini file in user's home directory:
            try:
                self.config.loadFromFileInUserHomedir()
                self.configSource = "inifile"
            except:
                self.configSource = 'default'
Exemple #3
0
#!/usr/bin/env python

total = 100
directory = "imagepool"

from webgobbler import imagePool, applicationConfig
from time import sleep

config = applicationConfig()
config["pool.keepimages"] = True
config["pool.imagepooldirectory"] = directory
config["pool.nbimages"] = total
pool = imagePool(config=config)
try:
    try:
        pool.start()
        count = 0
        while True:
            image = pool.getImage()
            if image:
                count += 1
                print "Downloaded: %s/%s" % (count, total)
                if total <= count:
                    break
            else:
                sleep(1.0)
    except KeyboardInterrupt:
        print "Interrupt."
finally:
    print "Stopping image pool (please wait)."
    pool.shutdown()
Exemple #4
0
#!/usr/bin/env python

total = 100
directory = "imagepool"

from webgobbler import imagePool, applicationConfig
from time import sleep

config = applicationConfig()
config["pool.keepimages"] = True
config["pool.imagepooldirectory"] = directory
config["pool.nbimages"] = total
pool = imagePool(config=config)
try:
    try:
        pool.start()
        count = 0
        while True:
            image = pool.getImage()
            if image:
                count += 1
                print "Downloaded: %s/%s" % (count, total)
                if total <= count:
                    break
            else:
                sleep(1.0)
    except KeyboardInterrupt:
        print "Interrupt."
finally:
    print "Stopping image pool (please wait)."
    pool.shutdown()