equal
deleted
inserted
replaced
112 |
112 |
113 self.RefreshView() |
113 self.RefreshView() |
114 |
114 |
115 def SetPouType(self, tagname, pou_instance=None): |
115 def SetPouType(self, tagname, pou_instance=None): |
116 if self.Controller is not None: |
116 if self.Controller is not None: |
117 self.PouTagName = tagname |
117 if tagname == "Project": |
118 if self.PouTagName == "Project": |
|
119 config_name = self.Controller.GetProjectMainConfigurationName() |
118 config_name = self.Controller.GetProjectMainConfigurationName() |
120 if config_name is not None: |
119 if config_name is not None: |
121 self.PouTagName = self.Controller.ComputeConfigurationName(config_name) |
120 tagname = self.Controller.ComputeConfigurationName(config_name) |
122 if pou_instance is not None: |
121 if pou_instance is not None: |
123 self.PouInstance = pou_instance |
122 self.PouInstance = pou_instance |
124 |
123 |
125 self.RefreshView() |
124 if self.PouTagName != tagname: |
|
125 self.PouTagName = tagname |
|
126 self.RefreshView() |
|
127 else: |
|
128 self.RefreshInstanceChoice() |
|
129 else: |
|
130 self.RefreshView() |
126 |
131 |
127 def ResetView(self): |
132 def ResetView(self): |
128 self.Controller = None |
133 self.Controller = None |
129 |
134 |
130 self.PouTagName = None |
135 self.PouTagName = None |
195 |
200 |
196 item = self.VariablesList.AppendItem(root, text, wnd=panel) |
201 item = self.VariablesList.AppendItem(root, text, wnd=panel) |
197 self.VariablesList.SetItemImage(item, self.ParentWindow.GetTreeImage(var_infos["class"])) |
202 self.VariablesList.SetItemImage(item, self.ParentWindow.GetTreeImage(var_infos["class"])) |
198 self.VariablesList.SetPyData(item, var_infos) |
203 self.VariablesList.SetPyData(item, var_infos) |
199 |
204 |
|
205 self.RefreshInstanceChoice() |
|
206 |
|
207 self.RefreshButtons() |
|
208 |
|
209 self.Thaw() |
|
210 |
|
211 def RefreshInstanceChoice(self): |
|
212 if self.Controller is not None and self.PouInfos is not None: |
200 instances = self.Controller.SearchPouInstances(self.PouTagName, self.Debug) |
213 instances = self.Controller.SearchPouInstances(self.PouTagName, self.Debug) |
201 for instance in instances: |
214 for instance in instances: |
202 self.InstanceChoice.Append(instance) |
215 self.InstanceChoice.Append(instance) |
203 if len(instances) == 1: |
216 if len(instances) == 1: |
204 self.PouInstance = instances[0] |
217 self.PouInstance = instances[0] |
208 elif self.PouInstance in instances: |
221 elif self.PouInstance in instances: |
209 self.InstanceChoice.SetStringSelection(self.PouInstance) |
222 self.InstanceChoice.SetStringSelection(self.PouInstance) |
210 else: |
223 else: |
211 self.PouInstance = None |
224 self.PouInstance = None |
212 self.InstanceChoice.SetValue(_("Select an instance")) |
225 self.InstanceChoice.SetValue(_("Select an instance")) |
213 |
226 |
214 self.RefreshButtons() |
|
215 |
|
216 self.Thaw() |
|
217 |
|
218 def RefreshButtons(self): |
227 def RefreshButtons(self): |
219 enabled = self.InstanceChoice.GetSelection() != -1 |
228 enabled = self.InstanceChoice.GetSelection() != -1 |
220 self.ParentButton.Enable(enabled and self.PouInfos["class"] != ITEM_CONFIGURATION) |
229 self.ParentButton.Enable(enabled and self.PouInfos["class"] != ITEM_CONFIGURATION) |
221 self.DebugButton.Enable(enabled and self.PouInfos["debug"] and self.Debug) |
230 self.DebugButton.Enable(enabled and self.PouInfos["debug"] and self.Debug) |
222 |
231 |