diff options
author | coutinho <coutinho@esrf.fr> | 2015-03-26 12:21:41 +0100 |
---|---|---|
committer | coutinho <coutinho@esrf.fr> | 2015-03-26 12:21:41 +0100 |
commit | 6f2a9f4d65212ef253a5ce6fc173d52b8a470c57 (patch) | |
tree | 674c3ba22a326794b20abf345ec5e01c102a1b11 /lib/taurus/web/examples/tornado | |
parent | 3d39d0a483286c6cc6abc58d5514dc5390104736 (diff) |
First commit in tauruslib. Restructure according to SEP10
Diffstat (limited to 'lib/taurus/web/examples/tornado')
21 files changed, 1488 insertions, 0 deletions
diff --git a/lib/taurus/web/examples/tornado/countclient.html b/lib/taurus/web/examples/tornado/countclient.html new file mode 100644 index 00000000..ecccf2f4 --- /dev/null +++ b/lib/taurus/web/examples/tornado/countclient.html @@ -0,0 +1,130 @@ +<!doctype html> +<html> +<head> + <title>Taurus</title> + <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon"> + + <!-- JQuery (local) --> + <script type="text/javascript" src="static/js/jquery.js"></script> + <script type="text/javascript" src="static/js/jquery-ui.js"></script> + <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> + <!-- JQuery (remote: google CDN) --> + <!-- + <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> + <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script> + --> + + <!-- JSXGraph (local) --> + <script type="text/javascript" src="static/js/jsxgraphcore.js"></script> + <script type="text/javascript" src="static/js/GeonextReader.js"></script> + <link type="text/css" href="static/css/jsxgraph.css" rel="stylesheet"></link> + <!-- JSXGraph (Remote) --> + <!-- + <link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" /> + <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> + <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/GeonextReader.js"></script> + --> + + <!-- Dojo (local) --> + <script src="static/js/dojo/dojo.js" data-dojo-config="parseOnLoad: true, async: true"></script> + + <!-- Dojo (remote: google CDN) --> + <!--<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js" data-dojo-config="parseOnLoad: true, async: true"></script>--> + + <!-- taurus (local) --> + <link type="text/css" href="static/css/taurus.css" rel="stylesheet"></link> + + + <!-- Application --> + <script type="text/javascript" src="static/js/countclient.js"></script> + <style> + body { + font-size: 62.5%; + } + + div.taurus-demo { + padding:12px; + font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif"; + } + div.taurus-demo h3.docs { clear:left; font-size:12px; font-weight:normal; padding:0 0 1em; margin:0; } + + .toggler { width: 400px; height: 200px; } + #tangotest-attributes { width: 240px; height: 135px; padding: 0.4em; position: relative; } + #tangotest-attributes h3 { margin: 0; padding: 0.4em; text-align: center; } + + div.motor-attributes { + clear:both; + padding:12px; + font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif"; + font-size: 1.3em; + line-height: 1.4em; + width: 520px; + } + </style> +</head> + +<body> + <h1>Taurus</h1> + <p> + <table border="0"> + <tr> + <td><div id="plot" class="jxgbox" style="width:380px; height:380px;"></div></td> + <td> + <div id="gauge01" + data-taurus-model="motor/motctrl01/1/position" + data-taurus-controller="Gauge" + style="width:260px; height:260px"></div> + </script> + </td> + <td><div id="geonext" class="jxgbox" style="width:380px; height:380px;"></div></td> + </tr> + </table> + </p> + <div class="taurus-demo"> + <p> + <button id="show-tangotest">Show TangoTest</button> + </p> + + <div id="motor-attributes" title="Mot01" class="motor-attributes"> + <table border="0" cellpadding="2" cellspacing="0"> + <tr> + <td data-taurus-model="motor/motctrl01/1/position?configuration=label"></td> + <td><div data-taurus-model="motor/motctrl01/1/position"></div></td> + <td><input type="number" data-taurus-model="motor/motctrl01/1/position" style="background-color:white;"></input></td> + <td><div data-taurus-model="motor/motctrl01/1/position?configuration=unit"></div></td> + </tr> + <tr> + <td><div data-taurus-model="motor/motctrl01/2/velocity?configuration=label"></div></td> + <td><div data-taurus-model="motor/motctrl01/2/velocity"></div></td> + <td><div data-taurus-model="motor/motctrl01/2/velocity?configuration=unit"></div></td> + </tr> + <tr> + <td><div data-taurus-model="motor/motctrl01/3/backlash?configuration=label"></div></td> + <td><div data-taurus-model="motor/motctrl01/3/backlash"></div></td> + <td><div data-taurus-model="motor/motctrl01/3/backlash?configuration=unit"></div></td> + </tr> + </table> + </div> + + <div class="toggler"> + <div id="tangotest-attributes" class="ui-widget-content ui-corner-all"> + <h3 class="ui-widget-header ui-corner-all">TangoTest</h3> + <table border="0" cellpadding="2" cellspacing="0"> + <tr> + <td><div data-taurus-model="sys/tg_test/1/double_scalar?configuration=label"></div></td> + <td><div data-taurus-model="sys/tg_test/1/double_scalar"></div></td> + <td><div data-taurus-model="sys/tg_test/1/double_scalar?configuration=unit"></div></td> + </tr> + <tr> + <td><div data-taurus-model="sys/tg_test/1/short_scalar?configuration=label"></div></td> + <td><div data-taurus-model="sys/tg_test/1/short_scalar"></div></td> + <td><div data-taurus-model="sys/tg_test/1/short_scalar?configuration=unit"></div></td> + </tr> + </table> + </div> + </div> + </div> + + +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/countserver.py b/lib/taurus/web/examples/tornado/countserver.py new file mode 100644 index 00000000..0058bd3f --- /dev/null +++ b/lib/taurus/web/examples/tornado/countserver.py @@ -0,0 +1,148 @@ +import os.path + +from tornado.web import Application, RequestHandler +from tornado.websocket import WebSocketHandler +from tornado.escape import json_encode, json_decode + +from taurus import Database, Device, Attribute, Configuration, Object +from taurus.core import TaurusDatabase, TaurusDevice, TaurusAttribute, TaurusConfiguration +from taurus.core import AttrQuality, TaurusEventType +from taurus.core import AttributeNameValidator, ConfigurationNameValidator +from taurus.core.util.colors import ATTRIBUTE_QUALITY_PALETTE + +class MainHandler(RequestHandler): + def get(self): + self.render("countclient.html") + + +class TestHandler(RequestHandler): + def get(self): + self.render("test.html") + + +class TaurusWebAttribute(object): + + TemplateDiv = """<div style="font-size: 24pt;{style}">{value}</div>""" + + def __init__(self, ws, name): + self.name = name + self.ws = ws + self.attribute.addListener(self) + + @property + def attribute(self): + return Attribute(self.name) + + def eventReceived(self, evt_src, evt_type, evt_value): + modelObj = evt_src + data = {} + if evt_type == TaurusEventType.Error: + data['css'] = {'color':'white', 'background-color' : 'red'} + data['html'] = str(evt_value) + else: + if evt_type == TaurusEventType.Config: + modelObj = evt_src.getParentObj() + data['title'] = evt_src.description + valueObj = modelObj.getValueObj() + value = valueObj.value + quality = valueObj.quality + bg, fg = ATTRIBUTE_QUALITY_PALETTE.rgb_pair(quality) + bg, fg = "rgb{0}".format(bg), "rgb{0}".format(fg) + data['css'] = {'color': fg, 'background-color' : bg} + data['html'] = modelObj.displayValue(value) + data['value'] = value +# data['css']['font-size'] = "24pt"; + data['model'] = modelObj.getNormalName() + json_data = json_encode(data) + self.write_message(json_data) + + def write_message(self, message): + return self.ws.write_message(message) + + def clear(self): + self.attribute.removeListener(self) + + +class TaurusWebConfiguration(object): + + TemplateDiv = """<div style="font-size: 24pt;{style}">{value}</div>""" + + def __init__(self, ws, name): + self.name = name + self.param = ConfigurationNameValidator().getParams(name)['configparam'] + self.ws = ws + self.configuration.addListener(self) + + @property + def configuration(self): + return Configuration(self.name) + + def eventReceived(self, evt_src, evt_type, evt_value): + modelObj = evt_src + data = {} + if evt_type == TaurusEventType.Error: + data['css'] = {'color':'white', 'background-color' : 'red'} + data['html'] = str(evt_value) + else: + data['css'] = {} + data['html'] = getattr(modelObj, self.param) + data['title'] = modelObj.description + + # data['css']['font-size'] = "24pt"; + data['model'] = self.name + json_data = json_encode(data) + self.write_message(json_data) + + def write_message(self, message): + return self.ws.write_message(message) + + def clear(self): + self.configuration.removeListener(self) + + +class TaurusSocket(WebSocketHandler): + + def open(self): + self.models = set() + + def on_message(self, json_data): + data = json_decode(json_data) + if 'models' in data: + self.clear_models() + model_names = set(data['models']) + for model_name in model_names: + model_name = str(model_name) + if AttributeNameValidator().isValid(model_name): + web_model = TaurusWebAttribute(self, model_name) + elif ConfigurationNameValidator().isValid(model_name): + web_model = TaurusWebConfiguration(self, model_name) + else: + continue + self.models.add(web_model) + + def on_close(self): + self.clear_models() + + def clear_models(self): + for model in self.models: + model.clear() + self.models.clear() + +def main(): + local_path = os.path.dirname(__file__) + static_path= os.path.join(local_path, 'static') + handlers = [ (r"/", MainHandler), + (r"/test", TestHandler), + (r"/taurus", TaurusSocket), ] + application = Application(handlers, static_path=static_path) + application.listen(8888) + print "Starting..." + try: + import tornado.ioloop + tornado.ioloop.IOLoop.instance().start() + print "Finished" + except KeyboardInterrupt: + print "Finished by Keyboard interrupt (Ctrl+C)" + +if __name__ == "__main__": + main() diff --git a/lib/taurus/web/examples/tornado/demo.html b/lib/taurus/web/examples/tornado/demo.html new file mode 100644 index 00000000..a2c5cde9 --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo.html @@ -0,0 +1,16 @@ +<!doctype html> +<html> +<head> + <title>Taurus WEB demo</title> + <link rel="shortcut icon" href="taurus/favicon.ico" type="image/x-icon"> + <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link> +</head> +<body> + <ul> + <li><a href="demo1.html">Demo 1</a></li> + <li><a href="demo2.html">Demo 2</a></li> + <li><a href="demo3.html">Demo 3</a></li> + <li><a href="demo4.html">Demo 4</a></li> + </ul> +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/demo.py b/lib/taurus/web/examples/tornado/demo.py new file mode 100644 index 00000000..7fac5c55 --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +############################################################################# +## +## This file is part of Taurus +## +## http://taurus-scada.org +## +## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain +## +## Taurus is free software: you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Taurus is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with Taurus. If not, see <http://www.gnu.org/licenses/>. +## +############################################################################# + +""" +""" + +__docformat__ = "restructuredtext" + +import os.path + +from taurus.web.taurustornado import RequestHandler +from taurus.web.taurustornado import start, get_default_handlers + +class MainPageHandler(RequestHandler): + def get(self): + self.render("demo.html") + +class DemoPageHandler(RequestHandler): + + def get(self, page): + self.render(page) + + +def main(): + local_path = os.path.dirname(__file__) + static_path = os.path.join(local_path, 'static') + handlers = [ (r"/", MainPageHandler), (r"/(demo.*)", DemoPageHandler)] + get_default_handlers() + + start(handlers=handlers, port=8888, static_path=static_path, debug=True) + +if __name__ == "__main__": + main() diff --git a/lib/taurus/web/examples/tornado/demo1.html b/lib/taurus/web/examples/tornado/demo1.html new file mode 100644 index 00000000..5c1edf8b --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo1.html @@ -0,0 +1,189 @@ +<!doctype html> +<html> +<head> + <title>Taurus WEB demo 1</title> + <link rel="shortcut icon" href="taurus/favicon.ico" type="image/x-icon"> + + <!-- JQuery --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery/jquery.js"></script> --> + <!-- Google CDN --> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> --> + + <!-- So far I don't need JQuery UI in this example so keep it commented --> + <!-- JQuery UI --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery-ui-1.10.2/ui/jquery-ui.js"></script> --> + <!-- <link type="text/css" href="thirdparty/jquery-ui-1.10.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + <!-- Google CDN --> + <!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> --> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" /></script> --> + <!-- <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + + <!-- So far I don't need Highcharts in this example so keep it commented --> + <!-- Highcharts --> + <!-- local --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/highcharts.js"></script> --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/modules/exporting.js"></script> --> + + <!-- taurus --> + <!-- local --> + <script type="text/javascript" src="taurus/js/taurus.js"></script> + <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link> + + <!-- Application --> + <script type="text/javascript" src="static/js/demo.js"></script> + <link type="text/css" href="static/css/demo.css" rel="stylesheet"></link> + + <script type="text/javascript" src="static/js/demo1.js"></script> + +</head> + +<body class="MS"> +<div class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Taurus WEB demo 1 - simple Tango attributes</div> +<br/> +<table class="MS Panel"> + <tr> + <!-- left column --> + <td> + <p><table class="Form"> + <tr><td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Sardana motor 01</td></tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/position?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/position" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/position?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/velocity?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/velocity" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/velocity?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/acceleration?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/acceleration" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/acceleration?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/status?configuration=unit" /></td> + </tr> + </table></p> + <p><table class="Form"> + <tr><td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Tango test</td></tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=unit" /></td> + </tr> + </table></p> + </td> + + <!-- right column --> + <td> + <table class="Panel"> + + <tr> + <td class="MSBLTitle" rowspan="2">MSPD</td> + <td class="MSFETitle">FE04</td> + <td class="MSIDTitle">SCW30</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">MISTRAL</td> + <td class="MSFETitle">FE09</td> + <td class="MSIDTitle">BEND</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">NCD</td> + <td class="MSFETitle">FE11</td> + <td class="MSIDTitle">IVU21</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/short_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">XALOC</td> + <td class="MSFETitle">FE13</td> + <td class="MSIDTitle">IVU21</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">CLAESS</td> + <td class="MSFETitle">FE22</td> + <td class="MSIDTitle">MPW80</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/float_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">CIRCE</td> + <td class="MSFETitle">FE24</td> + <td class="MSIDTitle">EU62</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/ulong_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">BOREAS</td> + <td class="MSFETitle">FE29</td> + <td class="MSIDTitle">EU71</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + </tr> + + </table> + </td> + </tr> +</table> +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/demo2.html b/lib/taurus/web/examples/tornado/demo2.html new file mode 100644 index 00000000..277ae890 --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo2.html @@ -0,0 +1,91 @@ +<!doctype html> +<html> +<head> + <title>Taurus WEB demo 2</title> + <link rel="shortcut icon" href="taurus/favicon.ico" type="image/x-icon"> + + <!-- JQuery --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery/jquery.js"></script> --> + <!-- Google CDN --> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> --> + + <!-- So far I don't need JQuery UI in this example so keep it commented --> + <!-- JQuery UI --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery-ui-1.10.2/ui/jquery-ui.js"></script> --> + <!-- <link type="text/css" href="thirdparty/jquery-ui-1.10.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + <!-- Google CDN --> + <!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> --> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" /></script> --> + <!-- <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + + <!-- So far I don't need Highcharts in this example so keep it commented --> + <!-- Highcharts --> + <!-- local --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/highcharts.js"></script> --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/modules/exporting.js"></script> --> + <!-- Highcharts.com --> + <script src="http://code.highcharts.com/highcharts.js"></script> + + <!-- Necessary style (font) for gauge --> + <link href='http://fonts.googleapis.com/css?family=Squada+One' rel='stylesheet' type='text/css'> + + <!-- taurus --> + <!-- local --> + <script type="text/javascript" src="taurus/js/taurus.js"></script> + <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link> + + <!-- Application --> + <script type="text/javascript" src="static/js/demo.js"></script> + <link type="text/css" href="static/css/demo.css" rel="stylesheet"></link> + + <script type="text/javascript" src="static/js/demo2.js"></script> + +</head> + +<body class="MS"> +<div class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Taurus WEB demo 2 - simple highcharts</div> +<br/> +<table><tr> + <td> + <table class="Form"> + <tr> + <td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Tango test</td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=unit" /></td> + </tr> + </table> + </td> + <td> + <div id="highcharts-canvas" style="display:inline; width:600px; height: 300px; margin: 0 auto;"></div> + </td> +</tr></table> +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/demo3.html b/lib/taurus/web/examples/tornado/demo3.html new file mode 100644 index 00000000..c6e5339e --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo3.html @@ -0,0 +1,91 @@ +<!doctype html> +<html> +<head> + <title>Taurus WEB demo 2</title> + <link rel="shortcut icon" href="taurus/favicon.ico" type="image/x-icon"> + + <!-- JQuery --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery/jquery.js"></script> --> + <!-- Google CDN --> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> --> + + <!-- So far I don't need JQuery UI in this example so keep it commented --> + <!-- JQuery UI --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery-ui-1.10.2/ui/jquery-ui.js"></script> --> + <!-- <link type="text/css" href="thirdparty/jquery-ui-1.10.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + <!-- Google CDN --> + <!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> --> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" /></script> --> + <!-- <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + + <!-- So far I don't need Highcharts in this example so keep it commented --> + <!-- Highcharts --> + <!-- local --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/highcharts.js"></script> --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/modules/exporting.js"></script> --> + <!-- Highcharts.com --> + <script src="http://code.highcharts.com/highcharts.js"></script> + + <!-- Necessary style (font) for gauge --> + <link href='http://fonts.googleapis.com/css?family=Squada+One' rel='stylesheet' type='text/css'> + + <!-- taurus --> + <!-- local --> + <script type="text/javascript" src="taurus/js/taurus.js"></script> + <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link> + + <!-- Application --> + <script type="text/javascript" src="static/js/demo.js"></script> + <link type="text/css" href="static/css/demo.css" rel="stylesheet"></link> + + <script type="text/javascript" src="static/js/demo3.js"></script> + +</head> + +<body class="MS"> +<div class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Taurus WEB demo 2 - simple highcharts</div> +<br/> +<table><tr> + <td> + <table class="Form"> + <tr> + <td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Tango test</td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=unit" /></td> + </tr> + </table> + </td> + <td> + <div id="highcharts-canvas" style="display:inline; width:600px; height: 300px; margin: 0 auto;"></div> + </td> +</tr></table> +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/demo4.html b/lib/taurus/web/examples/tornado/demo4.html new file mode 100644 index 00000000..4b55b248 --- /dev/null +++ b/lib/taurus/web/examples/tornado/demo4.html @@ -0,0 +1,59 @@ +<!doctype html>
+<html>
+<head>
+ <title>Taurus WEB demo 1</title>
+ <link rel="shortcut icon" href="taurus/favicon.ico" type="image/x-icon">
+
+ <!-- JQuery -->
+ <!-- local -->
+ <!-- <script type="text/javascript" src="thirdparty/jquery/jquery.js"></script> -->
+ <!-- Google CDN -->
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+ <!-- MediaTemple CDN -->
+ <!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> -->
+
+ <!-- So far I don't need JQuery UI in this example so keep it commented -->
+ <!-- JQuery UI -->
+ <!-- local -->
+ <!-- <script type="text/javascript" src="thirdparty/jquery-ui-1.10.2/ui/jquery-ui.js"></script> -->
+ <!-- <link type="text/css" href="thirdparty/jquery-ui-1.10.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet"></link> -->
+ <!-- Google CDN -->
+ <!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> -->
+ <!-- MediaTemple CDN -->
+ <!-- <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" /></script> -->
+ <!-- <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> -->
+
+ <!-- So far I don't need Highcharts in this example so keep it commented -->
+ <!-- Highcharts -->
+ <!-- local -->
+ <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/highcharts.js"></script> -->
+ <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/modules/exporting.js"></script> -->
+
+ <!-- taurus -->
+ <!-- local -->
+ <script type="text/javascript" src="taurus/js/taurus.js"></script>
+ <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link>
+
+ <!-- Application -->
+ <script type="text/javascript" src="static/js/demo.js"></script>
+ <link type="text/css" href="static/css/demo.css" rel="stylesheet"></link>
+
+ <script type="text/javascript" src="static/js/demo4.js"></script>
+
+</head>
+
+<body class="MS">
+<div class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Taurus WEB demo 4 - Tango attribute arrays</div>
+<br/>
+<table class="Form">
+ <tr>
+ <td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Tango test</td>
+ </tr>
+ <tr>
+ <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_spectrum_ro?configuration=label" /></td>
+ <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/long_spectrum_ro" /></td>
+ <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_spectrum_ro?configuration=unit" /></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/lib/taurus/web/examples/tornado/machinestatus.html b/lib/taurus/web/examples/tornado/machinestatus.html new file mode 100644 index 00000000..03201dff --- /dev/null +++ b/lib/taurus/web/examples/tornado/machinestatus.html @@ -0,0 +1,184 @@ +<!doctype html> +<html> +<head> + <title>Taurus WEB demo</title> + <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon"> + + <!-- JQuery --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery/jquery.js"></script> --> + <!-- Google CDN --> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> --> + + <!-- So far I don't need JQuery UI in this example so keep it commented --> + <!-- JQuery UI --> + <!-- local --> + <!-- <script type="text/javascript" src="thirdparty/jquery-ui-1.10.2/ui/jquery-ui.js"></script> --> + <!-- <link type="text/css" href="thirdparty/jquery-ui-1.10.2/themes/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + <!-- Google CDN --> + <!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> --> + <!-- MediaTemple CDN --> + <!-- <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" /></script> --> + <!-- <link type="text/css" href="static/css/jquery-ui/ui-lightness/jquery-ui.css" rel="stylesheet"></link> --> + + <!-- So far I don't need Highcharts in this example so keep it commented --> + <!-- Highcharts --> + <!-- local --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/highcharts.js"></script> --> + <!-- <script type="text/javascript" src="static/thirdparty/highcharts/js/modules/exporting.js"></script> --> + + <!-- taurus --> + <!-- local --> + <script type="text/javascript" src="taurus/js/taurus.js"></script> + <link type="text/css" href="taurus/css/taurus.css" rel="stylesheet"></link> + + <!-- Application --> + <script type="text/javascript" src="static/js/machinestatus.js"></script> + <link type="text/css" href="static/css/machinestatus.css" rel="stylesheet"></link> + +</head> + +<body class="MS"> +<table class="MS Panel"> + <tr> + <!-- left column --> + <td> + <p><table class="Form"> + <tr><td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Sardana motor 01</td></tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/position?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/positions" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/position?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/velocity?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/velocity" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/velocity?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/acceleration?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/acceleration" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/acceleration?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="motor/motctrl01/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="motor/motctrl01/1/status?configuration=unit" /></td> + </tr> + </table></p> + <p><table class="Form"> + <tr><td colspan="3" class="Panel" style="text-align: center; background-color: rgb(180,0,0);">Tango test</td></tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/state" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/state?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/status" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/status?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/double_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/long_scalar?configuration=unit" /></td> + </tr> + <tr> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=label" /></td> + <td><div class="Label BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="XTLabelValue" data-taurus-model="sys/tg_test/1/string_scalar?configuration=unit" /></td> + </tr> + </table></p> + </td> + + <!-- right column --> + <td> + <table class="Panel"> + + <tr> + <td class="MSBLTitle" rowspan="2">MSPD</td> + <td class="MSFETitle">FE04</td> + <td class="MSIDTitle">SCW30</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">MISTRAL</td> + <td class="MSFETitle">FE09</td> + <td class="MSIDTitle">BEND</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">NCD</td> + <td class="MSFETitle">FE11</td> + <td class="MSIDTitle">IVU21</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/short_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">XALOC</td> + <td class="MSFETitle">FE13</td> + <td class="MSIDTitle">IVU21</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/long_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">CLAESS</td> + <td class="MSFETitle">FE22</td> + <td class="MSIDTitle">MPW80</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/float_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">CIRCE</td> + <td class="MSFETitle">FE24</td> + <td class="MSIDTitle">EU62</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/ulong_scalar" /></td> + </tr> + + <tr> + <td class="MSBLTitle" rowspan="2">BOREAS</td> + <td class="MSFETitle">FE29</td> + <td class="MSIDTitle">EU71</td> + </tr> + <tr> + <td><div class="FELabel BorderLabel" data-taurus-model="sys/tg_test/1/string_scalar" /></td> + <td><div class="IDLabel BorderLabel" data-taurus-model="sys/tg_test/1/double_scalar" /></td> + </tr> + + </table> + </td> + </table> +</body> +</html> diff --git a/lib/taurus/web/examples/tornado/machinestatus.py b/lib/taurus/web/examples/tornado/machinestatus.py new file mode 100644 index 00000000..059ee2a3 --- /dev/null +++ b/lib/taurus/web/examples/tornado/machinestatus.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +############################################################################# +## +## This file is part of Taurus +## +## http://taurus-scada.org +## +## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain +## +## Taurus is free software: you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## Taurus is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with Taurus. If not, see <http://www.gnu.org/licenses/>. +## +############################################################################# + +""" +""" + +__docformat__ = "restructuredtext" + +import os.path + +from taurus.web.taurustornado import RequestHandler +from taurus.web.taurustornado import start, get_default_handlers + +class MainHandler(RequestHandler): + def get(self): + self.render("machinestatus.html") + +def main(): + local_path = os.path.dirname(__file__) + static_path = os.path.join(local_path, 'static') + handlers = [ (r"/", MainHandler) ] + get_default_handlers() + + start(handlers=handlers, static_path=static_path, debug=True) + +if __name__ == "__main__": + main() diff --git a/lib/taurus/web/examples/tornado/static/css/demo.css b/lib/taurus/web/examples/tornado/static/css/demo.css new file mode 100644 index 00000000..a0056bf8 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/css/demo.css @@ -0,0 +1,83 @@ + +.MS { color: #FFFFFF; + font-family: Sans-serif; } + +body.MS { background-color: #444444; } + +table.MS { } + +.Panel { width: 100%; + border-width: 1px; + border-style: solid; + border-radius: 5px; + border-color: white; + padding: 4px; } + +.PanelMin { + border-width: 1px; + border-style: solid; + border-radius: 5px; + border-color: white; + padding: 4px; } + +.Form { + border-width: 1px; + border-style: solid; + border-radius: 5px; + border-color: white; + padding: 4px; + background-image: linear-gradient(to bottom right, #CCCCCC 0%, #008BCC 100%); +} + +.PanelUp { border-top-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-style :solid; + border-left-style: solid; + border-right-style: solid; + border-bottom-style: none; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border-color: whitesmoke; + margin: 2px; + padding: 4px; } + +.MSBLTitle { font-family: arial, serif; + font-size : xx-large; + font-weight : bold; + text-align : left; } + +.MSFETitle { font-family: arial, serif; + font-size : x-large; + font-weight : normal; + text-align : left; } + +.MSIDTitle { font-family: arial, serif; + font-size : x-large; + font-weight : normal; + text-align : left; } + +.Label { + font-weight : normal; + font-family : monospace; + text-align : right; + vertical-align: middle; } + +.FELabel { font-size : large; + font-weight : normal; + font-family : monospace; + text-align : center; + vertical-align: middle; } + +.IDLabel { font-size : large; + font-weight : normal; + font-family : monospace; + text-align : right; + vertical-align: middle; } + +.BorderLabel { border-width:0px; + border-style:solid; + border-radius: 2px; + margin: auto; + padding: 4px; } + diff --git a/lib/taurus/web/examples/tornado/static/css/machinestatus.css b/lib/taurus/web/examples/tornado/static/css/machinestatus.css new file mode 100644 index 00000000..1a91ea55 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/css/machinestatus.css @@ -0,0 +1,76 @@ + +.MS { color: #FFFFFF; + font-family: Sans-serif; } + +body.MS { background-color: #444444; } + +table.MS { } + +.Panel { width: 100%; + border-width: 1px; + border-style: solid; + border-radius: 5px; + border-color: white; + padding: 4px; } + +.Form { + border-width: 1px; + border-style: solid; + border-radius: 5px; + border-color: white; + padding: 4px; + background-image: linear-gradient(to bottom right, #CCCCCC 0%, #008BCC 100%); +} + +.PanelUp { border-top-width: 1px; + border-left-width: 1px; + border-right-width: 1px; + border-top-style :solid; + border-left-style: solid; + border-right-style: solid; + border-bottom-style: none; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border-color: whitesmoke; + margin: 2px; + padding: 4px; } + +.MSBLTitle { font-family: arial, serif; + font-size : xx-large; + font-weight : bold; + text-align : left; } + +.MSFETitle { font-family: arial, serif; + font-size : x-large; + font-weight : normal; + text-align : left; } + +.MSIDTitle { font-family: arial, serif; + font-size : x-large; + font-weight : normal; + text-align : left; } + +.Label { + font-weight : normal; + font-family : monospace; + text-align : right; + vertical-align: middle; } + +.FELabel { font-size : large; + font-weight : normal; + font-family : monospace; + text-align : center; + vertical-align: middle; } + +.IDLabel { font-size : large; + font-weight : normal; + font-family : monospace; + text-align : right; + vertical-align: middle; } + +.BorderLabel { border-width:0px; + border-style:solid; + border-radius: 2px; + margin: auto; + padding: 4px; } + diff --git a/lib/taurus/web/examples/tornado/static/js/countclient.coffee b/lib/taurus/web/examples/tornado/static/js/countclient.coffee new file mode 100644 index 00000000..bb11f5c4 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/countclient.coffee @@ -0,0 +1,75 @@ +taurus_websocket = null + +taurus_models = -> + ( elem.dataset['taurusModel'] for elem in $('[data-taurus-model]') ) + +taurus_element = (model) -> + $('[data-taurus-model="' + model + '"]') + +initialize = -> + + console.log("Initializing page...") + + $('title').html(':: Taurus ::') + + gauge_props = + interactionArea: "none" + minimum: -140 + maximum: 150 + + dom = require("dojo/dom") + CircularLinearGauge = require("dojox/dgauges/components/default/CircularLinearGauge") + gauge = new CircularLinearGauge(gauge_props, dom.byId("gauge01")) + gauge.set('value', 44) + + taurus_websocket = new WebSocket("ws://pc151.cells.es:8888/taurus") + + taurus_websocket.onopen = -> + $('title').html(':: Taurus :: Connected') + initialize_taurus() + + taurus_websocket.onmessage = (event) -> + event_data = JSON.parse(event.data) + elements = taurus_element(event_data.model) + elements.filter(":not([data-taurus-controller = 'Gauge'])").css(event_data.css).html(event_data.html) + elements.filter("input").css('background-color','').css('color','') + g = elements.filter("#gauge01") + if g.length and gauge + indicatorText = gauge.getElement("indicatorText") + indicatorText.set('value', event_data.html) + indicatorText.indicator.set('value', event_data.html) + + taurus_websocket.onerror = (event) -> + $('body').append('<div>Error:' + event + ' ' + '</div>') + + taurus_websocket.onclose = (event) -> + $('title').html(':: Taurus :: Disconnected') + + plot = JXG.JSXGraph.initBoard('plot', {boundingbox: [-10, 10, 10, -10], axis:true, grid:true}) + geonext = JXG.JSXGraph.loadBoardFromFile('geonext', 'static/geonext/triangle.gxt', 'Geonext') + + props = + position : ["right", "bottom"] + width : 460 +# buttons : +# Ok : -> $(this).dialog("close") + + $('#motor-attributes').dialog(props) + + $("#tangotest-attributes" ).hide() + $('#show-tangotest').button().click(-> $('#tangotest-attributes').show('bounce', {}, 500, ->)) + + console.log("Finished initializing page") + +initialize_taurus = -> + console.log("Initializing taurus...") + models = taurus_models() + json_models = JSON.stringify({models : models}) + taurus_websocket.send(json_models) + console.log("Finished initializing taurus") + +$ -> + dojo_requirements = ["dojo/_base/kernel", "dojo/parser", "dojo/dom", + "dojox/dgauges/components/default/CircularLinearGauge"] + + require(dojo_requirements, initialize) diff --git a/lib/taurus/web/examples/tornado/static/js/countclient.js b/lib/taurus/web/examples/tornado/static/js/countclient.js new file mode 100644 index 00000000..106978d8 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/countclient.js @@ -0,0 +1,94 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var initialize, initialize_taurus, taurus_element, taurus_models, taurus_websocket; + + taurus_websocket = null; + + taurus_models = function() { + var elem, _i, _len, _ref, _results; + _ref = $('[data-taurus-model]'); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + _results.push(elem.dataset['taurusModel']); + } + return _results; + }; + + taurus_element = function(model) { + return $('[data-taurus-model="' + model + '"]'); + }; + + initialize = function() { + var CircularLinearGauge, dom, gauge, gauge_props, geonext, plot, props; + console.log("Initializing page..."); + $('title').html(':: Taurus ::'); + gauge_props = { + interactionArea: "none", + minimum: -140, + maximum: 150 + }; + dom = require("dojo/dom"); + CircularLinearGauge = require("dojox/dgauges/components/default/CircularLinearGauge"); + gauge = new CircularLinearGauge(gauge_props, dom.byId("gauge01")); + gauge.set('value', 44); + taurus_websocket = new WebSocket("ws://pc151.cells.es:8888/taurus"); + taurus_websocket.onopen = function() { + $('title').html(':: Taurus :: Connected'); + return initialize_taurus(); + }; + taurus_websocket.onmessage = function(event) { + var elements, event_data, g, indicatorText; + event_data = JSON.parse(event.data); + elements = taurus_element(event_data.model); + elements.filter(":not([data-taurus-controller = 'Gauge'])").css(event_data.css).html(event_data.html); + elements.filter("input").css('background-color', '').css('color', ''); + g = elements.filter("#gauge01"); + if (g.length && gauge) { + indicatorText = gauge.getElement("indicatorText"); + indicatorText.set('value', event_data.html); + return indicatorText.indicator.set('value', event_data.html); + } + }; + taurus_websocket.onerror = function(event) { + return $('body').append('<div>Error:' + event + ' ' + '</div>'); + }; + taurus_websocket.onclose = function(event) { + return $('title').html(':: Taurus :: Disconnected'); + }; + plot = JXG.JSXGraph.initBoard('plot', { + boundingbox: [-10, 10, 10, -10], + axis: true, + grid: true + }); + geonext = JXG.JSXGraph.loadBoardFromFile('geonext', 'static/geonext/triangle.gxt', 'Geonext'); + props = { + position: ["right", "bottom"], + width: 460 + }; + $('#motor-attributes').dialog(props); + $("#tangotest-attributes").hide(); + $('#show-tangotest').button().click(function() { + return $('#tangotest-attributes').show('bounce', {}, 500, function() {}); + }); + return console.log("Finished initializing page"); + }; + + initialize_taurus = function() { + var json_models, models; + console.log("Initializing taurus..."); + models = taurus_models(); + json_models = JSON.stringify({ + models: models + }); + taurus_websocket.send(json_models); + return console.log("Finished initializing taurus"); + }; + + $(function() { + var dojo_requirements; + dojo_requirements = ["dojo/_base/kernel", "dojo/parser", "dojo/dom", "dojox/dgauges/components/default/CircularLinearGauge"]; + return require(dojo_requirements, initialize); + }); + +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/demo.js b/lib/taurus/web/examples/tornado/static/js/demo.js new file mode 100644 index 00000000..a1ed2b69 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/demo.js @@ -0,0 +1,14 @@ + +(function() { + var initialize_demo; + + initialize_demo = function() { + console.log("Initializing taurus WEB generic demo application..."); + return console.log("Finished initializing taurus WEB generic demo application"); + }; + + $(function() { + return initialize_demo(); + }); + +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/demo1.js b/lib/taurus/web/examples/tornado/static/js/demo1.js new file mode 100644 index 00000000..ebca6a19 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/demo1.js @@ -0,0 +1,14 @@ + +(function() { + var initialize_demo1; + + initialize_demo1 = function() { + console.log("Initializing taurus WEB demo 1 application..."); + return console.log("Finished initializing taurus WEB demo 1 application"); + }; + + $(function() { + return initialize_demo1(); + }); + +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/demo2.js b/lib/taurus/web/examples/tornado/static/js/demo2.js new file mode 100644 index 00000000..9f8fa5aa --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/demo2.js @@ -0,0 +1,41 @@ + +(function() { + var initialize_demo2; + + initialize_demo2 = function() { + console.log("Initializing taurus WEB demo 2 application..."); + init_highcharts(); + return console.log("Finished initializing taurus WEB demo 2 application"); + }; + + $(function() { + return initialize_demo2(); + }); + + init_highcharts = function () { + $('#highcharts-canvas').highcharts({ + chart: { + type: 'bar' + }, + title: { + text: 'Fruit Consumption' + }, + xAxis: { + categories: ['Apples', 'Bananas', 'Oranges'] + }, + yAxis: { + title: { + text: 'Fruit eaten' + } + }, + series: [{ + name: 'Jane', + data: [1, 0, 4] + }, { + name: 'John', + data: [5, 7, 3] + }] + }); + }; + +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/demo3.js b/lib/taurus/web/examples/tornado/static/js/demo3.js new file mode 100644 index 00000000..0bc6e8e5 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/demo3.js @@ -0,0 +1,44 @@ + +(function() { + var initialize_demo3; + + initialize_demo3 = function() { + console.log("Initializing taurus WEB demo 3 application..."); + init_highcharts(); + return console.log("Finished initializing taurus WEB demo 3 application"); + }; + + $(function() { + return initialize_demo3(); + }); + + init_highcharts = function () { + var chart = new Highcharts.Chart({ + chart: { + renderTo: 'highcharts-canvas', + //type: 'line' + }, + title: { + text: 'Fruit Consumption' + }, + series: [{ + name: 'Jane', + data: [] + }], + + taurus_model : "sys/tg_test/1/double_scalar" + }); + + taurus_listener = function (event_data) { + if (event_data.model == chart.options.taurus_model) { + console.log(event_data.value); + data = chart.series.data + data.push([data.length,event_data.value]); + console.log(chart.series[0].data); + chart.redraw(); + } + }; + + taurus_onmessage_callbacks.add(taurus_listener); +}; +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/demo4.js b/lib/taurus/web/examples/tornado/static/js/demo4.js new file mode 100644 index 00000000..4a35cf6d --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/demo4.js @@ -0,0 +1,14 @@ + +(function() { + var initialize_demo4; + + initialize_demo4 = function() { + console.log("Initializing taurus WEB demo 4 application..."); + return console.log("Finished initializing taurus WEB demo 4 application"); + }; + + $(function() { + return initialize_demo4(); + }); + +}).call(this); diff --git a/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee b/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee new file mode 100644 index 00000000..41640933 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/machinestatus.coffee @@ -0,0 +1,9 @@ + +initialize = -> + + console.log("Initializing taurus WEB demo application...") + console.log("Finished initializing taurus WEB demo application") + +$ -> + initialize() + diff --git a/lib/taurus/web/examples/tornado/static/js/machinestatus.js b/lib/taurus/web/examples/tornado/static/js/machinestatus.js new file mode 100644 index 00000000..95dca018 --- /dev/null +++ b/lib/taurus/web/examples/tornado/static/js/machinestatus.js @@ -0,0 +1,14 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var initialize; + + initialize = function() { + console.log("Initializing taurus WEB machine status application..."); + return console.log("Finished initializing taurus WEB machine status application"); + }; + + $(function() { + return initialize(); + }); + +}).call(this); |