--- a/ConfigTreeNode.py Fri Nov 11 08:26:15 2022 +0100
+++ b/ConfigTreeNode.py Fri Nov 11 16:07:38 2022 +0100
@@ -133,6 +133,15 @@
def CTNTestModified(self):
return self.ChangesToSave
+ def CTNMarkModified(self): + oldChangesToSave = self.ChangesToSave + self.ChangesToSave = True + if not oldChangesToSave: + appframe = self.GetCTRoot().AppFrame + if appframe is not None: + appframe.RefreshTitle() + appframe.RefreshPageTitles() def ProjectTestModified(self):
recursively check modified status
--- a/opc_ua/client.py Fri Nov 11 08:26:15 2022 +0100
+++ b/opc_ua/client.py Fri Nov 11 16:07:38 2022 +0100
@@ -88,7 +88,7 @@
EditorType = OPCUAClientEditor
- self.modeldata = OPCUAClientModel(self.Log)
+ self.modeldata = OPCUAClientModel(self.Log, self.CTNMarkModified) filepath = self.GetFileName()
if os.path.isfile(filepath):
@@ -99,7 +99,7 @@
cfg = lambda path: self.GetParamsAttributes("OPCUAClient."+path)["value"]
AuthType = cfg("AuthType")
--- a/opc_ua/opcua_client_maker.py Fri Nov 11 08:26:15 2022 +0100
+++ b/opc_ua/opcua_client_maker.py Fri Nov 11 16:07:38 2022 +0100
@@ -447,9 +447,10 @@
class OPCUAClientList(list):
- def __init__(self, log = lambda m:None):
+ def __init__(self, log, change_callback): super(OPCUAClientList, self).__init__(self)
+ self.change_callback = change_callback v = dict(zip(lstcolnames, value))
@@ -480,13 +481,19 @@
list.append(self, [v[n] for n in lstcolnames])
+ def __delitem__(self, index): + list.__delitem__(self, index) class OPCUAClientModel(dict):
- def __init__(self, log = lambda m:None):
+ def __init__(self, log, change_callback = lambda : None): super(OPCUAClientModel, self).__init__()
for direction in directions:
- self[direction] = OPCUAClientList(log)
+ self[direction] = OPCUAClientList(log, change_callback) with open(path, 'rb') as csvfile:
@@ -496,7 +503,8 @@
- self[direction].append(row[1:])
+ # avoids calling change callback whe loading CSV + list.append(self[direction],row[1:]) with open(path, 'wb') as csvfile: