equal
deleted
inserted
replaced
21 #License along with this library; if not, write to the Free Software |
21 #License along with this library; if not, write to the Free Software |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
23 |
24 from node import * |
24 from node import * |
25 import eds_utils |
25 import eds_utils |
26 import os, shutil |
26 import os, shutil, types |
27 |
27 |
28 #------------------------------------------------------------------------------- |
28 #------------------------------------------------------------------------------- |
29 # Definition of NodeList Object |
29 # Definition of NodeList Object |
30 #------------------------------------------------------------------------------- |
30 #------------------------------------------------------------------------------- |
31 |
31 |
100 filepath = os.path.join(self.EDSFolder, file) |
100 filepath = os.path.join(self.EDSFolder, file) |
101 if os.path.isfile(filepath) and os.path.splitext(filepath)[-1] == ".eds": |
101 if os.path.isfile(filepath) and os.path.splitext(filepath)[-1] == ".eds": |
102 result = self.LoadEDS(file) |
102 result = self.LoadEDS(file) |
103 if result != None: |
103 if result != None: |
104 return result |
104 return result |
105 |
105 |
|
106 print "Load Master" |
106 result = self.LoadMasterNode(netname) |
107 result = self.LoadMasterNode(netname) |
107 if result != None: |
108 if result != None: |
108 return result |
109 return result |
109 |
110 |
|
111 print "Load Slaves" |
110 result = self.LoadSlaveNodes(netname) |
112 result = self.LoadSlaveNodes(netname) |
111 if result != None: |
113 if result != None: |
112 return result |
114 return result |
113 |
115 |
114 self.NetworkName = netname |
116 self.NetworkName = netname |
161 if netname: |
163 if netname: |
162 masterpath = os.path.join(self.Root, "%s_master.od"%netname) |
164 masterpath = os.path.join(self.Root, "%s_master.od"%netname) |
163 else: |
165 else: |
164 masterpath = os.path.join(self.Root, "master.od") |
166 masterpath = os.path.join(self.Root, "master.od") |
165 if os.path.isfile(masterpath): |
167 if os.path.isfile(masterpath): |
166 return self.Manager.OpenFileInCurrent(masterpath) |
168 result = self.Manager.OpenFileInCurrent(masterpath) |
167 else: |
169 else: |
168 return self.Manager.CreateNewNode("MasterNode", 0x00, "master", "", "None", "", "heartbeat", ["DS302"]) |
170 result = self.Manager.CreateNewNode("MasterNode", 0x00, "master", "", "None", "", "heartbeat", ["DS302"]) |
|
171 if not isinstance(result, types.IntType): |
|
172 return result |
|
173 return None |
169 |
174 |
170 def SaveMasterNode(self, netname = None): |
175 def SaveMasterNode(self, netname = None): |
171 if netname: |
176 if netname: |
172 masterpath = os.path.join(self.Root, "%s_master.od"%netname) |
177 masterpath = os.path.join(self.Root, "%s_master.od"%netname) |
173 else: |
178 else: |