# !ATTENTION - Current Control panel works only from pyOpenRPA v1.2.0! from pyOpenRPA import Orchestrator from pyOpenRPA.Orchestrator import Managers def ControlPanelRenderDict(inGSettings): # Example of the JS code in Python code lJSCheckVersion = f""" if (!('VersionStr' in mGlobal)) {{ window.location.reload(true); }} else {{ if (mGlobal.VersionStr != "{inGSettings["VersionStr"]}") {{ window.location.reload(true); }} else {{ $('div.orchestrator-version').html(mGlobal['VersionStr']); }} }} """ lResultDict={ "HeaderLeftText":"Version check", "HeaderRightText":"Orchestrator", "DataStorageKey":"", #Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side "SubheaderText":f"", "BodyKeyValueList":[ {"Key": "Client", "Value": '
'}, {"Key": "Server", "Value": inGSettings["VersionStr"]}, ], "FooterText":"", "FooterButtonX2List":[], "FooterButtonX1List":[], "GlobalStorage": "" # UNCOMMENT FOR DEBUG PURPOSE TO WATCH inGSettings on client side } return lResultDict # Check in control panel, that process is runnning #Orchestrator settings def SettingsUpdate(inGSettings): #Add RobotRDPActive in control panel Orchestrator.WebCPUpdate(inCPKeyStr="VersionCheck", inHTMLRenderDef=ControlPanelRenderDict) #Orchestrator.Managers.ControlPanel(inControlPanelNameStr="TestTTT",inRefreshHTMLJinja2TemplatePathStr="ControlPanel\\test.html", inJinja2TemplateRefreshBool = True) lProcess = Orchestrator.Managers.ProcessInitSafe(inAgentHostNameStr="IVANMASLOV-DESKTOP",inAgentUserNameStr="ND", inProcessNameWOExeStr="notepad",inStartCMDStr="notepad",inStopSafeTimeoutSecFloat=3) # Some test Orchestrator.OrchestratorInitWait() #lProcess.ScheduleStatusCheckEverySeconds(inIntervalSecondsInt=5) #lProcess.Start(inIsManualBool=False) lProcess.StartCheck() #Orchestrator.OrchestratorScheduleGet().every(2).seconds.do(Orchestrator.OrchestratorThreadStart, # lProcess.StartCheck) #Orchestrator.OrchestratorScheduleGet().every(5).seconds.do(Orchestrator.OrchestratorThreadStart,lProcess.StatusCheckStart) #lProcess.Start() lGit = Orchestrator.Managers.Git(inAgentHostNameStr="IVANMASLOV-DESKTOP",inAgentUserNameStr="ND",inGitPathStr="C:\Abs\Archive\scopeSrcUL\pyStore") lGit.BranchRevLastGetInterval(inBranchLocalStr="prd", inBranchRemoteStr="origin/prd", inPreviousBranchRestoreBool=False,inIntervalSecFloat=10.0) lGit.ProcessConnect(inProcess=lProcess) return inGSettings