Beremiz_service.py
changeset 381 5c0f34a9ab00
parent 369 bd54d41a7573
child 396 d1083f580ca1
equal deleted inserted replaced
380:46d7d2ce84d2 381:5c0f34a9ab00
   507     xhtml_header = '''<?xml version="1.0" encoding="utf-8"?>
   507     xhtml_header = '''<?xml version="1.0" encoding="utf-8"?>
   508 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   508 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   509 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
   509 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
   510 '''
   510 '''
   511 
   511 
   512     
   512     class PLCHMI(athena.LiveElement):
   513     class DefaultPLCStartedHMI(athena.LiveElement):
   513     
       
   514         initialised = False
       
   515     
       
   516         def HMIinitialised(self, result):
       
   517             self.initialised = True
       
   518         
       
   519         def HMIinitialisation(self):
       
   520             self.HMIinitialised(None)
       
   521     
       
   522     class DefaultPLCStartedHMI(PLCHMI):
   514         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[                                    
   523         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[                                    
   515                                              tags.h1["PLC IS NOW STARTED"],
   524                                              tags.h1["PLC IS NOW STARTED"],
   516                                              ])
   525                                              ])
   517     class PLCStoppedHMI(athena.LiveElement):
   526         
       
   527     class PLCStoppedHMI(PLCHMI):
   518         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
   528         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
   519                                              tags.h1["PLC IS STOPPED"]
   529                                              tags.h1["PLC IS STOPPED"]
   520                                              ])
   530                                              ])
   521     
   531         
   522     class MainPage(athena.LiveElement):
   532     class MainPage(athena.LiveElement):
   523         jsClass = u"WebInterface.PLC"
   533         jsClass = u"WebInterface.PLC"
   524         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
   534         docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
   525                                                         tags.div(id='content')[                         
   535                                                         tags.div(id='content')[                         
   526                                                         tags.div(render = tags.directive('PLCElement')),
   536                                                         tags.div(render = tags.directive('PLCElement')),
   581                                        tags.body[
   591                                        tags.body[
   582                                            tags.div[
   592                                            tags.div[
   583                                                    tags.div( render = tags.directive( "MainPage" ))
   593                                                    tags.div( render = tags.directive( "MainPage" ))
   584                                                    ]]]])
   594                                                    ]]]])
   585         MainPage = MainPage()
   595         MainPage = MainPage()
       
   596         PLCHMI = PLCHMI
   586 
   597 
   587         def __init__(self, plcState=False, *a, **kw):
   598         def __init__(self, plcState=False, *a, **kw):
   588             super(WebInterface, self).__init__(*a, **kw)
   599             super(WebInterface, self).__init__(*a, **kw)
   589             self.jsModules.mapping[u'WebInterface'] = util.sibpath(__file__, 'webinterface.js')
   600             self.jsModules.mapping[u'WebInterface'] = util.sibpath(__file__, 'webinterface.js')
   590             self.plcState = plcState
   601             self.plcState = plcState