--- a/runtime/NevowServer.py Mon Aug 06 14:30:43 2018 +0200
+++ b/runtime/NevowServer.py Mon Aug 06 15:36:09 2018 +0200
@@ -59,6 +59,7 @@
def HMIinitialisation(self):
self.HMIinitialised(None)
class DefaultPLCStartedHMI(PLCHMI):
docFactory = loaders.stan(
tags.div(render=tags.directive('liveElement'))[
@@ -128,6 +129,7 @@
for child in self.liveFragmentChildren[:]:
class ConfigurableBindings(configurable.Configurable):
@@ -140,77 +142,84 @@
def addExtension(self, name, desc, fields, btnlabel, callback):
return annotate.MethodBinding(
annotate.Method(arguments=[
annotate.Argument(*field)
- setattr(self, 'bind_'+name, _bind)
- setattr(self, 'action_'+name, callback)
+ setattr(self, 'bind_' + name, _bind) + setattr(self, 'action_' + name, callback) self.bindingsNames.append(name)
ConfigurableSettings = ConfigurableBindings()
class ISettings(annotate.TypedInterface):
- platform = annotate.String(label = _("Platform"),
- default = platform.system() + " " + platform.release(),
+ platform = annotate.String(label=_("Platform"), + default=platform.system( + ) + " " + platform.release(), - ctx = annotate.Context(),
- level = annotate.Choice(LogLevels,
- label=_("Log message level")),
- message = annotate.String(label=_("Message text"))):
+ ctx=annotate.Context(), + level=annotate.Choice(LogLevels, + label=_("Log message level")), + message=annotate.String(label=_("Message text"))): - sendLogMessage = annotate.autocallable(sendLogMessage,
- label=_("Send a message to the log"),
+ sendLogMessage = annotate.autocallable(sendLogMessage, + "Send a message to the log"), class SettingsPage(rend.Page):
# This makes webform_css url answer some default CSS
child_webform_css = webform.defaultCSS
- docFactory = loaders.stan([tags.html[
- tags.title[_("Beremiz Runtime Settings")],
- tags.link(rel='stylesheet',
- href=url.here.child("webform_css"))
- tags.h1["Runtime settings:"],
- webform.renderForms('staticSettings'),
- tags.h2["Extensions settings:"],
- webform.renderForms('dynamicSettings'),
+ docFactory = loaders.stan([ + tags.title[_("Beremiz Runtime Settings")], + tags.link(rel='stylesheet', + href=url.here.child("webform_css")) + tags.h1["Runtime settings:"], + webform.renderForms('staticSettings'), + tags.h2["Extensions settings:"], + webform.renderForms('dynamicSettings'), def configurable_staticSettings(self, ctx):
return configurable.TypedInterfaceConfigurable(self)
def configurable_dynamicSettings(self, ctx):
return ConfigurableSettings
def sendLogMessage(self, level, message, **kwargs):
level = LogLevelsDict[level]
if _PySrv.plcobj is not None:
- _PySrv.plcobj.LogMessage(level, "Web form log message: " + message )
+ _PySrv.plcobj.LogMessage( + level, "Web form log message: " + message) def locateChild(self, ctx, segments):
- if segments[0] in customSettingsURLs :
+ if segments[0] in customSettingsURLs: return customSettingsURLs[segments[0]](ctx, segments)
return super(SettingsPage, self).locateChild(ctx, segments)
@@ -222,12 +231,14 @@
tags.head(render=tags.directive('liveglue'))[
tags.link(rel='stylesheet',
href=url.here.child("webform_css"))
- tags.div(render=tags.directive("MainPage")),
@@ -237,7 +248,8 @@
def __init__(self, plcState=False, *a, **kw):
super(WebInterface, self).__init__(*a, **kw)
- self.jsModules.mapping[u'WebInterface'] = paths.AbsNeighbourFile(__file__, 'webinterface.js')
+ self.jsModules.mapping[u'WebInterface'] = paths.AbsNeighbourFile( + __file__, 'webinterface.js') self.MainPage.setPLCState(plcState)
@@ -287,7 +299,6 @@
# print "We will be called back when the client disconnects"
def RegisterWebsite(port):
site = appserver.NevowSite(website)
@@ -298,6 +309,7 @@
class statuslistener(object):
def __init__(self, site):
@@ -318,4 +330,3 @@