editors/LDViewer.py
branch1.1 Korean release
changeset 1384 02fe382c4511
parent 1347 533741e5075c
child 1571 486f94a8032c
equal deleted inserted replaced
1280:72a826dfcfbb 1384:02fe382c4511
   480 
   480 
   481     def AddLadderRung(self):
   481     def AddLadderRung(self):
   482         dialog = LDElementDialog(self.ParentWindow, self.Controler, "coil")
   482         dialog = LDElementDialog(self.ParentWindow, self.Controler, "coil")
   483         dialog.SetPreviewFont(self.GetFont())
   483         dialog.SetPreviewFont(self.GetFont())
   484         varlist = []
   484         varlist = []
   485         vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)
   485         vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug)
   486         if vars:
   486         if vars:
   487             for var in vars:
   487             for var in vars:
   488                 if var["Class"] != "Input" and var["Type"] == "BOOL":
   488                 if var.Class != "Input" and var.Type == "BOOL":
   489                     varlist.append(var["Name"])
   489                     varlist.append(var.Name)
   490         returntype = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, self.Debug)
   490         returntype = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, debug=self.Debug)
   491         if returntype == "BOOL":
   491         if returntype == "BOOL":
   492             varlist.append(self.Controler.GetEditedElementName(self.TagName))
   492             varlist.append(self.Controler.GetEditedElementName(self.TagName))
   493         dialog.SetVariables(varlist)
   493         dialog.SetVariables(varlist)
   494         dialog.SetValues({"name":"","type":COIL_NORMAL})
   494         dialog.SetValues({"name":"","type":COIL_NORMAL})
   495         if dialog.ShowModal() == wx.ID_OK:
   495         if dialog.ShowModal() == wx.ID_OK:
   580                     wires.append(element)
   580                     wires.append(element)
   581         if len(wires) > 0:
   581         if len(wires) > 0:
   582             dialog = LDElementDialog(self.ParentWindow, self.Controler, "contact")
   582             dialog = LDElementDialog(self.ParentWindow, self.Controler, "contact")
   583             dialog.SetPreviewFont(self.GetFont())
   583             dialog.SetPreviewFont(self.GetFont())
   584             varlist = []
   584             varlist = []
   585             vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)
   585             vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug)
   586             if vars:
   586             if vars:
   587                 for var in vars:
   587                 for var in vars:
   588                     if var["Class"] != "Output" and var["Type"] == "BOOL":
   588                     if var.Class != "Output" and var.Type == "BOOL":
   589                         varlist.append(var["Name"])
   589                         varlist.append(var.Name)
   590             dialog.SetVariables(varlist)
   590             dialog.SetVariables(varlist)
   591             dialog.SetValues({"name":"","type":CONTACT_NORMAL})
   591             dialog.SetValues({"name":"","type":CONTACT_NORMAL})
   592             if dialog.ShowModal() == wx.ID_OK:
   592             if dialog.ShowModal() == wx.ID_OK:
   593                 values = dialog.GetValues()
   593                 values = dialog.GetValues()
   594                 points = wires[0].GetSelectedSegmentPoints()
   594                 points = wires[0].GetSelectedSegmentPoints()
   794                         right_elements.reverse()
   794                         right_elements.reverse()
   795                     elif right_powerrail:
   795                     elif right_powerrail:
   796                         dialog = LDElementDialog(self.ParentWindow, self.Controleur, "coil")
   796                         dialog = LDElementDialog(self.ParentWindow, self.Controleur, "coil")
   797                         dialog.SetPreviewFont(self.GetFont())
   797                         dialog.SetPreviewFont(self.GetFont())
   798                         varlist = []
   798                         varlist = []
   799                         vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, self.Debug)
   799                         vars = self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug)
   800                         if vars:
   800                         if vars:
   801                             for var in vars:
   801                             for var in vars:
   802                                 if var["Class"] != "Input" and var["Type"] == "BOOL":
   802                                 if var.Class != "Input" and var.Type == "BOOL":
   803                                     varlist.append(var["Name"])
   803                                     varlist.append(var.Name)
   804                         returntype = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, self.Debug)
   804                         returntype = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, debug=self.Debug)
   805                         if returntype == "BOOL":
   805                         if returntype == "BOOL":
   806                             varlist.append(self.Controler.GetEditedElementName(self.TagName))
   806                             varlist.append(self.Controler.GetEditedElementName(self.TagName))
   807                         dialog.SetVariables(varlist)
   807                         dialog.SetVariables(varlist)
   808                         dialog.SetValues({"name":"","type":COIL_NORMAL})
   808                         dialog.SetValues({"name":"","type":COIL_NORMAL})
   809                         if dialog.ShowModal() == wx.ID_OK:
   809                         if dialog.ShowModal() == wx.ID_OK: