Beispiel #1
0
    def LoadActions(self):
        """ parses the definition specific actions """
        Logger.info(u'Loading Actions for definition:' + self.uDefPublicTitle)
        SetDefinitionContext(self.uName)
        if Globals.oFnAction.Exists():
            sET_Data = CachedFile(Globals.oFnAction)
            sET_Data = ReplaceDefVars(sET_Data, self.oDefinitionVars)
            oET_Root = Orca_FromString(sET_Data, self,
                                       Globals.oFnAction.string)
            Orca_include(oET_Root, orca_et_loader)
            SetDefinitionContext(self.uName)
            Globals.oActions.LoadActionsSub(oET_Root, u'pagestartactions',
                                            u'pagestartaction',
                                            Globals.oActions.dActionsPageStart,
                                            Globals.oFnAction)
            Globals.oActions.LoadActionsSub(oET_Root, u'pagestartactions',
                                            u'pagestopaction',
                                            Globals.oActions.dActionsPageStop,
                                            Globals.oFnAction)
            Globals.oActions.LoadActionsSub(oET_Root, u'actions', u'action',
                                            Globals.oActions.dActionsCommands,
                                            Globals.oFnAction)

            SetVar(uVarName=u'ORCASTANDARDPAGESTARTACTIONSINCLUDED',
                   oVarValue=u"1")
            SetVar(uVarName=u'ORCASTANDARDACTIONSINCLUDED', oVarValue=u"1")
        RestoreDefinitionContext()
        return
Beispiel #2
0
 def LoadActions(self):
     """ parses the definition specific actions """
     Logger.info (u'Loading Actions for script:'+self.uScriptName)
     if self.oFnAction.Exists():
         sET_Data = CachedFile(self.oFnAction)
         oET_Root = Orca_FromString(sET_Data, None, self.oFnAction.string)
         Globals.oActions.LoadActionsSub(oET_Root,u'actions',         u'action',          Globals.oActions.dActionsCommands,  self.oFnAction.string)
Beispiel #3
0
    def ReplaceElement(self, uFnElement, uReplaceWidgetName, oDefinition):
        """ Replaces an element at runtime in a page: the page must not be initalized
        :param string uFnElement: FileName of element to load
        :param string uReplaceWidgetName: The Widgetname to be replaced
        :param cDefinition oDefinition: Target Definition
        :rtype: bool
        :return: True if successful, otherwise False

        """

        uFnFile = ''

        try:
            uFnFile = (cFileName(u'').ImportFullPath(uFnElement)).string
            SetVar(uVarName='ORCA_INCLUDEFILE', oVarValue=uFnFile)
            if oDefinition is None:
                oDef = self.oWidgetBackGround.oDef
            else:
                oDef = oDefinition
            sET_Data = CachedFile(Globals.oFnElementIncludeWrapper)
            sET_Data = ReplaceDefVars(sET_Data, oDef.oDefinitionVars)
            oET_Root = Orca_FromString(sET_Data, oDef, uFnFile)
            Orca_include(oET_Root, orca_et_loader)
            self._ReplaceElements(oXMLNode=oET_Root,
                                  uReplaceWidgetName=uReplaceWidgetName)
            return True
        except Exception as e:
            uMsg = LogError(
                "Can''t load element (replace): %s (%s):" %
                (uFnElement, uFnFile), e)
            ShowErrorPopUp(uMessage=uMsg)
            return False
Beispiel #4
0
    def LoadElement(self, uFnElement, uAnchor, oDefinition):
        """ Load an element at runtime to a page: the page must not be initalized
        :param string uFnElement: FileName of element to load
        :param string uAnchor: Target Anchor in Page to place the element into
        :param cDefinition oDefinition: Target Definition
        :rtype: bool
        :return: True if successful, otherwise False

        """

        oFnElement = None

        try:
            oFnElement = cFileName('').ImportFullPath(uFnElement)
            SetVar(uVarName='ORCA_INCLUDEFILE', oVarValue=oFnElement.string)
            if oDefinition is None:
                oDef = self.oWidgetBackGround.oDef
            else:
                oDef = oDefinition
            sET_Data = CachedFile(Globals.oFnElementIncludeWrapper)
            sET_Data = ReplaceDefVars(sET_Data, oDef.oDefinitionVars)
            oET_Root = Orca_FromString(sET_Data, oDef, oFnElement.string)
            Orca_include(oET_Root, orca_et_loader)
            oWidget = self._AddElements(oXMLNode=oET_Root, uAnchor=uAnchor)
            if self.bIsInit:
                if oWidget is not None:
                    oWidget.Create(self.oWidgetBackGround.oObject)
            return True
        except Exception as e:
            uMsg = LogError("Can''t load element: %s:" % oFnElement.string, e)
            ShowErrorPopUp(uMessage=uMsg)
            return False
Beispiel #5
0
def orca_et_loader(
        uFile: str,
        uParse: str,
        uEncoding: str = "xml",
        oReplacementVars: Optional[cDefinitionVars] = None) -> List[Element]:
    """Custom Loader for ElementTree Include to add definition path to includes
        and to make make bulk include using placeholder possible
    """

    aRet: List[Element] = []
    aFiles: List[cFileName] = []
    oFn: cFileName
    uRaw: str
    oFnLoad: cFileName
    oFnLoadFileRedirect: Union[cFileName, None]
    uBaseName: str
    oFn: cFileName
    oElement: Element
    uFnFileShort: str

    if oReplacementVars is None:
        oReplacementVars = cDefinitionVars()

    if "*" in uFile or "?" in uFile:
        oFn = cFileName("").ImportFullPath(uFnFullName=uFile)
        oDir: cPath = oFn.oPath
        aFolderFiles = oDir.GetFileList(bFullPath=True, bSubDirs=False)
        for uFolderFile in aFolderFiles:
            if MatchWildCard(uValue=uFolderFile,
                             uMatchWithWildCard=oFn.string):
                aFiles.append(
                    cFileName("").ImportFullPath(uFnFullName=uFolderFile))
    else:
        oFn = cFileName("").ImportFullPath(uFnFullName=uFile)
        if oFn.Exists():
            aFiles.append(cFileName("").ImportFullPath(uFnFullName=uFile))
        else:
            Logger.debug(u'XML: Skipping XML Include (File not found):' +
                         oFn.string)

    for oFnLoad in aFiles:
        oFnLoadFileRedirect = Globals.oTheScreen.oSkin.dSkinRedirects.get(
            oFnLoad.string)
        if oFnLoadFileRedirect is not None:
            oFnLoad = oFnLoadFileRedirect
        Logger.debug(u'XML: Loading XML Include:' + oFnLoad)
        #uRaw= ElementInclude.default_loader(uLoadFile, "text", encoding)
        uRaw = CachedFile(oFileName=oFnLoad)
        uRaw = ReplaceDefVars(uRaw, oReplacementVars)
        aRet.append(fromstring(uRaw))
        uFnFileShort = ShortenFileName(uFnFile=oFnLoad.string)
        if aRet[-1].get("linefilename", "") == "":
            aRet[-1].set("linefilename", uFnFileShort)
            for oElement in aRet[-1]:
                oElement.set("linefilename", uFnFileShort)

    return aRet
Beispiel #6
0
def orca_et_loader(uFile,
                   parse,
                   encoding=None,
                   oReplacementVars=cDefinitionVars()):
    """Custom Loader for ElementTree Include to add definition path to includes
        and to make make bulk include using placeholder possible
    """
    if uFile.endswith('*'):
        uRet = []
        oFn = cFileName("").ImportFullPath(uFile)
        oDir = oFn.oPath
        uPattern = (oFn.string)[len(oDir.string):]
        uPattern = uPattern[1:-1]
        aFiles = oDir.GetFileList()
        for uFile in aFiles:
            if uFile.startswith(uPattern):
                oFnLoad = cFileName(oDir) + uFile
                oFnLoadFileRedirect = Globals.oTheScreen.oSkin.dSkinRedirects.get(
                    oFnLoad.string)
                if oFnLoadFileRedirect is not None:
                    oFnLoad = oFnLoadFileRedirect
                Logger.debug(u'XML: Bulk-Loading XML Include:' + oFnLoad)
                #uRaw= ElementInclude.default_loader(uLoadFile, "text", encoding)
                uRaw = CachedFile(oFnLoad)
                uRaw2 = ReplaceDefVars(uRaw, oReplacementVars)
                uRet.append(fromstring(uRaw2))
        if len(uRet) == 0:
            return None
        else:
            return uRet
    else:
        oFn = cFileName("").ImportFullPath(uFile)
        if oFn.Exists():
            Logger.debug(u'XML: Loading XML Include:' + oFn.string)
            #uRaw= ElementInclude.default_loader(uFile2, "text", encoding)
            uRaw = CachedFile(oFn)
            uRaw2 = ReplaceDefVars(uRaw, oReplacementVars)
            bRet = fromstring(uRaw2)
        else:
            Logger.debug(u'XML: Skipping XML Include (File not found):' +
                         oFn.string)
            bRet = None
        return bRet
Beispiel #7
0
 def LoadXMLLanguageFont(self, oFnFile):
     iCountFonts = 0
     try:
         sET_Data = CachedFile(oFnFile)
         oET_Root = Orca_FromString(sET_Data,None,oFnFile.string)
         iCountFonts = Globals.oTheScreen.oFonts.ParseFontFromXMLNode(oET_Root)
         Globals.oTheScreen.oFonts.ParseIconsFromXMLNode(oET_Root)
     except Exception as e:
         uMsg=LogError(u'Language: Fatal Error:Load Fonts from XmlFile:'+oFnFile.string,e)
         ShowErrorPopUp(uTitle='Fatal Error',uMessage=uMsg, bAbort=False)
     return iCountFonts
Beispiel #8
0
def LoadXMLFile(oFile):
    """
    Loads a simple XML file to an Elementree Node without any manipulating

    :rtype: xml.etree.ElementTree.Element
    :param cFileName oFile: xml file to load
    :return: Element tree element
    """

    uRaw = CachedFile(oFile)
    return fromstring(uRaw)
Beispiel #9
0
    def LoadFurtherXmlFile(self, oFnXml):
        # Loads pages from a further XML File
        sET_Data = CachedFile(oFnXml)
        sET_Data = ReplaceDefVars(sET_Data, self.oDefinitionVars)
        oET_Root = Orca_FromString(sET_Data, self, oFnXml.string)
        Orca_include(oET_Root, orca_et_loader)

        if self.bImportPages:
            # get a list of all pages and add Them
            oXMLPages = oET_Root.find('pages')
            for oXMLPage in oXMLPages.findall('page'):
                Globals.oTheScreen.oScreenPages.AddPageFromXmlNode(oXMLPage)
Beispiel #10
0
 def LoadActions(self) -> None:
     """ parses the definition specific actions """
     Logger.info(u'Loading Actions for script:' + self.uObjectName)
     if self.oFnAction.Exists():
         uET_Data = CachedFile(oFileName=self.oFnAction)
         oET_Root: Element = Orca_FromString(
             uET_Data=uET_Data, oDef=None, uFileName=self.oFnAction.string)
         Globals.oActions.LoadActionsSub(
             oET_Root=oET_Root,
             uSegmentTag=u'actions',
             uListTag=u'action',
             dTargetDic=Globals.oActions.dActionsCommands,
             uFileName=self.oFnAction.string)
Beispiel #11
0
 def LoadXMLLanguageFont(self, oFnFile:cFileName) -> int:
     """
     Loads the Font definitions from an xml file
     :param cFileName oFnFile: The filename of the xml font definition
     :return: The number of fonts loaded from the file
     """
     iCountFonts:int = 0
     try:
         uET_Data            = CachedFile(oFileName=oFnFile)
         oET_Root:Element    = Orca_FromString(uET_Data=uET_Data,oDef=None,uFileName=oFnFile.string)
         iCountFonts         = Globals.oTheScreen.oFonts.ParseFontFromXMLNode(oXMLNode=oET_Root)
         Globals.oTheScreen.oFonts.ParseIconsFromXMLNode(oXMLNode=oET_Root)
     except Exception as e:
         uMsg:str=LogError(uMsg=u'Language: Fatal Error:Load Fonts from XmlFile:'+oFnFile.string,oException=e)
         ShowErrorPopUp(uTitle='Fatal Error',uMessage=uMsg, bAbort=False)
     return iCountFonts
Beispiel #12
0
    def ExecuteActionLoadActionFile(self,oAction:cAction) -> eReturnCode:
        """
        loadactionfile:
            Load as specific action file
            Parameter:
            actionfilename: Full path to the action file
        """

        self.oEventDispatcher.LogAction(uTxt=u'LoadActionFile',oAction=oAction)
        oFnAction:cFileName=cFileName().ImportFullPath(uFnFullName=oAction.dActionPars.get("actionfilename",""))
        if oFnAction.Exists():
            uET_Data = CachedFile(oFileName=oFnAction)
            oET_Root:Element = Orca_FromString(uET_Data=uET_Data, oDef=None, uFileName=str(oFnAction))
            Globals.oActions.LoadActionsSub(oET_Root=oET_Root,uSegmentTag=u'actions',uListTag=u'action',dTargetDic=Globals.oActions.dActionsCommands,uFileName=oFnAction.string)


        return eReturnCode.Nothing
Beispiel #13
0
    def LoadFurtherXmlFile(self, *, oFnXml: cFileName) -> None:
        """
        Loads pages from a further XML File
        :param cFileName oFnXml: The filename of the xml to load
        :return: None
        """

        uET_Data = CachedFile(oFileName=oFnXml)
        uET_Data = ReplaceDefVars(uET_Data, self.oDefinitionVars)
        oET_Root: Element = Orca_FromString(uET_Data=uET_Data,
                                            oDef=self,
                                            uFileName=oFnXml.string)
        Orca_include(oET_Root, orca_et_loader)

        if self.bImportPages:
            # get a list of all pages and add Them
            oXMLPages: Element = oET_Root.find('pages')
            for oXMLPage in oXMLPages.findall('page'):
                Globals.oTheScreen.oScreenPages.AddPageFromXmlNode(
                    oXMLPage=oXMLPage)
Beispiel #14
0
def LoadXMLFile(*,
                oFile: cFileName,
                oParser: Optional[XMLParser] = None,
                bNoCache=False) -> Element:
    """
    Loads a simple XML file to an Elementree Node without any manipulating

    :rtype: xml.etree.ElementTree.Element
    :param cFileName oFile: xml file to load
    :param XMLParser oParser: Optional: Parser to use
    :param bool bNoCache: Optional: Do not use cached files
    :return: Element tree element
    """

    if oParser is None:
        if not bNoCache:
            return fromstring(CachedFile(oFileName=oFile))
        else:
            return ET().parse(source=oFile.string)
    else:
        return ET().parse(source=oFile.string, parser=oParser)
Beispiel #15
0
    def _LoadXmlFile(self,oFnFile):
        """ Loads all strings for the language from a specific files"""
        if not oFnFile.Exists():
            Logger.debug (u'Language: String File does not exist:'+oFnFile.string)
            return
        if oFnFile.string in self.aLoadedFiles:
            Logger.debug (u'Language: Skip duplicate language file loading:'+oFnFile.string)
            return

        oDef = None
        try:
            sET_Data = CachedFile(oFnFile)
            if Globals.uDefinitionContext:
                oDef = Globals.oDefinitions.get(Globals.uDefinitionContext)
            oET_Root = Orca_FromString(sET_Data,oDef,oFnFile.string)
            self.__LoadXMLNode(oET_Root,self.dIDToString)
        except ParseError as e:
            uMsg=LogError(u'Language: Fatal Error:Load Language XmlFile (xml parse error):'+oFnFile.string,e)
            ShowErrorPopUp(uTitle='Fatal Error',uMessage=uMsg, bAbort=True)
        except Exception as e:
            uMsg=LogError(u'Language: Fatal Error:Load Language XmlFile (2):'+oFnFile.string,e)
            ShowErrorPopUp(uTitle='Fatal Error',uMessage=uMsg, bAbort=True)
Beispiel #16
0
    def LoadActions(self) -> None:
        """ parses the definition specific actions """
        Logger.info(u'Loading Actions for definition:' + self.uDefPublicTitle)
        uET_Data: str
        SetDefinitionContext(uDefinitionName=self.uName)
        if Globals.oFnAction.Exists():
            uET_Data = CachedFile(oFileName=Globals.oFnAction)
            uET_Data = ReplaceDefVars(uET_Data, self.oDefinitionVars)
            oET_Root: Element = Orca_FromString(
                uET_Data=uET_Data,
                oDef=self,
                uFileName=Globals.oFnAction.string)
            Orca_include(oET_Root, orca_et_loader)
            SetDefinitionContext(uDefinitionName=self.uName)
            Globals.oActions.LoadActionsSub(
                oET_Root=oET_Root,
                uSegmentTag=u'pagestartactions',
                uListTag=u'pagestartaction',
                dTargetDic=Globals.oActions.dActionsPageStart,
                uFileName=Globals.oFnAction)
            Globals.oActions.LoadActionsSub(
                oET_Root=oET_Root,
                uSegmentTag=u'pagestartactions',
                uListTag=u'pagestopaction',
                dTargetDic=Globals.oActions.dActionsPageStop,
                uFileName=Globals.oFnAction)
            Globals.oActions.LoadActionsSub(
                oET_Root=oET_Root,
                uSegmentTag=u'actions',
                uListTag=u'action',
                dTargetDic=Globals.oActions.dActionsCommands,
                uFileName=Globals.oFnAction)

            SetVar(uVarName=u'ORCASTANDARDPAGESTARTACTIONSINCLUDED',
                   oVarValue=u"1")
            SetVar(uVarName=u'ORCASTANDARDACTIONSINCLUDED', oVarValue=u"1")
        RestoreDefinitionContext()
        return None
Beispiel #17
0
    def __GetUsedDefinitions_Sub(self, uDefinitionName, bImportActions,
                                 bImportLanguages, bImportPages,
                                 bImportSettings, uParentDefinitionName,
                                 uParentDefinitionAlias,
                                 aDefinitionVarsFromParent, uAlias):

        aAdditionalDefVars = {}

        if not uAlias in self.dDefinitionList_Dict:
            oDefinitionPathes = cDefinitionPathes(uDefinitionName)
            SetVar(uVarName="DEFINITIONPATH[%s]" % (uDefinitionName),
                   oVarValue=oDefinitionPathes.oPathDefinition.string)
            SetVar(
                uVarName="DEFINITIONPATHSKINELEMENTS[%s]" % (uDefinitionName),
                oVarValue=oDefinitionPathes.oPathDefinitionSkinElements.string)
            Globals.dDefinitionPathes[uDefinitionName] = oDefinitionPathes
            SetDefinitionPathes(uDefinitionName)

            oFnDefinition = Globals.oDefinitionPathes.oFnDefinition
            Logger.debug(u'TheScreen: Load Definition XmlFile:' +
                         oFnDefinition)
            oDefinition = cDefinition(uDefinitionName, self)
            oDefinition.uParentDefinitionName = uParentDefinitionName
            oDefinition.bImportActions = bImportActions
            oDefinition.bImportLanguages = bImportLanguages
            oDefinition.bImportPages = bImportPages
            oDefinition.bImportSettings = bImportSettings
            oDefinition.oDefinitionVarsFromParent = aDefinitionVarsFromParent

            #we read the definitionvars first with raw funtions
            sET_Data = CachedFile(Globals.oDefinitionPathes.oFnDefinition)
            oET_Root = fromstring(sET_Data)
            oRef = oET_Root.find('def_parameter')
            # And merge / Replace the existing Vars
            oDefinition.oDefinitionVars.clear()
            oDefinition.oDefinitionVars.update(
                ToOrderedDic(
                    GetXMLTextValue(oRef, u'definitionvars', False, u'{}')))

            if len(aDefinitionVarsFromParent) > 0:
                for uVarName in oDefinition.oDefinitionVars:
                    if uVarName in oDefinition.oDefinitionVarsFromParent:
                        oDefinition.oDefinitionVars[
                            uVarName] = oDefinition.oDefinitionVarsFromParent[
                                uVarName]
                    else:
                        Logger.warning(
                            "Importing definition %s from %s: Definition varname not passed: '%s', using default %s"
                            %
                            (oDefinition.uName, uParentDefinitionName,
                             uVarName, oDefinition.oDefinitionVars[uVarName]))
                for uVarName in aDefinitionVarsFromParent:
                    if not uVarName in oDefinition.oDefinitionVars:
                        oDefinition.oDefinitionVars[
                            uVarName] = oDefinition.oDefinitionVarsFromParent[
                                uVarName]
                        aAdditionalDefVars[
                            uVarName] = oDefinition.oDefinitionVarsFromParent[
                                uVarName]

            for uKey in oDefinition.oDefinitionVars:
                uVar = oDefinition.oDefinitionVars[uKey]
                if "$cookie(" in uVar:
                    uValue = GetCookieValue(uVar)
                    oDefinition.oDefinitionVars[uKey] = uValue

            if uAlias == u'':
                # this works on all python versions
                for uKey in oDefinition.oDefinitionVars:
                    uAlias = oDefinition.oDefinitionVars[uKey]
                    break

            if uAlias == '':
                uAlias = uDefinitionName
                oDefinition.uDefPublicTitle = uDefinitionName
                #create a default alias def var
                uAliasDefVar = "definition_alias_" + uAlias
                if oDefinition.oDefinitionVars.get(uAliasDefVar) is None:
                    SetDefVar(uVarName=uAliasDefVar,
                              uVarValue=uAlias,
                              dArray=oDefinition.oDefinitionVars)
            else:
                oDefinition.uDefPublicTitle = "%s [%s]" % (uAlias,
                                                           uDefinitionName)

            oDefinition.uAlias = uAlias

            if not uAlias in self.dDefinitionList_Dict:
                # create defvars for import pages
                aTmpDefinitionVars = copy(oDefinition.oDefinitionVars)
                for uVar in aTmpDefinitionVars:
                    if not uVar.endswith("_IMPORTPAGES"):
                        if bImportPages:
                            SetDefVar(uVarName=uVar + "_IMPORTPAGES",
                                      uVarValue="1",
                                      dArray=oDefinition.oDefinitionVars)
                        else:
                            SetDefVar(uVarName=uVar + "_IMPORTPAGES",
                                      uVarValue="0",
                                      dArray=oDefinition.oDefinitionVars)

                #and now again with adjusted definitionvars
                oET_Root = Orca_FromString(sET_Data, oDefinition, "root")
                oDefinition.oET_Root = oET_Root
                oDefinition.sET_Data = sET_Data

                self.AddDefinition(oDefinition)

                oXMLIncludes = oET_Root.find('definitionimports')
                if oXMLIncludes is not None:
                    for oXMLInclude in oXMLIncludes.findall('definition'):
                        uDefinitionNameImp = GetXMLTextValue(
                            oXMLInclude, u'', True, '')
                        bImportActionsImp = GetXMLBoolAttribute(
                            oXMLInclude, u'importactions', False, False)
                        bImportLanguagesImp = GetXMLBoolAttribute(
                            oXMLInclude, u'importlanguages', False, False)
                        bImportPagesImp = GetXMLBoolAttribute(
                            oXMLInclude, u'importpages', False, False)
                        bImportSettingsImp = GetXMLBoolAttribute(
                            oXMLInclude, u'importsettings', False, False)
                        uAliasImp = GetXMLTextAttribute(
                            oXMLInclude, u'alias', False, '')
                        aDefinitionVarsImp = cDefinitionVars()
                        aDefinitionVarsImp.update(
                            ToDic(
                                GetXMLTextAttribute(oXMLInclude,
                                                    u'definitionvars', False,
                                                    {})))

                        # Pass Through of additional Definitionvars
                        for uVarName in aAdditionalDefVars:
                            if not uVarName in aDefinitionVarsImp:
                                aDefinitionVarsImp[
                                    uVarName] = aAdditionalDefVars[uVarName]

                        self.__GetUsedDefinitions_Sub(
                            uDefinitionNameImp, bImportActionsImp,
                            bImportLanguagesImp, bImportPagesImp,
                            bImportSettingsImp, oDefinition.uName,
                            oDefinition.uAlias, aDefinitionVarsImp, uAliasImp)
            else:
                Logger.debug(
                    u'GetUsedDefinitions: Skipping duplicate xml %s [%s]' %
                    (uAlias, uDefinitionName))
        else:
            Logger.debug(
                u'GetUsedDefinitions: Skipping duplicate xml %s [%s]' %
                (uAlias, uDefinitionName))
Beispiel #18
0
    def ReadCodeset(self) -> None:
        """  reads the codeset file """

        oTmpCodeSetAction: cAction
        aTmpCodeSetAction: List[cAction]

        oCodesetFileName: cFileName = self.oInterFace.FindCodesetFile(
            self.aIniSettings.uFNCodeset)

        if oCodesetFileName is None:
            self.ShowDebug(uMsg=u'Cannot Read Codeset (Not Found):' +
                           self.aIniSettings.uFNCodeset)
            return

        self.ShowDebug(uMsg=u'Read Codeset:' + oCodesetFileName)

        if oCodesetFileName.Exists():
            uET_Data: str = CachedFile(oFileName=oCodesetFileName)
            oET_Root: Element = Orca_FromString(
                uET_Data=uET_Data,
                oDef=None,
                uFileName=oCodesetFileName.string)
            Orca_include(oET_Root, orca_et_loader)
            dTmpCodeSetActions: Dict[str, List[cAction]] = {}
            Globals.oActions.LoadActionsSub(oET_Root=oET_Root,
                                            uSegmentTag=u'',
                                            uListTag=u'action',
                                            dTargetDic=dTmpCodeSetActions,
                                            uFileName=oCodesetFileName.string)
            # replacing alias
            bDoItAgain: bool = True
            uKey: str = u''
            uAlias: str = u''

            try:
                # replace all alias
                while bDoItAgain:
                    bDoItAgain = False
                    try:
                        for uKey in dTmpCodeSetActions:
                            iPos: int = -1
                            for oTmpCodeSetAction in dTmpCodeSetActions[uKey]:
                                iPos += 1
                                if oTmpCodeSetAction.dActionPars.get(
                                        'type', '') == "alias":
                                    uAlias: str = oTmpCodeSetAction.dActionPars[
                                        'cmd']
                                    aAliasCodeSet: List[
                                        cAction] = dTmpCodeSetActions[uAlias]
                                    if len(aAliasCodeSet) == 1:
                                        oTmpCodeSetAction = copy(
                                            aAliasCodeSet[0])
                                        oTmpCodeSetAction.uActionName = uAlias
                                    else:
                                        oTmpCodeSetAction.uActionString = "call"
                                        oTmpCodeSetAction.dActionPars[
                                            "actionname"] = uAlias
                                        oTmpCodeSetAction.iActionId = GetActionID(
                                            oTmpCodeSetAction.uActionString)
                                        oTmpCodeSetAction.dActionPars[
                                            "type"] = ""

                                    dTmpCodeSetActions[uKey][
                                        iPos] = oTmpCodeSetAction
                                    bDoItAgain = True

                    except Exception as e:
                        uMsg: str = self.ShowError(
                            uMsg=
                            u'Cannot read Codeset (wrong alias [%s=%s] CodesetFileName: %s):'
                            % (uKey, uAlias, oCodesetFileName.string),
                            oException=e)
                        ShowErrorPopUp(uTitle='Error Reading Codeset',
                                       uMessage=uMsg)

                # Make calls local & Read the common attributes
                for uKey in dTmpCodeSetActions:
                    for oTmpCodeSetAction in dTmpCodeSetActions[uKey]:
                        if oTmpCodeSetAction.iActionId == Globals.oActions.oActionType.Call:
                            uActionName: str = oTmpCodeSetAction.dActionPars.get(
                                "actionname", "")
                            if uActionName in dTmpCodeSetActions:
                                oTmpCodeSetAction.dActionPars[
                                    "actionname"] = self.MakeLocalActionName(
                                        uActionName)
                        self.ReadAction(oTmpCodeSetAction)

                # add them to the global action list
                for uKey in dTmpCodeSetActions:
                    Globals.oActions.SetActionList(
                        self.MakeLocalActionName(uKey),
                        dTmpCodeSetActions[uKey])

            except Exception as e:
                uMsg: str = self.ShowError(uMsg=u'Cannot read Codeset :',
                                           oException=e)
                ShowErrorPopUp(uTitle='Error Reading Codeset', uMessage=uMsg)

            self.SetContextVar(uVarName="firstcall", uVarValue="1")