diff --git a/pym/calculate/lib/datavars.py b/pym/calculate/lib/datavars.py index 164bb71..763010c 100644 --- a/pym/calculate/lib/datavars.py +++ b/pym/calculate/lib/datavars.py @@ -149,6 +149,9 @@ class VariableInterface(object): def invalidate(self, force=False): pass + def is_console_set(self, varname): + pass + class Variable(VariableInterface): """ @@ -268,6 +271,9 @@ class Variable(VariableInterface): return [[]] return "" + def is_console_set(self, varname): + return self.parent.is_console_set(varname) + def GetBool(self, varname): return self.isTrue(self.Get(varname)) @@ -1232,6 +1238,7 @@ class DataVars(SimpleDataVars): self.defaultModule = "main" self.importedModules = [] self.iniCache = {} + self.map_opt_vars = {} @contextmanager def useDefaultModule(self, modulename): @@ -1757,8 +1764,18 @@ class DataVars(SimpleDataVars): for var in chain(normal, expert): varname = var.rpartition('.')[2] self.mapVarGroup[varname] = lastIndex + objVar = self.getInfo(varname) + if objVar.opt is not None: + for opname in objVar.opt: + self.map_opt_vars[opname] = varname return self + def is_console_set(self, varname): + for op in self.Get('cl_console_args'): + if self.map_opt_vars.get(op, '') == varname: + return True + return False + def getGroups(self): """ Get groups variables diff --git a/pym/calculate/lib/variables/env.py b/pym/calculate/lib/variables/env.py index 9dca6cb..badb324 100644 --- a/pym/calculate/lib/variables/env.py +++ b/pym/calculate/lib/variables/env.py @@ -782,3 +782,11 @@ class VariableClHelpSet(ReadonlyVariable): """ type = "bool" value = "off" + + +class VariableClConsoleArgs(Variable): + """ + Список аргументов переданных через консоль + """ + type = "list" + value = []