From 91f2720f9f79fbb22de2487b2cfb1f8133c343af Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 4 May 2026 16:12:27 +0200 Subject: [PATCH] add Module.setExport to change the export flag Change-Id: I245845e30cf51ba762ac9b949a0adf188bf16efc --- frappy/modulebase.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frappy/modulebase.py b/frappy/modulebase.py index 92acc9c4..c47a659e 100644 --- a/frappy/modulebase.py +++ b/frappy/modulebase.py @@ -439,8 +439,9 @@ class Module(HasAccessibles): if not self.export: # do not export parameters of a module not exported accessible.export = False self.accessibles[name] = accessible - if accessible.export: - self.accessiblename2attr[accessible.export] = name + self.setExport(name, accessible.export) + # if accessible.export: + # self.accessiblename2attr[accessible.export] = name if isinstance(accessible, Parameter): self.parameters[name] = accessible if isinstance(accessible, Command): @@ -502,6 +503,19 @@ class Module(HasAccessibles): # this checks again for datatype and sets the timestamp setattr(self, pname, pobj.value) + def setExport(self, pname, flag): + """change the export flag of a parameter or command + + to be called in "meth:checkProperties() when needed """ + pobj = self.accessibles[pname] + if flag: + pobj.export = True + pobj.fixExport() + self.accessiblename2attr[pobj.export] = pname + else: + self.accessiblename2attr.pop(pobj.export, None) + pobj.export = False + def announceUpdate(self, pname, value=None, err=None, timestamp=None, validate=True): """announce a changed value or readerror