def analyze_objects(self):
     if self.analyze_done: return True
     for kobj in KnownObjects.select():
         if kobj.objtype == "module": self.load_module(kobj)
         elif kobj.objtype == "feature": self.load_feature(kobj)
         else:
             self.iface.warn("Unknown object type %s" % kobj.objtype)
             self.iface.warn(kobj.format())
     ModuleObject.cls_finish_setup()
     FeatureObject.cls_finish_setup()
     self.analyze_done = True
Beispiel #2
0
 def analyze_objects(self):
     if self.analyze_done: return True
     for kobj in KnownObjects.select():
         if kobj.objtype == "module": self.load_module(kobj)
         elif kobj.objtype == "feature": self.load_feature(kobj)
         else: 
             self.iface.warn("Unknown object type %s" % kobj.objtype)
             self.iface.warn(kobj.format())
     ModuleObject.cls_finish_setup()
     FeatureObject.cls_finish_setup()
     self.analyze_done =True
Beispiel #3
0
def update_database(iface):
    from datetime import datetime
    iface.info(u"Actualizando base de datos de módulos y funcionalidades . . . ")
    KnownObjects.delete().execute() # -- Borrar todos los objetos
    module_root = {}
    for path in cfg.module.modulefolders:
        if not os.path.exists(path):
            iface.debug(u"Se ignora directorio inexistente %s" % repr(path))
            continue
        modules = find_files(path,"*.mod", True)
        if not modules:
            iface.warn(u"Directorio no contiene módulos %s" % repr(path))
            continue
        iface.info(u"Se encontraron %d modulos en la carpeta %s" % (len(modules), repr(path)))
        for module in modules:
            iface.debug(u"Módulo %s" % module)
            mtime = get_max_mtime(path,module)
            dmtime = datetime.fromtimestamp(mtime)
            obj = KnownObjects()
            obj.objtype = "module"
            obj.abspath = path
            obj.relpath = os.path.dirname(module)
            obj.filename = os.path.basename(module)
            obj.timestamp = int(mtime)
            obj.extradata = ""
            obj.save()
            
            # print dmtime.strftime("%a %d %B %Y @ %H:%M:%S %z")
        module_root[path] = modules

    feature_root = {}
    for path in cfg.module.featurefolders:
        if not os.path.exists(path):
            iface.debug(u"Se ignora directorio inexistente %s" % repr(path))
            continue
        features = find_files(path,"*.feature.ini", True)
        if not features:
            iface.warn("Directorio no contiene funcionalidades %s" % repr(path))
            continue
        iface.info(u"Se encontraron %d funcionalidades en la carpeta %s" % (len(features), repr(path)))
        for feature in features:
            iface.debug(u"Funcionalidad %s" % feature)
            mtime = get_max_mtime(path,feature)
            dmtime = datetime.fromtimestamp(mtime)
            # print dmtime.strftime("%a %d %B %Y @ %H:%M:%S %z")
            obj = KnownObjects()
            obj.objtype = "feature"
            obj.abspath = path
            obj.relpath = os.path.dirname(feature)
            obj.filename = os.path.basename(feature)
            obj.timestamp = int(mtime)
            obj.extradata = ""
            obj.save()
        
        feature_root[path] = features
Beispiel #4
0
 def setup(self):
     self.db = peewee.SqliteDatabase(self.dbfile)
     self.db.execute("PRAGMA synchronous = 1;")
     KnownObjects.setup(database.db)
Beispiel #5
0
def update_database(iface):
    from datetime import datetime
    iface.info(
        u"Actualizando base de datos de módulos y funcionalidades . . . ")
    KnownObjects.delete().execute()  # -- Borrar todos los objetos
    module_root = {}
    for path in cfg.module.modulefolders:
        if not os.path.exists(path):
            iface.debug(u"Se ignora directorio inexistente %s" % repr(path))
            continue
        modules = find_files(path, "*.mod", True)
        if not modules:
            iface.warn(u"Directorio no contiene módulos %s" % repr(path))
            continue
        iface.info(u"Se encontraron %d modulos en la carpeta %s" %
                   (len(modules), repr(path)))
        for module in modules:
            iface.debug(u"Módulo %s" % module)
            mtime = get_max_mtime(path, module)
            dmtime = datetime.fromtimestamp(mtime)
            obj = KnownObjects()
            obj.objtype = "module"
            obj.abspath = path
            obj.relpath = os.path.dirname(module)
            obj.filename = os.path.basename(module)
            obj.timestamp = int(mtime)
            obj.extradata = ""
            obj.save()

            # print dmtime.strftime("%a %d %B %Y @ %H:%M:%S %z")
        module_root[path] = modules

    feature_root = {}
    for path in cfg.module.featurefolders:
        if not os.path.exists(path):
            iface.debug(u"Se ignora directorio inexistente %s" % repr(path))
            continue
        features = find_files(path, "*.feature.ini", True)
        if not features:
            iface.warn("Directorio no contiene funcionalidades %s" %
                       repr(path))
            continue
        iface.info(u"Se encontraron %d funcionalidades en la carpeta %s" %
                   (len(features), repr(path)))
        for feature in features:
            iface.debug(u"Funcionalidad %s" % feature)
            mtime = get_max_mtime(path, feature)
            dmtime = datetime.fromtimestamp(mtime)
            # print dmtime.strftime("%a %d %B %Y @ %H:%M:%S %z")
            obj = KnownObjects()
            obj.objtype = "feature"
            obj.abspath = path
            obj.relpath = os.path.dirname(feature)
            obj.filename = os.path.basename(feature)
            obj.timestamp = int(mtime)
            obj.extradata = ""
            obj.save()

        feature_root[path] = features
Beispiel #6
0
 def setup(self):
     self.db = peewee.SqliteDatabase(self.dbfile)
     self.db.execute("PRAGMA synchronous = 1;")
     KnownObjects.setup(database.db)