98 []) # options |
98 []) # options |
99 dialog.Destroy() |
99 dialog.Destroy() |
100 _View = None |
100 _View = None |
101 def _OpenView(self): |
101 def _OpenView(self): |
102 if not self._View: |
102 if not self._View: |
103 def _onclose(): |
103 open_objdictedit = True |
104 self._View = None |
104 has_permissions = self.GetPlugRoot().CheckProjectPathPerm() |
105 def _onsave(): |
105 if not has_permissions: |
106 self.GetPlugRoot().SaveProject() |
106 dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame, |
107 self._View = objdictedit(self.GetPlugRoot().AppFrame, self) |
107 _("You don't have write permissions.\nOpen ObjDictEdit anyway ?"), |
108 # TODO redefine BusId when IEC channel change |
108 _("Open ObjDictEdit"), |
109 self._View.SetBusId(self.GetCurrentLocation()) |
109 wx.YES_NO|wx.ICON_QUESTION) |
110 self._View._onclose = _onclose |
110 open_objdictedit = dialog.ShowModal() == wx.ID_YES |
111 self._View._onsave = _onsave |
111 dialog.Destroy() |
112 self._View.Show() |
112 if open_objdictedit: |
|
113 def _onclose(): |
|
114 self._View = None |
|
115 if has_permissions: |
|
116 def _onsave(): |
|
117 self.GetPlugRoot().SaveProject() |
|
118 else: |
|
119 def _onsave(): |
|
120 pass |
|
121 |
|
122 self._View = objdictedit(self.GetPlugRoot().AppFrame, self) |
|
123 # TODO redefine BusId when IEC channel change |
|
124 self._View.SetBusId(self.GetCurrentLocation()) |
|
125 self._View._onclose = _onclose |
|
126 self._View._onsave = _onsave |
|
127 self._View.Show() |
113 |
128 |
114 PluginMethods = [ |
129 PluginMethods = [ |
115 {"bitmap" : os.path.join("images", "NetworkEdit"), |
130 {"bitmap" : os.path.join("images", "NetworkEdit"), |
116 "name" : "Edit slave", |
131 "name" : "Edit slave", |
117 "tooltip" : "Edit CanOpen slave with ObjdictEdit", |
132 "tooltip" : "Edit CanOpen slave with ObjdictEdit", |
183 self.LoadProject(self.PlugPath()) |
198 self.LoadProject(self.PlugPath()) |
184 |
199 |
185 _View = None |
200 _View = None |
186 def _OpenView(self): |
201 def _OpenView(self): |
187 if not self._View: |
202 if not self._View: |
188 def _onclose(): |
203 open_networkedit = True |
189 self._View = None |
204 has_permissions = self.GetPlugRoot().CheckProjectPathPerm() |
190 def _onsave(): |
205 if not has_permissions: |
191 self.GetPlugRoot().SaveProject() |
206 dialog = wx.MessageDialog(self.GetPlugRoot().AppFrame, |
192 self._View = networkedit(self.GetPlugRoot().AppFrame, self) |
207 _("You don't have write permissions.\nOpen NetworkEdit anyway ?"), |
193 # TODO redefine BusId when IEC channel change |
208 _("Open NetworkEdit"), |
194 self._View.SetBusId(self.GetCurrentLocation()) |
209 wx.YES_NO|wx.ICON_QUESTION) |
195 self._View._onclose = _onclose |
210 open_networkedit = dialog.ShowModal() == wx.ID_YES |
196 self._View._onsave = _onsave |
211 dialog.Destroy() |
197 self._View.Show() |
212 if open_networkedit: |
|
213 def _onclose(): |
|
214 self._View = None |
|
215 if has_permissions: |
|
216 def _onsave(): |
|
217 self.GetPlugRoot().SaveProject() |
|
218 else: |
|
219 def _onsave(): |
|
220 pass |
|
221 self._View = networkedit(self.GetPlugRoot().AppFrame, self) |
|
222 # TODO redefine BusId when IEC channel change |
|
223 self._View.SetBusId(self.GetCurrentLocation()) |
|
224 self._View._onclose = _onclose |
|
225 self._View._onsave = _onsave |
|
226 self._View.Show() |
198 |
227 |
199 def _ShowMasterGenerated(self): |
228 def _ShowMasterGenerated(self): |
200 buildpath = self._getBuildPath() |
229 buildpath = self._getBuildPath() |
201 # Eventually create build dir |
230 # Eventually create build dir |
202 if not os.path.exists(buildpath): |
231 if not os.path.exists(buildpath): |