# HG changeset patch # User Edouard Tisserant # Date 1608288628 -3600 # Node ID 144b149cded4339e104944307b9ec5374c10a527 # Parent 467ff0e58327817f238300ad7d442a754903b92e runtime: added restart/reset button in web settings. Accidentaly fixed web settings logging feature. diff -r 467ff0e58327 -r 144b149cded4 runtime/NevowServer.py --- a/runtime/NevowServer.py Thu Dec 10 15:48:15 2020 +0100 +++ b/runtime/NevowServer.py Fri Dec 18 11:50:28 2020 +0100 @@ -39,6 +39,7 @@ import util.paths as paths from runtime.loglevels import LogLevels, LogLevelsDict +from runtime import MainWorker, GetPLCObjectSingleton PAGE_TITLE = 'Beremiz Runtime Web Interface' @@ -217,6 +218,18 @@ "Send a message to the log"), action=_("Send")) + # pylint: disable=no-self-argument + def restartOrResetPLC( + ctx=annotate.Context(), + action=annotate.Choice(["Restart", "Reset"], + required=True, + label=_("Action"))): + pass + + restartOrResetPLC = annotate.autocallable(restartOrResetPLC, + label=_( + "Restart or Reset"), + action=_("Do")) customSettingsURLs = { } @@ -284,9 +297,16 @@ def sendLogMessage(self, level, message, **kwargs): level = LogLevelsDict[level] - if _PySrv.plcobj is not None: - _PySrv.plcobj.LogMessage( - level, "Web form log message: " + message) + GetPLCObjectSingleton().LogMessage( + level, "Web form log message: " + message) + + def restartOrResetPLC(self, action, **kwargs): + if(action == "Reset"): + GetPLCObjectSingleton().RepairPLC() + else: + MainWorker.quit() + + def locateChild(self, ctx, segments): if segments[0] in customSettingsURLs: