1163 #------------------------------------------------------------------------------- |
1163 #------------------------------------------------------------------------------- |
1164 # Edit element content functions |
1164 # Edit element content functions |
1165 #------------------------------------------------------------------------------- |
1165 #------------------------------------------------------------------------------- |
1166 |
1166 |
1167 def EditContactContent(self, contact): |
1167 def EditContactContent(self, contact): |
1168 dialog = LDElementDialog(self.Parent, "contact") |
1168 if self.GetDrawingMode() == FREEDRAWING_MODE: |
1169 varlist = [] |
1169 Viewer.EditContactContent(self, contact) |
1170 vars = self.Controler.GetCurrentElementEditingInterfaceVars() |
1170 else: |
1171 if vars: |
1171 dialog = LDElementDialog(self.Parent, "contact") |
1172 for var in vars: |
1172 varlist = [] |
1173 if var["Class"] != "Output" and var["Type"] == "BOOL": |
1173 vars = self.Controler.GetCurrentElementEditingInterfaceVars() |
1174 varlist.append(var["Name"]) |
1174 if vars: |
1175 dialog.SetVariables(varlist) |
1175 for var in vars: |
1176 dialog.SetValues({"name":contact.GetName(),"type":contact.GetType()}) |
1176 if var["Class"] != "Output" and var["Type"] == "BOOL": |
1177 if dialog.ShowModal() == wxID_OK: |
1177 varlist.append(var["Name"]) |
1178 values = dialog.GetValues() |
1178 dialog.SetVariables(varlist) |
1179 contact.SetName(values["name"]) |
1179 dialog.SetValues({"name":contact.GetName(),"type":contact.GetType()}) |
1180 contact.SetType(values["type"]) |
1180 if dialog.ShowModal() == wxID_OK: |
1181 contact.RefreshModel(False) |
1181 values = dialog.GetValues() |
1182 self.Refresh() |
1182 contact.SetName(values["name"]) |
1183 dialog.Destroy() |
1183 contact.SetType(values["type"]) |
|
1184 contact.RefreshModel(False) |
|
1185 self.Refresh() |
|
1186 dialog.Destroy() |
1184 |
1187 |
1185 def EditCoilContent(self, coil): |
1188 def EditCoilContent(self, coil): |
1186 dialog = LDElementDialog(self.Parent, "coil") |
1189 if self.GetDrawingMode() == FREEDRAWING_MODE: |
1187 varlist = [] |
1190 Viewer.EditCoilContent(self, coil) |
1188 vars = self.Controler.GetCurrentElementEditingInterfaceVars() |
1191 else: |
1189 if vars: |
1192 dialog = LDElementDialog(self.Parent, "coil") |
1190 for var in vars: |
1193 varlist = [] |
1191 if var["Class"] != "Input" and var["Type"] == "BOOL": |
1194 vars = self.Controler.GetCurrentElementEditingInterfaceVars() |
1192 varlist.append(var["Name"]) |
1195 if vars: |
1193 returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType() |
1196 for var in vars: |
1194 if returntype == "BOOL": |
1197 if var["Class"] != "Input" and var["Type"] == "BOOL": |
1195 varlist.append(self.Controler.GetCurrentElementEditingName()) |
1198 varlist.append(var["Name"]) |
1196 dialog.SetVariables(varlist) |
1199 returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType() |
1197 dialog.SetValues({"name":coil.GetName(),"type":coil.GetType()}) |
1200 if returntype == "BOOL": |
1198 if dialog.ShowModal() == wxID_OK: |
1201 varlist.append(self.Controler.GetCurrentElementEditingName()) |
1199 values = dialog.GetValues() |
1202 dialog.SetVariables(varlist) |
1200 coil.SetName(values["name"]) |
1203 dialog.SetValues({"name":coil.GetName(),"type":coil.GetType()}) |
1201 coil.SetType(values["type"]) |
1204 if dialog.ShowModal() == wxID_OK: |
1202 coil.RefreshModel(False) |
1205 values = dialog.GetValues() |
1203 self.Refresh() |
1206 coil.SetName(values["name"]) |
1204 dialog.Destroy() |
1207 coil.SetType(values["type"]) |
1205 |
1208 coil.RefreshModel(False) |
|
1209 self.Refresh() |
|
1210 dialog.Destroy() |
|
1211 |
|
1212 def EditPowerRailContent(self, powerrail): |
|
1213 if self.GetDrawingMode() == FREEDRAWING_MODE: |
|
1214 Viewer.EditPowerRailContent(self, powerrail) |
|
1215 |