beremiz

Let extensions know when configuration is new, to apply defaults.
py2compat
17 months ago, Edouard Tisserant
1772f66ebefa
Parents 1e8869ed2d4c
Children 5812a0cfdde6
Let extensions know when configuration is new, to apply defaults.

Add "new_config" member to CTN, True when config was just created.
--- a/ConfigTreeNode.py Thu Jan 16 15:30:35 2025 +0100
+++ b/ConfigTreeNode.py Tue Jan 21 09:29:59 2025 +0100
@@ -584,6 +584,8 @@
NewCTNName = self.FindNewName(CTNName)
# If dir have already be made, and file exist
if os.path.isdir(self.CTNPath(NewCTNName)): # and os.path.isfile(self.ConfNodeXmlFilePath(CTNName)):
+ # Make CTN aware that this configuration was loaded
+ self.new_config = False
# Load the confnode.xml file into parameters members
self.LoadXMLParams(NewCTNName)
# Basic check. Better to fail immediately.
@@ -604,6 +606,8 @@
# just loaded, nothing to saved
self.ChangesToSave = False
else:
+ # Make CTN aware that this is first time configuration
+ self.new_config = True
# If confnode do not have corresponding file/dirs - they will be created on Save
self.CTNMakeDir()
# Find an IEC number