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