Ejemplo n.º 1
0
    def __loadExtended(self):
        """
        Load the Extended iDevices (iDevices coded in Python)
        JR: Modifico esta funcion para que tambien cargue los idevices extendidos de fabrica
        """
        self.__loadUserExtended()
        
        #JR: Si existe el archivo extended.data cargamos de ahi los iDevices extendidos
        extendedPath = self.config.configDir/'idevices'/'extended.data'
        log.debug("load extended iDevices from "+extendedPath)
        
        self.factoryiDevices = self.__getFactoryExtendediDevices()

        if extendedPath.exists():
            self.extended = persist.decodeObject(extendedPath.bytes())
        else:
            self.extended = copy.deepcopy(self.factoryiDevices)
            #self.extended = self.factoryiDevices
            for idevice in self.__getIdevicesFPD():
                self.delIdevice(idevice)

        for idevice in self.extended:
            for factoryiDevice in self.factoryiDevices:
                if factoryiDevice.title == idevice.title:
                    idevice.id = factoryiDevice.id
                    break
Ejemplo n.º 2
0
    def __loadExtended(self):
        """
        Load the Extended iDevices (iDevices coded in Python)
        JR: Modifico esta funcion para que tambien cargue los idevices extendidos de fabrica
        """
        self.__loadUserExtended()

        #JR: Si existe el archivo extended.data cargamos de ahi los iDevices extendidos
        extendedPath = self.config.configDir/'idevices'/'extended.data'
        log.debug("load extended iDevices from "+extendedPath)

        self.factoryiDevices = self.__getFactoryExtendediDevices()

        if extendedPath.exists():
            self.extended = persist.decodeObject(extendedPath.bytes())
        else:
            self.extended = copy.deepcopy(self.factoryiDevices)
            #self.extended = self.factoryiDevices
            for idevice in self.__getIdevicesFPD():
                self.delIdevice(idevice)




        # generate new ids for these iDevices, to avoid any clashes
        for idevice in self.extended:
            idevice.id = self.getNewIdeviceId()
Ejemplo n.º 3
0
    def __loadExtended(self):
        """
        Load the Extended iDevices (iDevices coded in Python)
        JRJ: Modifico esta función para que también cargue los idevices extendidos de fábrica
        (Function modified so it also loads extended factory iDevices)
        """
        self.__loadUserExtended()

        #JRJ: Si existe el archivo extended.data cargamos de ahi los iDevices extendidos
        # (if the file extended.data exists, we load there the extended iDevices)
        extendedPath = self.config.configDir/'idevices'/'extended.data'
        log.debug("load extended iDevices from "+extendedPath)

        self.factoryiDevices = self.__getFactoryExtendediDevices()

        # Temporarily (or not) we will make extended.data be rebuilt every time the application starts
        rebuilt_extended = True

        # Check if path exist and and if necessary delete config/extended.data
        if extendedPath.exists() and not rebuilt_extended:
            self.extended = persist.decodeObject(extendedPath.bytes())
            self.__upgradeExtended()
        else:
            self.extended = copy.deepcopy(self.factoryiDevices)
            for idevice in self.__getIdevicesFPD():
                self.delIdevice(idevice)
Ejemplo n.º 4
0
 def __loadGeneric(self):
     """
     Load the Generic iDevices from the appdata directory
     """
     #JRJ: Modificamos la lectura para contemplar los genéricos que se muestran y todos los genéricos
     # (Modidy the reading to apply also to the generic shown and all the generic iDevices)
     showgenericPath = self.config.configDir/'idevices'/'showgeneric.data'
     log.debug("load generic iDevices from "+showgenericPath)
     if showgenericPath.exists():
         self.generic = persist.decodeObject(showgenericPath.bytes())
         self.__upgradeGeneric()
         allgenericPath = self.config.configDir/'idevices'/'allgeneric.data'
         if allgenericPath.exists():
             self.factoryiDevices = self.factoryiDevices + persist.decodeObject(allgenericPath.bytes())
         else:
             self.factoryiDevices = self.factoryiDevices + self.generic
     else:
         self.generic = self.__createGeneric()
         self.factoryiDevices = self.factoryiDevices + self.generic
         from exe.engine.listaidevice import ListaIdevice
         self.addIdevice(ListaIdevice())
Ejemplo n.º 5
0
 def __loadGeneric(self):
     """
     Load the Generic iDevices from the appdata directory
     """
     #JRJ: Modificamos la lectura para contemplar los genéricos que se muestran y todos los genéricos
     # (Modidy the reading to apply also to the generic shown and all the generic iDevices)
     showgenericPath = self.config.configDir/'idevices'/'showgeneric.data'
     log.debug("load generic iDevices from "+showgenericPath)
     if showgenericPath.exists():
         self.generic = persist.decodeObject(showgenericPath.bytes())
         self.__upgradeGeneric()
         allgenericPath = self.config.configDir/'idevices'/'allgeneric.data'
         if allgenericPath.exists():
             self.factoryiDevices = self.factoryiDevices + persist.decodeObject(allgenericPath.bytes())
         else:
             self.factoryiDevices = self.factoryiDevices + self.generic
     else:
         self.generic = self.__createGeneric()
         self.factoryiDevices = self.factoryiDevices + self.generic
         from exe.engine.listaidevice import ListaIdevice
         self.addIdevice(ListaIdevice())
Ejemplo n.º 6
0
 def __loadGeneric(self):
     """
     Load the Generic iDevices from the appdata directory
     """
     genericPath = self.config.configDir / "idevices" / "generic.data"
     log.debug("load generic iDevices from " + genericPath)
     if genericPath.exists():
         self.generic = persist.decodeObject(genericPath.bytes())
         self.__upgradeGeneric()
     else:
         self.__createGeneric()
     for idevice in self.generic:
         idevice.id = self.getNewIdeviceId()
Ejemplo n.º 7
0
    def __loadGeneric(self):
        """
        Load the Generic iDevices from the appdata directory
        """
        genericPath = self.config.configDir / 'idevices' / 'generic.data'
        log.debug("load generic iDevices from " + genericPath)
        if genericPath.exists():
            self.generic = persist.decodeObject(genericPath.bytes())
            self.__upgradeGeneric()
        else:
            self.__createGeneric()

        # generate new ids for these iDevices, to avoid any clashes
        for idevice in self.generic:
            idevice.id = self.getNewIdeviceId()
Ejemplo n.º 8
0
    def __loadGeneric(self):
        """
        Load the Generic iDevices from the appdata directory
        """
        #JR: Modificamos la lectura para contemplar los genericos que se muestran y todos los genericos
        showgenericPath = self.config.configDir/'idevices'/'showgeneric.data'
        log.debug("load generic iDevices from "+showgenericPath)
        if showgenericPath.exists():
            self.generic = persist.decodeObject(showgenericPath.bytes())
            self.__upgradeGeneric()
            allgenericPath = self.config.configDir/'idevices'/'allgeneric.data'
            if allgenericPath.exists():
                self.factoryiDevices = self.factoryiDevices + persist.decodeObject(allgenericPath.bytes())
            else:
                self.factoryiDevices = self.factoryiDevices + self.generic
        else:
            self.generic = self.__createGeneric()
            self.factoryiDevices = self.factoryiDevices + self.generic

        for factoryiDevice in self.factoryiDevices:
            for idevice in self.generic:
                if factoryiDevice.title == idevice.title:
                    idevice.id = factoryiDevice.id
                    break
Ejemplo n.º 9
0
    def __loadGeneric(self):
        """
        Load the Generic iDevices from the appdata directory
        """
        genericPath = self.config.configDir/'idevices'/'generic.data'
        log.debug("load generic iDevices from "+genericPath)
        if genericPath.exists():
            self.generic = persist.decodeObject(genericPath.bytes())
            self.__upgradeGeneric()
        else:
            self.__createGeneric()


        # generate new ids for these iDevices, to avoid any clashes
        for idevice in self.generic:
            idevice.id = self.getNewIdeviceId()
Ejemplo n.º 10
0
    def __loadExtended(self):
        """
        Load the Extended iDevices (iDevices coded in Python)
        JRJ: Modifico esta función para que también cargue los idevices extendidos de fábrica
        (Function modified so it also loads extended factory iDevices)
        """
        self.__loadUserExtended()
        
        #JRJ: Si existe el archivo extended.data cargamos de ahi los iDevices extendidos
        # (if the file extended.data exists, we load there the extended iDevices)
        extendedPath = self.config.configDir/'idevices'/'extended.data'
        log.debug("load extended iDevices from "+extendedPath)
        
        self.factoryiDevices = self.__getFactoryExtendediDevices()

        if extendedPath.exists():
            self.extended = persist.decodeObject(extendedPath.bytes())
            self.__upgradeExtended()
        else:
            self.extended = copy.deepcopy(self.factoryiDevices)
            #self.extended = self.factoryiDevices
            for idevice in self.__getIdevicesFPD():
                self.delIdevice(idevice)
Ejemplo n.º 11
0
    def __loadExtended(self):
        """
        Load the Extended iDevices (iDevices coded in Python)
        JRJ: Modifico esta función para que también cargue los idevices extendidos de fábrica
        (Function modified so it also loads extended factory iDevices)
        """
        self.__loadUserExtended()
        
        #JRJ: Si existe el archivo extended.data cargamos de ahi los iDevices extendidos
        # (if the file extended.data exists, we load there the extended iDevices)
        extendedPath = self.config.configDir/'idevices'/'extended.data'
        log.debug("load extended iDevices from "+extendedPath)
        
        self.factoryiDevices = self.__getFactoryExtendediDevices()

        if extendedPath.exists():
            self.extended = persist.decodeObject(extendedPath.bytes())
            self.__upgradeExtended()
        else:
            self.extended = copy.deepcopy(self.factoryiDevices)
            #self.extended = self.factoryiDevices
            for idevice in self.__getIdevicesFPD():
                self.delIdevice(idevice)
Ejemplo n.º 12
0
 def testPersist(self):
     toEncode = Foo()
     encoded = persist.encodeObject(toEncode)
     decoded = persist.decodeObject(encoded)
     self.assertEqual(toEncode, decoded)
Ejemplo n.º 13
0
 def testPersist(self):
     toEncode = Foo()
     encoded = persist.encodeObject(toEncode)
     decoded = persist.decodeObject(encoded)
     self.assertEqual(toEncode, decoded)