# HG changeset patch # User Laurent Bessard # Date 1359569005 -3600 # Node ID aa136ef125062c62db48e7ccdee1d8de5857c509 # Parent 401e44bae7c073e8d3ccb46895883fe45426d1e4 Fix bug with refresh PLC status tool bar diff -r 401e44bae7c0 -r aa136ef12506 Beremiz.py --- a/Beremiz.py Wed Jan 30 18:54:12 2013 +1100 +++ b/Beremiz.py Wed Jan 30 19:03:25 2013 +0100 @@ -774,8 +774,6 @@ getattr(self.CTR, method)() # Re-enable button event.GetEventObject().Enable() - # Trigger refresh on Idle - wx.CallAfter(self.RefreshStatusToolBar) return OnMenu def GetConfigEntry(self, entry_name, default): diff -r 401e44bae7c0 -r aa136ef12506 ProjectController.py --- a/ProjectController.py Wed Jan 30 18:54:12 2013 +1100 +++ b/ProjectController.py Wed Jan 30 19:03:25 2013 +0100 @@ -1123,19 +1123,16 @@ }.get(status,[]): self.ShowMethod(*args) self.previous_plcstate = status - return True - return False + {"Broken": self.logger.write_error, + None: lambda x: None}.get( + status, self.logger.write)(_("PLC is %s\n")%_(status)) + if self.AppFrame is not None: + self.AppFrame.RefreshStatusToolBar() def PullPLCStatusProc(self, event): if self._connector is None: self.StatusTimer.Stop() - if self.UpdateMethodsFromPLCStatus(): - - status = _(self.previous_plcstate) - {"Broken": self.logger.write_error, - None: lambda x: None}.get( - self.previous_plcstate, self.logger.write)(_("PLC is %s\n")%status) - self.AppFrame.RefreshStatusToolBar() + self.UpdateMethodsFromPLCStatus() def RegisterDebugVarToConnector(self): self.DebugTimer=None diff -r 401e44bae7c0 -r aa136ef12506 tests/python/plc.xml --- a/tests/python/plc.xml Wed Jan 30 18:54:12 2013 +1100 +++ b/tests/python/plc.xml Wed Jan 30 19:03:25 2013 +0100 @@ -8,7 +8,7 @@ productVersion="0.0" creationDateTime="2008-12-14T16:21:19"/> <contentHeader name="Beremiz Python Support Tests" - modificationDateTime="2012-11-15T18:38:58"> + modificationDateTime="2013-01-11T14:08:25"> <coordinateInfo> <pageSize x="1024" y="1024"/> <fbd> @@ -155,6 +155,9 @@ <type> <string/> </type> + <initialValue> + <simpleValue value="test"/> + </initialValue> </variable> <variable name="Test_Bool"> <type> @@ -1064,6 +1067,30 @@ </ST> </body> </pou> + <pou name="norm" pouType="function"> + <interface> + <returnType> + <REAL/> + </returnType> + <inputVars> + <variable name="IN1"> + <type> + <REAL/> + </type> + </variable> + <variable name="IN2"> + <type> + <REAL/> + </type> + </variable> + </inputVars> + </interface> + <body> + <ST> +<![CDATA[NORM := SQRT(IN1 * IN1 + IN2 * IN2);]]> + </ST> + </body> + </pou> </pous> </types> <instances> @@ -1071,6 +1098,13 @@ <configuration name="conf_pytest"> <resource name="res_pytest"> <task name="pytest_task" interval="T#1ms" priority="0"/> + <globalVars> + <variable name="TOTO"> + <type> + <INT/> + </type> + </variable> + </globalVars> <pouInstance name="pytest_instance" typeName="main_pytest"/> </resource> <globalVars>