From 73228cde0e7cf919c3c27a3cabc74fea0e98e0a4 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 6 Feb 2018 15:21:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D1=8B=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=D0=B0=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4=D0=BD=D1=83=D1=8E=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/datavars.py | 17 +++++++++++++++++ pym/calculate/lib/variables/env.py | 8 ++++++++ 2 files changed, 25 insertions(+) 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 = []