def __init__(self): ''' sortorder auto = unspecified first = begin of list in type last = end of list in type before:scriptname = before given script name after:scriptname = after given script name on Logical conficts result is unspecified ''' self.aSettings = {} self.bIsInit = False self.iMyVersion = ToIntVersion('1.0.0') self.iOrcaVersion = ToIntVersion('1.0.0') self.oConfigParser = KivyConfigParser() self.oFnConfig = None self.oFnScript = None self.oPathMy = None self.oPathMyCode = None self.oScriptConfig = None self.uConfigName = "SCRIPTDEFAULT" self.uScriptName = u'' self.uSection = u'' self.uSortOrder = u'auto' self.uSubType = u'Generic' self.uType = u'Generic' self.oFnAction = None
def ParseFromXMLNode(self, oXMLEntry): """ Parses an xms string into object vars """ self.uName = GetXMLTextValue(oXMLEntry, u'name', True, u'Error') self.uAuthor = GetXMLTextValue(oXMLEntry, u'author', False, u'unknown') self.uVersion = GetXMLTextValue(oXMLEntry, u'version', False, u'0') self.uMinOrcaVersion = GetXMLTextValue(oXMLEntry, u'minorcaversion', False, u'1.1.0') self.bSkip = GetXMLBoolValue(oXMLEntry, u'skip', False, False) self.iVersion = ToIntVersion(self.uVersion) self.iMinOrcaVersion = ToIntVersion(self.uMinOrcaVersion) self.oDescriptions.ParseFromXMLNode(oXMLEntry) oXMLSources = oXMLEntry.find(u'sources') if not oXMLSources is None: for oXMLSource in oXMLSources.findall(u'source'): oSource = cRepSource() oSource.ParseFromXMLNode(oXMLSource) self.aSources.append(oSource) oXMLDependencies = oXMLEntry.find(u'dependencies') if not oXMLDependencies is None: for oXMLDependency in oXMLDependencies.findall(u'dependency'): oRepDependency = cRepDependency() oRepDependency.ParseFromXMLNode(oXMLDependency) self.aDependencies.append(oRepDependency) oXMLSkipFiles = oXMLEntry.find(u'skipfiles') if not oXMLSkipFiles is None: oRepSkipFile = cRepSkipFile() for oXMLSkipFile in oXMLSkipFiles.findall(u'file'): oRepSkipFile.ParseFromXMLNode(oXMLSkipFile) oRepSkipFile.uFile = ReplaceVars(oRepSkipFile.uFile) self.aSkipFiles.append(oRepSkipFile) self.aSkipFileNames.append(oRepSkipFile.uFile)
def __init__(self): self.dSettings: Dict[str, cBaseSettings] = {} self.bIsInit: bool = False self.iMyVersion: int = ToIntVersion('1.0.0') self.iOrcaVersion: int = ToIntVersion( '1.0.0' ) #OrcaVersion defines for what Orca Version the Interface has been developed self.oFnObject: Optional[cFileName] = None self.oObjectConfig: cBaseConfig = None self.oPathMyData: Optional[cPath] = None self.oPathMyCode: Optional[cPath] = None self.uConfigName: str = u'DEFAULT' self.uIniFileLocation: str = u'local' self.uObjectName: str = u'' self.uObjectType: str = u''
def __init__(self): self.aDiscoverScriptsBlackList = [] self.aDiscoverScriptsWhiteList = [] self.aSettings = {} self.bIsInit = False self.iLastRet = 0 self.iMyVersion = ToIntVersion('1.0.0') self.iOrcaVersion = ToIntVersion( '1.0.0' ) #OrcaVersion defines for what Orca Version the Interface has been developed self.oAction = None self.oInterFaceConfig = None self.oInterFaceConfigDiscover = None self.oFnInterFace = None self.uInterFaceName = u'' self.oPathMyCode = None self.oPathMy = None
def __init__(self): """ We initialize all App vars. Even as this is formally not required in python, I prefer to have it this way """ App.__init__(self) # Don't Move or change self.sVersion = "3.7.0" self.sBranch = "Canberra" #todo: Remove in release Logger.setLevel(logging.DEBUG) Globals.uVersion = ToUnicode(self.sVersion) Globals.iVersion = ToIntVersion( Globals.uVersion) # string of App Version SetVar(uVarName=u'REPVERSION', oVarValue=ToUnicode(Globals.iVersion)) Globals.uBranch = ToUnicode(self.sBranch) Globals.oApp = self Globals.uPlatform = OS_Platform() # The used Platform Globals.oParameter = cParameter( ) # Object for Commandline and Environment Parameter Globals.aRepNames = [('$lvar(683)', 'definitions'), ('$lvar(690)', 'wizard templates'), ('$lvar(684)', 'codesets'), ('$lvar(685)', 'skins'), ('$lvar(686)', 'interfaces'), ('$lvar(730)', 'scripts'), ('$lvar(687)', 'languages'), ('$lvar(689)', 'sounds'), ('$lvar(691)', 'fonts'), ('$lvar(688)', 'others')] Globals.oOrcaConfigParser = OrcaConfigParser() Globals.oActions = cActions() Globals.oDefinitions = cDefinitions( ) # Object which holds all loaded definitions Globals.oDownLoadSettings = cDownLoad_Settings( ) # Object, for managing the settings dialog for download repositories Globals.oNotifications = cNotifications() Globals.oRotation = cRotation() Globals.oLanguage = cLanguage() Globals.oScripts = cScripts() # Object which holds all scripts Globals.oSound = cSound() Globals.oInterFaces = cInterFaces( ) # Object which holds all Interfaces Globals.oWaitForConnectivity = cWaitForConnectivity( ) # Object for checking, if we have network access self.bClearCaches = False # If we install a new app version, all Caches (Atlas/Definition) are cleared self.bDeInitDone = False # Flag, if de-initialisation already done self.bOnError = False # Flag, if we got an error on app initialisation, Mainly used, if we can't find the ORCA definition files to give the user a chance to adjust the path self.bOnWait = False # Flag, which shows, that a user has opened a questions No further actions behind this by now self.oDiscoverList = None # Objects which represents the result of all discover scripts self.oInput = None self.oWaitMessage = None self.settings_cls = SettingsWithSpinner self.title = 'ORCA - Open Remote Control Application' self.oFnConfig = None self.uDefinitionToDelete = u'' self.oPathSkinRoot = None self.uSoundsName = u'' SetVar(uVarName=u'WAITFORROTATION', oVarValue='0') OS_GetWindowSize() Logger.info( u'Init: ORCA Remote Application started: Version %s (%s):' % (Globals.uVersion, Globals.uPlatform))
def InitAndReadSettingsPanel(self): """ Reads the complete settings from the orca.ini file it will set setting defaults, if we do not have an ini file by now """ try: ''' if Globals.oParameter.oPathLog is not None: oPathLogfile = Globals.oParameter.oPathLog else: oPathLogfile = cPath(Globals.oPathRoot) + "logs" oPathLogfile.Create() kivyConfig.set('kivy', 'log_dir', oPathLogfile.string) kivyConfig.write() uOrgLogFn=Logger.manager.loggerDict["kivy"].handlers[1].filename Logger.debug(u"Init: Original Startup Logile at :"+uOrgLogFn) ''' Logger.level = Logger.level Globals.fDoubleTapTime = ToFloat( kivyConfig.getint('postproc', 'double_tap_time')) / 1000.0 self.oFnConfig = cFileName(Globals.oPathRoot) + u'orca.ini' oConfig = Globals.oOrcaConfigParser oConfig.filename = self.oFnConfig.string if self.oFnConfig.Exists(): oConfig.read(self.oFnConfig.string) if not oConfig.has_section(u'ORCA'): oConfig.add_section(u'ORCA') Globals.uDefinitionName = Config_GetDefault_Str( oConfig, u'ORCA', u'definition', u'setup') if "[" in Globals.uDefinitionName: Globals.uDefinitionName = Globals.uDefinitionName[ Globals.uDefinitionName.find("[") + 1:Globals.uDefinitionName.find("]")] if Globals.uDefinitionName == u'setup': Logger.setLevel(logging.DEBUG) oRootPath = Config_GetDefault_Path(oConfig, u'ORCA', u'rootpath', Globals.oPathRoot.string) if oRootPath.string: Globals.oPathRoot = oRootPath oFnCheck = cFileName(Globals.oPathRoot + 'actions') + 'actionsfallback.xml' if not oFnCheck.Exists(): Globals.oPathRoot = OS_GetUserDataPath() Logger.debug(u'Init: Override Path:' + Globals.oPathRoot) self.InitRootDirs() Globals.iLastInstalledVersion = Config_GetDefault_Int( oConfig, u'ORCA', 'lastinstalledversion', ToIntVersion(Globals.uVersion)) Globals.bProtected = (Globals.oPathRoot + u'protected').Exists() if Globals.bProtected: SetVar(uVarName="PROTECTED", oVarValue="1") else: SetVar(uVarName="PROTECTED", oVarValue="0") # get the installed interfaces , etc i = 0 while True: oInstalledRep = cInstalledReps() uKey = u'installedrep%i_type' % i oInstalledRep.uType = Config_GetDefault_Str( oConfig, u'ORCA', uKey, '') uKey = u'installedrep%i_name' % i oInstalledRep.uName = Config_GetDefault_Str( oConfig, u'ORCA', uKey, '') uKey = u'installedrep%i_version' % i oInstalledRep.iVersion = Config_GetDefault_Int( oConfig, u'ORCA', uKey, 0) if not oInstalledRep.uName == '': uKey = '%s:%s' % (oInstalledRep.uType, oInstalledRep.uName) Globals.dInstalledReps[uKey] = oInstalledRep i += 1 else: break del Globals.aRepositories[:] # get the configured repos for i in range(Globals.iCntRepositories): if i == 0: uDefault = 'https://www.orca-remote.org/repositories/ORCA_$var(REPVERSION)/repositories' else: uDefault = '' uKey = u'repository' + str(i) uRep = ReplaceVars( Config_GetDefault_Str(oConfig, u'ORCA', uKey, uDefault)) Globals.aRepositories.append(uRep) # we add some values for state, which helps for the Download Settings uKey = u'repository_state' + str(i) Config_GetDefault_Str(oConfig, u'ORCA', uKey, '1') # Getting the lists for skins, definitions and languages Globals.aSkinList = self.oPathSkinRoot.GetFolderList() Globals.aLanguageList = Globals.oPathLanguageRoot.GetFolderList() Globals.aDefinitionList = Globals.oPathDefinitionRoot.GetFolderList( ) Globals.uSkinName = Config_GetDefault_Str(oConfig, u'ORCA', u'skin', u'ORCA_silver_hires') self.uSoundsName = Config_GetDefault_Str(oConfig, u'ORCA', u'sounds', u'ORCA_default') Globals.uLanguage = Config_GetDefault_Str(oConfig, u'ORCA', u'language', OS_GetLocale()) Globals.uDefinitionContext = Globals.uDefinitionName if Globals.uDefinitionName == 'setup': Logger.setLevel(logging.DEBUG) if not Globals.uLanguage in Globals.aLanguageList: if len(Globals.aLanguageList) > 0: Globals.uLanguage = Globals.aLanguageList[0] oConfig.set(u'ORCA', u'language', Globals.uLanguage) Globals.uLocalesName = Config_GetDefault_Str( oConfig, u'ORCA', u'locales', u'UK (12h)') if 'shared_documents' in Globals.aDefinitionList: Globals.aDefinitionList.remove('shared_documents') if not Globals.uDefinitionName in Globals.aDefinitionList: if len(Globals.aDefinitionList) > 0: Globals.uDefinitionName = Globals.aDefinitionList[0] oConfig.set(u'ORCA', u'definition', Globals.uDefinitionName) if not Globals.uSkinName in Globals.aSkinList: if len(Globals.aSkinList) > 0: Globals.uSkinName = Globals.aSkinList[0] oConfig.set(u'ORCA', u'skin', Globals.uSkinName) oConfig.set(u'ORCA', u'interface', ReplaceVars("select")) oConfig.set(u'ORCA', u'script', ReplaceVars("select")) oConfig.set(u'ORCA', u'definitionmanage', ReplaceVars("select")) Globals.bInitPagesAtStart = Config_GetDefault_Bool( oConfig, u'ORCA', u'initpagesatstartup', u'0') Globals.fDelayedPageInitInterval = Config_GetDefault_Float( oConfig, u'ORCA', u'delayedpageinitinterval', u'60') Globals.fStartRepeatDelay = Config_GetDefault_Float( oConfig, u'ORCA', u'startrepeatdelay', u'0.8') Globals.fContRepeatDelay = Config_GetDefault_Float( oConfig, u'ORCA', u'contrepeatdelay', u'0.2') Globals.fLongPressTime = Config_GetDefault_Float( oConfig, u'ORCA', u'longpresstime', u'1') Globals.bConfigCheckForNetwork = Config_GetDefault_Bool( oConfig, u'ORCA', u'checkfornetwork', u'1') Globals.uNetworkCheckType = Config_GetDefault_Str( oConfig, u'ORCA', u'checknetworktype', OS_GetDefaultNetworkCheckMode()) Globals.uConfigCheckNetWorkAddress = Config_GetDefault_Str( oConfig, u'ORCA', u'checknetworkaddress', 'auto') Globals.bClockWithSeconds = Config_GetDefault_Bool( oConfig, u'ORCA', u'clockwithseconds', u'1') Globals.bLongDate = Config_GetDefault_Bool(oConfig, u'ORCA', u'longdate', u'0') Globals.bLongDay = Config_GetDefault_Bool(oConfig, u'ORCA', u'longday', u'0') Globals.bLongMonth = Config_GetDefault_Bool( oConfig, u'ORCA', u'longmonth', u'0') Globals.bVibrate = Config_GetDefault_Bool(oConfig, u'ORCA', u'vibrate', u'0') Globals.bIgnoreAtlas = Config_GetDefault_Bool( oConfig, u'ORCA', u'ignoreatlas', u'0') Globals.fScreenSize = Config_GetDefault_Float( oConfig, u'ORCA', u'screensize', u'0') if Globals.fScreenSize == 0: Globals.fScreenSize = math.sqrt( Globals.iAppWidth**2 + Globals.iAppHeight**2) / Metrics.dpi self.InitOrientationVars() Globals.uStretchMode = Config_GetDefault_Str( oConfig, u'ORCA', u'stretchmode', OS_GetDefaultStretchMode()) Globals.oSound.ReadSoundVolumesFromConfig(oConfig) oConfig.write() self.InitPathes() # init all used pathes # clear cache in case of an update if self.bClearCaches: ClearAtlas() # Create and read the definition ini file Globals.oDefinitionConfigParser = oConfig = OrcaConfigParser() oConfig.filename = Globals.oDefinitionPathes.oFnDefinitionIni.string if Globals.oDefinitionPathes.oFnDefinitionIni.Exists(): oConfig.read(Globals.oDefinitionPathes.oFnDefinitionIni.string) uSection = Globals.uDefinitionName uSection = uSection.replace(u' ', u'_') if not oConfig.has_section(uSection): oConfig.add_section(uSection) return True except Exception as e: uMsg = u'Global Init:Unexpected error reading settings:' + ToUnicode( e) Logger.critical(uMsg) ShowErrorPopUp(uTitle='Fatal Error', uMessage=uMsg, bAbort=True, uTextContinue='', uTextQuit=u'Quit') return 0