Improving support for svgui, separating setting end getting attributes functions from creating function.
--- a/Beremiz_service.py Thu Aug 13 11:48:55 2009 +0200
+++ b/Beremiz_service.py Fri Aug 14 16:26:19 2009 +0200
@@ -509,16 +509,26 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
'''
-
- class DefaultPLCStartedHMI(athena.LiveElement):
+ class PLCHMI(athena.LiveElement):
+
+ initialised = False
+
+ def HMIinitialised(self, result):
+ self.initialised = True
+
+ def HMIinitialisation(self):
+ self.HMIinitialised(None)
+
+ class DefaultPLCStartedHMI(PLCHMI):
docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
tags.h1["PLC IS NOW STARTED"],
])
- class PLCStoppedHMI(athena.LiveElement):
+
+ class PLCStoppedHMI(PLCHMI):
docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
tags.h1["PLC IS STOPPED"]
])
-
+
class MainPage(athena.LiveElement):
jsClass = u"WebInterface.PLC"
docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
@@ -583,6 +593,7 @@
tags.div( render = tags.directive( "MainPage" ))
]]]])
MainPage = MainPage()
+ PLCHMI = PLCHMI
def __init__(self, plcState=False, *a, **kw):
super(WebInterface, self).__init__(*a, **kw)
--- a/plugins/python/modules/svgui/livesvg.js Thu Aug 13 11:48:55 2009 +0200
+++ b/plugins/python/modules/svgui/livesvg.js Fri Aug 14 16:26:19 2009 +0200
@@ -1,14 +1,11 @@
// import Nevow.Athena
// import Divmod.Base
-function init() {
- Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'initClient');
-}
function updateAttr(id, param, value) {
Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'setattr', id, param, value);
}
-var svguiWidgets={};
+var svguiWidgets = new Array();
var currentObject = null;
function setCurrentObject(obj) {
@@ -28,6 +25,7 @@
LiveSVGPage.LiveSVGWidget = Nevow.Athena.Widget.subclass('LiveSVGPage.LiveSVGWidget');
LiveSVGPage.LiveSVGWidget.methods(
+
function handleEvent(self, evt) {
if (currentObject != null) {
currentObject.handleEvent(evt);
@@ -36,28 +34,20 @@
function receiveData(self, data){
dataReceived = json_parse(data);
- newState = json_parse(dataReceived.kwargs).state
- svguiWidgets[dataReceived.back_id].updateState(newState);
+ gadget = svguiWidgets[dataReceived.id]
+ if (gadget) {
+ gadget.updateValues(json_parse(dataReceived.kwargs));
+ }
//console.log("OBJET : " + dataReceived.back_id + " STATE : " + newState);
},
- function SvguiButton(self,elt_back, args){
- var btn = new svguilib.button(self, elt_back, args.sele_id, args.toggle, args.state, args.active);
- return btn;
- },
-
- function SvguiTextCtrl(self, elt_back, args){
- var txtCtrl = new svguilib.textControl(self, elt_back, args.state);
- return txtCtrl;
- },
-
function init(self, arg1){
//console.log("Object received : " + arg1);
for (ind in arg1) {
gad = json_parse(arg1[ind]);
args = json_parse(gad.kwargs);
- gadget = self[gad.__class__](gad.back_id, args);
- svguiWidgets[gadget.back_elt.id]=gadget;
+ gadget = new svguilib[gad.__class__](self, gad.id, args);
+ svguiWidgets[gadget.id]=gadget;
//console.log('GADGET :' + gadget);
}
var elements = document.getElementsByTagName("svg");
@@ -67,5 +57,3 @@
//console.log("SVGUIWIDGETS : " + svguiWidgets);
}
);
-
-Divmod.Base.addLoadEvent(init);
\ No newline at end of file
--- a/plugins/python/modules/svgui/pous.xml Thu Aug 13 11:48:55 2009 +0200
+++ b/plugins/python/modules/svgui/pous.xml Fri Aug 14 16:26:19 2009 +0200
@@ -8,7 +8,7 @@
productVersion="0.0"
creationDateTime="2008-12-14T16:53:26"/>
<contentHeader name="Beremiz non-standard POUs library"
- modificationDateTime="2009-07-15T17:13:23">
+ modificationDateTime="2009-08-12T15:35:33">
<coordinateInfo>
<fbd>
<scaling x="0" y="0"/>
@@ -51,12 +51,12 @@
</ST>
</body>
</pou>
- <pou name="Button_toggle" pouType="functionBlock">
+ <pou name="TextCtrl" pouType="functionBlock">
<interface>
<localVars>
- <variable name="SVGUI_Command">
- <type>
- <derived name="python_poll"/>
+ <variable name="ID">
+ <type>
+ <string/>
</type>
</variable>
</localVars>
@@ -66,135 +66,59 @@
<string/>
</type>
</variable>
- <variable name="sele_id">
+ <variable name="set_text">
+ <type>
+ <BOOL/>
+ </type>
+ </variable>
+ <variable name="text">
<type>
<string/>
</type>
</variable>
- <variable name="set_state">
- <type>
- <BOOL/>
- </type>
- </variable>
</inputVars>
- <outputVars>
- <variable name="current_state">
- <type>
- <BOOL/>
- </type>
- </variable>
- </outputVars>
<localVars>
- <variable name="GetButtonState">
- <type>
- <derived name="GetBoolString"/>
+ <variable name="SVGUI_TEXTCTRL">
+ <type>
+ <derived name="python_eval"/>
+ </type>
+ </variable>
+ <variable name="setstate_Command">
+ <type>
+ <derived name="python_eval"/>
</type>
</variable>
</localVars>
</interface>
<body>
<FBD>
- <block localId="1" width="125" height="140" typeName="python_poll" instanceName="SVGUI_Command">
- <position x="872" y="137"/>
- <inputVariables>
- <variable formalParameter="TRIG">
- <connectionPointIn>
- <relPosition x="0" y="50"/>
- <connection refLocalId="10">
- <position x="872" y="187"/>
- <position x="795" y="187"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="CODE">
- <connectionPointIn>
- <relPosition x="0" y="110"/>
- <connection refLocalId="2" formalParameter="OUT">
- <position x="872" y="247"/>
- <position x="678" y="247"/>
- <position x="678" y="80"/>
- <position x="636" y="80"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="ACK">
- <connectionPointOut>
- <relPosition x="125" y="50"/>
- </connectionPointOut>
- </variable>
- <variable formalParameter="RESULT">
- <connectionPointOut>
- <relPosition x="125" y="110"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="2" width="150" height="485" typeName="CONCAT">
- <position x="486" y="25"/>
+ <block localId="1" width="193" height="160" typeName="CONCAT">
+ <position x="626" y="122"/>
<inputVariables>
<variable formalParameter="IN1">
<connectionPointIn>
- <relPosition x="0" y="55"/>
+ <relPosition x="0" y="43"/>
+ <connection refLocalId="2">
+ <position x="626" y="165"/>
+ <position x="535" y="165"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="89"/>
<connection refLocalId="3">
- <position x="486" y="80"/>
- <position x="380" y="80"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN2">
- <connectionPointIn>
- <relPosition x="0" y="120"/>
- <connection refLocalId="11">
- <position x="486" y="145"/>
- <position x="170" y="145"/>
+ <position x="626" y="211"/>
+ <position x="535" y="211"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN3">
<connectionPointIn>
- <relPosition x="0" y="185"/>
- <connection refLocalId="5">
- <position x="486" y="210"/>
- <position x="380" y="210"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN4">
- <connectionPointIn>
- <relPosition x="0" y="250"/>
- <connection refLocalId="12">
- <position x="486" y="275"/>
- <position x="205" y="275"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN5">
- <connectionPointIn>
- <relPosition x="0" y="315"/>
- <connection refLocalId="7">
- <position x="486" y="340"/>
- <position x="350" y="340"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN6">
- <connectionPointIn>
- <relPosition x="0" y="385"/>
- <connection refLocalId="28" formalParameter="CODE">
- <position x="486" y="410"/>
- <position x="389" y="410"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN7">
- <connectionPointIn>
- <relPosition x="0" y="450"/>
- <connection refLocalId="9">
- <position x="486" y="475"/>
- <position x="389" y="475"/>
+ <relPosition x="0" y="135"/>
+ <connection refLocalId="6">
+ <position x="626" y="257"/>
+ <position x="532" y="257"/>
</connection>
</connectionPointIn>
</variable>
@@ -203,272 +127,33 @@
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
- <relPosition x="150" y="55"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <inVariable localId="3" height="30" width="291">
- <position x="89" y="65"/>
- <connectionPointOut>
- <relPosition x="291" y="15"/>
- </connectionPointOut>
- <expression>'int(SVGUI("SvguiButton","'</expression>
- </inVariable>
- <inVariable localId="5" height="30" width="140">
- <position x="240" y="195"/>
- <connectionPointOut>
- <relPosition x="140" y="15"/>
- </connectionPointOut>
- <expression>'",sele_id="'</expression>
- </inVariable>
- <inVariable localId="7" height="30" width="110">
- <position x="240" y="325"/>
- <connectionPointOut>
- <relPosition x="110" y="15"/>
- </connectionPointOut>
- <expression>'",state='</expression>
- </inVariable>
- <inVariable localId="9" height="30" width="290">
- <position x="99" y="460"/>
- <connectionPointOut>
- <relPosition x="290" y="15"/>
- </connectionPointOut>
- <expression>',toggle=True,active=True))'</expression>
- </inVariable>
- <inVariable localId="10" height="30" width="70">
- <position x="725" y="172"/>
- <connectionPointOut>
- <relPosition x="70" y="15"/>
- </connectionPointOut>
- <expression>BOOL#1</expression>
- </inVariable>
- <inVariable localId="11" height="35" width="85">
- <position x="85" y="130"/>
+ <relPosition x="193" y="43"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="2" height="30" width="460">
+ <position x="75" y="150"/>
+ <connectionPointOut>
+ <relPosition x="460" y="15"/>
+ </connectionPointOut>
+ <expression>'createSVGUIControl("textControl", back_id="'</expression>
+ </inVariable>
+ <inVariable localId="3" height="35" width="85">
+ <position x="450" y="196"/>
<connectionPointOut>
<relPosition x="85" y="15"/>
</connectionPointOut>
<expression>back_id</expression>
</inVariable>
- <inVariable localId="12" height="35" width="85">
- <position x="120" y="260"/>
- <connectionPointOut>
- <relPosition x="85" y="15"/>
- </connectionPointOut>
- <expression>sele_id</expression>
- </inVariable>
- <inVariable localId="13" height="35" width="100">
- <position x="109" y="395"/>
- <connectionPointOut>
- <relPosition x="100" y="15"/>
- </connectionPointOut>
- <expression>set_state</expression>
- </inVariable>
- <block localId="25" width="145" height="45" typeName="STRING_TO_INT">
- <position x="1052" y="217"/>
- <inputVariables>
- <variable formalParameter="IN">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="1" formalParameter="RESULT">
- <position x="1052" y="247"/>
- <position x="997" y="247"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="OUT">
- <connectionPointOut>
- <relPosition x="145" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="26" width="125" height="45" typeName="INT_TO_BOOL">
- <position x="1247" y="217"/>
- <inputVariables>
- <variable formalParameter="IN">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="25" formalParameter="OUT">
- <position x="1247" y="247"/>
- <position x="1197" y="247"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="OUT">
- <connectionPointOut>
- <relPosition x="125" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <outVariable localId="27" height="35" width="145">
- <position x="1402" y="232"/>
- <connectionPointIn>
- <relPosition x="0" y="15"/>
- <connection refLocalId="26" formalParameter="OUT">
- <position x="1402" y="247"/>
- <position x="1372" y="247"/>
- </connection>
- </connectionPointIn>
- <expression>current_state</expression>
- </outVariable>
- <block localId="28" width="140" height="40" typeName="GetBoolString" instanceName="GetButtonState">
- <position x="249" y="380"/>
- <inputVariables>
- <variable formalParameter="VALUE">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="13">
- <position x="249" y="410"/>
- <position x="209" y="410"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="CODE">
- <connectionPointOut>
- <relPosition x="140" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- </FBD>
- </body>
- </pou>
- <pou name="TextCtrl" pouType="functionBlock">
- <interface>
- <inputVars>
- <variable name="back_id">
- <type>
- <string/>
- </type>
- </variable>
- <variable name="state">
- <type>
- <string/>
- </type>
- </variable>
- </inputVars>
- <localVars>
- <variable name="SVGUI_TEXTCTRL">
- <type>
- <derived name="python_poll"/>
- </type>
- </variable>
- </localVars>
- <outputVars>
- <variable name="code">
- <type>
- <string/>
- </type>
- </variable>
- </outputVars>
- </interface>
- <body>
- <FBD>
- <block localId="1" width="265" height="230" typeName="CONCAT">
- <position x="549" y="125"/>
- <inputVariables>
- <variable formalParameter="IN1">
- <connectionPointIn>
- <relPosition x="0" y="40"/>
- <connection refLocalId="2">
- <position x="549" y="165"/>
- <position x="361" y="165"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN2">
- <connectionPointIn>
- <relPosition x="0" y="85"/>
- <connection refLocalId="3">
- <position x="549" y="210"/>
- <position x="160" y="210"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN3">
- <connectionPointIn>
- <relPosition x="0" y="125"/>
- <connection refLocalId="5">
- <position x="549" y="250"/>
- <position x="195" y="250"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN4">
- <connectionPointIn>
- <relPosition x="0" y="165"/>
- <connection refLocalId="4">
- <position x="549" y="290"/>
- <position x="140" y="290"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN5">
- <connectionPointIn>
- <relPosition x="0" y="210"/>
- <connection refLocalId="6">
- <position x="549" y="335"/>
- <position x="125" y="335"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="OUT">
- <connectionPointOut>
- <relPosition x="265" y="40"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <inVariable localId="2" height="30" width="286">
- <position x="75" y="150"/>
- <connectionPointOut>
- <relPosition x="286" y="15"/>
- </connectionPointOut>
- <expression>'SVGUI("SvguiTextCtrl","'</expression>
- </inVariable>
- <inVariable localId="3" height="35" width="85">
- <position x="75" y="195"/>
- <connectionPointOut>
- <relPosition x="85" y="15"/>
- </connectionPointOut>
- <expression>back_id</expression>
- </inVariable>
- <inVariable localId="4" height="35" width="65">
- <position x="75" y="275"/>
- <connectionPointOut>
- <relPosition x="65" y="15"/>
- </connectionPointOut>
- <expression>state</expression>
- </inVariable>
- <inVariable localId="5" height="30" width="120">
- <position x="75" y="235"/>
- <connectionPointOut>
- <relPosition x="120" y="15"/>
- </connectionPointOut>
- <expression>'",state="'</expression>
- </inVariable>
<inVariable localId="6" height="30" width="50">
- <position x="75" y="320"/>
+ <position x="482" y="242"/>
<connectionPointOut>
<relPosition x="50" y="15"/>
</connectionPointOut>
<expression>'")'</expression>
</inVariable>
- <block localId="7" width="125" height="115" typeName="python_poll" instanceName="SVGUI_TEXTCTRL">
+ <block localId="7" width="125" height="115" typeName="python_eval" instanceName="SVGUI_TEXTCTRL">
<position x="909" y="75"/>
<inputVariables>
<variable formalParameter="TRIG">
@@ -487,7 +172,7 @@
<relPosition x="0" y="90"/>
<connection refLocalId="1" formalParameter="OUT">
<position x="909" y="165"/>
- <position x="814" y="165"/>
+ <position x="819" y="165"/>
</connection>
</connectionPointIn>
</variable>
@@ -506,23 +191,208 @@
</variable>
</outputVariables>
</block>
- <outVariable localId="8" height="35" width="55">
- <position x="1084" y="150"/>
+ <inVariable localId="9" height="30" width="70">
+ <position x="799" y="70"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
+ </inVariable>
+ <outVariable localId="10" height="30" width="30">
+ <position x="1094" y="150"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
<connection refLocalId="7" formalParameter="RESULT">
- <position x="1084" y="165"/>
+ <position x="1094" y="165"/>
<position x="1034" y="165"/>
</connection>
</connectionPointIn>
- <expression>code</expression>
+ <expression>ID</expression>
</outVariable>
- <inVariable localId="9" height="30" width="70">
- <position x="799" y="70"/>
- <connectionPointOut>
- <relPosition x="70" y="15"/>
- </connectionPointOut>
- <expression>BOOL#1</expression>
+ <connector name="CREATED" localId="11" height="30" width="110">
+ <position x="1096" y="105"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="7" formalParameter="ACK">
+ <position x="1096" y="120"/>
+ <position x="1034" y="120"/>
+ </connection>
+ </connectionPointIn>
+ </connector>
+ <block localId="4" width="125" height="140" typeName="python_eval" instanceName="setstate_Command">
+ <position x="957" y="472"/>
+ <inputVariables>
+ <variable formalParameter="TRIG">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="31" formalParameter="OUT">
+ <position x="957" y="522"/>
+ <position x="909" y="522"/>
+ <position x="909" y="444"/>
+ <position x="857" y="444"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="CODE">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="12" formalParameter="OUT">
+ <position x="957" y="582"/>
+ <position x="822" y="582"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="ACK">
+ <connectionPointOut>
+ <relPosition x="125" y="50"/>
+ </connectionPointOut>
+ </variable>
+ <variable formalParameter="RESULT">
+ <connectionPointOut>
+ <relPosition x="125" y="110"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <continuation name="CREATED" localId="5" height="30" width="110">
+ <position x="589" y="429"/>
+ <connectionPointOut>
+ <relPosition x="110" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <block localId="12" width="186" height="288" typeName="CONCAT">
+ <position x="636" y="536"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="46"/>
+ <connection refLocalId="14">
+ <position x="636" y="582"/>
+ <position x="526" y="582"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="99"/>
+ <connection refLocalId="8">
+ <position x="636" y="635"/>
+ <position x="526" y="635"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN3">
+ <connectionPointIn>
+ <relPosition x="0" y="152"/>
+ <connection refLocalId="15">
+ <position x="636" y="688"/>
+ <position x="527" y="688"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN4">
+ <connectionPointIn>
+ <relPosition x="0" y="205"/>
+ <connection refLocalId="32">
+ <position x="636" y="741"/>
+ <position x="528" y="741"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN5">
+ <connectionPointIn>
+ <relPosition x="0" y="258"/>
+ <connection refLocalId="16">
+ <position x="636" y="794"/>
+ <position x="528" y="794"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="186" y="46"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="8" height="30" width="53">
+ <position x="473" y="620"/>
+ <connectionPointOut>
+ <relPosition x="53" y="15"/>
+ </connectionPointOut>
+ <expression>ID</expression>
+ </inVariable>
+ <inVariable localId="13" height="35" width="100">
+ <position x="599" y="469"/>
+ <connectionPointOut>
+ <relPosition x="100" y="17"/>
+ </connectionPointOut>
+ <expression>set_text</expression>
+ </inVariable>
+ <inVariable localId="14" height="30" width="120">
+ <position x="406" y="567"/>
+ <connectionPointOut>
+ <relPosition x="120" y="15"/>
+ </connectionPointOut>
+ <expression>'setAttr('</expression>
+ </inVariable>
+ <inVariable localId="15" height="30" width="122">
+ <position x="405" y="673"/>
+ <connectionPointOut>
+ <relPosition x="122" y="15"/>
+ </connectionPointOut>
+ <expression>',"text","'</expression>
+ </inVariable>
+ <inVariable localId="16" height="30" width="50">
+ <position x="478" y="779"/>
+ <connectionPointOut>
+ <relPosition x="50" y="15"/>
+ </connectionPointOut>
+ <expression>'")'</expression>
+ </inVariable>
+ <block localId="31" width="75" height="105" typeName="AND">
+ <position x="782" y="403"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="41"/>
+ <connection refLocalId="5">
+ <position x="782" y="444"/>
+ <position x="699" y="444"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="83"/>
+ <connection refLocalId="13">
+ <position x="782" y="486"/>
+ <position x="699" y="486"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="75" y="41"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="32" height="30" width="90">
+ <position x="438" y="726"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ <expression>text</expression>
</inVariable>
</FBD>
</body>
@@ -530,9 +400,9 @@
<pou name="Button" pouType="functionBlock">
<interface>
<localVars>
- <variable name="SVGUI_Command">
- <type>
- <derived name="python_poll"/>
+ <variable name="ID">
+ <type>
+ <string/>
</type>
</variable>
</localVars>
@@ -547,38 +417,68 @@
<string/>
</type>
</variable>
+ <variable name="toggle">
+ <type>
+ <BOOL/>
+ </type>
+ </variable>
<variable name="set_state">
<type>
<BOOL/>
</type>
</variable>
+ <variable name="state_in">
+ <type>
+ <BOOL/>
+ </type>
+ </variable>
</inputVars>
<outputVars>
- <variable name="current_state">
+ <variable name="state_out">
<type>
<BOOL/>
</type>
</variable>
</outputVars>
<localVars>
+ <variable name="init_Command">
+ <type>
+ <derived name="python_eval"/>
+ </type>
+ </variable>
<variable name="GetButtonState">
<type>
<derived name="GetBoolString"/>
</type>
</variable>
+ <variable name="setstate_Command">
+ <type>
+ <derived name="python_eval"/>
+ </type>
+ </variable>
+ <variable name="getstate_Command">
+ <type>
+ <derived name="python_poll"/>
+ </type>
+ </variable>
+ <variable name="GetButtonToggle">
+ <type>
+ <derived name="GetBoolString"/>
+ </type>
+ </variable>
</localVars>
</interface>
<body>
<FBD>
- <block localId="1" width="125" height="140" typeName="python_poll" instanceName="SVGUI_Command">
- <position x="827" y="168"/>
+ <block localId="1" width="125" height="140" typeName="python_eval" instanceName="init_Command">
+ <position x="838" y="32"/>
<inputVariables>
<variable formalParameter="TRIG">
<connectionPointIn>
<relPosition x="0" y="50"/>
<connection refLocalId="10">
- <position x="827" y="218"/>
- <position x="766" y="218"/>
+ <position x="838" y="82"/>
+ <position x="781" y="82"/>
</connection>
</connectionPointIn>
</variable>
@@ -586,10 +486,8 @@
<connectionPointIn>
<relPosition x="0" y="110"/>
<connection refLocalId="2" formalParameter="OUT">
- <position x="827" y="278"/>
- <position x="679" y="278"/>
- <position x="679" y="80"/>
- <position x="649" y="80"/>
+ <position x="838" y="142"/>
+ <position x="641" y="142"/>
</connection>
</connectionPointIn>
</variable>
@@ -608,69 +506,71 @@
</variable>
</outputVariables>
</block>
- <block localId="2" width="150" height="485" typeName="CONCAT">
- <position x="499" y="25"/>
+ <block localId="2" width="150" height="442" typeName="CONCAT">
+ <position x="491" y="92"/>
<inputVariables>
<variable formalParameter="IN1">
<connectionPointIn>
- <relPosition x="0" y="55"/>
+ <relPosition x="0" y="50"/>
<connection refLocalId="3">
- <position x="499" y="80"/>
- <position x="378" y="80"/>
+ <position x="491" y="142"/>
+ <position x="433" y="142"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN2">
<connectionPointIn>
- <relPosition x="0" y="120"/>
+ <relPosition x="0" y="110"/>
<connection refLocalId="11">
- <position x="499" y="145"/>
- <position x="170" y="145"/>
+ <position x="491" y="202"/>
+ <position x="431" y="202"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN3">
<connectionPointIn>
- <relPosition x="0" y="185"/>
+ <relPosition x="0" y="170"/>
<connection refLocalId="5">
- <position x="499" y="210"/>
- <position x="380" y="210"/>
+ <position x="491" y="262"/>
+ <position x="431" y="262"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN4">
<connectionPointIn>
- <relPosition x="0" y="250"/>
+ <relPosition x="0" y="230"/>
<connection refLocalId="12">
- <position x="499" y="275"/>
- <position x="205" y="275"/>
+ <position x="491" y="322"/>
+ <position x="430" y="322"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN5">
<connectionPointIn>
- <relPosition x="0" y="315"/>
- <connection refLocalId="7">
- <position x="499" y="340"/>
- <position x="348" y="340"/>
+ <relPosition x="0" y="290"/>
+ <connection refLocalId="23">
+ <position x="491" y="382"/>
+ <position x="463" y="382"/>
+ <position x="463" y="370"/>
+ <position x="430" y="370"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN6">
<connectionPointIn>
- <relPosition x="0" y="385"/>
- <connection refLocalId="28" formalParameter="CODE">
- <position x="499" y="410"/>
- <position x="369" y="410"/>
+ <relPosition x="0" y="350"/>
+ <connection refLocalId="24" formalParameter="CODE">
+ <position x="491" y="442"/>
+ <position x="429" y="442"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN7">
<connectionPointIn>
- <relPosition x="0" y="450"/>
+ <relPosition x="0" y="410"/>
<connection refLocalId="9">
- <position x="499" y="475"/>
- <position x="275" y="475"/>
+ <position x="491" y="502"/>
+ <position x="430" y="502"/>
</connection>
</connectionPointIn>
</variable>
@@ -679,76 +579,165 @@
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
- <relPosition x="150" y="55"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <inVariable localId="3" height="30" width="290">
- <position x="88" y="65"/>
- <connectionPointOut>
- <relPosition x="290" y="15"/>
- </connectionPointOut>
- <expression>'int(SVGUI("SvguiButton","'</expression>
+ <relPosition x="150" y="50"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="3" height="30" width="400">
+ <position x="33" y="127"/>
+ <connectionPointOut>
+ <relPosition x="400" y="15"/>
+ </connectionPointOut>
+ <expression>'createSVGUIControl("button",back_id="'</expression>
</inVariable>
<inVariable localId="5" height="30" width="140">
- <position x="240" y="195"/>
+ <position x="291" y="247"/>
<connectionPointOut>
<relPosition x="140" y="15"/>
</connectionPointOut>
<expression>'",sele_id="'</expression>
</inVariable>
- <inVariable localId="7" height="30" width="110">
- <position x="238" y="325"/>
+ <inVariable localId="9" height="30" width="180">
+ <position x="250" y="487"/>
+ <connectionPointOut>
+ <relPosition x="180" y="15"/>
+ </connectionPointOut>
+ <expression>',active=True)'</expression>
+ </inVariable>
+ <inVariable localId="10" height="30" width="70">
+ <position x="711" y="67"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
+ </inVariable>
+ <inVariable localId="11" height="35" width="85">
+ <position x="346" y="187"/>
+ <connectionPointOut>
+ <relPosition x="85" y="15"/>
+ </connectionPointOut>
+ <expression>back_id</expression>
+ </inVariable>
+ <inVariable localId="12" height="35" width="85">
+ <position x="345" y="307"/>
+ <connectionPointOut>
+ <relPosition x="85" y="15"/>
+ </connectionPointOut>
+ <expression>sele_id</expression>
+ </inVariable>
+ <inVariable localId="13" height="35" width="100">
+ <position x="452" y="639"/>
+ <connectionPointOut>
+ <relPosition x="100" y="15"/>
+ </connectionPointOut>
+ <expression>set_state</expression>
+ </inVariable>
+ <block localId="28" width="140" height="40" typeName="GetBoolString" instanceName="GetButtonState">
+ <position x="239" y="897"/>
+ <inputVariables>
+ <variable formalParameter="VALUE">
+ <connectionPointIn>
+ <relPosition x="0" y="30"/>
+ <connection refLocalId="32">
+ <position x="239" y="927"/>
+ <position x="181" y="927"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="CODE">
+ <connectionPointOut>
+ <relPosition x="140" y="30"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <outVariable localId="29" height="30" width="53">
+ <position x="1015" y="127"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="1" formalParameter="RESULT">
+ <position x="1015" y="142"/>
+ <position x="963" y="142"/>
+ </connection>
+ </connectionPointIn>
+ <expression>ID</expression>
+ </outVariable>
+ <block localId="4" width="125" height="140" typeName="python_eval" instanceName="setstate_Command">
+ <position x="810" y="640"/>
+ <inputVariables>
+ <variable formalParameter="TRIG">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="31" formalParameter="OUT">
+ <position x="810" y="690"/>
+ <position x="762" y="690"/>
+ <position x="762" y="612"/>
+ <position x="710" y="612"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="CODE">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="7" formalParameter="OUT">
+ <position x="810" y="750"/>
+ <position x="643" y="750"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="ACK">
+ <connectionPointOut>
+ <relPosition x="125" y="50"/>
+ </connectionPointOut>
+ </variable>
+ <variable formalParameter="RESULT">
+ <connectionPointOut>
+ <relPosition x="125" y="110"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <connector name="CREATED" localId="30" height="30" width="110">
+ <position x="1014" y="67"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="1" formalParameter="ACK">
+ <position x="1014" y="82"/>
+ <position x="963" y="82"/>
+ </connection>
+ </connectionPointIn>
+ </connector>
+ <continuation name="CREATED" localId="6" height="30" width="110">
+ <position x="442" y="597"/>
<connectionPointOut>
<relPosition x="110" y="15"/>
</connectionPointOut>
- <expression>'",state='</expression>
- </inVariable>
- <inVariable localId="9" height="30" width="180">
- <position x="225" y="460"/>
- <connectionPointOut>
- <relPosition x="180" y="15"/>
- </connectionPointOut>
- <expression>',active=True))'</expression>
- </inVariable>
- <inVariable localId="10" height="30" width="70">
- <position x="696" y="203"/>
- <connectionPointOut>
- <relPosition x="70" y="15"/>
- </connectionPointOut>
- <expression>BOOL#1</expression>
- </inVariable>
- <inVariable localId="11" height="35" width="85">
- <position x="85" y="130"/>
- <connectionPointOut>
- <relPosition x="85" y="15"/>
- </connectionPointOut>
- <expression>back_id</expression>
- </inVariable>
- <inVariable localId="12" height="35" width="85">
- <position x="120" y="260"/>
- <connectionPointOut>
- <relPosition x="85" y="15"/>
- </connectionPointOut>
- <expression>sele_id</expression>
- </inVariable>
- <inVariable localId="13" height="35" width="100">
- <position x="62" y="395"/>
- <connectionPointOut>
- <relPosition x="100" y="15"/>
- </connectionPointOut>
- <expression>set_state</expression>
- </inVariable>
- <block localId="25" width="145" height="45" typeName="STRING_TO_INT">
- <position x="1014" y="248"/>
- <inputVariables>
- <variable formalParameter="IN">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="1" formalParameter="RESULT">
- <position x="1014" y="278"/>
- <position x="952" y="278"/>
+ </continuation>
+ <block localId="31" width="75" height="105" typeName="AND">
+ <position x="635" y="571"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="41"/>
+ <connection refLocalId="6">
+ <position x="635" y="612"/>
+ <position x="552" y="612"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="83"/>
+ <connection refLocalId="13">
+ <position x="635" y="654"/>
+ <position x="552" y="654"/>
</connection>
</connectionPointIn>
</variable>
@@ -757,53 +746,286 @@
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
- <relPosition x="145" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="26" width="125" height="45" typeName="INT_TO_BOOL">
- <position x="1209" y="248"/>
- <inputVariables>
- <variable formalParameter="IN">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="25" formalParameter="OUT">
- <position x="1209" y="278"/>
- <position x="1159" y="278"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="OUT">
- <connectionPointOut>
- <relPosition x="125" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <outVariable localId="27" height="35" width="145">
- <position x="1364" y="263"/>
+ <relPosition x="75" y="41"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="32" height="30" width="90">
+ <position x="91" y="912"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ <expression>state_in</expression>
+ </inVariable>
+ <outVariable localId="33" height="30" width="100">
+ <position x="1334" y="1184"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
<connection refLocalId="26" formalParameter="OUT">
- <position x="1364" y="278"/>
- <position x="1334" y="278"/>
+ <position x="1334" y="1199"/>
+ <position x="1286" y="1199"/>
</connection>
</connectionPointIn>
- <expression>current_state</expression>
+ <expression>state_out</expression>
</outVariable>
- <block localId="28" width="140" height="40" typeName="GetBoolString" instanceName="GetButtonState">
- <position x="229" y="380"/>
+ <block localId="7" width="150" height="319" typeName="CONCAT">
+ <position x="493" y="701"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="49"/>
+ <connection refLocalId="14">
+ <position x="493" y="750"/>
+ <position x="379" y="750"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="108"/>
+ <connection refLocalId="8">
+ <position x="493" y="809"/>
+ <position x="435" y="809"/>
+ <position x="435" y="803"/>
+ <position x="379" y="803"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN3">
+ <connectionPointIn>
+ <relPosition x="0" y="167"/>
+ <connection refLocalId="15">
+ <position x="493" y="868"/>
+ <position x="435" y="868"/>
+ <position x="435" y="855"/>
+ <position x="379" y="855"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN4">
+ <connectionPointIn>
+ <relPosition x="0" y="226"/>
+ <connection refLocalId="28" formalParameter="CODE">
+ <position x="493" y="927"/>
+ <position x="379" y="927"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN5">
+ <connectionPointIn>
+ <relPosition x="0" y="285"/>
+ <connection refLocalId="16">
+ <position x="493" y="986"/>
+ <position x="377" y="986"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="150" y="49"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="8" height="30" width="53">
+ <position x="326" y="788"/>
+ <connectionPointOut>
+ <relPosition x="53" y="15"/>
+ </connectionPointOut>
+ <expression>ID</expression>
+ </inVariable>
+ <inVariable localId="14" height="30" width="120">
+ <position x="259" y="735"/>
+ <connectionPointOut>
+ <relPosition x="120" y="15"/>
+ </connectionPointOut>
+ <expression>'setAttr('</expression>
+ </inVariable>
+ <inVariable localId="15" height="30" width="122">
+ <position x="257" y="840"/>
+ <connectionPointOut>
+ <relPosition x="122" y="15"/>
+ </connectionPointOut>
+ <expression>',"state",'</expression>
+ </inVariable>
+ <inVariable localId="16" height="30" width="41">
+ <position x="336" y="971"/>
+ <connectionPointOut>
+ <relPosition x="41" y="15"/>
+ </connectionPointOut>
+ <expression>')'</expression>
+ </inVariable>
+ <block localId="17" width="125" height="140" typeName="python_poll" instanceName="getstate_Command">
+ <position x="801" y="1089"/>
+ <inputVariables>
+ <variable formalParameter="TRIG">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="18">
+ <position x="801" y="1139"/>
+ <position x="763" y="1139"/>
+ <position x="763" y="1099"/>
+ <position x="720" y="1099"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="CODE">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="22" formalParameter="OUT">
+ <position x="801" y="1199"/>
+ <position x="643" y="1199"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="ACK">
+ <connectionPointOut>
+ <relPosition x="125" y="50"/>
+ </connectionPointOut>
+ </variable>
+ <variable formalParameter="RESULT">
+ <connectionPointOut>
+ <relPosition x="125" y="110"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="25" width="145" height="45" typeName="STRING_TO_INT">
+ <position x="966" y="1169"/>
+ <inputVariables>
+ <variable formalParameter="IN">
+ <connectionPointIn>
+ <relPosition x="0" y="30"/>
+ <connection refLocalId="17" formalParameter="RESULT">
+ <position x="966" y="1199"/>
+ <position x="926" y="1199"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="145" y="30"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="26" width="125" height="45" typeName="INT_TO_BOOL">
+ <position x="1161" y="1169"/>
+ <inputVariables>
+ <variable formalParameter="IN">
+ <connectionPointIn>
+ <relPosition x="0" y="30"/>
+ <connection refLocalId="25" formalParameter="OUT">
+ <position x="1161" y="1199"/>
+ <position x="1111" y="1199"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="125" y="30"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <continuation name="CREATED" localId="18" height="30" width="110">
+ <position x="610" y="1084"/>
+ <connectionPointOut>
+ <relPosition x="110" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <inVariable localId="19" height="30" width="53">
+ <position x="383" y="1238"/>
+ <connectionPointOut>
+ <relPosition x="53" y="15"/>
+ </connectionPointOut>
+ <expression>ID</expression>
+ </inVariable>
+ <inVariable localId="20" height="30" width="150">
+ <position x="286" y="1184"/>
+ <connectionPointOut>
+ <relPosition x="150" y="15"/>
+ </connectionPointOut>
+ <expression>'int(getAttr('</expression>
+ </inVariable>
+ <inVariable localId="21" height="30" width="190">
+ <position x="246" y="1292"/>
+ <connectionPointOut>
+ <relPosition x="190" y="15"/>
+ </connectionPointOut>
+ <expression>',"state",False))'</expression>
+ </inVariable>
+ <block localId="22" width="150" height="183" typeName="CONCAT">
+ <position x="493" y="1152"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="47"/>
+ <connection refLocalId="20">
+ <position x="493" y="1199"/>
+ <position x="436" y="1199"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="101"/>
+ <connection refLocalId="19">
+ <position x="493" y="1253"/>
+ <position x="436" y="1253"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN3">
+ <connectionPointIn>
+ <relPosition x="0" y="155"/>
+ <connection refLocalId="21">
+ <position x="493" y="1307"/>
+ <position x="483" y="1307"/>
+ <position x="483" y="1307"/>
+ <position x="436" y="1307"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="150" y="47"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="23" height="30" width="130">
+ <position x="300" y="355"/>
+ <connectionPointOut>
+ <relPosition x="130" y="15"/>
+ </connectionPointOut>
+ <expression>'",toggle='</expression>
+ </inVariable>
+ <block localId="24" width="140" height="40" typeName="GetBoolString" instanceName="GetButtonToggle">
+ <position x="289" y="412"/>
<inputVariables>
<variable formalParameter="VALUE">
<connectionPointIn>
<relPosition x="0" y="30"/>
- <connection refLocalId="13">
- <position x="229" y="410"/>
- <position x="162" y="410"/>
+ <connection refLocalId="27">
+ <position x="289" y="442"/>
+ <position x="220" y="442"/>
</connection>
</connectionPointIn>
</variable>
@@ -817,11 +1039,25 @@
</variable>
</outputVariables>
</block>
+ <inVariable localId="27" height="30" width="90">
+ <position x="130" y="427"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ <expression>toggle</expression>
+ </inVariable>
</FBD>
</body>
</pou>
- <pou name="Button_led" pouType="functionBlock">
+ <pou name="Led" pouType="functionBlock">
<interface>
+ <localVars>
+ <variable name="ID">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ </localVars>
<inputVars>
<variable name="back_id">
<type>
@@ -833,21 +1069,24 @@
<string/>
</type>
</variable>
- </inputVars>
- <inputVars>
- <variable name="state">
+ <variable name="state_in">
<type>
<BOOL/>
</type>
</variable>
</inputVars>
<localVars>
- <variable name="SVGUI_Command_LED">
+ <variable name="init_Command">
+ <type>
+ <derived name="python_eval"/>
+ </type>
+ </variable>
+ <variable name="setstate_Command">
<type>
<derived name="python_poll"/>
</type>
</variable>
- <variable name="GetLEDState">
+ <variable name="GetLedState">
<type>
<derived name="GetBoolString"/>
</type>
@@ -856,200 +1095,328 @@
</interface>
<body>
<FBD>
- <inVariable localId="1" height="30" width="244">
- <position x="51" y="110"/>
- <connectionPointOut>
- <relPosition x="244" y="15"/>
- </connectionPointOut>
- <expression>'SVGUI("SvguiButton","'</expression>
- </inVariable>
- <inVariable localId="2" height="30" width="140">
- <position x="50" y="255"/>
+ <block localId="1" width="125" height="140" typeName="python_eval" instanceName="init_Command">
+ <position x="810" y="30"/>
+ <inputVariables>
+ <variable formalParameter="TRIG">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="10">
+ <position x="810" y="80"/>
+ <position x="753" y="80"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="CODE">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="2" formalParameter="OUT">
+ <position x="810" y="140"/>
+ <position x="640" y="140"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="ACK">
+ <connectionPointOut>
+ <relPosition x="125" y="50"/>
+ </connectionPointOut>
+ </variable>
+ <variable formalParameter="RESULT">
+ <connectionPointOut>
+ <relPosition x="125" y="110"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="2" width="150" height="322" typeName="CONCAT">
+ <position x="490" y="90"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="3">
+ <position x="490" y="140"/>
+ <position x="415" y="140"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="11">
+ <position x="490" y="200"/>
+ <position x="415" y="200"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN3">
+ <connectionPointIn>
+ <relPosition x="0" y="170"/>
+ <connection refLocalId="5">
+ <position x="490" y="260"/>
+ <position x="415" y="260"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN4">
+ <connectionPointIn>
+ <relPosition x="0" y="230"/>
+ <connection refLocalId="12">
+ <position x="490" y="320"/>
+ <position x="414" y="320"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN5">
+ <connectionPointIn>
+ <relPosition x="0" y="290"/>
+ <connection refLocalId="9">
+ <position x="490" y="380"/>
+ <position x="414" y="380"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="150" y="50"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="3" height="30" width="400">
+ <position x="15" y="125"/>
+ <connectionPointOut>
+ <relPosition x="400" y="15"/>
+ </connectionPointOut>
+ <expression>'createSVGUIControl("button",back_id="'</expression>
+ </inVariable>
+ <block localId="4" width="125" height="140" typeName="python_poll" instanceName="setstate_Command">
+ <position x="782" y="536"/>
+ <inputVariables>
+ <variable formalParameter="TRIG">
+ <connectionPointIn>
+ <relPosition x="0" y="50"/>
+ <connection refLocalId="6">
+ <position x="782" y="586"/>
+ <position x="653" y="586"/>
+ <position x="653" y="552"/>
+ <position x="602" y="552"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="CODE">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="7" formalParameter="OUT">
+ <position x="782" y="646"/>
+ <position x="615" y="646"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="ACK">
+ <connectionPointOut>
+ <relPosition x="125" y="50"/>
+ </connectionPointOut>
+ </variable>
+ <variable formalParameter="RESULT">
+ <connectionPointOut>
+ <relPosition x="125" y="110"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="5" height="30" width="140">
+ <position x="275" y="245"/>
<connectionPointOut>
<relPosition x="140" y="15"/>
</connectionPointOut>
<expression>'",sele_id="'</expression>
</inVariable>
- <inVariable localId="3" height="35" width="85">
- <position x="50" y="185"/>
+ <continuation name="CREATED" localId="6" height="30" width="110">
+ <position x="492" y="537"/>
+ <connectionPointOut>
+ <relPosition x="110" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <block localId="7" width="150" height="319" typeName="CONCAT">
+ <position x="465" y="597"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="49"/>
+ <connection refLocalId="14">
+ <position x="465" y="646"/>
+ <position x="351" y="646"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="108"/>
+ <connection refLocalId="8">
+ <position x="465" y="705"/>
+ <position x="407" y="705"/>
+ <position x="407" y="699"/>
+ <position x="351" y="699"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN3">
+ <connectionPointIn>
+ <relPosition x="0" y="167"/>
+ <connection refLocalId="15">
+ <position x="465" y="764"/>
+ <position x="407" y="764"/>
+ <position x="407" y="751"/>
+ <position x="351" y="751"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN4">
+ <connectionPointIn>
+ <relPosition x="0" y="226"/>
+ <connection refLocalId="28" formalParameter="CODE">
+ <position x="465" y="823"/>
+ <position x="351" y="823"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN5">
+ <connectionPointIn>
+ <relPosition x="0" y="285"/>
+ <connection refLocalId="16">
+ <position x="465" y="882"/>
+ <position x="407" y="882"/>
+ <position x="407" y="883"/>
+ <position x="351" y="883"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="150" y="49"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="8" height="30" width="53">
+ <position x="298" y="684"/>
+ <connectionPointOut>
+ <relPosition x="53" y="15"/>
+ </connectionPointOut>
+ <expression>ID</expression>
+ </inVariable>
+ <inVariable localId="9" height="30" width="300">
+ <position x="124" y="365"/>
+ <connectionPointOut>
+ <relPosition x="300" y="15"/>
+ </connectionPointOut>
+ <expression>'",toggle=True,active=False)'</expression>
+ </inVariable>
+ <inVariable localId="10" height="30" width="70">
+ <position x="683" y="65"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
+ </inVariable>
+ <inVariable localId="11" height="35" width="85">
+ <position x="330" y="185"/>
<connectionPointOut>
<relPosition x="85" y="15"/>
</connectionPointOut>
<expression>back_id</expression>
</inVariable>
- <inVariable localId="4" height="35" width="85">
- <position x="50" y="325"/>
+ <inVariable localId="12" height="35" width="85">
+ <position x="329" y="305"/>
<connectionPointOut>
<relPosition x="85" y="15"/>
</connectionPointOut>
<expression>sele_id</expression>
</inVariable>
- <inVariable localId="5" height="30" width="165">
- <position x="50" y="545"/>
- <connectionPointOut>
- <relPosition x="165" y="15"/>
- </connectionPointOut>
- <expression>',toggle=True)'</expression>
- </inVariable>
- <inVariable localId="6" height="30" width="120">
- <position x="50" y="400"/>
+ <inVariable localId="14" height="30" width="120">
+ <position x="231" y="631"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
- <expression>'", state='</expression>
- </inVariable>
- <inVariable localId="9" height="35" width="65">
- <position x="52" y="470"/>
- <connectionPointOut>
- <relPosition x="65" y="15"/>
- </connectionPointOut>
- <expression>state</expression>
- </inVariable>
- <block localId="10" width="80" height="530" typeName="CONCAT">
- <position x="503" y="70"/>
- <inputVariables>
- <variable formalParameter="IN1">
- <connectionPointIn>
- <relPosition x="0" y="55"/>
- <connection refLocalId="1">
- <position x="503" y="125"/>
- <position x="295" y="125"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN2">
- <connectionPointIn>
- <relPosition x="0" y="130"/>
- <connection refLocalId="3">
- <position x="503" y="200"/>
- <position x="135" y="200"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN3">
- <connectionPointIn>
- <relPosition x="0" y="200"/>
- <connection refLocalId="2">
- <position x="503" y="270"/>
- <position x="190" y="270"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN4">
- <connectionPointIn>
- <relPosition x="0" y="270"/>
- <connection refLocalId="4">
- <position x="503" y="340"/>
- <position x="135" y="340"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN5">
- <connectionPointIn>
- <relPosition x="0" y="345"/>
- <connection refLocalId="6">
- <position x="503" y="415"/>
- <position x="170" y="415"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN6">
- <connectionPointIn>
- <relPosition x="0" y="415"/>
- <connection refLocalId="28" formalParameter="CODE">
- <position x="503" y="485"/>
- <position x="368" y="485"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="IN7">
- <connectionPointIn>
- <relPosition x="0" y="490"/>
- <connection refLocalId="5">
- <position x="503" y="560"/>
- <position x="215" y="560"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="OUT">
- <connectionPointOut>
- <relPosition x="80" y="55"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="11" width="125" height="65" typeName="python_poll" instanceName="SVGUI_Command_LED">
- <position x="753" y="135"/>
- <inputVariables>
- <variable formalParameter="TRIG">
+ <expression>'setAttr('</expression>
+ </inVariable>
+ <inVariable localId="15" height="30" width="122">
+ <position x="229" y="736"/>
+ <connectionPointOut>
+ <relPosition x="122" y="15"/>
+ </connectionPointOut>
+ <expression>',"state",'</expression>
+ </inVariable>
+ <inVariable localId="16" height="30" width="41">
+ <position x="310" y="868"/>
+ <connectionPointOut>
+ <relPosition x="41" y="15"/>
+ </connectionPointOut>
+ <expression>')'</expression>
+ </inVariable>
+ <block localId="28" width="140" height="40" typeName="GetBoolString" instanceName="GetLedState">
+ <position x="211" y="793"/>
+ <inputVariables>
+ <variable formalParameter="VALUE">
<connectionPointIn>
<relPosition x="0" y="30"/>
- <connection refLocalId="12">
- <position x="753" y="165"/>
- <position x="715" y="165"/>
- <position x="715" y="90"/>
- <position x="698" y="90"/>
- </connection>
- </connectionPointIn>
- </variable>
+ <connection refLocalId="32">
+ <position x="211" y="823"/>
+ <position x="153" y="823"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
<variable formalParameter="CODE">
- <connectionPointIn>
- <relPosition x="0" y="55"/>
- <connection refLocalId="10" formalParameter="OUT">
- <position x="753" y="190"/>
- <position x="658" y="190"/>
- <position x="658" y="125"/>
- <position x="583" y="125"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="ACK">
- <connectionPointOut>
- <relPosition x="125" y="30"/>
- </connectionPointOut>
- </variable>
- <variable formalParameter="RESULT">
- <connectionPointOut>
- <relPosition x="125" y="55"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <inVariable localId="12" height="30" width="70">
- <position x="628" y="75"/>
- <connectionPointOut>
- <relPosition x="70" y="15"/>
- </connectionPointOut>
- <expression>BOOL#1</expression>
- </inVariable>
- <block localId="28" width="140" height="40" typeName="GetBoolString" instanceName="GetLEDState">
- <position x="228" y="455"/>
- <inputVariables>
- <variable formalParameter="VALUE">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="9">
- <position x="228" y="485"/>
- <position x="117" y="485"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="CODE">
<connectionPointOut>
<relPosition x="140" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
+ <outVariable localId="29" height="30" width="53">
+ <position x="987" y="125"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="1" formalParameter="RESULT">
+ <position x="987" y="140"/>
+ <position x="935" y="140"/>
+ </connection>
+ </connectionPointIn>
+ <expression>ID</expression>
+ </outVariable>
+ <connector name="CREATED" localId="30" height="30" width="110">
+ <position x="986" y="65"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="1" formalParameter="ACK">
+ <position x="986" y="80"/>
+ <position x="935" y="80"/>
+ </connection>
+ </connectionPointIn>
+ </connector>
+ <inVariable localId="32" height="30" width="90">
+ <position x="63" y="808"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ <expression>state_in</expression>
+ </inVariable>
</FBD>
</body>
</pou>
--- a/plugins/python/modules/svgui/svgui_server.py Thu Aug 13 11:48:55 2009 +0200
+++ b/plugins/python/modules/svgui/svgui_server.py Fri Aug 14 16:26:19 2009 +0200
@@ -8,77 +8,123 @@
svgfile = '%(svgfile)s'
-svguiWidgets={}
+svguiWidgets = {}
+
+currentId = 0
+def getNewId():
+ global currentId
+ currentId += 1
+ return currentId
class SvguiWidget:
- def __init__(self, classname, back_id, **kwargs):
+ def __init__(self, classname, id, **kwargs):
self.classname = classname
- self.back_id = back_id
+ self.id = id
self.attrs = kwargs.copy()
- self.lastattrs = kwargs.copy()
+ self.inputs = {}
+ self.outputs = {}
self.inhibit = False
self.changed = False
- def setattr(self, attrname, value):
- self.attrs[attrname] = value
+ def setinput(self, attrname, value):
+ self.inputs[attrname] = value
- def getattr(self, attrname):
- return self.args.get(attrname, None)
+ def getinput(self, attrname, default=None):
+ if not self.inputs.has_key(attrname):
+ self.inputs[attrname] = default
+ return self.inputs[attrname]
- def update(self, **kwargs):
+ def setoutput(self, attrname, value):
+ if self.outputs.get(attrname) != value:
+ self.outputs[attrname] = value
+ self.changed = True
+ self.RefreshInterface()
+
+ def updateoutputs(self, **kwargs):
for attrname, value in kwargs.iteritems():
- if self.lastattrs.get(attrname, None) != value:
+ if self.outputs.get(attrname) != value:
+ self.outputs[attrname] = value
self.changed = True
- self.attrs[attrname] = value
- self.lastattrs[attrname] = value
+ self.RefreshInterface()
+
+ def RefreshInterface(self):
interface = website.getHMI()
- if interface is not None and self.changed and not self.inhibit:
+ if isinstance(interface, SVGUI_HMI) and self.changed and not self.inhibit:
self.changed = False
- interface.sendData(self)
-
- return self.attrs["state"]
+ d = interface.sendData(self)
+ if d is not None:
+ self.inhibit = True
+ d.addCallback(self.InterfaceRefreshed)
+
+ def InterfaceRefreshed(self, result):
+ self.inhibit = False
+ if self.changed:
+ self.RefreshInterface()
-def convert_to_builtin_type(obj):
+def get_object_init_state(obj):
# Convert objects to a dictionary of their representation
- d = { '__class__':obj.classname,
- 'back_id':obj.back_id,
- 'kwargs':json.dumps(obj.attrs),
+ attrs = obj.attrs.copy()
+ attrs.update(obj.inputs)
+ d = { '__class__': obj.classname,
+ 'id': obj.id,
+ 'kwargs': json.dumps(attrs),
}
return d
-def dataToSend():
- gadgets = []
- for gadget in svguiWidgets.values():
- gadgets.append(unicode(json.dumps(gadget, default=convert_to_builtin_type, indent=2), 'ascii'))
- return gadgets
+def get_object_current_state(obj):
+ # Convert objects to a dictionary of their representation
+ d = { '__class__': obj.classname,
+ 'id': obj.id,
+ 'kwargs': json.dumps(obj.outputs),
+ }
+ return d
-
-class SVGUI_HMI(athena.LiveElement):
+class SVGUI_HMI(website.PLCHMI):
jsClass = u"LiveSVGPage.LiveSVGWidget"
docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
tags.xml(loaders.xmlfile(os.path.join(WorkingDir, svgfile))),
])
+
+ def HMIinitialisation(self):
+ gadgets = []
+ for gadget in svguiWidgets.values():
+ gadgets.append(unicode(json.dumps(gadget, default=get_object_init_state, indent=2), 'ascii'))
+ d = self.callRemote('init', gadgets)
+ d.addCallback(self.HMIinitialised)
+
+ def sendData(self,data):
+ if self.initialised:
+ return self.callRemote('receiveData',unicode(json.dumps(data, default=get_object_current_state, indent=2), 'ascii'))
+ return None
+
+ def setattr(self, id, attrname, value):
+ svguiWidgets[id].setinput(attrname, value)
- def sendData(self,data):
- objDefer = self.callRemote('receiveData',unicode(json.dumps(data, default=convert_to_builtin_type, indent=2), 'ascii'))
+def createSVGUIControl(*args, **kwargs):
+ id = getNewId()
+ gad = SvguiWidget(args[0], id, **kwargs)
+ svguiWidgets[id] = gad
+ gadget = [unicode(json.dumps(gad, default=get_object_init_state, indent=2), 'ascii')]
+ interface = website.getHMI()
+ if isinstance(interface, SVGUI_HMI) and interface.initialised:
+ interface.callRemote('init', gadget)
+ return id
- def initClient(self):
- self.callRemote('init', dataToSend())
-
- def setattr(self, id, attrname, value):
- svguiWidgets[id].setattr(attrname, value)
+def setAttr(id, attrname, value):
+ gad = svguiWidgets.get(id, None)
+ if gad is not None:
+ gad.setoutput(attrname, value)
-def SVGUI(*args, **kwargs):
- classname, back_id = args
- gad = svguiWidgets.get(back_id, None)
- if gad is None:
- gad = SvguiWidget(classname, back_id, **kwargs)
- svguiWidgets[back_id] = gad
- gadget = [unicode(json.dumps(gad, default=convert_to_builtin_type, indent=2), 'ascii')]
- interface = website.getHMI()
- if interface is not None:
- interface.callRemote('init', gadget)
+def updateAttr(id, **kwargs):
+ gad = svguiWidgets.get(id, None)
+ if gad is not None:
+ gad.updateoutput(**kwargs)
- return gad.update(**kwargs)
+def getAttr(id, attrname, default=None):
+ gad = svguiWidgets.get(id, None)
+ if gad is not None:
+ return gad.getinput(attrname, default)
+ return default
+
--- a/plugins/python/modules/svgui/svguilib.py Thu Aug 13 11:48:55 2009 +0200
+++ b/plugins/python/modules/svgui/svguilib.py Fri Aug 14 16:26:19 2009 +0200
@@ -1,13 +1,14 @@
class button:
- def __init__(self, parent, back_id, sele_id, toggle, state, active):
+ def __init__(self, parent, id, args):
self.parent = parent
- self.back_elt = getSVGElementById(back_id)
- self.sele_elt = getSVGElementById(sele_id)
- self.toggle = toggle
- self.state = state
- self.active = active
+ self.id = id
+ self.back_elt = getSVGElementById(args.back_id)
+ self.sele_elt = getSVGElementById(args.sele_id)
+ self.toggle = args.toggle
+ self.active = args.active
+ self.state = False
self.dragging = False
if toggle:
self.up = not state
@@ -40,9 +41,11 @@
self.sele_elt.setAttribute("visibility", "visible")
self.back_elt.setAttribute("visibility", "hidden")
- def updateState(self, value):
- self.up = not value
- self.updateElements()
+ def updateValues(self, values):
+ if values.state != self.state:
+ self.state = values.state
+ self.up = not self.state
+ self.updateElements()
def handleEvent(self, evt):
# Quand le bouton de la souris est presse
@@ -57,7 +60,7 @@
else:
self.up = False
self.state = True
- updateAttr(self.back_elt.id, 'state', self.state)
+ updateAttr(self.id, 'state', self.state)
self.updateElements()
if isCurrentObject(self) and self.dragging:
@@ -76,31 +79,31 @@
evt.stopPropagation()
if self.toggle and self.up == self.state:
self.state = not self.state
- updateAttr(self.back_elt.id, 'state', self.state)
+ updateAttr(self.id, 'state', self.state)
elif not self.toggle:
self.up = True
self.state = False
- updateAttr(self.back_elt.id, 'state', self.state)
+ updateAttr(self.id, 'state', self.state)
self.updateElements()
self.dragging = False
class textControl:
- def __init__(self, parent, back_id, state):
+ def __init__(self, parent, id, args):
self.parent = parent
- self.back_elt = getSVGElementById(back_id)
- self.state = state
- self.setValue(self.state)
+ self.id = id
+ self.back_elt = getSVGElementById(args.back_id)
+ self.value = ""
+ self.updateElements()
+
+ def updateValues(self, values):
+ if values.text != self.value:
+ self.value = values.text
+ self.updateElements()
+
+ def updateElements(self):
+ self.back_elt.firstChild.firstChild.textContent = self.value
def handleEvent(self, evt):
pass
-
- def getValue(self):
- return self.back_elt.firstChild.firstChild.textContent
-
- def setValue(self, value):
- self.back_elt.firstChild.firstChild.textContent = value
-
- def updateState(self, value):
- self.setValue(value)
\ No newline at end of file
--- a/tests/linux/test_svgui/plc.xml Thu Aug 13 11:48:55 2009 +0200
+++ b/tests/linux/test_svgui/plc.xml Fri Aug 14 16:26:19 2009 +0200
@@ -8,7 +8,7 @@
productVersion="0.0"
creationDateTime="2008-12-14T16:21:19"/>
<contentHeader name="Beremiz Python Support Tests"
- modificationDateTime="2009-08-10T16:18:56">
+ modificationDateTime="2009-08-14T16:13:40">
<coordinateInfo>
<pageSize x="1024" y="1024"/>
<fbd>
@@ -73,100 +73,96 @@
<BOOL/>
</type>
</variable>
- <variable name="Texte_compteur">
+ <variable name="Btn1">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn2">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn3">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn4">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn5">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn6">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn7">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Btn8">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Start_Stop">
+ <type>
+ <derived name="Button"/>
+ </type>
+ </variable>
+ <variable name="Compteur">
<type>
<derived name="TextCtrl"/>
</type>
</variable>
- <variable name="Start_Stop">
- <type>
- <derived name="Button_toggle"/>
- </type>
- </variable>
<variable name="Temoin">
<type>
- <derived name="Button_led"/>
- </type>
- </variable>
- <variable name="Btn1">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn2">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn3">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn4">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn5">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn6">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn7">
- <type>
- <derived name="Button"/>
- </type>
- </variable>
- <variable name="Btn8">
- <type>
- <derived name="Button"/>
+ <derived name="Led"/>
</type>
</variable>
</localVars>
</interface>
<body>
<FBD>
- <block localId="32" width="80" height="80" typeName="ADD">
- <position x="150" y="400"/>
+ <block localId="32" width="80" height="110" typeName="ADD">
+ <position x="665" y="420"/>
<inputVariables>
<variable formalParameter="EN">
<connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="49" formalParameter="current_state">
- <position x="150" y="430"/>
- <position x="140" y="430"/>
- <position x="140" y="272"/>
- <position x="485" y="272"/>
- <position x="485" y="150"/>
- <position x="425" y="150"/>
+ <relPosition x="0" y="35"/>
+ <connection refLocalId="5">
+ <position x="665" y="455"/>
+ <position x="610" y="455"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN1">
<connectionPointIn>
- <relPosition x="0" y="50"/>
- <connection refLocalId="39">
- <position x="150" y="450"/>
- <position x="105" y="450"/>
+ <relPosition x="0" y="65"/>
+ <connection refLocalId="100" formalParameter="OUT">
+ <position x="665" y="485"/>
+ <position x="490" y="485"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="IN2">
<connectionPointIn>
- <relPosition x="0" y="70"/>
+ <relPosition x="0" y="95"/>
<connection refLocalId="33">
- <position x="150" y="470"/>
- <position x="140" y="470"/>
- <position x="140" y="500"/>
- <position x="345" y="500"/>
- <position x="345" y="530"/>
- <position x="335" y="530"/>
+ <position x="665" y="515"/>
+ <position x="645" y="515"/>
+ <position x="645" y="555"/>
+ <position x="870" y="555"/>
+ <position x="870" y="485"/>
+ <position x="855" y="485"/>
</connection>
</connectionPointIn>
</variable>
@@ -175,25 +171,23 @@
<outputVariables>
<variable formalParameter="ENO">
<connectionPointOut>
- <relPosition x="80" y="30"/>
+ <relPosition x="80" y="35"/>
</connectionPointOut>
</variable>
<variable formalParameter="OUT">
<connectionPointOut>
- <relPosition x="80" y="50"/>
+ <relPosition x="80" y="65"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<inOutVariable localId="33" height="35" width="85">
- <position x="250" y="515"/>
+ <position x="770" y="470"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
<connection refLocalId="32" formalParameter="OUT">
- <position x="250" y="530"/>
- <position x="240" y="530"/>
- <position x="240" y="450"/>
- <position x="230" y="450"/>
+ <position x="770" y="485"/>
+ <position x="745" y="485"/>
</connection>
</connectionPointIn>
<connectionPointOut>
@@ -201,158 +195,49 @@
</connectionPointOut>
<expression>counter</expression>
</inOutVariable>
- <inVariable localId="39" height="30" width="60">
- <position x="45" y="435"/>
- <connectionPointOut>
- <relPosition x="60" y="15"/>
- </connectionPointOut>
- <expression>INT#1</expression>
+ <inVariable localId="39" height="35" width="70">
+ <position x="90" y="470"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
</inVariable>
<inVariable localId="41" height="30" width="120">
- <position x="20" y="120"/>
+ <position x="45" y="180"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
<expression>'stop_back'</expression>
</inVariable>
<inVariable localId="42" height="30" width="120">
- <position x="20" y="170"/>
+ <position x="45" y="225"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
<expression>'stop_sele'</expression>
</inVariable>
<inVariable localId="46" height="30" width="180">
- <position x="385" y="340"/>
+ <position x="675" y="265"/>
<connectionPointOut>
<relPosition x="180" y="15"/>
</connectionPointOut>
<expression>'text_compteur'</expression>
</inVariable>
- <block localId="47" width="130" height="65" typeName="TextCtrl" instanceName="Texte_compteur">
- <position x="715" y="395"/>
- <inputVariables>
- <variable formalParameter="back_id">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="46">
- <position x="715" y="425"/>
- <position x="630" y="425"/>
- <position x="630" y="355"/>
- <position x="565" y="355"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="state">
- <connectionPointIn>
- <relPosition x="0" y="55"/>
- <connection refLocalId="83" formalParameter="OUT">
- <position x="715" y="450"/>
- <position x="540" y="450"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="code">
- <connectionPointOut>
- <relPosition x="130" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="49" width="240" height="125" typeName="Button_toggle" instanceName="Start_Stop">
- <position x="185" y="115"/>
- <inputVariables>
- <variable formalParameter="back_id">
- <connectionPointIn>
- <relPosition x="0" y="35"/>
- <connection refLocalId="41">
- <position x="185" y="150"/>
- <position x="160" y="150"/>
- <position x="160" y="135"/>
- <position x="140" y="135"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="sele_id">
- <connectionPointIn>
- <relPosition x="0" y="70"/>
- <connection refLocalId="42">
- <position x="185" y="185"/>
- <position x="140" y="185"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="set_state">
- <connectionPointIn>
- <relPosition x="0" y="105"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="35"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="50" width="115" height="135" typeName="Button_led" instanceName="Temoin">
- <position x="660" y="20"/>
- <inputVariables>
- <variable formalParameter="back_id">
- <connectionPointIn>
- <relPosition x="0" y="40"/>
- <connection refLocalId="51">
- <position x="660" y="60"/>
- <position x="632" y="60"/>
- <position x="632" y="55"/>
- <position x="615" y="55"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="sele_id">
- <connectionPointIn>
- <relPosition x="0" y="75"/>
- <connection refLocalId="52">
- <position x="660" y="95"/>
- <position x="625" y="95"/>
- </connection>
- </connectionPointIn>
- </variable>
- <variable formalParameter="state">
- <connectionPointIn>
- <relPosition x="0" y="115"/>
- <connection refLocalId="49" formalParameter="current_state">
- <position x="660" y="135"/>
- <position x="545" y="135"/>
- <position x="545" y="150"/>
- <position x="425" y="150"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables/>
- </block>
<inVariable localId="51" height="30" width="110">
- <position x="505" y="40"/>
+ <position x="725" y="80"/>
<connectionPointOut>
<relPosition x="110" y="15"/>
</connectionPointOut>
<expression>'led_stop'</expression>
</inVariable>
<inVariable localId="52" height="30" width="120">
- <position x="505" y="80"/>
+ <position x="715" y="115"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
<expression>'led_start'</expression>
</inVariable>
- <block localId="53" width="235" height="135" typeName="Button" instanceName="Btn1">
+ <block localId="53" width="235" height="200" typeName="Button" instanceName="Btn1">
<position x="180" y="620"/>
<inputVariables>
<variable formalParameter="back_id">
@@ -373,15 +258,25 @@
</connection>
</connectionPointIn>
</variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ </connectionPointIn>
+ </variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="115"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
+ <relPosition x="0" y="145"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="180"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
<connectionPointOut>
<relPosition x="235" y="40"/>
</connectionPointOut>
@@ -402,408 +297,444 @@
</connectionPointOut>
<expression>'btn1_sele'</expression>
</inVariable>
- <block localId="56" width="240" height="85" typeName="Button" instanceName="Btn2">
- <position x="180" y="785"/>
+ <block localId="56" width="240" height="210" typeName="Button" instanceName="Btn2">
+ <position x="175" y="855"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="63">
- <position x="180" y="815"/>
- <position x="130" y="815"/>
+ <position x="175" y="895"/>
+ <position x="125" y="895"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="75"/>
<connection refLocalId="67">
- <position x="180" y="835"/>
- <position x="155" y="835"/>
- <position x="155" y="855"/>
- <position x="130" y="855"/>
- </connection>
+ <position x="175" y="930"/>
+ <position x="125" y="930"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="115"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="57" width="240" height="85" typeName="Button" instanceName="Btn3">
- <position x="180" y="895"/>
+ <relPosition x="0" y="155"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="190"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="57" width="240" height="225" typeName="Button" instanceName="Btn3">
+ <position x="175" y="1100"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="66">
- <position x="180" y="925"/>
- <position x="140" y="925"/>
+ <position x="175" y="1140"/>
+ <position x="135" y="1140"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="80"/>
<connection refLocalId="65">
- <position x="180" y="945"/>
- <position x="157" y="945"/>
- <position x="157" y="965"/>
- <position x="140" y="965"/>
- </connection>
+ <position x="175" y="1180"/>
+ <position x="135" y="1180"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="120"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="58" width="240" height="85" typeName="Button" instanceName="Btn4">
- <position x="180" y="1005"/>
+ <relPosition x="0" y="165"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="205"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="58" width="240" height="225" typeName="Button" instanceName="Btn4">
+ <position x="175" y="1355"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="69">
- <position x="180" y="1035"/>
- <position x="140" y="1035"/>
+ <position x="175" y="1395"/>
+ <position x="135" y="1395"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="80"/>
<connection refLocalId="70">
- <position x="180" y="1055"/>
- <position x="160" y="1055"/>
- <position x="160" y="1075"/>
- <position x="140" y="1075"/>
- </connection>
+ <position x="175" y="1435"/>
+ <position x="135" y="1435"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="120"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="59" width="240" height="85" typeName="Button" instanceName="Btn5">
- <position x="180" y="1115"/>
+ <relPosition x="0" y="165"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="205"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="59" width="240" height="215" typeName="Button" instanceName="Btn5">
+ <position x="900" y="615"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="72">
- <position x="180" y="1145"/>
- <position x="140" y="1145"/>
+ <position x="900" y="655"/>
+ <position x="860" y="655"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="80"/>
<connection refLocalId="73">
- <position x="180" y="1165"/>
- <position x="160" y="1165"/>
- <position x="160" y="1185"/>
- <position x="140" y="1185"/>
- </connection>
+ <position x="900" y="695"/>
+ <position x="860" y="695"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="115"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="60" width="240" height="85" typeName="Button" instanceName="Btn6">
- <position x="180" y="1230"/>
+ <relPosition x="0" y="155"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="195"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="60" width="240" height="230" typeName="Button" instanceName="Btn6">
+ <position x="900" y="855"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="75">
- <position x="180" y="1260"/>
- <position x="160" y="1260"/>
- <position x="160" y="1255"/>
- <position x="140" y="1255"/>
+ <position x="900" y="895"/>
+ <position x="860" y="895"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="85"/>
<connection refLocalId="76">
- <position x="180" y="1280"/>
- <position x="160" y="1280"/>
- <position x="160" y="1300"/>
- <position x="140" y="1300"/>
- </connection>
+ <position x="900" y="940"/>
+ <position x="860" y="940"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="125"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="61" width="240" height="85" typeName="Button" instanceName="Btn7">
- <position x="180" y="1345"/>
+ <relPosition x="0" y="165"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="210"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="61" width="240" height="230" typeName="Button" instanceName="Btn7">
+ <position x="900" y="1105"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="78">
- <position x="180" y="1375"/>
- <position x="160" y="1375"/>
- <position x="160" y="1370"/>
- <position x="140" y="1370"/>
+ <position x="900" y="1145"/>
+ <position x="860" y="1145"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="85"/>
<connection refLocalId="79">
- <position x="180" y="1395"/>
- <position x="160" y="1395"/>
- <position x="160" y="1415"/>
- <position x="140" y="1415"/>
- </connection>
+ <position x="900" y="1190"/>
+ <position x="860" y="1190"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="125"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
- </connectionPointOut>
- </variable>
- </outputVariables>
- </block>
- <block localId="62" width="240" height="85" typeName="Button" instanceName="Btn8">
- <position x="180" y="1455"/>
+ <relPosition x="0" y="165"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="210"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <block localId="62" width="240" height="220" typeName="Button" instanceName="Btn8">
+ <position x="900" y="1355"/>
<inputVariables>
<variable formalParameter="back_id">
<connectionPointIn>
- <relPosition x="0" y="30"/>
+ <relPosition x="0" y="40"/>
<connection refLocalId="81">
- <position x="180" y="1485"/>
- <position x="140" y="1485"/>
+ <position x="900" y="1395"/>
+ <position x="860" y="1395"/>
</connection>
</connectionPointIn>
</variable>
<variable formalParameter="sele_id">
<connectionPointIn>
- <relPosition x="0" y="50"/>
+ <relPosition x="0" y="80"/>
<connection refLocalId="82">
- <position x="180" y="1505"/>
- <position x="160" y="1505"/>
- <position x="160" y="1525"/>
- <position x="140" y="1525"/>
- </connection>
+ <position x="900" y="1435"/>
+ <position x="860" y="1435"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="120"/>
</connectionPointIn>
</variable>
<variable formalParameter="set_state">
<connectionPointIn>
- <relPosition x="0" y="70"/>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="current_state">
- <connectionPointOut>
- <relPosition x="240" y="30"/>
+ <relPosition x="0" y="160"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="200"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="240" y="40"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<inVariable localId="63" height="30" width="120">
- <position x="10" y="800"/>
+ <position x="5" y="880"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
<expression>'btn2_back'</expression>
</inVariable>
<inVariable localId="65" height="35" width="125">
- <position x="15" y="950"/>
+ <position x="10" y="1165"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn3_sele'</expression>
</inVariable>
<inVariable localId="66" height="35" width="125">
- <position x="15" y="910"/>
+ <position x="10" y="1125"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn3_back'</expression>
</inVariable>
<inVariable localId="67" height="30" width="120">
- <position x="10" y="840"/>
+ <position x="5" y="915"/>
<connectionPointOut>
<relPosition x="120" y="15"/>
</connectionPointOut>
<expression>'btn2_sele'</expression>
</inVariable>
<inVariable localId="69" height="35" width="125">
- <position x="15" y="1020"/>
+ <position x="10" y="1380"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn4_back'</expression>
</inVariable>
<inVariable localId="70" height="35" width="125">
- <position x="15" y="1060"/>
+ <position x="10" y="1420"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn4_sele'</expression>
</inVariable>
<inVariable localId="72" height="35" width="125">
- <position x="15" y="1130"/>
+ <position x="735" y="640"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn5_back'</expression>
</inVariable>
<inVariable localId="73" height="35" width="125">
- <position x="15" y="1170"/>
+ <position x="735" y="680"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn5_sele'</expression>
</inVariable>
<inVariable localId="75" height="35" width="125">
- <position x="15" y="1240"/>
+ <position x="735" y="880"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn6_back'</expression>
</inVariable>
<inVariable localId="76" height="35" width="125">
- <position x="15" y="1285"/>
+ <position x="735" y="925"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn6_sele'</expression>
</inVariable>
<inVariable localId="78" height="35" width="125">
- <position x="15" y="1355"/>
+ <position x="735" y="1130"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn7_back'</expression>
</inVariable>
<inVariable localId="79" height="35" width="125">
- <position x="15" y="1400"/>
+ <position x="735" y="1175"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn7_sele'</expression>
</inVariable>
<inVariable localId="81" height="35" width="125">
- <position x="15" y="1470"/>
+ <position x="735" y="1380"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn8_back'</expression>
</inVariable>
<inVariable localId="82" height="35" width="125">
- <position x="15" y="1510"/>
+ <position x="735" y="1420"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>'btn8_sele'</expression>
</inVariable>
<block localId="83" width="145" height="60" typeName="INT_TO_STRING">
- <position x="395" y="400"/>
- <inputVariables>
- <variable formalParameter="EN">
- <connectionPointIn>
- <relPosition x="0" y="30"/>
- <connection refLocalId="32" formalParameter="ENO">
- <position x="395" y="430"/>
- <position x="230" y="430"/>
- </connection>
- </connectionPointIn>
- </variable>
+ <position x="600" y="320"/>
+ <inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
- <relPosition x="0" y="50"/>
- <connection refLocalId="33">
- <position x="395" y="450"/>
- <position x="365" y="450"/>
- <position x="365" y="530"/>
- <position x="335" y="530"/>
- </connection>
- </connectionPointIn>
- </variable>
- </inputVariables>
- <inOutVariables/>
- <outputVariables>
- <variable formalParameter="ENO">
- <connectionPointOut>
- <relPosition x="145" y="30"/>
- </connectionPointOut>
- </variable>
+ <relPosition x="0" y="40"/>
+ <connection refLocalId="4">
+ <position x="600" y="360"/>
+ <position x="555" y="360"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
- <relPosition x="145" y="50"/>
+ <relPosition x="145" y="40"/>
</connectionPointOut>
</variable>
</outputVariables>
@@ -812,7 +743,7 @@
<position x="505" y="645"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="53" formalParameter="current_state">
+ <connection refLocalId="53" formalParameter="state_out">
<position x="505" y="660"/>
<position x="415" y="660"/>
</connection>
@@ -820,82 +751,353 @@
<expression>DigitalBit0</expression>
</outVariable>
<outVariable localId="85" height="35" width="125">
- <position x="505" y="800"/>
+ <position x="500" y="880"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="56" formalParameter="current_state">
- <position x="505" y="815"/>
- <position x="420" y="815"/>
+ <connection refLocalId="56" formalParameter="state_out">
+ <position x="500" y="895"/>
+ <position x="415" y="895"/>
</connection>
</connectionPointIn>
<expression>DigitalBit1</expression>
</outVariable>
<outVariable localId="91" height="35" width="125">
- <position x="515" y="1470"/>
+ <position x="1230" y="1380"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="62" formalParameter="current_state">
- <position x="515" y="1485"/>
- <position x="420" y="1485"/>
+ <connection refLocalId="62" formalParameter="state_out">
+ <position x="1230" y="1395"/>
+ <position x="1140" y="1395"/>
</connection>
</connectionPointIn>
<expression>DigitalBit7</expression>
</outVariable>
<outVariable localId="90" height="35" width="125">
- <position x="515" y="1360"/>
+ <position x="1235" y="1130"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="61" formalParameter="current_state">
- <position x="515" y="1375"/>
- <position x="420" y="1375"/>
+ <connection refLocalId="61" formalParameter="state_out">
+ <position x="1235" y="1145"/>
+ <position x="1140" y="1145"/>
</connection>
</connectionPointIn>
<expression>DigitalBit6</expression>
</outVariable>
<outVariable localId="89" height="35" width="125">
- <position x="510" y="1245"/>
+ <position x="1230" y="880"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="60" formalParameter="current_state">
- <position x="510" y="1260"/>
- <position x="420" y="1260"/>
+ <connection refLocalId="60" formalParameter="state_out">
+ <position x="1230" y="895"/>
+ <position x="1140" y="895"/>
</connection>
</connectionPointIn>
<expression>DigitalBit5</expression>
</outVariable>
<outVariable localId="88" height="35" width="125">
- <position x="510" y="1130"/>
+ <position x="1230" y="640"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="59" formalParameter="current_state">
- <position x="510" y="1145"/>
- <position x="420" y="1145"/>
+ <connection refLocalId="59" formalParameter="state_out">
+ <position x="1230" y="655"/>
+ <position x="1140" y="655"/>
</connection>
</connectionPointIn>
<expression>DigitalBit4</expression>
</outVariable>
<outVariable localId="87" height="35" width="125">
- <position x="505" y="1020"/>
+ <position x="500" y="1380"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="58" formalParameter="current_state">
- <position x="505" y="1035"/>
- <position x="420" y="1035"/>
+ <connection refLocalId="58" formalParameter="state_out">
+ <position x="500" y="1395"/>
+ <position x="415" y="1395"/>
</connection>
</connectionPointIn>
<expression>DigitalBit3</expression>
</outVariable>
<outVariable localId="86" height="35" width="125">
- <position x="505" y="910"/>
+ <position x="500" y="1125"/>
<connectionPointIn>
<relPosition x="0" y="15"/>
- <connection refLocalId="57" formalParameter="current_state">
- <position x="505" y="925"/>
- <position x="420" y="925"/>
+ <connection refLocalId="57" formalParameter="state_out">
+ <position x="500" y="1140"/>
+ <position x="415" y="1140"/>
</connection>
</connectionPointIn>
<expression>DigitalBit2</expression>
</outVariable>
+ <block localId="92" width="200" height="230" typeName="Button" instanceName="Start_Stop">
+ <position x="225" y="155"/>
+ <inputVariables>
+ <variable formalParameter="back_id">
+ <connectionPointIn>
+ <relPosition x="0" y="40"/>
+ <connection refLocalId="41">
+ <position x="225" y="195"/>
+ <position x="165" y="195"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="sele_id">
+ <connectionPointIn>
+ <relPosition x="0" y="85"/>
+ <connection refLocalId="42">
+ <position x="225" y="240"/>
+ <position x="165" y="240"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="toggle">
+ <connectionPointIn>
+ <relPosition x="0" y="125"/>
+ <connection refLocalId="93">
+ <position x="225" y="280"/>
+ <position x="165" y="280"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="set_state">
+ <connectionPointIn>
+ <relPosition x="0" y="165"/>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="210"/>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="state_out">
+ <connectionPointOut>
+ <relPosition x="200" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <inVariable localId="93" height="30" width="70">
+ <position x="95" y="265"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
+ </inVariable>
+ <block localId="94" width="100" height="145" typeName="TextCtrl" instanceName="Compteur">
+ <position x="900" y="240"/>
+ <inputVariables>
+ <variable formalParameter="back_id">
+ <connectionPointIn>
+ <relPosition x="0" y="40"/>
+ <connection refLocalId="46">
+ <position x="900" y="280"/>
+ <position x="855" y="280"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="set_text">
+ <connectionPointIn>
+ <relPosition x="0" y="80"/>
+ <connection refLocalId="3">
+ <position x="900" y="320"/>
+ <position x="855" y="320"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="text">
+ <connectionPointIn>
+ <relPosition x="0" y="120"/>
+ <connection refLocalId="83" formalParameter="OUT">
+ <position x="900" y="360"/>
+ <position x="745" y="360"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables/>
+ </block>
+ <inVariable localId="1" height="30" width="70">
+ <position x="80" y="85"/>
+ <connectionPointOut>
+ <relPosition x="70" y="15"/>
+ </connectionPointOut>
+ <expression>BOOL#1</expression>
+ </inVariable>
+ <block localId="95" width="100" height="130" typeName="Led" instanceName="Temoin">
+ <position x="900" y="55"/>
+ <inputVariables>
+ <variable formalParameter="back_id">
+ <connectionPointIn>
+ <relPosition x="0" y="40"/>
+ <connection refLocalId="51">
+ <position x="900" y="95"/>
+ <position x="835" y="95"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="sele_id">
+ <connectionPointIn>
+ <relPosition x="0" y="75"/>
+ <connection refLocalId="52">
+ <position x="900" y="130"/>
+ <position x="835" y="130"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="state_in">
+ <connectionPointIn>
+ <relPosition x="0" y="110"/>
+ <connection refLocalId="2">
+ <position x="900" y="165"/>
+ <position x="835" y="165"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables/>
+ </block>
+ <block localId="96" width="80" height="65" typeName="AND">
+ <position x="200" y="45"/>
+ <inputVariables>
+ <variable formalParameter="IN1" negated="true">
+ <connectionPointIn>
+ <relPosition x="0" y="30"/>
+ <connection refLocalId="96" formalParameter="OUT">
+ <position x="200" y="75"/>
+ <position x="175" y="75"/>
+ <position x="175" y="30"/>
+ <position x="305" y="30"/>
+ <position x="305" y="75"/>
+ <position x="280" y="75"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="55"/>
+ <connection refLocalId="1">
+ <position x="200" y="100"/>
+ <position x="150" y="100"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="80" y="30"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <connector name="CLOCK" localId="97" height="30" width="90">
+ <position x="345" y="60"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="96" formalParameter="OUT">
+ <position x="345" y="75"/>
+ <position x="280" y="75"/>
+ </connection>
+ </connectionPointIn>
+ </connector>
+ <connector name="COUNT" localId="98" height="30" width="90">
+ <position x="485" y="180"/>
+ <connectionPointIn>
+ <relPosition x="0" y="15"/>
+ <connection refLocalId="92" formalParameter="state_out">
+ <position x="485" y="195"/>
+ <position x="425" y="195"/>
+ </connection>
+ </connectionPointIn>
+ </connector>
+ <continuation name="COUNT" localId="2" height="30" width="90">
+ <position x="745" y="150"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <inVariable localId="4" height="35" width="85">
+ <position x="470" y="345"/>
+ <connectionPointOut>
+ <relPosition x="85" y="15"/>
+ </connectionPointOut>
+ <expression>counter</expression>
+ </inVariable>
+ <continuation name="COUNT" localId="5" height="30" width="90">
+ <position x="520" y="440"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <block localId="99" width="80" height="110" typeName="AND">
+ <position x="215" y="445"/>
+ <inputVariables>
+ <variable formalParameter="IN1">
+ <connectionPointIn>
+ <relPosition x="0" y="40"/>
+ <connection refLocalId="39">
+ <position x="215" y="485"/>
+ <position x="160" y="485"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ <variable formalParameter="IN2">
+ <connectionPointIn>
+ <relPosition x="0" y="85"/>
+ <connection refLocalId="6">
+ <position x="215" y="530"/>
+ <position x="160" y="530"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="80" y="40"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <continuation name="CLOCK" localId="6" height="30" width="90">
+ <position x="70" y="515"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ </continuation>
+ <block localId="100" width="125" height="45" typeName="BOOL_TO_INT">
+ <position x="365" y="455"/>
+ <inputVariables>
+ <variable formalParameter="IN">
+ <connectionPointIn>
+ <relPosition x="0" y="30"/>
+ <connection refLocalId="99" formalParameter="OUT">
+ <position x="365" y="485"/>
+ <position x="295" y="485"/>
+ </connection>
+ </connectionPointIn>
+ </variable>
+ </inputVariables>
+ <inOutVariables/>
+ <outputVariables>
+ <variable formalParameter="OUT">
+ <connectionPointOut>
+ <relPosition x="125" y="30"/>
+ </connectionPointOut>
+ </variable>
+ </outputVariables>
+ </block>
+ <continuation name="CLOCK" localId="3" height="30" width="90">
+ <position x="765" y="305"/>
+ <connectionPointOut>
+ <relPosition x="90" y="15"/>
+ </connectionPointOut>
+ </continuation>
</FBD>
</body>
</pou>
--- a/webinterface.js Thu Aug 13 11:48:55 2009 +0200
+++ b/webinterface.js Fri Aug 14 16:26:19 2009 +0200
@@ -1,5 +1,9 @@
// import Nevow.Athena
+function init() {
+ Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'HMIinitialisation');
+}
+
WebInterface.PLC = Nevow.Athena.Widget.subclass('WebInterface.PLC');
WebInterface.PLC.method(
'updateHMI',
@@ -12,6 +16,9 @@
function childAdded(widget) {
var node = self.nodeById('content');
node.replaceChild(widget.node, node.getElementsByTagName('div')[0]);
+ init();
});
});
- });
\ No newline at end of file
+ });
+
+Divmod.Base.addLoadEvent(init);
\ No newline at end of file