def CheckDiscover(self, uSection: str) -> None: self.oInterFace.ShowDebug(uMsg=u'Testing to discover settings') oSetting: cBaseInterFaceSettings = self.oInterFace.GetSettingObjectForConfigName( uConfigName=uSection) uDiscoverScriptName: str = oSetting.aIniSettings.uDiscoverScriptName dParams: Dict[str, str] = {} uKey: str uParamKey: str dResult: Dict uResult: str oException: Exception for uKey in oSetting.aIniSettings: if uKey[1:].startswith(uDiscoverScriptName.upper()): uParamKey = uKey[len(uDiscoverScriptName) + 2:] dParams[uParamKey] = oSetting.aIniSettings[uKey] dResult = Globals.oScripts.RunScript(uDiscoverScriptName, **dParams) oException = dResult.get('Exception', None) uResult = "" if oException is None: for uKey in dResult: uResult = uResult + uKey + ":" + str(dResult[uKey]) + "\n" ShowMessagePopUp(uMessage=uResult)
def CreateDiscoverList_ShowDetails(self, instance): uText= u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(1063): %s \n" \ u"$lvar(SCRIPT_DISC_ELVMAX_1): %s " % (instance.oDevice.sFoundIP,instance.oDevice.uFoundHostName,instance.oDevice.uFoundName,instance.oDevice.uFoundSerial) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, instance): uText= u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(6002): %s \n"\ u"$lvar(5031): %s \n" % (instance.oDevice.sFoundIP,instance.oDevice.uFoundHostName,instance.oDevice.uFoundPort,instance.oDevice.uFoundModel) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, instance): uText= u"$lvar(5029): %s \n"\ u"$lvar(5034): %s \n"\ u"$lvar(5031): %s \n"\ u"\n"\ u"Revision: %s" % (instance.oDevice.uIP,instance.oDevice.uUUID,instance.oDevice.uModel,instance.oDevice.uRevision) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self,oButton:Button) -> None: dDevice:TypedQueryDict = oButton.dDevice uText:str = u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(6002): %s \n"\ u"$lvar(5031): %s \n" % (dDevice.uIP,dDevice.uHostName,str(dDevice.iPort),dDevice.uModel) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, instance): uText= u"$lvar(5029): %s \n"\ u"$lvar(6002): %s \n"\ u"$lvar(5031): %s \n"\ u"$lvar(5032): %s \n"\ u"\n"\ u"%s" % (instance.oDevice.sFoundIP,instance.oDevice.uFoundPort,instance.oDevice.uFoundModel,instance.oDevice.uFoundIdentifier,instance.oDevice.sData) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, oButton: Button) -> None: dDevice: TypedQueryDict = oButton.dDevice uText= u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(1063): %s \n" \ u"$lvar(SCRIPT_DISC_ELVMAX_1): %s " % (dDevice.uFoundIP,dDevice.uFoundHostName,dDevice.uFoundName,dDevice.uFoundSerial) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, oButton: Button) -> None: dDevice: TypedQueryDict = oButton.dDevice uText= u"$lvar(5029): %s \n"\ u"$lvar(5034): %s \n"\ u"$lvar(5031): %s \n"\ u"\n"\ u"Revision: %s" % (dDevice.uIP,dDevice.uUUID,dDevice.uModel,dDevice.uRevision) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self,oButton:Button) -> None: dDevice:TypedQueryDict = oButton.dDevice uText= u"$lvar(5029): %s \n" \ u"$lvar(6002): %s \n" \ u"$lvar(5035): %s \n"\ u"\n"\ u"%s" % (dDevice.uFoundIP,dDevice.uFoundPort,dDevice.uFoundHostName,dDevice.sData) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, oButton: Button) -> None: dDevice: TypedQueryDict = oButton.dDevice uText:str = u"$lvar(5029): %s \n"\ u"$lvar(6002): %s \n"\ u"$lvar(5031): %s \n"\ u"$lvar(5032): %s \n"\ u"\n"\ u"%s" % (dDevice.uFoundIP,dDevice.uFoundPort,dDevice.uFoundModel,dDevice.uFoundIdentifier,dDevice.uData) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, instance): uText= u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(5030): %s \n"\ u"$lvar(5031): %s \n"\ u"$lvar(5032): %s \n"\ u"$lvar(SCRIPT_DISC_UPNP_1): %s \n"\ u"\n"\ u"%s\n"\ u"\n"\ u"%s" % (instance.oDevice.sFoundIP,instance.oDevice.uFoundHostName,instance.oDevice.uFoundManufacturer,instance.oDevice.uFoundModel,instance.oDevice.uFoundFriendlyName,instance.oDevice.uFoundServiceType,instance.oDevice.sData,instance.oDevice.uResult) ShowMessagePopUp(uMessage=uText)
def CreateDiscoverList_ShowDetails(self, oButton: Button) -> None: dDevice: TypedQueryDict = oButton.dDevice uText:str= u"$lvar(5029): %s \n" \ u"$lvar(5035): %s \n" \ u"$lvar(5030): %s \n"\ u"$lvar(5031): %s \n"\ u"$lvar(5032): %s \n"\ u"$lvar(SCRIPT_DISC_UPNP_1): %s \n"\ u"\n"\ u"%s\n"\ u"\n"\ u"%s" % (dDevice.uFoundIP,dDevice.uFoundHostName,dDevice.uFoundManufacturer,dDevice.uFoundModel,dDevice.uFoundFriendlyName,dDevice.uFoundServiceType,dDevice.sData,dDevice.uResult) ShowMessagePopUp(uMessage=uText)
def On_ConfigChange(self, oSettings, oConfig, uSection, uKey, uValue): """ Handles a change of a setting element """ if uKey == u'button_load_resources': self.LoadRepositoryDirectory(bDoNotExecute=False) elif uKey == 'button_add_resource': self.uLast = uValue uTmp, uRepType, uRepName = uValue.split(':') del self.aQueue[:] del self.aItemQueue[:] self.CreateDownloadQueueForRepositoryItem(uRepType, uRepName) self.DownloadDownloadQueue() elif uKey.startswith(u'repository_state'): pass else: ShowMessagePopUp(uMessage=u'$lvar(5011)') return True
def OrcaConfigParser_On_Setting_Change(config: kivyConfig, section: str, key: str, value: str) -> None: uSection: str = section uKey: str = key uValue: str = value # uValue = ToUnicode(value) if uSection == "ORCA": if uKey == u'button_clear_atlas': ClearAtlas() elif uKey == u"button_notification": uNotification = uValue.split("_")[-1] Globals.oNotifications.SendNotification( uNotification=uNotification, **{ "key": uKey, "value": uValue }) elif uKey == u'button_discover_rediscover': if uValue == u'button_discover_rediscover': Globals.oInterFaces.DiscoverAll() else: Globals.oInterFaces.DiscoverAll(bForce=True) elif uKey == u'button_discover_results': from ORCA.utils.Discover import cDiscover_List Globals.oApp.oDiscoverList = cDiscover_List() Globals.oApp.oDiscoverList.ShowList() elif uKey == u'button_installed_reps': Globals.oDownLoadSettings.LoadDirect(uDirect=uValue, bForce=True) elif uKey == u'button_show_installationhint': Var_DeleteCookie(uVarName='SHOWINSTALLATIONHINT', uPrefix=Globals.uDefinitionName) Globals.oTheScreen.AddActionToQueue( aActions=[{ 'string': 'call', 'actionname': 'Fkt ShowInstallationHint' }]) elif uKey == u'button_show_powerstati': Globals.oTheScreen.AddActionShowPageToQueue( uPageName=u'Page_PowerStati') elif uKey == u'button_updateallreps': Globals.oDownLoadSettings.UpdateAllInstalledRepositories( bForce=True) elif uKey == u'showborders': Globals.bShowBorders = not Globals.bShowBorders Globals.oTheScreen.AddActionToQueue( aActions=[{ 'string': 'updatewidget *@*' }]) elif uKey == u'language': # Changes the languages, reloads all strings and reloads the settings dialog Globals.uLanguage = uValue Globals.oApp.InitPathes() Globals.oNotifications.SendNotification( uNotification="on_language_change") elif uKey == u'locales': Globals.uLocalesName = uValue Globals.oTheScreen.LoadLocales() elif uKey == u'startrepeatdelay': Globals.fStartRepeatDelay = float(uValue) elif uKey == u'longpresstime': Globals.fLongPressTime = float(uValue) elif uKey == u'contrepeatdelay': Globals.fContRepeatDelay = float(uValue) elif uKey == u'clockwithseconds': Globals.bClockWithSeconds = (uValue == '1') elif uKey == u'longdate': Globals.bLongDate = (uValue == '1') elif uKey == u'longday': Globals.bLongDay = (uValue == '1') elif uKey == u'longmonth': Globals.bLongMonth = (uValue == '1') elif uKey == u'checkfornetwork': Globals.bConfigCheckForNetwork = (uValue == '1') elif uKey == u'vibrate': Globals.bVibrate = (uValue == '1') elif uKey == u'button_configureinterface': uButton, Globals.oTheScreen.uInterFaceToConfig, Globals.oTheScreen.uConfigToConfig = uValue.split( ':') Globals.oTheScreen.AddActionShowPageToQueue( uPageName=u'Page_InterfaceSettings') elif uKey == u'button_configurescripts': uAction: str uScriptName: str uAction, uScriptName = uValue.split(':') if uAction == "button_configure": Globals.oTheScreen.uScriptToConfig = uScriptName Globals.oTheScreen.AddActionShowPageToQueue( uPageName=u'Page_ScriptSettings') elif uAction == "button_run": kwargs = {"caller": "settings"} Globals.oScripts.RunScript(uScriptName, **kwargs) elif uKey == u'definition': ShowQuestionPopUp( uTitle='$lvar(599)', uMessage='$lvar(5026)', fktYes=Globals.oApp.on_config_change_change_definition, uStringYes='$lvar(5001)', uStringNo='$lvar(5002)') elif uKey == u'skin': Globals.oApp.ReStart() elif uKey == u'rootpath': if not Globals.bInit: Globals.oApp.close_settings() Globals.oApp._app_settings = None kivyConfig.write() Clock.schedule_once(Globals.oApp.Init_ReadConfig, 0) else: ShowMessagePopUp(uMessage=u'$lvar(5011)') elif uKey == u'sound_muteall': Globals.oSound.bMute = ToBool(uValue) elif uKey.startswith(u'soundvolume_'): uSoundName = uKey[12:] Globals.oSound.SetSoundVolume(uSoundName=uSoundName, iValue=ToInt(uValue)) Globals.oSound.PlaySound(uSoundName=uSoundName) elif uKey == u'button_changedefinitionsetting': Globals.uDefinitionToConfigure = uValue[7:] Globals.oTheScreen.AddActionShowPageToQueue( uPageName=u'Page_DefinitionSettings') if uKey in Globals.oDefinitions.aDefinitionSettingVars: SetVar(uVarName=uKey, oVarValue=uValue) else: pass
def OrcaConfigParser_On_Setting_Change(config, section, key, value): uValue = ToUnicode(value) if section == "ORCA": if key == u'button_clear_atlas': ClearAtlas() elif key == u"button_notification": uNotification = value.split("_")[-1] Globals.oNotifications.SendNotification(uNotification,**{"key":key,"value":value}) elif key == u'button_discover_rediscover': if uValue == u'button_discover_rediscover': Globals.oInterFaces.DiscoverAll() else: Globals.oInterFaces.DiscoverAll(bForce=True) elif key == u'button_discover_results': from ORCA.utils.Discover import cDiscover_List Globals.oApp.oDiscoverList = cDiscover_List() Globals.oApp.oDiscoverList.ShowList() elif key == u'button_getonline': Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_Settings_Download') elif key == u'button_installed_reps': Globals.oDownLoadSettings.LoadDirect(uValue, True) elif key == u'button_show_installationhint': Var_DeleteCookie('SHOWINSTALLATIONHINT', Globals.uDefinitionName) Globals.oTheScreen.AddActionToQueue([{'string': 'call', 'actionname': 'Fkt ShowInstallationHint'}]) elif key == u'button_show_licensefile': SetVar(uVarName="SHOWFILE", oVarValue=ReplaceVars("$var(LICENSEFILE)")) Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_ShowFile') elif key == u'button_show_credits': SetVar(uVarName="SHOWFILE", oVarValue=ReplaceVars("$var(CREDITSFILE)")) Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_ShowFile') elif key == u'button_show_logfile': SetVar(uVarName="SHOWFILE", oVarValue=ReplaceVars("$var(LOGFILE)")) Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_ShowFile') elif key == u'button_show_powerstati': Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_PowerStati') elif key == u'button_updateallreps': Globals.oDownLoadSettings.UpdateAllInstalledRepositories(True) elif key == u'language': # Changes the languages, reloads all strings and reloads the settings dialog Globals.uLanguage = uValue Globals.oApp.InitPathes() Globals.oNotifications.SendNotification("on_language_change") elif key == u'locales': Globals.uLocalesName = uValue Globals.oTheScreen.LoadLocales() elif key == u'startrepeatdelay': Globals.fStartRepeatDelay = float(uValue) elif key == u'longpresstime': Globals.fLongPressTime = float(uValue) elif key == u'contrepeatdelay': Globals.fContRepeatDelay = float(uValue) elif key == u'clockwithseconds': Globals.bClockWithSeconds = (uValue == '1') elif key == u'longdate': Globals.bLongDate = (uValue == '1') elif key == u'longday': Globals.bLongDay = (uValue == '1') elif key == u'longmonth': Globals.bLongMonth = (uValue == '1') elif key == u'checkfornetwork': Globals.bConfigCheckForNetwork = (uValue == '1') elif key == u'vibrate': Globals.bVibrate = (uValue == '1') elif key == u'interface': if uValue == 'select': return Globals.oTheScreen.uInterFaceToConfig = uValue if Globals.oInterFaces.dInterfaces.get(uValue) is None: Globals.oInterFaces.LoadInterface(uValue) Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_InterfaceSettings') Globals.oOrcaConfigParser.set(u'ORCA', key, u'select') Globals.oOrcaConfigParser.write() elif key == u'script': if uValue == 'select': return uScript = u'' Globals.oOrcaConfigParser.set(u'ORCA', key, 'select') Globals.oOrcaConfigParser.write() tValue = uValue.split(':') uValue = tValue[0] if len(tValue) > 1: uScript = tValue[1] # Configure if uValue == ReplaceVars('$lvar(516)'): Globals.oTheScreen.uScriptToConfig = uScript Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_ScriptSettings') # Run if uValue == ReplaceVars('$lvar(517)'): kwargs = {"caller": "settings"} Globals.oScripts.RunScript(uScript,**kwargs) Globals.oOrcaConfigParser.set(u'ORCA', key, u'select') Globals.oOrcaConfigParser.write() elif key == u'definition': ShowQuestionPopUp(uTitle='$lvar(599)', uMessage='$lvar(5026)', fktYes=Globals.oApp.on_config_change_change_definition, uStringYes='$lvar(5001)', uStringNo='$lvar(5002)') elif key == u'skin': Globals.oApp.ReStart() elif key == u'rootpath': if not Globals.bInit: Globals.oApp.close_settings() Globals.oApp._app_settings = None kivyConfig.write() Clock.schedule_once(Globals.oApp.Init_ReadConfig, 0) else: ShowMessagePopUp(uMessage=u'$lvar(5011)') elif key.startswith(u'soundvolume_'): uSoundName = key[12:] Globals.oSound.SetSoundVolume(uSoundName, ToInt(uValue)) Globals.oSound.PlaySound(uSoundName) elif key == u'button_changedefinitionsetting': Globals.uDefinitionToConfigure = uValue[7:] Globals.oTheScreen.AddActionShowPageToQueue(uPageName=u'Page_DefinitionSettings') else: ShowMessagePopUp(uMessage=u'$lvar(5011)') # todo: check , if this required anymore elif section == Globals.uDefinitionName: if key in Globals.oDefinitions.aDefinitionSettingVars: SetVar(uVarName = key, oVarValue = value) ShowMessagePopUp(uMessage=u'$lvar(5011)')
def CreateDiscoverList_ShowDetails(self, oButton: Button) -> None: Logger.error("You must implement CreateDiscoverList_ShowDetails") dDevice: TypedQueryDict = oButton.dDevice uText: str = u"$lvar(5029): %s \n" % dDevice.uFoundIP ShowMessagePopUp(uMessage=uText)