# HG changeset patch # User laurent # Date 1337587655 -7200 # Node ID fea31f89b5f65505a83d26e0c7126a372e185f82 # Parent 5998beb54a6c80b44cf921300699de1facc4e8e1# Parent 6da739ac134616c47eaac20daf430b7effda863b Merged diff -r 6da739ac1346 -r fea31f89b5f6 etherlab/ConfigEditor.py --- a/etherlab/ConfigEditor.py Mon May 21 04:34:10 2012 +0200 +++ b/etherlab/ConfigEditor.py Mon May 21 10:07:35 2012 +0200 @@ -2,7 +2,8 @@ import wx.grid import wx.gizmos -from controls import CustomGrid, CustomTable, EditorPanel +from controls import CustomGrid, CustomTable +from ConfTreeNodeEditor import ConfTreeNodeEditor [ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3) @@ -37,7 +38,7 @@ ID_NODEEDITORVARIABLESGRID, ] = [wx.NewId() for _init_ctrls in range(13)] -class NodeEditor(EditorPanel): +class NodeEditor(ConfTreeNodeEditor): ID = ID_NODEEDITOR @@ -138,7 +139,7 @@ self._init_sizers() def __init__(self, parent, controler, window): - EditorPanel.__init__(self, parent, "", window, controler) + ConfTreeNodeEditor.__init__(self, parent, "", window, controler) self.SyncManagersTable = SyncManagersTable(self, [], GetSyncManagersTableColnames()) self.SyncManagersGrid.SetTable(self.SyncManagersTable) @@ -160,15 +161,6 @@ wx.ALIGN_LEFT, wx.ALIGN_LEFT]): self.VariablesGrid.AddColumn(colname, colsize, colalign) self.VariablesGrid.SetMainColumn(1) - - img = wx.Bitmap(self.Controler.GetIconPath("Slave.png"), wx.BITMAP_TYPE_PNG).ConvertToImage() - self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16))) - - def __del__(self): - self.Controler.OnCloseEditor(self) - - def GetTitle(self): - return self.Controler.CTNFullName() def GetBufferState(self): return False, False @@ -259,10 +251,4 @@ event.Skip() -class CIA402NodeEditor(NodeEditor): - - def __init__(self, parent, controler, window): - NodeEditor.__init__(self, parent, controler, window) - - img = wx.Bitmap(self.Controler.GetIconPath("CIA402Slave.png"), wx.BITMAP_TYPE_PNG).ConvertToImage() - self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16))) +CIA402NodeEditor = NodeEditor diff -r 6da739ac1346 -r fea31f89b5f6 etherlab/etherlab.py --- a/etherlab/etherlab.py Mon May 21 04:34:10 2012 +0200 +++ b/etherlab/etherlab.py Mon May 21 10:07:35 2012 +0200 @@ -66,8 +66,8 @@ NODE_PROFILE = None EditorType = NodeEditor - def GetIconPath(self, icon): - return os.path.join(CONFNODEFOLDER, "images", icon) + def GetIconPath(self): + return os.path.join(CONFNODEFOLDER, "images", "Slave.png") def ExtractHexDecValue(self, value): return ExtractHexDecValue(value) @@ -135,13 +135,6 @@ "children": self.CTNParent.GetDeviceLocationTree(self.GetSlavePos(), self.GetCurrentLocation(), self.BaseParams.getName()) } - ConfNodeMethods = [ - {"bitmap" : os.path.join(CONFNODEFOLDER, "images", "editSlave"), - "name" : _("Edit Slave"), - "tooltip" : _("Edit Slave"), - "method" : "_OpenView"}, - ] - def CTNGenerate_C(self, buildpath, locations): """ Generate C code @@ -186,12 +179,8 @@ NODE_PROFILE = 402 EditorType = CIA402NodeEditor - ConfNodeMethods = [ - {"bitmap" : os.path.join(CONFNODEFOLDER, "images", "editCIA402Slave"), - "name" : _("Edit CIA402 Slave"), - "tooltip" : _("Edit CIA402 Slave"), - "method" : "_OpenView"}, - ] + def GetIconPath(self): + return os.path.join(CONFNODEFOLDER, "images", "CIA402Slave.png") def CTNGenerate_C(self, buildpath, locations): """ @@ -338,7 +327,7 @@ for child in tree.childNodes: if child.nodeType == tree.ELEMENT_NODE and child.nodeName == "EtherCATConfig": - self.Config.loadXMLTree(child, ["xmlns:xsi", "xsi:noNamespaceSchemaLocation"]) + self.Config.loadXMLTree(child) self.CreateConfigBuffer(True) else: self.CreateConfigBuffer(False) @@ -1366,7 +1355,7 @@ for child in xml_tree.childNodes: if child.nodeType == xml_tree.ELEMENT_NODE and child.nodeName == "EtherCATInfo": modules_infos = EtherCATInfoClasses["EtherCATInfo.xsd"]["EtherCATInfo"]() - modules_infos.loadXMLTree(child, ["xmlns:xsi", "xsi:noNamespaceSchemaLocation"]) + modules_infos.loadXMLTree(child) if modules_infos is not None: vendor = modules_infos.getVendor()