70 sizer.Add(obj, 2, wx.EXPAND, 0) |
70 sizer.Add(obj, 2, wx.EXPAND, 0) |
71 obj.Bind(wx.EVT_LEFT_DOWN, ButtonDown) |
71 obj.Bind(wx.EVT_LEFT_DOWN, ButtonDown) |
72 obj.Bind(wx.EVT_LEFT_UP, ButtonUp) |
72 obj.Bind(wx.EVT_LEFT_UP, ButtonUp) |
73 return obj |
73 return obj |
74 |
74 |
75 def UpdatePositions(self, event): |
75 def UpdPos(self): |
76 |
|
77 # TODO : uncomment |
|
78 positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList] |
76 positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList] |
79 |
77 |
80 self.window_1.UpdatePositions(positions) |
78 self.window_1.UpdatePositions(positions) |
81 |
79 |
82 event.Skip() |
80 Class_wxglade_hmi.UpdPos = UpdPos |
83 |
81 |
84 Class_wxglade_hmi.UpdatePositions = UpdatePositions |
82 |
|
83 #def UpdatePositions(self, event): |
|
84 # |
|
85 # positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList] |
|
86 # |
|
87 # self.window_1.UpdatePositions(positions) |
|
88 # |
|
89 # event.Skip() |
|
90 |
|
91 #Class_wxglade_hmi.UpdatePositions = UpdatePositions |
85 |
92 |
86 initorig = Class_wxglade_hmi.__init__ |
93 initorig = Class_wxglade_hmi.__init__ |
87 def Init(self,*args,**kargs): |
94 def Init(self,*args,**kargs): |
88 initorig(self,*args,**kargs) |
95 initorig(self,*args,**kargs) |
89 sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(0).GetSizer() |
96 sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(0).GetSizer() |
94 lambda btname: MakeButtonFunc(self, sizer, btname), ActionButtons) |
101 lambda btname: MakeButtonFunc(self, sizer, btname), ActionButtons) |
95 self.axis_buttons = map( |
102 self.axis_buttons = map( |
96 lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"), |
103 lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"), |
97 MakeButtonFunc(self, sizer, axis+"axisPlus")), |
104 MakeButtonFunc(self, sizer, axis+"axisPlus")), |
98 AxisList) |
105 AxisList) |
99 self.timer = wx.Timer(self, -1) |
106 # self.timer = wx.Timer(self, -1) |
100 self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer) |
107 # self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer) |
101 self.ShowFullScreen(True,wx.FULLSCREEN_ALL) |
108 self.ShowFullScreen(True,wx.FULLSCREEN_ALL) |
102 wx.CallAfter(self.timer.Start,200) |
109 # wx.CallAfter(self.timer.Start,200) |
103 |
110 |
104 Class_wxglade_hmi.__init__ = Init |
111 Class_wxglade_hmi.__init__ = Init |
105 |
112 |
106 def GUIMessage(message): |
113 def SetPLCGlobalVar(self, evt): |
107 try: |
114 tglbtname = evt.GetEventObject().GetName() |
108 wxglade_hmi.window_1.Message = message |
115 setattr(PLCGlobals, tglbtname, evt.GetEventObject().GetValue()) |
109 except: |
|
110 # sometime get some wxpydeadobject |
|
111 pass |
|
112 |
|
113 def SetNegLimits(*args): |
|
114 wxglade_hmi.window_1.NegLimits = args |
|
115 |
|
116 def SetDisk(*args): |
|
117 wxglade_hmi.window_1.Disk = args |
|
118 GUIMessage("DiskOK") |
|
119 |
116 |
120 ]]></xhtml:p> |
117 ]]></xhtml:p> |
121 </globals> |
118 </globals> |
122 <init> |
119 <init> |
123 <xhtml:p><![CDATA[ |
120 <xhtml:p><![CDATA[ |