From d53eb38c31fb300d39c98fef81af99a40819246f Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 8 Dec 2008 13:35:55 +0100 Subject: allow using complex shell commandlines (including | etc.) for job tasks (handle with care, no tool exist precondition checking!) --- lib/python/Components/Task.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 9a768425..04e5c938 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -127,6 +127,7 @@ class Task(object): self.cmd = None self.cwd = "/tmp" self.args = [ ] + self.cmdline = None self.task_progress_changed = None self.output_line = "" job.addTask(self) @@ -141,6 +142,9 @@ class Task(object): self.global_preconditions.append(ToolExistsPrecondition()) self.postconditions.append(ReturncodePostcondition()) + def setCmdline(self, cmdline): + self.cmdline = cmdline + def checkPreconditions(self, immediate = False): not_met = [ ] if immediate: @@ -166,13 +170,15 @@ class Task(object): self.container.stdoutAvail.append(self.processStdout) self.container.stderrAvail.append(self.processStderr) - assert self.cmd is not None - assert len(self.args) >= 1 - if self.cwd is not None: self.container.setCWD(self.cwd) - print "execute:", self.container.execute(self.cmd, *self.args), self.cmd, self.args + if not self.cmd and self.cmdline: + print "execute:", self.container.execute(self.cmdline), self.cmdline + else: + assert self.cmd is not None + assert len(self.args) >= 1 + print "execute:", self.container.execute(self.cmd, *self.args), ' '.join(self.args) if self.initial_input: self.writeInput(self.initial_input) -- cgit v1.2.3 From 73b5c76cb020ac7baa2536e14997618b0e17eef5 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 8 Dec 2008 13:45:18 +0100 Subject: add new config types ConfigSearchText, which uses the new sql NumericalTextInput search map plus type ConfigDirectory which displays paths as strings --- lib/python/Components/config.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/python/Components') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index d79337ba..cfa4318c 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -926,6 +926,31 @@ class ConfigNumber(ConfigText): self.marked_pos = 0 self.offset = 0 +class ConfigSearchText(ConfigText): + def __init__(self, default = "", fixed_size = False, visible_width = False): + ConfigText.__init__(self, default = default, fixed_size = fixed_size, visible_width = visible_width) + NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False, search = True) + +class ConfigDirectory(ConfigText): + def __init__(self, default="", visible_width=60): + ConfigText.__init__(self, default, fixed_size = True, visible_width = visible_width) + def handleKey(self, key): + pass + def getValue(self): + if self.text == "": + return None + else: + return ConfigText.getValue(self) + def setValue(self, val): + if val == None: + val = "" + ConfigText.setValue(self, val) + def getMulti(self, selected): + if self.text == "": + return ("mtext"[1-selected:], _("List of Storage Devices"), range(0)) + else: + return ConfigText.getMulti(self, selected) + # a slider. class ConfigSlider(ConfigElement): def __init__(self, default = 0, increment = 1, limits = (0, 100)): -- cgit v1.2.3