--- a/Beremiz.py Wed Jul 25 17:58:18 2007 +0200
+++ b/Beremiz.py Thu Jul 26 17:17:50 2007 +0200
@@ -439,26 +439,33 @@
if dialog.ShowModal() == wxID_OK:
projectpath = dialog.GetPath()
- if os.path.isdir(projectpath):
+ if os.path.isdir(projectpath): configpath = os.path.join(projectpath, ".project")
- if os.path.isfile(configpath):
- file = open(configpath, "r")
- for bus_id, bus_type, bus_name in [line.strip().split(" ") for line in file.readlines() if line.strip() != ""]:
- if bus_type == "CanFestival":
- manager = NodeManager(os.path.join(base_folder, "CanFestival-3", "objdictgen"))
- nodelist = NodeList(manager)
- result = nodelist.LoadProject(projectpath, bus_name)
- self.BusManagers[id] = {"Name" : bus_name, "Type" : bus_type, "NodeList" : nodelist, "Editor" : None}
- message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+ if not os.path.isfile(configpath): + file = open(configpath, "r") + lines = [line.strip() for line in file.readlines() if line.strip() != ""] + if line[0] != "Beremiz": + for bus_id, bus_type, bus_name in [line.split(" ") for line in lines]: + if bus_type == "CanFestival": + manager = NodeManager(os.path.join(base_folder, "CanFestival-3", "objdictgen")) + nodelist = NodeList(manager) + result = nodelist.LoadProject(projectpath, bus_name) + self.BusManagers[id] = {"Name" : bus_name, "Type" : bus_type, "NodeList" : nodelist, "Editor" : None} - self.BusManagers[id] = {"Name" : bus_name, "Type" : bus_type}
+ message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR) + self.BusManagers[id] = {"Name" : bus_name, "Type" : bus_type} self.PLCManager = PLCControler()
plc_file = os.path.join(projectpath, "plc.xml")
if os.path.isfile(plc_file):
@@ -478,6 +485,10 @@
+ message = wxMessageDialog(self, "\"%s\" folder is not a valid Beremiz project"%projectpath, "Error", wxOK|wxICON_ERROR) def OnCloseProjectMenu(self, event):