# HG changeset patch # User Edouard Tisserant # Date 1434633763 -7200 # Node ID 9ee3a2dea7e8d8c3ed8b10f7b86c37ecdfc0d8c7 # Parent 954d1f42d42dd49b69903a26b4759cd8efd1ab59 Extended wxHMI test diff -r 954d1f42d42d -r 9ee3a2dea7e8 tests/wxGlade/HMIFrame@wxglade_hmi/py_ext.xml --- a/tests/wxGlade/HMIFrame@wxglade_hmi/py_ext.xml Thu Jun 18 11:36:35 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - - - - diff -r 954d1f42d42d -r 9ee3a2dea7e8 tests/wxGlade/HMIFrame@wxglade_hmi/pyfile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/wxGlade/HMIFrame@wxglade_hmi/pyfile.xml Thu Jun 18 15:22:43 2015 +0200 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r 954d1f42d42d -r 9ee3a2dea7e8 tests/wxHMI/HMI@wxglade_hmi/hmi.wxg --- a/tests/wxHMI/HMI@wxglade_hmi/hmi.wxg Thu Jun 18 11:36:35 2015 +0200 +++ b/tests/wxHMI/HMI@wxglade_hmi/hmi.wxg Thu Jun 18 15:22:43 2015 +0200 @@ -1,72 +1,99 @@ - - - - - - - frame_1 - - 0 - 0 - 1 - 0 - 2 - 0 - - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL - 0 - - - - $parent - $id - - 400,400 - - - - wxEXPAND - 0 - - - 0 - 0 - 2 - 1 - 0 - - wxEXPAND - 0 - - - wxVERTICAL - - - - - - - - wxEXPAND - 0 - - - 0 - 4 - 2 - 0 - - - - - - - - - - - - - - - + + + + + + + frame_1 + + 0 + 0 + 1 + 0 + 4 + 0 + + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 0 + + + # WHERE IS THAT ?\nprint "hello"\n + + $parent + $id + + 400,400 + + + + wxEXPAND + 0 + + + 0 + 0 + 2 + 1 + 0 + + wxEXPAND + 0 + + + wxVERTICAL + + + + + + + + wxEXPAND + 0 + + + 0 + 4 + 2 + 0 + + + + + + + + + + + + + + 0 + + + + + SetPLCGlobalVar + + + "DrawTest" + + + + + 0 + + + + + SetPLCGlobalVar + + + "DrawEscher" + + + + + + diff -r 954d1f42d42d -r 9ee3a2dea7e8 tests/wxHMI/HMI@wxglade_hmi/pyfile.xml --- a/tests/wxHMI/HMI@wxglade_hmi/pyfile.xml Thu Jun 18 11:36:35 2015 +0200 +++ b/tests/wxHMI/HMI@wxglade_hmi/pyfile.xml Thu Jun 18 15:22:43 2015 +0200 @@ -72,16 +72,23 @@ obj.Bind(wx.EVT_LEFT_UP, ButtonUp) return obj -def UpdatePositions(self, event): - - # TODO : uncomment +def UpdPos(self): positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList] self.window_1.UpdatePositions(positions) - event.Skip() +Class_wxglade_hmi.UpdPos = UpdPos -Class_wxglade_hmi.UpdatePositions = UpdatePositions + +#def UpdatePositions(self, event): +# +# positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList] +# +# self.window_1.UpdatePositions(positions) +# +# event.Skip() + +#Class_wxglade_hmi.UpdatePositions = UpdatePositions initorig = Class_wxglade_hmi.__init__ def Init(self,*args,**kargs): @@ -96,26 +103,16 @@ lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"), MakeButtonFunc(self, sizer, axis+"axisPlus")), AxisList) - self.timer = wx.Timer(self, -1) - self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer) + # self.timer = wx.Timer(self, -1) + # self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer) self.ShowFullScreen(True,wx.FULLSCREEN_ALL) - wx.CallAfter(self.timer.Start,200) + # wx.CallAfter(self.timer.Start,200) Class_wxglade_hmi.__init__ = Init -def GUIMessage(message): - try: - wxglade_hmi.window_1.Message = message - except: - # sometime get some wxpydeadobject - pass - -def SetNegLimits(*args): - wxglade_hmi.window_1.NegLimits = args - -def SetDisk(*args): - wxglade_hmi.window_1.Disk = args - GUIMessage("DiskOK") +def SetPLCGlobalVar(self, evt): + tglbtname = evt.GetEventObject().GetName() + setattr(PLCGlobals, tglbtname, evt.GetEventObject().GetValue()) ]]> diff -r 954d1f42d42d -r 9ee3a2dea7e8 tests/wxHMI/plc.xml --- a/tests/wxHMI/plc.xml Thu Jun 18 11:36:35 2015 +0200 +++ b/tests/wxHMI/plc.xml Thu Jun 18 15:22:43 2015 +0200 @@ -1,7 +1,7 @@ - + @@ -64,11 +64,18 @@ + + + + + + + - + @@ -83,8 +90,8 @@ - - + + @@ -93,9 +100,9 @@ - - - + + + @@ -110,7 +117,7 @@ - + @@ -129,6 +136,124 @@ power + + + + + + DrawTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ZaxisPos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + 0 + @@ -171,6 +296,13 @@ + + + + + + + @@ -321,6 +453,56 @@ power + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BOOL#TRUE + + + + + + + 'wxglade_hmi.UpdPos()' + @@ -382,7 +564,7 @@ - +