# HG changeset patch # User lbessard # Date 1186066138 -7200 # Node ID 6d8728efcdec1437d2d7a5d415d98fdb0eb8e24f # Parent ef2541ff1e68957c267e101875044bc877f8f8fb Adding validity verifications on project folders opened diff -r ef2541ff1e68 -r 6d8728efcdec Beremiz.py --- a/Beremiz.py Thu Jul 26 17:17:50 2007 +0200 +++ b/Beremiz.py Thu Aug 02 16:48:58 2007 +0200 @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -#This file is part of Beremiz, a library implementing an IEC 61131-3 editor -#based on the plcopen standard. +#This file is part of Beremiz, a Integrated Development Environment for +#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. # -#Copyright (C): Edouard TISSERANT and Laurent BESSARD +#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD # #See COPYING file for copyrights details. # @@ -16,7 +16,7 @@ #This library is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#Lesser General Public License for more details. +#General Public License for more details. # #You should have received a copy of the GNU General Public #License along with this library; if not, write to the Free Software @@ -440,18 +440,18 @@ projectpath = dialog.GetPath() dialog.Destroy() try: - if os.path.isdir(projectpath): + if not os.path.isdir(projectpath): raise Exception self.BusManagers = {} configpath = os.path.join(projectpath, ".project") if not os.path.isfile(configpath): - raise + raise Exception file = open(configpath, "r") lines = [line.strip() for line in file.readlines() if line.strip() != ""] - if line[0] != "Beremiz": + if lines[0] != "Beremiz": file.close() raise Exception - for bus_id, bus_type, bus_name in [line.split(" ") for line in lines]: + for bus_id, bus_type, bus_name in [line.split(" ") for line in lines[1:]]: id = int(bus_id, 16) if bus_type == "CanFestival": manager = NodeManager(os.path.join(base_folder, "CanFestival-3", "objdictgen")) @@ -506,6 +506,7 @@ file.close() configpath = os.path.join(self.CurrentProjectPath, ".project") file = open(configpath, "w") + file.write("Beremiz\n") busidlist = self.BusManagers.keys() busidlist.sort() for id in busidlist: diff -r ef2541ff1e68 -r 6d8728efcdec config_utils.py --- a/config_utils.py Thu Jul 26 17:17:50 2007 +0200 +++ b/config_utils.py Thu Aug 02 16:48:58 2007 +0200 @@ -1,25 +1,26 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -#This file is part of CanFestival, a library implementing CanOpen Stack. +#This file is part of Beremiz, a Integrated Development Environment for +#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. # -#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD +#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD # #See COPYING file for copyrights details. # #This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU Lesser General Public +#modify it under the terms of the GNU General Public #License as published by the Free Software Foundation; either #version 2.1 of the License, or (at your option) any later version. # #This library is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#Lesser General Public License for more details. +#General Public License for more details. # -#You should have received a copy of the GNU Lesser General Public +#You should have received a copy of the GNU General Public #License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from types import *