--- a/etherlab/etherlab.py Sun Jun 10 20:16:17 2012 +0200
+++ b/etherlab/etherlab.py Mon Jun 11 01:21:26 2012 +0200
@@ -62,7 +62,17 @@
#--------------------------------------------------
+ XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?> + <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <xsd:element name="SlaveParams"> + <xsd:attribute name="DynamicPDOs" type="xsd:boolean" use="optional" default="true"/> @@ -87,42 +97,46 @@
return self.CTNParams[1].getElementInfos(parts[0], parts[1])
- if wx.VERSION < (2, 8, 0) and self.MandatoryParams:
- params.append(self.MandatoryParams[1].getElementInfos(self.MandatoryParams[0]))
+ params.append(self.CTNParams[1].getElementInfos(self.CTNParams[0])) slave_type = self.CTNParent.GetSlaveType(self.GetSlavePos())
+ params[0]['children'].insert(0, 'type': self.CTNParent.GetSlaveTypesLibrary(self.NODE_PROFILE),
- 'value': (slave_type["device_type"], slave_type)},
+ 'value': (slave_type["device_type"], slave_type)}) + params[0]['children'].insert(1, - 'value': self.CTNParent.GetSlaveAlias(self.GetSlavePos())}]
- params.append(self.CTNParams[1].getElementInfos(self.CTNParams[0]))
+ 'value': self.CTNParent.GetSlaveAlias(self.GetSlavePos())}) def SetParamsAttribute(self, path, value):
+ if path == "SlaveParams.Type": + self.CTNParent.SetSlaveType(position, value) + slave_type = self.CTNParent.GetSlaveType(self.GetSlavePos()) + value = (slave_type["device_type"], slave_type) + elif path == "SlaveParams.Alias": + self.CTNParent.SetSlaveAlias(position, value) position = self.BaseParams.getIEC_Channel()
value, changed = ConfigTreeNode.SetParamsAttribute(self, path, value)
# Filter IEC_Channel, Slave_Type and Alias that have specific behavior
if path == "BaseParams.IEC_Channel":
self.CTNParent.SetSlavePosition(position, value)
- elif path == "SlaveParams.Type":
- self.CTNParent.SetSlaveType(position, value)
- slave_type = self.CTNParent.GetSlaveType(self.GetSlavePos())
- value = (slave_type["device_type"], slave_type)
- elif path == "SlaveParams.Alias":
- self.CTNParent.SetSlaveAlias(position, value)
@@ -170,6 +184,7 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="CIA402SlaveParams">
+ <xsd:attribute name="DynamicPDOs" type="xsd:boolean" use="optional" default="true"/> @@ -180,27 +195,40 @@
EditorType = CIA402NodeEditor
- {"bitmap" : "CIA402AxisRef",
+ {"bitmap" : os.path.join(CONFNODEFOLDER, "images", "CIA402AxisRef.png"), "tooltip" : _("Initiate Drag'n drop of Axis ref located variable"),
- "method" : "_getCIA402AxisRef"},
+ "method" : "_getCIA402AxisRef", return os.path.join(CONFNODEFOLDER, "images", "CIA402Slave.png")
- def GetDeviceLocationTree(self, slave_pos, current_location, device_name):
+ def SetParamsAttribute(self, path, value): + if path == "CIA402SlaveParams.Type": + path = "SlaveParams.Type" + elif path == "CIA402SlaveParams.Alias": + path = "SlaveParams.Alias" + return _EthercatSlaveCTN.SetParamsAttribute(self, path, value) + def GetVariableLocationTree(self): axis_name = self.CTNName()
- vars = [{"name": "%s Axis Ref" % (axis_name),
- "type": LOCATION_VAR_INPUT,
- "IEC_type": "AXIS_REF",
- "location": "%IW%s.0" % (".".join(map(str, current_location))),
- vars.extend(_EthercatSlaveCTN.GetDeviceLocationTree(self, slave_pos, current_location, device_name))
+ current_location = self.GetCurrentLocation() + children = [{"name": "%s Axis Ref" % (axis_name), + "type": LOCATION_VAR_INPUT, + "location": "%%IW%s.0" % (".".join(map(str, current_location))), + children.extend(self.CTNParent.GetDeviceLocationTree(self.GetSlavePos(), current_location, axis_name)) + return {"name": axis_name, + "type": LOCATION_CONFNODE, + "location": self.GetFullIEC_Channel(), def _getCIA402AxisRef(self):
data = wx.TextDataObject(str(("%IW%s.0" % ".".join(map(str, self.GetCurrentLocation())),
@@ -334,7 +362,6 @@
<xsd:attribute name="MasterNumber" type="xsd:integer" use="optional" default="0"/>
<xsd:attribute name="ConfigurePDOs" type="xsd:boolean" use="optional" default="true"/>
- <xsd:attribute name="DynamicPDOs" type="xsd:boolean" use="optional" default="true"/>