Ejemplo n.º 1
0
def ScanDefinitionNames() -> Dict:
    """
    Parses the Definition description to give definition names
    """

    uDefinitionName: str
    oDefinitionPathes: cDefinitionPathes
    oRepManagerEntry: cRepManagerEntry
    dDefinitionReps: Dict = {}

    aHide: List[str] = [
        "appfavorites_template", "cmdfavorites_template",
        "tvfavorites_template", "activity_template"
    ]

    for uDefinitionName in Globals.aDefinitionList:
        if not uDefinitionName in aHide:
            if Globals.dDefinitionPathes.get(uDefinitionName) is None:
                oDefinitionPathes = cDefinitionPathes(
                    uDefinitionName=uDefinitionName)
                Globals.dDefinitionPathes[uDefinitionName] = oDefinitionPathes
            oRepManagerEntry = cRepManagerEntry(
                oFileName=Globals.dDefinitionPathes[uDefinitionName].
                oFnDefinition)
            if oRepManagerEntry.ParseFromXML():
                dDefinitionReps[
                    uDefinitionName] = oRepManagerEntry.oRepEntry.uName

    return dDefinitionReps
Ejemplo n.º 2
0
 def GetOthers(self) -> None:
     """ Gets all others reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     self.aFiles=(self.oPathRepSource + 'repositories/orca-remote/repositories/others').GetFileList(bSubDirs = False, bFullPath = True)
     for uFn in self.aFiles:
         oRepManagerEntry:cRepManagerEntry = cRepManagerEntry(oFileName=uFn)
         if oRepManagerEntry.ParseFromXML():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Resource not ready for Repository Manager, skipped: '+uFn)
     self.SaveRepositoryXML('others','Various ORCA resources')
Ejemplo n.º 3
0
 def GetSkins(self) -> None:
     """ Gets all skins reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     for uSkinName in Globals.aSkinList:
         oFn:cFileName=cFileName().ImportFullPath(uFnFullName='%s/skins/%s/skin.xml' % (Globals.oPathRoot.string, uSkinName))
         oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=oFn)
         if oRepManagerEntry.ParseFromXML():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Skin not ready for Repository Manager, skipped: '+oFn)
     self.SaveRepositoryXML('skins','Orca Genuine Skins')
Ejemplo n.º 4
0
 def GetScripts(self) -> None:
     """ Gets all scripts reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     for uScriptName in Globals.oScripts.dScriptPathList:
         oFn:cFileName=cFileName(Globals.oScripts.dScriptPathList[uScriptName])+'script.py'
         oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=oFn)
         if oRepManagerEntry.ParseFromSourceFile():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Script not ready for Repository Manager, skipped: '+oFn)
     self.SaveRepositoryXML('scripts','Orca Genuine Scripts')
Ejemplo n.º 5
0
 def GetInterfaces(self) -> None:
     """ Gets all interface reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     for uInterFaceName in Globals.oInterFaces.aObjectNameList:
         oFn:cFileName=cFileName().ImportFullPath(uFnFullName='%s/interfaces/%s/interface.py' % (Globals.oPathRoot.string, uInterFaceName))
         oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=oFn)
         if oRepManagerEntry.ParseFromSourceFile():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Interface not ready for Repository Manager, skipped: '+oFn)
     self.SaveRepositoryXML('interfaces','Orca Genuine Interfaces')
Ejemplo n.º 6
0
 def GetLanguages(self) -> None:
     """ Gets all Language reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     for uLanguage in Globals.aLanguageList:
         oFn:cFileName=cFileName().ImportFullPath(uFnFullName='%s/languages/%s/strings.xml' % (Globals.oPathRoot.string, uLanguage))
         oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=oFn)
         if oRepManagerEntry.ParseFromXML():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Language not ready for Repository Manager, skipped: '+oFn)
     self.SaveRepositoryXML('languages','Orca Genuine Language Files')
Ejemplo n.º 7
0
 def GetSounds(self) -> None:
     """ Gets all sounds reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     for uSound in Globals.oSound.aSoundsList:
         oFnSound:cFileName = cFileName(Globals.oPathSoundsRoot + uSound) +"sounds.xml"
         oRepManagerEntry:cRepManagerEntry = cRepManagerEntry(oFileName=oFnSound)
         if oRepManagerEntry.ParseFromXML():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Soundset not ready for Repository Manager, skipped: '+oFnSound)
     self.SaveRepositoryXML('sounds','Orca Genuine Sounds')
Ejemplo n.º 8
0
    def ParseSettings(self) -> None:
        """ Parses the settings for a definition """
        self.oRepManEntry = cRepManagerEntry(oFileName="")
        self.oRepManEntry.ParseFromXML(vContent=self.oET_Root)
        self.uDefDescription = self.oRepManEntry.oRepEntry.uName
        self.uDefPublicTitle = self.uDefDescription
        if self.uAlias != "" and self.uAlias != self.uName:
            self.uDefPublicTitle = "%s [%s]" % (self.uAlias,
                                                self.uDefPublicTitle)

        if self.bImportSettings:
            self.ParseXMLSettings()
        return
Ejemplo n.º 9
0
    def Init(self,
             uObjectName: str,
             oFnObject: Optional[cFileName] = None) -> None:
        """ Initializes the object """

        self.bIsInit = True
        self.uObjectName = uObjectName

        if self.uObjectType == "script":
            self.oPathMyCode = Globals.oScripts.dScriptPathList[
                self.uObjectName]
            if self.uIniFileLocation == "global":
                self.oPathMyData = Globals.oPathGlobalSettingsScripts + self.uObjectName
            elif self.uIniFileLocation == "local":
                self.oPathMyData = Globals.oDefinitionPathes.oPathDefinitionScriptSettings + self.uObjectName
        else:
            self.oPathMyCode = Globals.oPathInterface + self.uObjectName
            if self.uIniFileLocation == "global":
                self.oPathMyData = Globals.oPathGlobalSettingsInterfaces + self.uObjectName
            elif self.uIniFileLocation == "local":
                self.oPathMyData = Globals.oDefinitionPathes.oPathDefinitionInterfaceSettings + self.uObjectName

        if self.oPathMyData is not None:
            if not self.oPathMyData.Exists():
                self.oPathMyData.Create()

        self.oFnObject = cFileName(oFnObject)

        Globals.oLanguage.LoadXmlFile(self.uObjectType.upper(),
                                      self.uObjectName)
        oRepManagerEntry: cRepManagerEntry = cRepManagerEntry(
            oFileName=oFnObject)
        if oRepManagerEntry.ParseFromSourceFile():
            self.iMyVersion = oRepManagerEntry.oRepEntry.iVersion
            self.iOrcaVersion = oRepManagerEntry.oRepEntry.iMinOrcaVersion
        Globals.oNotifications.RegisterNotification(
            uNotification="on_stopapp",
            fNotifyFunction=self.DeInit,
            uDescription=self.uObjectType.capitalize() + ":" +
            self.uObjectName)
        Globals.oNotifications.RegisterNotification(
            uNotification="on_pause",
            fNotifyFunction=self.OnPause,
            uDescription=self.uObjectType.capitalize() + ":" +
            self.uObjectName)
        Globals.oNotifications.RegisterNotification(
            uNotification="on_resume",
            fNotifyFunction=self.OnResume,
            uDescription=self.uObjectType.capitalize() + ":" +
            self.uObjectName)
        self.ShowDebug(uMsg=u'Init')
Ejemplo n.º 10
0
 def GetCodesets(self) -> None:
     """ Gets all codeset reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     self.aFiles=Globals.oPathCodesets.GetFileList(bSubDirs = True, bFullPath = True)
     for uFn in self.aFiles:
         if uFn.lower().endswith('.xml'):
             oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=uFn)
             if oRepManagerEntry.ParseFromXML():
                 if not oRepManagerEntry.oRepEntry.bSkip:
                     self.aRepManagerEntries.append(oRepManagerEntry)
             else:
                 Logger.warning('Codeset not ready for Repository Manager, skipped: '+uFn)
     self.SaveRepositoryXML('codesets','Orca Genuine Codesets')
Ejemplo n.º 11
0
 def GetFonts(self) -> None:
     """ Gets all others reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     aFontsFolders:List[str] = Globals.oPathFonts.GetFolderList(bFullPath=True)
     for uFontFolder in aFontsFolders:
         oFnFontDefinition:cFileName = cFileName(cPath(uFontFolder)) + "fonts.xml"
         oRepManagerEntry:cRepManagerEntry = cRepManagerEntry(oFileName=oFnFontDefinition)
         if oRepManagerEntry.ParseFromXML():
             if not oRepManagerEntry.oRepEntry.bSkip:
                 self.aRepManagerEntries.append(oRepManagerEntry)
         else:
             Logger.warning('Font not ready for Repository Manager, skipped: '+oFnFontDefinition)
     self.SaveRepositoryXML('fonts','Font Resources')
Ejemplo n.º 12
0
 def GetWizardTemplates(self) -> None:
     """ Gets all wizard reps """
     del self.aFiles[:]
     del self.aRepManagerEntries[:]
     aDirs:List[str]=(Globals.oPathRoot + u'wizard templates').GetFolderList()
     for uDirName in aDirs:
         aDirsSub:List[str]=(Globals.oPathRoot + (u'wizard templates/' + uDirName)).GetFolderList()
         for uDirsSub in aDirsSub:
             oFn:cFileName=cFileName(Globals.oPathRoot + (u'wizard templates/' + uDirName + "/" + uDirsSub)) +  (uDirsSub + ".xml")
             oRepManagerEntry:cRepManagerEntry=cRepManagerEntry(oFileName=oFn)
             if oRepManagerEntry.ParseFromXML():
                 if not oRepManagerEntry.oRepEntry.bSkip:
                     self.aRepManagerEntries.append(oRepManagerEntry)
             else:
                 Logger.warning('Wizard Template not ready for Repository Manager, skipped: '+oFn)
     self.SaveRepositoryXML('wizard templates','Wizard Templates')
Ejemplo n.º 13
0
def GetDefinitionFileNameByName(*, uDefinitionName: str) -> str:
    """
        gets the definition file name if the definition description is available
    """
    try:
        aDefinitionList: List[str] = Globals.oPathDefinitionRoot.GetFolderList(
        )
        for uDir in aDefinitionList:
            if not uDir == 'shared_documents':
                oFn: cFileName = cFileName(Globals.oPathDefinitionRoot +
                                           uDir) + u"definition.xml"
                oRepManEntry: cRepManagerEntry = cRepManagerEntry(
                    oFileName=oFn)
                oRepManEntry.ParseFromXML()
                uDefName: str = oRepManEntry.oRepEntry.uName
                if uDefName == uDefinitionName:
                    return uDir
        return ''

    except Exception as e:
        LogError(
            uMsg=u'GetDefinitionFileNameByName: Error:Load Definition XmlFile:',
            oException=e)
        return ''