runtime/webinterface.js
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 15 Sep 2017 19:01:31 +0300
changeset 1807 5562f34f2fc2
parent 719 db54ccc96309
permissions -rw-r--r--
lazy initialization of highlight pens and brushes for DebugVariableViewer

Constructors wx.Pen() and wx.Brush() require wx.App to exist already.
That causes crash during import of the control,
because import is done before calling main application code.
369
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
     1
// import Nevow.Athena
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
     2
381
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
     3
function init() {
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
     4
  Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'HMIinitialisation');
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
     5
}
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
     6
369
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
     7
WebInterface.PLC = Nevow.Athena.Widget.subclass('WebInterface.PLC');
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
     8
WebInterface.PLC.method(
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
     9
	 'updateHMI',
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    10
	 function (self, data) {
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    11
	   d = self.callRemote('getPLCElement');
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    12
	   d.addCallback(
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    13
			 function liveElementReceived(le) {
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    14
				d2 = self.addChildWidgetFromWidgetInfo(le);
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    15
				d2.addCallback(
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    16
						function childAdded(widget) {
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    17
						var node = self.nodeById('content');
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    18
						node.replaceChild(widget.node, node.getElementsByTagName('div')[0]);
381
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
    19
						init();
369
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    20
						});
bd54d41a7573 Adding support for twisted website HMI
laurent
parents:
diff changeset
    21
				});
381
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
    22
	   });
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
    23
5c0f34a9ab00 Improving support for svgui, separating setting end getting attributes functions from creating function.
laurent
parents: 369
diff changeset
    24
Divmod.Base.addLoadEvent(init);