From c2949659c05623749b81592f54560c50478141de Mon Sep 17 00:00:00 2001 From: Antoine Durand-Gasselin Date: Tue, 25 Aug 2009 16:43:26 +0200 Subject: [PATCH] [dialogwizard/dialogwizard] implementation d'autres primitives dialog Ignore-this: a5ea5b8b8ef3e7c22c853c99c5acb0fb darcs-hash:20090825144326-bd074-675a61c9635905883d3a91cabd59fd8be82f67c0.gz --- lib/dialogwizard/dialogwizard.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/dialogwizard/dialogwizard.py b/lib/dialogwizard/dialogwizard.py index 95fe81f1..8619b8ec 100755 --- a/lib/dialogwizard/dialogwizard.py +++ b/lib/dialogwizard/dialogwizard.py @@ -35,10 +35,31 @@ class DialogStepGenerator(): return dico return Step(fn) - def select_step(self, title, enonce, var, choix): + def select_step(self, title, enonce, var, choix, **kw): + def fn(dico, default): + rc, res = self.d.menu(enonce, choices = choix, title = title, **kw) + self._check_rc(rc) + dico[var] = res + return dico + return Step(fn) + + def input_step(self, title, enonce, var, **kw): def fn(dico, default): rc, res = self.d.inputbox(enonce, title = title, init = dico.get(var, ''), **kw) self._check_rc(rc) dico[var] = res return dico return Step(fn) + + def checklist_step(self, title, enonce, liste): + def fn(dico, default): + choix = [var, txt, dico.get(var, 'off') for var, txt in liste] + rc, res = self.d.checklist(enonce, title = title, choices = choix, **kw) + self._check_rc(rc) + for tag, item, status in liste: + if tag in res: + dico[tag] = 'on' + else: + dico[tag] = 'off' + return dico + return Step(fn)