66 from PLCOpenEditor import IDEFrame, ProjectDialog |
66 from PLCOpenEditor import IDEFrame, ProjectDialog |
67 |
67 |
68 havecanfestival = False |
68 havecanfestival = False |
69 try: |
69 try: |
70 from confnodes.canfestival import RootClass as CanOpenRootClass |
70 from confnodes.canfestival import RootClass as CanOpenRootClass |
71 from confnodes.canfestival.canfestival import _SlavePlug, _NodeListPlug, NodeManager |
71 from confnodes.canfestival.canfestival import _SlaveCTN, _NodeListCTN, NodeManager |
72 havecanfestival = True |
72 havecanfestival = True |
73 except: |
73 except: |
74 havecanfestival = False |
74 havecanfestival = False |
75 |
75 |
76 |
76 |
195 def __getitem__(self, key): |
195 def __getitem__(self, key): |
196 if key == "children": |
196 if key == "children": |
197 return self.VariableLocationTree |
197 return self.VariableLocationTree |
198 raise KeyError, "Only 'children' key is available" |
198 raise KeyError, "Only 'children' key is available" |
199 |
199 |
200 def PlugEnabled(self): |
200 def CTNEnabled(self): |
201 return None |
201 return None |
202 |
202 |
203 def SetIcon(self, icon): |
203 def SetIcon(self, icon): |
204 self.Icon = icon |
204 self.Icon = icon |
205 |
205 |
206 def _GetChildBySomething(self, something, toks): |
206 def _GetChildBySomething(self, something, toks): |
207 return _GetModuleBySomething({"children" : self.VariableLocationTree}, something, toks) |
207 return _GetModuleBySomething({"children" : self.VariableLocationTree}, something, toks) |
208 |
208 |
209 def GetBaseTypes(self): |
209 def GetBaseTypes(self): |
210 return self.GetPlugRoot().GetBaseTypes() |
210 return self.GetCTRoot().GetBaseTypes() |
211 |
211 |
212 def GetSizeOfType(self, type): |
212 def GetSizeOfType(self, type): |
213 return LOCATION_SIZES[self.GetPlugRoot().GetBaseType(type)] |
213 return LOCATION_SIZES[self.GetCTRoot().GetBaseType(type)] |
214 |
214 |
215 def _GetVariableLocationTree(self, current_location, infos): |
215 def _GetVariableLocationTree(self, current_location, infos): |
216 if infos["type"] == LOCATION_MODULE: |
216 if infos["type"] == LOCATION_MODULE: |
217 location = current_location + (infos["IEC_Channel"],) |
217 location = current_location + (infos["IEC_Channel"],) |
218 return {"name": infos["name"], |
218 return {"name": infos["name"], |
244 "location": self.GetFullIEC_Channel(), |
244 "location": self.GetFullIEC_Channel(), |
245 "icon": self.Icon, |
245 "icon": self.Icon, |
246 "children": [self._GetVariableLocationTree(self.GetCurrentLocation(), child) |
246 "children": [self._GetVariableLocationTree(self.GetCurrentLocation(), child) |
247 for child in self.VariableLocationTree]} |
247 for child in self.VariableLocationTree]} |
248 |
248 |
249 def PlugTestModified(self): |
249 def CTNTestModified(self): |
250 return False |
250 return False |
251 |
251 |
252 def PlugMakeDir(self): |
252 def CTNMakeDir(self): |
253 pass |
253 pass |
254 |
254 |
255 def PlugRequestSave(self): |
255 def CTNRequestSave(self): |
256 return None |
256 return None |
257 |
257 |
258 def ResetUsedLocations(self): |
258 def ResetUsedLocations(self): |
259 self.UsedLocations = {} |
259 self.UsedLocations = {} |
260 |
260 |
286 def CheckLocationConflicts(self, location): |
286 def CheckLocationConflicts(self, location): |
287 if len(location) > 0: |
287 if len(location) > 0: |
288 return self._CheckLocationConflicts(self.UsedLocations, list(location)) |
288 return self._CheckLocationConflicts(self.UsedLocations, list(location)) |
289 return False |
289 return False |
290 |
290 |
291 def PlugGenerate_C(self, buildpath, locations): |
291 def CTNGenerate_C(self, buildpath, locations): |
292 """ |
292 """ |
293 Generate C code |
293 Generate C code |
294 @param current_location: Tupple containing confnode IEC location : %I0.0.4.5 => (0,0,4,5) |
294 @param current_location: Tupple containing confnode IEC location : %I0.0.4.5 => (0,0,4,5) |
295 @param locations: List of complete variables locations \ |
295 @param locations: List of complete variables locations \ |
296 [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...) |
296 [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...) |
344 "Type": variable["IEC_type"], |
344 "Type": variable["IEC_type"], |
345 "Retrieve": variable["retrieve"], |
345 "Retrieve": variable["retrieve"], |
346 "Publish": variable["publish"], |
346 "Publish": variable["publish"], |
347 }) |
347 }) |
348 break |
348 break |
349 base_types = self.GetPlugRoot().GetBaseTypes() |
349 base_types = self.GetCTRoot().GetBaseTypes() |
350 for var in vars: |
350 for var in vars: |
351 prefix = "" |
351 prefix = "" |
352 if var["Type"] in base_types: |
352 if var["Type"] in base_types: |
353 prefix = "IEC_" |
353 prefix = "IEC_" |
354 code_str["var_decl"] += "%s%s beremiz%s;\n"%(prefix, var["Type"], var["location"]) |
354 code_str["var_decl"] += "%s%s beremiz%s;\n"%(prefix, var["Type"], var["location"]) |
361 Gen_Module_path = os.path.join(buildpath, "Bus_%s.c"%location_str) |
361 Gen_Module_path = os.path.join(buildpath, "Bus_%s.c"%location_str) |
362 module = open(Gen_Module_path,'w') |
362 module = open(Gen_Module_path,'w') |
363 module.write(BUS_TEXT % code_str) |
363 module.write(BUS_TEXT % code_str) |
364 module.close() |
364 module.close() |
365 |
365 |
366 matiec_flags = '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath()) |
366 matiec_flags = '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()) |
367 return [(Gen_Module_path, matiec_flags)],"",True |
367 return [(Gen_Module_path, matiec_flags)],"",True |
368 |
368 |
369 #------------------------------------------------------------------------------- |
369 #------------------------------------------------------------------------------- |
370 # LPC CanFestival ConfNode Class |
370 # LPC CanFestival ConfNode Class |
371 #------------------------------------------------------------------------------- |
371 #------------------------------------------------------------------------------- |
376 "CAN_Baudrate": "125K", |
376 "CAN_Baudrate": "125K", |
377 "Slave_NodeId": 2, |
377 "Slave_NodeId": 2, |
378 "Master_NodeId": 1, |
378 "Master_NodeId": 1, |
379 } |
379 } |
380 |
380 |
381 class LPCCanOpenSlave(_SlavePlug): |
381 class LPCCanOpenSlave(_SlaveCTN): |
382 XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> |
382 XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> |
383 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
383 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
384 <xsd:element name="CanFestivalSlaveNode"> |
384 <xsd:element name="CanFestivalSlaveNode"> |
385 <xsd:complexType> |
385 <xsd:complexType> |
386 <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/> |
386 <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/> |
412 "", # description |
412 "", # description |
413 "None", # profile |
413 "None", # profile |
414 "", # prfile filepath |
414 "", # prfile filepath |
415 "heartbeat", # NMT |
415 "heartbeat", # NMT |
416 []) # options |
416 []) # options |
417 self.OnPlugSave() |
417 self.OnCTNSave() |
418 |
418 |
419 def GetCanDevice(self): |
419 def GetCanDevice(self): |
420 return str(self.BaseParams.getIEC_Channel()) |
420 return str(self.BaseParams.getIEC_Channel()) |
421 |
421 |
422 class LPCCanOpenMaster(_NodeListPlug): |
422 class LPCCanOpenMaster(_NodeListCTN): |
423 XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> |
423 XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> |
424 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
424 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
425 <xsd:element name="CanFestivalNode"> |
425 <xsd:element name="CanFestivalNode"> |
426 <xsd:complexType> |
426 <xsd:complexType> |
427 <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/> |
427 <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/> |
435 def GetCanDevice(self): |
435 def GetCanDevice(self): |
436 return str(self.BaseParams.getIEC_Channel()) |
436 return str(self.BaseParams.getIEC_Channel()) |
437 |
437 |
438 class LPCCanOpen(CanOpenRootClass): |
438 class LPCCanOpen(CanOpenRootClass): |
439 XSD = None |
439 XSD = None |
440 PlugChildsTypes = [("CanOpenNode",LPCCanOpenMaster, "CanOpen Master"), |
440 CTNChildrenTypes = [("CanOpenNode",LPCCanOpenMaster, "CanOpen Master"), |
441 ("CanOpenSlave",LPCCanOpenSlave, "CanOpen Slave")] |
441 ("CanOpenSlave",LPCCanOpenSlave, "CanOpen Slave")] |
442 |
442 |
443 def GetCanDriver(self): |
443 def GetCanDriver(self): |
444 return "" |
444 return "" |
445 |
445 |
446 def LoadChilds(self): |
446 def LoadChildren(self): |
447 ConfigTreeNode.LoadChilds(self) |
447 ConfigTreeNode.LoadChildren(self) |
448 |
448 |
449 if self.GetChildByName("Master") is None: |
449 if self.GetChildByName("Master") is None: |
450 master = self.PlugAddChild("Master", "CanOpenNode", 0) |
450 master = self.CTNAddChild("Master", "CanOpenNode", 0) |
451 master.BaseParams.setEnabled(False) |
451 master.BaseParams.setEnabled(False) |
452 |
452 |
453 if self.GetChildByName("Slave") is None: |
453 if self.GetChildByName("Slave") is None: |
454 slave = self.PlugAddChild("Slave", "CanOpenSlave", 1) |
454 slave = self.CTNAddChild("Slave", "CanOpenSlave", 1) |
455 slave.BaseParams.setEnabled(False) |
455 slave.BaseParams.setEnabled(False) |
456 |
456 |
457 |
457 |
458 #------------------------------------------------------------------------------- |
458 #------------------------------------------------------------------------------- |
459 # LPCConfigTreeRoot Class |
459 # LPCConfigTreeRoot Class |
511 self.OrigBuildPath = buildpath |
511 self.OrigBuildPath = buildpath |
512 |
512 |
513 ConfigTreeRoot.__init__(self, frame, logger) |
513 ConfigTreeRoot.__init__(self, frame, logger) |
514 |
514 |
515 if havecanfestival: |
515 if havecanfestival: |
516 self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")] |
516 self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")] |
517 else: |
517 else: |
518 self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus")] |
518 self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus")] |
519 self.PlugType = "LPC" |
519 self.CTNType = "LPC" |
520 |
520 |
521 self.OnlineMode = "OFF" |
521 self.OnlineMode = "OFF" |
522 self.LPCConnector = None |
522 self.LPCConnector = None |
523 |
523 |
524 self.CurrentMode = None |
524 self.CurrentMode = None |
674 "pageSize": (0, 0), |
674 "pageSize": (0, 0), |
675 "scaling": {}}) |
675 "scaling": {}}) |
676 |
676 |
677 # Change XSD into class members |
677 # Change XSD into class members |
678 self._AddParamsMembers() |
678 self._AddParamsMembers() |
679 self.PluggedChilds = {} |
679 self.Children = {} |
680 |
680 |
681 # Keep track of the root confnode (i.e. project path) |
681 # Keep track of the root confnode (i.e. project path) |
682 self.ProjectPath = ProjectPath |
682 self.ProjectPath = ProjectPath |
683 |
683 |
684 self.BuildPath = self._getBuildPath() |
684 self.BuildPath = self._getBuildPath() |
685 if self.OrigBuildPath is not None: |
685 if self.OrigBuildPath is not None: |
686 mycopytree(self.OrigBuildPath, self.BuildPath) |
686 mycopytree(self.OrigBuildPath, self.BuildPath) |
687 |
687 |
688 # If dir have already be made, and file exist |
688 # If dir have already be made, and file exist |
689 if os.path.isdir(self.PlugPath()) and os.path.isfile(self.ConfNodeXmlFilePath()): |
689 if os.path.isdir(self.CTNPath()) and os.path.isfile(self.ConfNodeXmlFilePath()): |
690 #Load the confnode.xml file into parameters members |
690 #Load the confnode.xml file into parameters members |
691 result = self.LoadXMLParams() |
691 result = self.LoadXMLParams() |
692 if result: |
692 if result: |
693 return result |
693 return result |
694 #Load and init all the childs |
694 #Load and init all the children |
695 self.LoadChilds() |
695 self.LoadChildren() |
696 |
696 |
697 if havecanfestival and self.GetChildByName("CanOpen") is None: |
697 if havecanfestival and self.GetChildByName("CanOpen") is None: |
698 canopen = self.PlugAddChild("CanOpen", "CanOpen", 0) |
698 canopen = self.CTNAddChild("CanOpen", "CanOpen", 0) |
699 canopen.BaseParams.setEnabled(False) |
699 canopen.BaseParams.setEnabled(False) |
700 canopen.LoadChilds() |
700 canopen.LoadChildren() |
701 |
701 |
702 if self.PlugTestModified(): |
702 if self.CTNTestModified(): |
703 self.SaveProject() |
703 self.SaveProject() |
704 |
704 |
705 if wx.GetApp() is None: |
705 if wx.GetApp() is None: |
706 self.RefreshConfNodesBlockLists() |
706 self.RefreshConfNodesBlockLists() |
707 else: |
707 else: |
879 |
879 |
880 # Reset variable and program list that are parsed from |
880 # Reset variable and program list that are parsed from |
881 # CSV file generated by IEC2C compiler. |
881 # CSV file generated by IEC2C compiler. |
882 self.ResetIECProgramsAndVariables() |
882 self.ResetIECProgramsAndVariables() |
883 |
883 |
884 gen_result = self.PlugGenerate_C(buildpath, self.PLCGeneratedLocatedVars) |
884 gen_result = self.CTNGenerate_C(buildpath, self.PLCGeneratedLocatedVars) |
885 PlugCFilesAndCFLAGS, PlugLDFLAGS, DoCalls = gen_result[:3] |
885 CTNCFilesAndCFLAGS, CTNLDFLAGS, DoCalls = gen_result[:3] |
886 # if some files have been generated put them in the list with their location |
886 # if some files have been generated put them in the list with their location |
887 if PlugCFilesAndCFLAGS: |
887 if CTNCFilesAndCFLAGS: |
888 self.LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), PlugCFilesAndCFLAGS, DoCalls)] |
888 self.LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), CTNCFilesAndCFLAGS, DoCalls)] |
889 else: |
889 else: |
890 self.LocationCFilesAndCFLAGS = [] |
890 self.LocationCFilesAndCFLAGS = [] |
891 |
891 |
892 # confnode asks for some LDFLAGS |
892 # confnode asks for some LDFLAGS |
893 if PlugLDFLAGS: |
893 if CTNLDFLAGS: |
894 # LDFLAGS can be either string |
894 # LDFLAGS can be either string |
895 if type(PlugLDFLAGS)==type(str()): |
895 if type(CTNLDFLAGS)==type(str()): |
896 self.LDFLAGS=[PlugLDFLAGS] |
896 self.LDFLAGS=[CTNLDFLAGS] |
897 #or list of strings |
897 #or list of strings |
898 elif type(PlugLDFLAGS)==type(list()): |
898 elif type(CTNLDFLAGS)==type(list()): |
899 self.LDFLAGS=PlugLDFLAGS[:] |
899 self.LDFLAGS=CTNLDFLAGS[:] |
900 else: |
900 else: |
901 self.LDFLAGS=[] |
901 self.LDFLAGS=[] |
902 |
902 |
903 # Template based part of C code generation |
903 # Template based part of C code generation |
904 # files are stacked at the beginning, as files of confnode tree root |
904 # files are stacked at the beginning, as files of confnode tree root |
1181 self.Freeze() |
1181 self.Freeze() |
1182 self.ClearSizer(self.PLCParamsSizer) |
1182 self.ClearSizer(self.PLCParamsSizer) |
1183 |
1183 |
1184 if self.CTR is not None: |
1184 if self.CTR is not None: |
1185 plcwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
1185 plcwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
1186 if self.CTR.PlugTestModified(): |
1186 if self.CTR.CTNTestModified(): |
1187 bkgdclr = CHANGED_TITLE_COLOUR |
1187 bkgdclr = CHANGED_TITLE_COLOUR |
1188 else: |
1188 else: |
1189 bkgdclr = TITLE_COLOUR |
1189 bkgdclr = TITLE_COLOUR |
1190 |
1190 |
1191 if self.CTR not in self.ConfNodeInfos: |
1191 if self.CTR not in self.ConfNodeInfos: |
1216 self.RefreshScrollBars() |
1216 self.RefreshScrollBars() |
1217 self.Thaw() |
1217 self.Thaw() |
1218 |
1218 |
1219 def GenerateTreeBranch(self, confnode): |
1219 def GenerateTreeBranch(self, confnode): |
1220 leftwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
1220 leftwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) |
1221 if confnode.PlugTestModified(): |
1221 if confnode.CTNTestModified(): |
1222 bkgdclr=CHANGED_WINDOW_COLOUR |
1222 bkgdclr=CHANGED_WINDOW_COLOUR |
1223 else: |
1223 else: |
1224 bkgdclr=WINDOW_COLOUR |
1224 bkgdclr=WINDOW_COLOUR |
1225 |
1225 |
1226 leftwindow.SetBackgroundColour(bkgdclr) |
1226 leftwindow.SetBackgroundColour(bkgdclr) |
1227 |
1227 |
1228 if confnode not in self.ConfNodeInfos: |
1228 if confnode not in self.ConfNodeInfos: |
1229 self.ConfNodeInfos[confnode] = {"expanded" : False, "left_visible" : False, "right_visible" : False} |
1229 self.ConfNodeInfos[confnode] = {"expanded" : False, "left_visible" : False, "right_visible" : False} |
1230 |
1230 |
1231 self.ConfNodeInfos[confnode]["children"] = confnode.IECSortedChilds() |
1231 self.ConfNodeInfos[confnode]["children"] = confnode.IECSortedChildren() |
1232 confnode_infos = confnode.GetVariableLocationTree() |
1232 confnode_infos = confnode.GetVariableLocationTree() |
1233 confnode_locations = [] |
1233 confnode_locations = [] |
1234 if len(self.ConfNodeInfos[confnode]["children"]) == 0: |
1234 if len(self.ConfNodeInfos[confnode]["children"]) == 0: |
1235 confnode_locations = confnode_infos["children"] |
1235 confnode_locations = confnode_infos["children"] |
1236 if not self.ConfNodeInfos[confnode].has_key("locations_infos"): |
1236 if not self.ConfNodeInfos[confnode].has_key("locations_infos"): |
1475 def SetOnlineMode(self, mode, path=None): |
1475 def SetOnlineMode(self, mode, path=None): |
1476 self.CTR.SetOnlineMode(mode, path) |
1476 self.CTR.SetOnlineMode(mode, path) |
1477 self.RestartTimer() |
1477 self.RestartTimer() |
1478 |
1478 |
1479 def AddBus(self, iec_channel, name, icon=None): |
1479 def AddBus(self, iec_channel, name, icon=None): |
1480 for child in self.CTR.IterChilds(): |
1480 for child in self.CTR.IterChildren(): |
1481 if child.BaseParams.getName() == name: |
1481 if child.BaseParams.getName() == name: |
1482 return "Error: A bus named %s already exists\n" % name |
1482 return "Error: A bus named %s already exists\n" % name |
1483 elif child.BaseParams.getIEC_Channel() == iec_channel: |
1483 elif child.BaseParams.getIEC_Channel() == iec_channel: |
1484 return "Error: A bus with IEC_channel %d already exists\n" % iec_channel |
1484 return "Error: A bus with IEC_channel %d already exists\n" % iec_channel |
1485 bus = self.CTR.PlugAddChild(name, "LPCBus", iec_channel) |
1485 bus = self.CTR.CTNAddChild(name, "LPCBus", iec_channel) |
1486 if bus is None: |
1486 if bus is None: |
1487 return "Error: Unable to create bus\n" |
1487 return "Error: Unable to create bus\n" |
1488 bus.SetIcon(icon) |
1488 bus.SetIcon(icon) |
1489 self.RestartTimer() |
1489 self.RestartTimer() |
1490 |
1490 |
1491 def RenameBus(self, iec_channel, name): |
1491 def RenameBus(self, iec_channel, name): |
1492 bus = self.CTR.GetChildByIECLocation((iec_channel,)) |
1492 bus = self.CTR.GetChildByIECLocation((iec_channel,)) |
1493 if bus is None: |
1493 if bus is None: |
1494 return "Error: No bus found\n" |
1494 return "Error: No bus found\n" |
1495 for child in self.CTR.IterChilds(): |
1495 for child in self.CTR.IterChildren(): |
1496 if child != bus and child.BaseParams.getName() == name: |
1496 if child != bus and child.BaseParams.getName() == name: |
1497 return "Error: A bus named %s already exists\n" % name |
1497 return "Error: A bus named %s already exists\n" % name |
1498 bus.BaseParams.setName(name) |
1498 bus.BaseParams.setName(name) |
1499 self.RestartTimer() |
1499 self.RestartTimer() |
1500 |
1500 |
1501 def ChangeBusIECChannel(self, old_iec_channel, new_iec_channel): |
1501 def ChangeBusIECChannel(self, old_iec_channel, new_iec_channel): |
1502 bus = self.CTR.GetChildByIECLocation((old_iec_channel,)) |
1502 bus = self.CTR.GetChildByIECLocation((old_iec_channel,)) |
1503 if bus is None: |
1503 if bus is None: |
1504 return "Error: No bus found\n" |
1504 return "Error: No bus found\n" |
1505 for child in self.CTR.IterChilds(): |
1505 for child in self.CTR.IterChildren(): |
1506 if child != bus and child.BaseParams.getIEC_Channel() == new_iec_channel: |
1506 if child != bus and child.BaseParams.getIEC_Channel() == new_iec_channel: |
1507 return "Error: A bus with IEC_channel %d already exists\n" % new_iec_channel |
1507 return "Error: A bus with IEC_channel %d already exists\n" % new_iec_channel |
1508 if wx.GetApp() is None: |
1508 if wx.GetApp() is None: |
1509 self.CTR.UpdateProjectVariableLocation(str(old_iec_channel), |
1509 self.CTR.UpdateProjectVariableLocation(str(old_iec_channel), |
1510 str(new_iec_channel)) |
1510 str(new_iec_channel)) |
1518 def RemoveBus(self, iec_channel): |
1518 def RemoveBus(self, iec_channel): |
1519 bus = self.CTR.GetChildByIECLocation((iec_channel,)) |
1519 bus = self.CTR.GetChildByIECLocation((iec_channel,)) |
1520 if bus is None: |
1520 if bus is None: |
1521 return "Error: No bus found\n" |
1521 return "Error: No bus found\n" |
1522 self.CTR.RemoveProjectVariableByFilter(str(iec_channel)) |
1522 self.CTR.RemoveProjectVariableByFilter(str(iec_channel)) |
1523 self.CTR.PluggedChilds["LPCBus"].remove(bus) |
1523 self.CTR.Children["LPCBus"].remove(bus) |
1524 self.RestartTimer() |
1524 self.RestartTimer() |
1525 |
1525 |
1526 def AddModule(self, parent, iec_channel, name, icode, icon=None): |
1526 def AddModule(self, parent, iec_channel, name, icode, icon=None): |
1527 module = self.CTR.GetChildByIECLocation(parent) |
1527 module = self.CTR.GetChildByIECLocation(parent) |
1528 if module is None: |
1528 if module is None: |