diff -r 9bf197698af0 -r 39cd981ff242 PLCControler.py --- a/PLCControler.py Fri Jul 27 10:03:24 2007 +0200 +++ b/PLCControler.py Thu Aug 02 16:51:58 2007 +0200 @@ -4,7 +4,7 @@ #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor #based on the plcopen standard. # -#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 @@ -476,6 +476,7 @@ if old_name in self.ElementsOpened: idx = self.ElementsOpened.index(old_name) self.ElementsOpened[idx] = new_name + self.Project.updateElementName(old_name, new_name) self.RefreshPouUsingTree() self.RefreshBlockTypes() self.BufferProject() @@ -649,7 +650,6 @@ for vartype, varlist in self.ExtractVarLists(vars): configuration.globalVars.append(varlist) self.RefreshBlockTypes() - self.BufferProject() # Return the configuration globalvars def GetConfigurationGlobalVars(self, name): @@ -692,7 +692,6 @@ for vartype, varlist in self.ExtractVarLists(vars): resource.globalVars.append(varlist) self.RefreshBlockTypes() - self.BufferProject() # Return the resource globalvars def GetConfigurationResourceGlobalVars(self, config_name, name): @@ -769,7 +768,6 @@ # Set Pou interface pou.setVars(self.ExtractVarLists(vars)) self.RefreshBlockTypes() - self.BufferProject() # Replace the return type of the pou given by its name (only for functions) def SetPouInterfaceReturnType(self, name, type): @@ -784,7 +782,15 @@ # Change return type return_type.setValue(type) self.RefreshBlockTypes() - self.BufferProject() + + def UpdateProjectUsedPous(self, old_name, new_name): + if self.Project: + self.Project.updateElementName(old_name, new_name) + + def UpdateCurrentPouEditingUsedVariable(self, old_name, new_name): + pou = self.GetCurrentElementEditing() + if pou: + pou.updateElementName(old_name, new_name) # Return the return type of the pou given by its name def GetPouInterfaceReturnTypeByName(self, name): @@ -2038,7 +2044,10 @@ self.Buffering = False def ProjectIsSaved(self): - return self.ProjectBuffer.IsCurrentSaved() + if self.ProjectBuffer: + return self.ProjectBuffer.IsCurrentSaved() + else: + return False def LoadPrevious(self): self.Project = self.Copy(self.ProjectBuffer.Previous())